Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shader comparison #297

Merged
merged 2 commits into from
Jul 7, 2017
Merged

Fix shader comparison #297

merged 2 commits into from
Jul 7, 2017

Conversation

lilleyse
Copy link
Contributor

@lilleyse lilleyse commented Jul 3, 2017

Solves the crash in #296, but not the conversion problem

@mramato

@coveralls
Copy link

Coverage Status

Coverage remained the same at 93.644% when pulling 8b5062d on shader-string into cb7af37 on master.

@mramato
Copy link
Contributor

mramato commented Jul 5, 2017

Doesn't this change imply we're missing some pretty critical unit tests? We've had several problems in this area.

@likangning93
Copy link
Contributor

The spec for MergeDuplicateProperties spoofs glTF with pipeline extras and assumes that shaders are stored as buffers in extras._pipeline.source, I think that's why we didn't catch this before.

@mramato
Copy link
Contributor

mramato commented Jul 5, 2017

The spec for MergeDuplicateProperties spoofs glTF with pipeline extras and assumes that shaders are stored as buffers in extras._pipeline.source, I think that's why we didn't catch this before.

Sounds like we have bad specs as well then. We should be mocking/spying on as little as possible in our specs precisely because it leads to problems like this.

@lilleyse
Copy link
Contributor Author

lilleyse commented Jul 7, 2017

Thanks for pinpointing the issue @likangning93. Fixed the test. It passed before because shaders referenced the same Buffer objects which would pass both the === check and the .equals check.

@lilleyse
Copy link
Contributor Author

lilleyse commented Jul 7, 2017

@likangning93 if this looks good can you merge? Then I'll push a new release out.

@@ -139,8 +139,6 @@ describe('MergeDuplicateProperties', function() {

var mergeShaders = MergeDuplicateProperties.mergeShaders;
describe('mergeShaders', function() {
var testShaderBufferOne = Buffer.from('test shader one', 'utf8');
var testShaderBufferTwo = Buffer.from('test shader two', 'utf8');
it('merges duplicate shaders', function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is basically useless, why doesn't it should load and use real gltf files, not mock what it expects the source to look like.

Given you want to get out a new release, I'm okay with @likangning93 merging this, but I'll write up an issue to fix this and other tests that do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree here. In general we have strayed away from creating too many test gltf files on disk, but maybe a middle ground is good.

@mramato
Copy link
Contributor

mramato commented Jul 7, 2017

Submitted #300

@likangning93 likangning93 merged commit bf9c64b into master Jul 7, 2017
@likangning93 likangning93 deleted the shader-string branch July 7, 2017 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants