[PATCH vkd3d 3/5] tests: Try to avoid using SV_Position from shaders which can be tested with SM2.

Zebediah Figura zfigura at codeweavers.com
Thu Apr 7 14:14:42 CDT 2022


On 4/7/22 13:11, Henri Verbeet wrote:
> On Thu, 7 Apr 2022 at 20:03, Zebediah Figura <zfigura at codeweavers.com> wrote:
>>
>> On 4/7/22 08:07, Henri Verbeet wrote:
>>> On Wed, 6 Apr 2022 at 23:05, Zebediah Figura <zfigura at codeweavers.com> wrote:
>>>>
>>>> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
>>>> ---
>>>>    tests/conditional.shader_test           | 11 +++++---
>>>>    tests/hlsl-for.shader_test              | 17 +++++++-----
>>>>    tests/hlsl-struct-semantics.shader_test | 35 ++++++++++++++++++++-----
>>>>    tests/trigonometry.shader_test          | 31 +++++++++-------------
>>>>    4 files changed, 60 insertions(+), 34 deletions(-)
>>>>
>>> Using uniforms works of course, but an alternative worth considering
>>> is using texture coordinates. That would allow the structure of these
>>> tests to remain otherwise unmodified.
>>
>> I believe I had tried that at some point and found it difficult, but
>> maybe that was before I encoded support for custom input layouts into
>> the shader runner. I'll look at it again...
> 
> In principle it should be a matter of adding texture coordinates to
> the vertex buffer in patch 1/5, and then emitting them from the vertex
> shader. We'd also get normalised coordinates in the pixel shader
> instead of render target coordinates, but that's a relatively minor
> difference.

Ah, now I remember. The problem ends up being a difference in pixel 
center. E.g. one can do something like this for the trigonometry test:


[vertex shader]
void main(out float tex : texcoord, inout float4 pos : sv_position)
{
     tex = (pos.x + 1) * 320;
}

[pixel shader]
float4 main(float tex : texcoord) : sv_target
{
     return float4(sin(tex), cos(tex), 0, 0);
}


and the results will remain about the same (modulo measuring error) for 
d3d9, but will be different for d3d11/d3d12 due to the half-pixel offset.

I suppose we could manually offset vertex position in the shader runner 
backend...



More information about the wine-devel mailing list