src/compiler/Compiler.cpp


Log

Author Commit Date CI Message
daniel@transgaming.com 4167cc91 2013-01-11T04:11:53 Incorporated BSD-licensed changes implementing array bounds clamping. BUG=none TEST=ran associated WebKit layout tests in Chromium Review URL: https://codereview.appspot.com/6999052 git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1701 736b8ea6-26fd-11df-bfd4-992fa37f6226
daniel@transgaming.com 0aa3b5a2 2012-11-28T19:43:24 Implement user-defined name hashing. ANGLEBUG=315 Review URL: https://codereview.appspot.com/6818109 git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1469 736b8ea6-26fd-11df-bfd4-992fa37f6226
daniel@transgaming.com c23f4611 2012-11-28T19:42:57 Interface design for user-defined name hashing. 1) We use BuiltInResources to pass the hash function to ANGLE, deciding whether we applies hash function or not. 2) We use 64 bits hashing function, because 64 bits is 16 bytes using hex representation, plus the "webgl_" prefix, we can keep the names under 128 (WebGL allows 5 levels of nesting in structures). If chooseing 128 bits, we will go beyond 128 characters, and some drivers can't handle that safely. ANGLEBUG=315 Review URL: https://codereview.appspot.com/6822077 git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1466 736b8ea6-26fd-11df-bfd4-992fa37f6226
gman@chromium.org 8d804799 2012-10-17T21:33:48 Add Variable Packing checks to ANGLE BUG=373 TEST=unit tests git-svn-id: https://angleproject.googlecode.com/svn/trunk@1317 736b8ea6-26fd-11df-bfd4-992fa37f6226
alokp@chromium.org 8b851c6d 2012-06-15T16:25:11 Preparation of hooking up the new preprocessor. - Added custom Diagnostics class. Routed all info-log messages via this new class. - Added custom DirectiveHandler class. Moved directive-handling code to this class and routed the old path. - Deleted lexer_glue because it is not needed anymore. The new preprocessor is almost ready! - Killed a bunch of dead code related to PragmaTable. Review URL: https://codereview.appspot.com/6308074 git-svn-id: https://angleproject.googlecode.com/svn/trunk@1150 736b8ea6-26fd-11df-bfd4-992fa37f6226
maxvujovic@gmail.com 430f5e0c 2012-06-08T17:47:59 Add the SH_CSS_SHADERS_SPEC flag. Review URL: https://codereview.appspot.com/6270050/ git-svn-id: https://angleproject.googlecode.com/svn/trunk@1145 736b8ea6-26fd-11df-bfd4-992fa37f6226
maxvujovic@gmail.com 77222c97 2012-06-04T21:06:05 Apply SH_TIMING_RESTRICTIONS to all samplers. Issue: 332 Review URL: https://codereview.appspot.com/6273044/ git-svn-id: https://angleproject.googlecode.com/svn/trunk@1131 736b8ea6-26fd-11df-bfd4-992fa37f6226
maxvujovic@gmail.com 66ebd014 2012-05-30T22:18:11 Add the SH_TIMING_RESTRICTIONS compile flag and dependency graph implementation. Description of the algorithm: http://code.google.com/p/mvujovic/wiki/ShaderControlFlowAnalysis This flag is one potential solution to timing attacks on textures containing cross-domain content or user agent data. This kind of analysis could be useful for both WebGL and CSS Shaders. The SH_TIMING_RESTRICTIONS flag will reject a shader if it uses texture dependent data to affect control flow. Other ways of affecting shader timing such as using NaNs in basic arithmetic operations or using built-in functions (e.g. atan) with different inputs are still under investigation. Issue=329 Review URL: http://codereview.appspot.com/6195062/ git-svn-id: https://angleproject.googlecode.com/svn/trunk@1101 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com b9f64aae 2012-01-20T00:35:15 Use a global ref-counted singleton for long name map. This makes sure the same varying/uniform variables maps to the unique name in vertex/fragment shader. BUG= TEST=webgl conformance tests Review URL: https://codereview.appspot.com/5556065 git-svn-id: https://angleproject.googlecode.com/svn/trunk@950 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com 9996b8e6 2012-01-19T01:43:55 Rollback r942. MapLongVariableNames inherits from TIntermTraverser, and TIntermTraverser uses ANGLE's memory allocator, thus the memory is released per compilation. Our design is for MapLongVariableNames to be a singleton across all compilations, thus, this is not working. BUG= TEST= TBR=kbr Review URL: https://codereview.appspot.com/5556053 git-svn-id: https://angleproject.googlecode.com/svn/trunk@949 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com 4625d27b 2012-01-13T00:29:21 Long name mapping needs to be consistent between vertex/fragment shaders. For example: varying variables, uniforms. This CL makes MapLongVariableNames a ref-counted singleton and therefore, the map is shared by all shaders. Also, function/variable names changes from Varying to Global because uniforms also need to be consistent, not just varying variables. ANGLEBUG=279 TEST=webgl conformance tests, especially invalid-passed-params.html and glsl-long-variable-names.html Review URL: http://codereview.appspot.com/5539046 git-svn-id: https://angleproject.googlecode.com/svn/trunk@942 736b8ea6-26fd-11df-bfd4-992fa37f6226
kbr@chromium.org 22152117 2011-10-26T01:18:28 Limit copied uniform and vertex attribute names to the implicit size of the buffers passed in. Increase the size of the buffer the client will allocate for mapped names to be equal to the maximum token length. BUG=http://code.google.com/p/angleproject/issues/detail?id=234 TEST=WebGL conformance test to be checked in soon Review URL: http://codereview.appspot.com/5306063 git-svn-id: https://angleproject.googlecode.com/svn/trunk@804 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com a3b4ab4c 2011-09-16T00:53:26 Further work on the function emulation. This is to work around driver bugs. We added more functions, and removed some unnecessary ones. Remove the function group because we have flags for each function now. Use more macros instead of functions. Don't emit global precision because that will affect all later code. ANGLEBUG=196 TEST=build and test on Mac ATI/NVIDIA, fixes the failing webgl glsl conformance tests. Review URL: http://codereview.appspot.com/5011053 git-svn-id: https://angleproject.googlecode.com/svn/trunk@754 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com f420c424 2011-09-12T18:27:59 Add/remove more functions to use shims. Remove normalize and add cos instead to avoid a crash in Mac with ATI cards (angle bug 193, 202). Also add atan and mod as it's also buggy on Mac/Win with NVIDIA cards. Also, trying to minimize emulated functions by adding masks for fragment/vertex shaders. ANGLEBUG=196 Review URL: http://codereview.appspot.com/4992047 git-svn-id: https://angleproject.googlecode.com/svn/trunk@748 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com 32e97315 2011-08-24T01:03:11 Emulate certain buil-in functions to work around driver bugs. This is implemented by adding a new compile option SH_EMULATE_BUILT_IN_FUNCTIONS. The emulated functions are names as webgl_originalName_emu so there will never be naming conflicts. At the moment only three functions are emulated: normalize, abs, sign. Also, the compile option will emulate all three. However, the mechanism to emulate only a selected subset is also imeplemented. It can be turned on easily. ANGLEBUG=196 TEST=with this option, the failed test with abs.frag passes. Review URL: http://codereview.appspot.com/4916043 git-svn-id: https://angleproject.googlecode.com/svn/trunk@738 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com 0c6bb7a6 2011-08-17T19:39:58 Add an compile option to unroll for-loops with integer indices. ANGLEBUG=193 TEST=with this option, for-loops with integer indices will be unrolled. Review URL: http://codereview.appspot.com/4899047 git-svn-id: https://angleproject.googlecode.com/svn/trunk@734 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com 09c323a4 2011-08-12T18:22:25 Add an option to support for GL_OES_EGL_image_external. Comes with this extension is the new sampler type samplerExternalOES. ANGLEBUG=175 TEST=compile the attached shader file Review URL: http://codereview.appspot.com/4809076 git-svn-id: https://angleproject.googlecode.com/svn/trunk@728 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com b1762df4 2011-07-30T02:04:23 Detect function recursion and reject a shader if detected. ANGLEBUG=191 TEST=shaders with function recursion are rejected. Review URL: http://codereview.appspot.com/4808061 git-svn-id: https://angleproject.googlecode.com/svn/trunk@711 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com dc4b4f85 2011-06-17T00:42:53 Always emit precision in shader variable declarations. After the shader compile (and before code output), the precision scopes are already lost. In order to correctly output precisions, we need to emit precision in each variable declaration, therefore, each variable should have its precision set. This CL fixes the bugs that the precisions are lost for variables using default precsions and struct fields. Also, this CL fixes a bug in the grammar: constructors are not type_specifier and they shouldn't have precisions. BUG=168 TEST=webgl conformance tests, gles2 conformance tests. Review URL: http://codereview.appspot.com/4617041 git-svn-id: https://angleproject.googlecode.com/svn/trunk@695 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com 5601ea0d 2011-06-10T18:23:25 Implement ES2 backend for Angle translator. With this CL, we have the option to select a code output backend: GLSL, GLSL ES, or HLSL. Note that we always emit the highest supported float precision for fragment shader due to anglebug 168. Although this is a temporary solution, it's not against GLSL ES spec, because it's ok for implementation to upgrade precision. Tested with WebGL conformance test suite, GLES2 conformance test suite (only failed 2/1198), and a few webgl demos, including worlds of webgl, aquarium, etc. anglebug=81 test=translator emitting correct GLSL ES code when ES2 backend is selected. Review URL: http://codereview.appspot.com/4550129 git-svn-id: https://angleproject.googlecode.com/svn/trunk@687 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com 24c08c4e 2011-05-27T17:40:48 Fix the bug that long varying varibales are mapped into different names in fragment/vertex shaders. ANGLEBUG=144 TEST=the same long varying variable name in fragment/vertex shaders map to the same shortened name if using the same translator. Review URL: http://codereview.appspot.com/4547063 git-svn-id: https://angleproject.googlecode.com/svn/trunk@660 736b8ea6-26fd-11df-bfd4-992fa37f6226
zmo@google.com fd747b86 2011-04-23T01:30:07 Implement shader identifier name mapping. The name mapping happens when an identifier is longer than 32 characters. The name mapping is behind a flag, so it won't happen by default. Also, functions to query the mapped names are added. The purpose of this CL is for the drivers that can't handle long names. For example, linux NVIDIA driver can't handle 256 character name, whereas WebGL spec requires that. This CL also fixes the issue that some of the TIntermSymbols' ids are 0s. ANGLEBUG=144 TEST=test manually with shaders with long identifier names. Review URL: http://codereview.appspot.com/4428058 git-svn-id: https://angleproject.googlecode.com/svn/trunk@619 736b8ea6-26fd-11df-bfd4-992fa37f6226
apatrick@chromium.org 0f4cefe9 2011-01-26T19:30:57 Map D3D calls and HLSL shaders back to GLES2 calls and GLSL ES shaders in PIX. This makes debugging and profiling using PIX a lot more convenient. The top level of events are the GLES calls with their arguments. Those can be expanded to see the D3D calls that were issued for a particular GLES call. When PIX is attached, the shaders are saved out to temporary files and referenced from the translated HLSL shaders via #line directives. This enabled source level debugging of the original GLSL from PIX for pixel and vertex shaders. The HLSL is also saved to a temporary file so that intrinsic functions like texture2D can be stepped into. It also avoids creating a text file in the current working directory, which has continued to be an issue. I made the dependency on d3d9.dll static again so it can be accessed by GetModuleHandle witihin DllMain. I added an EVENT macro that issues D3DPERF_BeginEvent and D3DPERF_EndEvent around a C++ block. I replaced TRACE with EVENT for all the entry points. I removed the tracing of shader source since the source is visible in PIX. The means by which the filename of the temporary shader file is passed into the shader compiler is a little clunky. I did it that way to avoid changing the function signatures and breaking folks using the translator. I plan to make the compiler respect #pragma optimize so that optimization can be disabled for debugging purposes. For now it just disables shader optimization in debug builds of ANGLE. Review URL: http://codereview.appspot.com/3945043 git-svn-id: https://angleproject.googlecode.com/svn/trunk@541 736b8ea6-26fd-11df-bfd4-992fa37f6226
daniel@transgaming.com 83921386 2011-01-08T05:46:00 rewrite buffers implementation to support static buffers more efficiently Bug=89 Trac #13565 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@526 736b8ea6-26fd-11df-bfd4-992fa37f6226
alokp@chromium.org b59a778c 2010-11-24T18:38:33 Implemented validation for loop and indexing limitations specified by GLSL ES spec 1.0 Appendix A Section 4 and 5. A couple of things to note: - This CL only validates the "form" of loop and indexing. It does not detect number-of-iterations or out-of-bound access. This will require more involved analysis/heuristics. - I haved combined SH_VALIDATE_CONTROL_FLOW and SH_VALIDATE_INDEXING into one flag - SH_VALIDATE_LOOP_INDEXING. Validating both together is much easier. BUG=48 Review URL: http://codereview.appspot.com/3225041 git-svn-id: https://angleproject.googlecode.com/svn/trunk@491 736b8ea6-26fd-11df-bfd4-992fa37f6226
alokp@chromium.org bafcbaa3 2010-11-23T19:07:43 Moved the global-pool-allocator to TCompiler so that all memory allocated by the compiler can be de-allocated. Earlier the global-pool-allocator kept accumulating memory from all compilers (symbol-table in particular). The memory was only de-allocated when gpu-process exited or ShFinalize() was called. This was a problem for Chromium which keeps the GPU process around for the browser session. Now the memory is de-allocated as soon as the compiler is deleted, which happens when a tab is closed. BUG=58808 (crbug.com) Review URL: http://codereview.appspot.com/3280041 git-svn-id: https://angleproject.googlecode.com/svn/trunk@489 736b8ea6-26fd-11df-bfd4-992fa37f6226
alokp@chromium.org 1f29954d 2010-11-12T15:50:23 Added API to enforce GLSL limitations mandated by WebGL. BUG=48 Review URL: http://codereview.appspot.com/3005042 git-svn-id: https://angleproject.googlecode.com/svn/trunk@476 736b8ea6-26fd-11df-bfd4-992fa37f6226
alokp@chromium.org 044a5cf8 2010-11-12T15:42:16 Refactored glslang grammar files to make: - lexer and parser reentrant - line number handling automatic Caveats: - The preprocessor is still not thread-safe and full of bugs. I have another not-yet-ready patch to replace the preprocessor. - The grammar files use options that are not supported by the old versions of flex and bison checked into compiler/tools. So I need to check-in the generated lexer-parser along with a shell script to generate them. Review URL: http://codereview.appspot.com/2992041 git-svn-id: https://angleproject.googlecode.com/svn/trunk@475 736b8ea6-26fd-11df-bfd4-992fa37f6226
alokp@chromium.org 4888ceb6 2010-10-01T21:13:12 Made the API of shader translator library consistent. - We recently started using OpenGL-type enums. This CL makes all old enums consistent with the new scheme. - Renamed TBuiltInResource to ShBuiltInResources to have a consistent prefix BUG=46 Review URL: http://codereview.appspot.com/2328041 git-svn-id: https://angleproject.googlecode.com/svn/trunk@443 736b8ea6-26fd-11df-bfd4-992fa37f6226
alokp@chromium.org 570bfc7c 2010-09-24T17:19:25 Built-in string for vertex shaders can be empty. Nicolas handled this case in r433 but r437 overwrote it. Review URL: http://codereview.appspot.com/2233046 git-svn-id: https://angleproject.googlecode.com/svn/trunk@439 736b8ea6-26fd-11df-bfd4-992fa37f6226
alokp@chromium.org 07620a58 2010-09-23T17:53:56 - Moved the implementation for ShCompile to the compiler class so that internal details about compiler can be encapsulated. Now we do not need to expose built-in symbol table. - Fixed a few const violations. - Added CollectAttribsUniforms class. BUG=26 Review URL: http://codereview.appspot.com/2263041 git-svn-id: https://angleproject.googlecode.com/svn/trunk@437 736b8ea6-26fd-11df-bfd4-992fa37f6226