From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/tpf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index 290fdcb3..e706f28b 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -2830,6 +2830,22 @@ static D3D_SHADER_VARIABLE_TYPE sm4_base_type(const struct hlsl_type *type) return D3D_SVT_VERTEXSHADER; case HLSL_TYPE_VOID: return D3D_SVT_VOID; + case HLSL_TYPE_UAV: + switch (type->sampler_dim) + { + case HLSL_SAMPLER_DIM_1D: + return D3D_SVT_RWTEXTURE1D; + case HLSL_SAMPLER_DIM_2D: + return D3D_SVT_RWTEXTURE2D; + case HLSL_SAMPLER_DIM_3D: + return D3D_SVT_RWTEXTURE3D; + case HLSL_SAMPLER_DIM_1DARRAY: + return D3D_SVT_RWTEXTURE1DARRAY; + case HLSL_SAMPLER_DIM_2DARRAY: + return D3D_SVT_RWTEXTURE2DARRAY; + default: + vkd3d_unreachable(); + } default: vkd3d_unreachable(); }
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- tests/hlsl/ternary.shader_test | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/tests/hlsl/ternary.shader_test b/tests/hlsl/ternary.shader_test index 1fc2f070..00ff936c 100644 --- a/tests/hlsl/ternary.shader_test +++ b/tests/hlsl/ternary.shader_test @@ -31,3 +31,28 @@ float4 main() : sv_target uniform 0 float4 1.1 3.0 4.0 5.0 draw quad probe all rgba (1.1, 2.0, 0.0, 0.0) + +[require] +shader model >= 5.0 + +[uav 1] +format r32 float +size (2, 2) + +0.1 0.2 +0.3 0.4 + +[pixel shader] +RWTexture2D<float> u; +float4 f; + +float4 main() : sv_target +{ + return f.x ? (u[uint2(0, 0)] = 0.5) : (u[uint2(1, 1)] = 0.6); +} + +[test] +draw quad +uniform 0 float4 1.0 0.0 0.0 0.0 +probe uav 1 (0, 0) r (0.5) +probe uav 1 (1, 1) r (0.6)
Wrt 2/2, we could presumably avoid the 5.0 requirement by just using normal variables? Any reason to use UAVs in particular?