Changeset 126342 in webkit
- Timestamp:
- Aug 22, 2012 1:14:08 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r126341 r126342 1 2012-08-22 Dean Jackson <dino@apple.com> 2 3 [WebGL] Mac/ATI/AMD systems need to translate built-in GLSL functions 4 https://bugs.webkit.org/show_bug.cgi?id=94030 5 6 Reviewed by Tim Horton. 7 8 ATI/AMD GPUs on Apple platforms do not give correct values for some of 9 the built-in GLSL functions. Add a compile flag that is passed to ANGLE 10 so that, with this configuration, it will rewrite the shader to emulate 11 the function in code. 12 13 This is exposing some design weaknesses in the way we call ANGLE. We'll 14 soon need to add more compiler flags; Future bugs will likely clean 15 this code up. But this approach is satisfactory for the moment. 16 17 This change is tested by the Khronos WebGL conformance test suite, in particular: 18 conformance/glsl/functions/glsl-function-distance.html 19 conformance/glsl/functions/glsl-function-dot.html 20 conformance/glsl/functions/glsl-function-length.html 21 22 * platform/graphics/ANGLEWebKitBridge.cpp: 23 (WebCore::ANGLEWebKitBridge::validateShaderSource): Test for ATI cards 24 on the Mac platform, and pass in an extra flag to the translation step. 25 * platform/graphics/ANGLEWebKitBridge.h: 26 (ANGLEWebKitBridge): Add a new parameter to getTranslatedShaderSourceANGLE 27 that accepts some extra options to pass to ANGLE. 28 * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: 29 (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE): Pass 30 the extra options into ANGLE's compile function. 31 1 32 2012-08-22 Tommy Widenflycht <tommyw@google.com> 2 33 -
trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp
r122175 r126342 67 67 } 68 68 69 bool ANGLEWebKitBridge::validateShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog )69 bool ANGLEWebKitBridge::validateShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog, int extraCompileOptions) 70 70 { 71 71 if (!builtCompilers) { … … 89 89 const char* const shaderSourceStrings[] = { shaderSource }; 90 90 91 bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, SH_OBJECT_CODE );91 bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, SH_OBJECT_CODE | extraCompileOptions); 92 92 if (!validateSuccess) { 93 93 int logSize = 0; -
trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h
r121259 r126342 54 54 void setResources(ShBuiltInResources); 55 55 56 bool validateShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog );56 bool validateShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog, int extraCompileOptions); 57 57 58 58 private: -
trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
r125349 r126342 122 122 String translatedShaderSource; 123 123 String shaderInfoLog; 124 int extraCompileOptions = 0; 124 125 125 bool isValid = compiler.validateShaderSource(entry.source.utf8().data(), shaderType, translatedShaderSource, shaderInfoLog); 126 #if PLATFORM(MAC) 127 const char* vendor = reinterpret_cast<const char*>(::glGetString(GL_VENDOR)); 128 if (vendor && (std::strstr(vendor, "ATI") || std::strstr(vendor, "AMD"))) 129 extraCompileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS; 130 #endif 131 132 bool isValid = compiler.validateShaderSource(entry.source.utf8().data(), shaderType, translatedShaderSource, shaderInfoLog, extraCompileOptions); 126 133 127 134 entry.log = shaderInfoLog;
Note: See TracChangeset
for help on using the changeset viewer.