Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(130)

Issue 3945043: Map D3D calls and HLSL shaders back to GLES2 calls and GLSL ES shaders in PIX... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 11 months ago by apatrick1
Modified:
13 years, 10 months ago
Reviewers:
dgkoch, nicolas
CC:
angleproject-review_googlegroups.com
Base URL:
http://angleproject.googlecode.com/svn/trunk/
Visibility:
Public.

Description

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. Committed: http://code.google.com/p/angleproject/source/detail?r=541

Patch Set 1 #

Total comments: 20

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 1

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 9

Patch Set 7 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+535 lines, -305 lines) Patch
M include/GLSLANG/ShaderLang.h View 1 2 3 4 5 6 1 chunk +3 lines, -1 line 0 comments Download
M src/build_angle.gyp View 1 2 3 4 5 6 3 chunks +6 lines, -2 lines 0 comments Download
M src/common/debug.h View 1 2 3 4 5 6 1 chunk +58 lines, -20 lines 0 comments Download
M src/common/debug.cpp View 1 2 3 4 5 6 1 chunk +96 lines, -44 lines 0 comments Download
M src/common/version.h View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M src/compiler/Compiler.cpp View 1 2 3 4 5 6 3 chunks +13 lines, -3 lines 0 comments Download
M src/compiler/OutputHLSL.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M src/compiler/OutputHLSL.cpp View 1 2 3 4 5 6 11 chunks +55 lines, -14 lines 0 comments Download
M src/compiler/ParseHelper.h View 1 2 3 4 5 6 2 chunks +4 lines, -2 lines 0 comments Download
M src/compiler/glslang.y View 1 2 3 4 5 6 3 chunks +9 lines, -2 lines 0 comments Download
M src/compiler/glslang_tab.cpp View 1 2 3 4 5 6 4 chunks +14 lines, -7 lines 0 comments Download
M src/compiler/intermediate.h View 1 2 3 4 5 6 3 chunks +4 lines, -1 line 0 comments Download
M src/libEGL/Display.cpp View 1 2 3 4 5 6 3 chunks +2 lines, -12 lines 0 comments Download
M src/libEGL/libEGL.cpp View 1 2 3 4 5 6 34 chunks +34 lines, -34 lines 0 comments Download
M src/libEGL/libEGL.vcproj View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M src/libEGL/main.cpp View 1 2 3 4 5 6 1 chunk +9 lines, -9 lines 0 comments Download
M src/libGLESv2/Program.cpp View 1 2 3 4 5 6 2 chunks +18 lines, -4 lines 0 comments Download
M src/libGLESv2/Shader.cpp View 1 2 3 4 5 6 1 chunk +24 lines, -5 lines 0 comments Download
M src/libGLESv2/libGLESv2.cpp View 1 2 3 4 5 6 135 chunks +135 lines, -135 lines 0 comments Download
M src/libGLESv2/libGLESv2.vcproj View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M src/libGLESv2/main.cpp View 1 2 3 4 5 6 1 chunk +5 lines, -5 lines 0 comments Download
M src/libGLESv2/utilities.h View 1 2 3 4 5 6 2 chunks +5 lines, -0 lines 0 comments Download
M src/libGLESv2/utilities.cpp View 1 2 3 4 5 6 2 chunks +35 lines, -0 lines 0 comments Download

Messages

