vkd3d-shader/hlsl: Handle SV_IsFrontFace semantic.
Merge request reports
Activity
I think I found an example in hlsl-struct-semantics.shader_test of what you're talking about regarding manually filled vertex buffers. I couldn't make it work for purposes of this semantic, because I don't fully understand how it works. I did try to specify 3 vertices, and use draw triangle strip 3. With SV_IsFrontFace I was going to switch between returned target colors. Flipping vertices order did not make any difference in shader output. I'm sure I screwed up something.
Is there a good tutorial for this front face flag?
For the patch itself, I'm sure having a test would be better and I'm going to look at adding one, but the change is very straightforward and generates what it should, according to disassembly.
I think I found an example in hlsl-struct-semantics.shader_test of what you're talking about regarding manually filled vertex buffers. I couldn't make it work for purposes of this semantic, because I don't fully understand how it works. I did try to specify 3 vertices, and use draw triangle strip 3. With SV_IsFrontFace I was going to switch between returned target colors. Flipping vertices order did not make any difference in shader output. I'm sure I screwed up something.
Changing the vertex order doesn't change anything at all?
I do realize now that the shader runners all have default (i.e. back face) culling, so it won't render anything at all if the triangle is back-facing. We can probably just disable culling unconditionally.
That doesn't explain why you're getting the same face by changing the order, though.
added 44 commits
-
10bef019...616c4bf5 - 41 commits from branch
wine:master
- c3d629c1 - vkd3d-shader/hlsl: Handle SV_IsFrontFace semantic.
- 3293293b - tests: Disable culling in shader runners.
- a74ed1dd - tests: Add a test for SV_IsFrontFace.
Toggle commit list-
10bef019...616c4bf5 - 41 commits from branch
- tests/hlsl-is-front-face.shader_test 0 → 100644
35 } m; 36 }; 37 38 struct output 39 { 40 struct 41 { 42 float4 color : sv_target; 43 } m; 44 }; 45 46 struct output main(struct input i, bool face : sv_isfrontface) 47 { 48 struct output o; 49 o.m.color = i.m.texcoord; 50 if (face) o.m.color += float4(1.0, 1.0, 1.0, 1.0); changed this line in version 3 of the diff
added 5 commits
-
a74ed1dd...94ff9ba5 - 2 commits from branch
wine:master
- e02b837b - vkd3d-shader/hlsl: Handle SV_IsFrontFace semantic.
- 6a6b0296 - tests: Disable culling in shader runners.
- 95a4e01d - tests: Add a test for SV_IsFrontFace.
Toggle commit list-
a74ed1dd...94ff9ba5 - 2 commits from branch
That pixel shader looks a fair bit more complicated than it needs to be. The texcoord input in particular doesn't seem to add much, but ultimately I think we could just do the following?
[pixel shader] float4 main(bool front : sv_isfrontface) : sv_target { return front ? float4(1.0f, 2.0f, 1.0f, 2.0f) : float4(0.0f, 1.0f, 0.0f, 1.0f); }
It may also be less total code to add "draw quad cw" and "draw quad ccw" statements to the shader runner, instead of using an explicit input layout, vertex buffer, and vertex shader here.
added 11 commits
-
95a4e01d...0c05f240 - 8 commits from branch
wine:master
- bae3cb62 - vkd3d-shader/hlsl: Handle SV_IsFrontFace semantic.
- 929ed847 - tests: Disable culling in shader runners.
- 0ad66068 - tests: Add a test for SV_IsFrontFace.
Toggle commit list-
95a4e01d...0c05f240 - 8 commits from branch
added 7 commits
-
0ad66068...a1bd4e08 - 4 commits from branch
wine:master
- ca59a3c3 - vkd3d-shader/hlsl: Handle SV_IsFrontFace semantic.
- a496e3a8 - tests: Disable culling in shader runners.
- e4503ad8 - tests: Add a test for SV_IsFrontFace.
Toggle commit list-
0ad66068...a1bd4e08 - 4 commits from branch