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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/MergeDuplicateProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function shaderEquals(shaderOne, shaderTwo) {
if (shaderOne.type !== shaderTwo.type) {
return false;
}
return shaderOne.extras._pipeline.source.equals(shaderTwo.extras._pipeline.source);
return shaderOne.extras._pipeline.source === shaderTwo.extras._pipeline.source;
}

/**
Expand Down
10 changes: 4 additions & 6 deletions specs/lib/MergeDuplicatePropertiesSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.

var gltf = {
programs : {
Expand All @@ -158,31 +156,31 @@ describe('MergeDuplicateProperties', function() {
type : WebGLConstants.VERTEX_SHADER,
extras : {
_pipeline : {
source : testShaderBufferOne
source : 'test shader one'
}
}
},
FSOne : {
type : WebGLConstants.FRAGMENT_SHADER,
extras : {
_pipeline : {
source : testShaderBufferOne
source : 'test shader one'
}
}
},
VSTwo : {
type : WebGLConstants.VERTEX_SHADER,
extras : {
_pipeline : {
source : testShaderBufferTwo
source : 'test shader two'
}
}
},
FSTwo : {
type : WebGLConstants.FRAGMENT_SHADER,
extras : {
_pipeline : {
source : testShaderBufferOne
source : 'test shader one'
}
}
}
Expand Down