Total messages: 15
apatrick1
Another one for you Daniel. Now back to flipping Y coordinates... Thanks, Al http://codereview.appspot.com/3945043/diff/1/src/compiler/OutputHLSL.cpp File ...
13 years, 11 months ago (2011-01-12 21:52:18 UTC) #1
dgkoch
Adding Nicolas as a reviewer. Nicolas: can you take a look at this as well? ...
13 years, 11 months ago (2011-01-13 04:22:40 UTC) #2
apatrick1
Main changes were to reinstate tracing to a file and not bind to D3DPERF API ...
13 years, 11 months ago (2011-01-13 23:54:57 UTC) #3
nicolas
I haven't tested it in detail yet, but I believe the extra brackets could be ...
13 years, 11 months ago (2011-01-14 12:57:20 UTC) #4
apatrick1
The ternary operator was a good counter-example. I was able to make it generate incorrect ...
13 years, 11 months ago (2011-01-14 23:02:57 UTC) #5
dgkoch
Just the disabling d3d9ex that needs to be addressed and then it's LGTM to me. ...
13 years, 11 months ago (2011-01-16 16:24:47 UTC) #6
apatrick1
Done. Changes were to debug.* and Display.cpp.
13 years, 11 months ago (2011-01-18 20:22:01 UTC) #7
nicolas
The change at the bottom of glslang.y causes a crash (null dereference) in one of ...
13 years, 11 months ago (2011-01-19 15:15:42 UTC) #8
apatrick1
I couldn't reproduce the crash by running the conformance tests but I think I fixed ...
13 years, 11 months ago (2011-01-21 22:26:55 UTC) #9
apatrick1
nicolas, okay to check in? Thanks, Al
13 years, 10 months ago (2011-01-25 22:29:01 UTC) #10
nicolas
The crash is fixed. All looks good to me!
13 years, 10 months ago (2011-01-26 16:51:44 UTC) #11
dgkoch
Hi Al, I spotted a couple of final bugs in some of the preprocessing. Note ...
13 years, 10 months ago (2011-01-26 17:30:49 UTC) #12
apatrick1
http://codereview.appspot.com/3945043/diff/33001/src/build_angle.gyp File src/build_angle.gyp (right): http://codereview.appspot.com/3945043/diff/33001/src/build_angle.gyp#newcode8 src/build_angle.gyp:8: 'ANGLE_DISABLE_TRACE', For Chrome I was going to try having ...
13 years, 10 months ago (2011-01-26 19:30:46 UTC) #13
dgkoch
http://codereview.appspot.com/3945043/diff/33001/src/build_angle.gyp File src/build_angle.gyp (right): http://codereview.appspot.com/3945043/diff/33001/src/build_angle.gyp#newcode8 src/build_angle.gyp:8: 'ANGLE_DISABLE_TRACE', On 2011/01/26 19:30:46, apatrick1 wrote: > For Chrome ...
13 years, 10 months ago (2011-01-26 19:53:43 UTC) #14
apatrick1
13 years, 10 months ago (2011-01-26 20:09:18 UTC) #15
On 2011/01/26 19:53:43, dgkoch wrote:
> http://codereview.appspot.com/3945043/diff/33001/src/build_angle.gyp
> File src/build_angle.gyp (right):
> 
> http://codereview.appspot.com/3945043/diff/33001/src/build_angle.gyp#newcode8
> src/build_angle.gyp:8: 'ANGLE_DISABLE_TRACE',
> On 2011/01/26 19:30:46, apatrick1 wrote:
> > For Chrome I was going to try having it on by default so end users can use
PIX
> > to debug WebGL. If there is a performance issue I'll try caching whether PIX
> it
> > attached in a static bool in perfActive().
> > 
> > For the vcproj build, I have no preference as to whether the D3DPERF stuff
is
> on
> > by default.
> 
> Ok that's fine as long as it was intentional.  I might suggest using the
static
> bool for that.  One caveat here is that they might end up debugging the
> compositor as well when it is enabled :-)

I was thinking I would add two more levels of hierarchy for the events. The top
would group by the HTML element id of the issuing WebGL element (or label as
"Compositor"). The next level would be the actual WebGL calls with arguments,
with the corresponding but slightly different ANGLE GLES calls below that.

I'm also going to try and label  the D3D resources with the corresponding GLES
id using this approach, assuming it works in D3D9:

http://blogs.msdn.com/b/chuckw/archive/2010/04/15/object-naming.aspx
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b