Commit f685dcd9 authored by roger_fong@apple.com's avatar roger_fong@apple.com

[WebGL] Make sure we satisfy uniform and varying packing restrictions.

https://bugs.webkit.org/show_bug.cgi?id=125124.
<rdar://problem/15203291>

Reviewed by Brent Fulgham.

Tests covered by WebGL Khronos conformance tests:
webgl/1.0.2/conformance/glsl/misc/shader-uniform-packing-restrictions.html
webgl/1.0.2/conformance/glsl/misc/shader-varying-packing-restrictions.html

* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
(WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
* src/compiler/Compiler.cpp: 
Add a check to enforcePackingRestrictions to ensure we make sure packing restrictions for varyings are satisfied as well.
(TCompiler::TCompiler):
(TCompiler::Init):
(TCompiler::compile):
(TCompiler::enforcePackingRestrictions):
* src/compiler/ShHandle.h: Keep track of maximum varying vectors.
* platform/mac/TestExpectations: Unskip some 1.0.2 WebGL conformance tests that should now be passing.
Skip conformance/ogles/GL/build/build_009_to_016.html which is a faulty test and has too many varyings in one shader.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0e035b16
2013-12-05 Roger Fong <roger_fong@apple.com>
[WebGL] Make sure we satisfy uniform and varying packing restrictions.
https://bugs.webkit.org/show_bug.cgi?id=125124.
<rdar://problem/15203291>
Reviewed by Brent Fulgham.
* platform/mac/TestExpectations: Unskip some 1.0.2 WebGL conformance tests that should now be passing.
Skip conformance/ogles/GL/build/build_009_to_016.html which is a faulty test and has too many varyings in one shader.
2013-12-05 Alexandru Chiculita <achicu@adobe.com>
Web Inspector: [CSS Regions] Show a list of containing regions when clicking a node that is part of a flow
......@@ -695,11 +695,8 @@ webgl/1.0.2/conformance/limits/gl-max-texture-dimensions.html [ Pass Failure ]
# Currently working on 1.0.2 conformance, skip currently known failing tests, <rdar://problem/12099869>
webgl/1.0.2/conformance/glsl/misc/shader-with-too-many-uniforms.html [ Failure ]
webgl/1.0.2/conformance/extensions/webgl-compressed-texture-s3tc.html [ Failure ]
webgl/1.0.2/conformance/glsl/misc/shader-uniform-packing-restrictions.html [ Failure Timeout ]
webgl/1.0.2/conformance/glsl/misc/shader-varying-packing-restrictions.html [ Failure ]
webgl/1.0.2/conformance/glsl/misc/shader-uniform-packing-restrictions.html [ Timeout ]
webgl/1.0.2/conformance/glsl/misc/shader-with-global-variable-precision-mismatch.html [ Failure ]
webgl/1.0.2/conformance/glsl/misc/shader-with-short-circuiting-operators.html [ Failure ]
webgl/1.0.2/conformance/glsl/misc/shaders-with-varyings.html [ Failure ]
webgl/1.0.2/conformance/ogles/GL/biuDepthRange/biuDepthRange_001_to_002.html [ Failure ]
webgl/1.0.2/conformance/ogles/GL/gl_FragCoord/gl_FragCoord_001_to_003.html [ Failure ]
......@@ -708,6 +705,9 @@ webgl/1.0.2/conformance/rendering/gl-scissor-test.html [ Failure ]
webgl/1.0.2/conformance/typedarrays/array-unit-tests.html [ Failure ]
webgl/1.0.2/conformance/typedarrays/data-view-test.html [ Failure ]
# Test is faulty, skipping for now
webgl/1.0.2/conformance/ogles/GL/build/build_009_to_016.html [ Failure ]
# Skipping all webgl conformance tests on trunk
webgl/conformance
......
2013-12-05 Roger Fong <roger_fong@apple.com>
[WebGL] Make sure we satisfy uniform and varying packing restrictions.
https://bugs.webkit.org/show_bug.cgi?id=125124.
<rdar://problem/15203291>
Reviewed by Brent Fulgham.
* src/compiler/Compiler.cpp:
Add a check to enforcePackingRestrictions to ensure we make sure packing restrictions for varyings are satisfied as well.
(TCompiler::TCompiler):
(TCompiler::Init):
(TCompiler::compile):
(TCompiler::enforcePackingRestrictions):
* src/compiler/ShHandle.h: Keep track of maximum varying vectors.
2013-12-05 Matthew Hanson <matthew_hanson@apple.com>
Fix ANGLE build failures by re-comitting the changes in http://trac.webkit.org/changeset/154223
......
......@@ -74,6 +74,7 @@ TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
: shaderType(type),
shaderSpec(spec),
maxUniformVectors(0),
maxVaryingVectors(0),
maxExpressionComplexity(0),
maxCallStackDepth(0),
fragmentPrecisionHigh(false),
......@@ -94,6 +95,7 @@ bool TCompiler::Init(const ShBuiltInResources& resources)
maxUniformVectors = (shaderType == SH_VERTEX_SHADER) ?
resources.MaxVertexUniformVectors :
resources.MaxFragmentUniformVectors;
maxVaryingVectors = resources.MaxVaryingVectors;
maxExpressionComplexity = resources.MaxExpressionComplexity;
maxCallStackDepth = resources.MaxCallStackDepth;
......@@ -203,13 +205,8 @@ bool TCompiler::compile(const char* const shaderStrings[],
if (success && (compileOptions & SH_VARIABLES)) {
collectVariables(root);
if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {
if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS)
success = enforcePackingRestrictions();
if (!success) {
infoSink.info.prefix(EPrefixError);
infoSink.info << "too many uniforms";
}
}
}
if (success && (compileOptions & SH_INTERMEDIATE_TREE))
......@@ -399,7 +396,22 @@ void TCompiler::collectVariables(TIntermNode* root)
bool TCompiler::enforcePackingRestrictions()
{
VariablePacker packer;
return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
bool success = packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
if (!success) {
infoSink.info.prefix(EPrefixError);
infoSink.info << "too many uniforms";
return false;
}
success = packer.CheckVariablesWithinPackingLimits(maxVaryingVectors, varyings);
if (!success) {
infoSink.info.prefix(EPrefixError);
infoSink.info << "too many varyings";
return false;
}
return true;
}
void TCompiler::mapLongVariableNames(TIntermNode* root)
......
......@@ -98,7 +98,7 @@ protected:
// Translate to object code.
virtual void translate(TIntermNode* root) = 0;
// Returns true if, after applying the packing rules in the GLSL 1.017 spec
// Appendix A, section 7, the shader does not use too many uniforms.
// Appendix A, section 7, the shader does not use too many uniforms or varyings.
bool enforcePackingRestrictions();
// Returns true if the shader passes the restrictions that aim to prevent timing attacks.
bool enforceTimingRestrictions(TIntermNode* root, bool outputGraph);
......@@ -123,6 +123,7 @@ private:
ShShaderSpec shaderSpec;
int maxUniformVectors;
int maxVaryingVectors;
int maxExpressionComplexity;
int maxCallStackDepth;
......
2013-12-05 Roger Fong <roger_fong@apple.com>
[WebGL] Make sure we satisfy uniform and varying packing restrictions.
https://bugs.webkit.org/show_bug.cgi?id=125124.
<rdar://problem/15203291>
Reviewed by Brent Fulgham.
Tests covered by WebGL Khronos conformance tests:
webgl/1.0.2/conformance/glsl/misc/shader-uniform-packing-restrictions.html
webgl/1.0.2/conformance/glsl/misc/shader-varying-packing-restrictions.html
* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
(WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
2013-12-05 Laszlo Vidacs <lac@inf.u-szeged.hu>
32bit buildfix after r160151
......@@ -170,7 +170,7 @@ String Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE(Platform3DObject
String translatedShaderSource;
String shaderInfoLog;
int extraCompileOptions = SH_MAP_LONG_VARIABLE_NAMES | SH_CLAMP_INDIRECT_ARRAY_BOUNDS | SH_UNFOLD_SHORT_CIRCUIT;
int extraCompileOptions = SH_MAP_LONG_VARIABLE_NAMES | SH_CLAMP_INDIRECT_ARRAY_BOUNDS | SH_UNFOLD_SHORT_CIRCUIT | SH_ENFORCE_PACKING_RESTRICTIONS;
if (m_requiresBuiltInFunctionEmulation)
extraCompileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment