Merge pull request #2976 from jeremy-lunarg/hayes-fix-2975
[platform/upstream/glslang.git] / Test / hlsl.samplecmplevelzero.offsetarray.dx10.frag
1 SamplerComparisonState g_sSamp : register(s0);
2
3 uniform Texture1D <float4> g_tTex1df4 : register(t0);
4 Texture1D <int4>   g_tTex1di4;
5 Texture1D <uint4>  g_tTex1du4;
6
7 Texture2D <float4> g_tTex2df4;
8 Texture2D <int4>   g_tTex2di4;
9 Texture2D <uint4>  g_tTex2du4;
10
11 Texture3D <float4> g_tTex3df4;
12 Texture3D <int4>   g_tTex3di4;
13 Texture3D <uint4>  g_tTex3du4;
14
15 TextureCube <float4> g_tTexcdf4;
16 TextureCube <int4>   g_tTexcdi4;
17 TextureCube <uint4>  g_tTexcdu4;
18
19 Texture1DArray <float4> g_tTex1df4a;
20 Texture1DArray <int4>   g_tTex1di4a;
21 Texture1DArray <uint4>  g_tTex1du4a;
22
23 Texture2DArray <float4> g_tTex2df4a;
24 Texture2DArray <int4>   g_tTex2di4a;
25 Texture2DArray <uint4>  g_tTex2du4a;
26
27 TextureCubeArray <float4> g_tTexcdf4a;
28 TextureCubeArray <int4>   g_tTexcdi4a;
29 TextureCubeArray <uint4>  g_tTexcdu4a;
30
31 struct PS_OUTPUT
32 {
33     float4 Color : SV_Target0;
34     float  Depth : SV_Depth;
35 };
36
37 PS_OUTPUT main()
38 {
39    PS_OUTPUT psout;
40
41    // 1DArray
42    float r11 = g_tTex1df4a . SampleCmpLevelZero(g_sSamp, float2(0.1, 0.2), 0.75, 2);
43    float r13 = g_tTex1di4a . SampleCmpLevelZero(g_sSamp, float2(0.1, 0.2), 0.75, 2);
44    float r15 = g_tTex1du4a . SampleCmpLevelZero(g_sSamp, float2(0.1, 0.2), 0.75, 2);
45
46    // 2DArray
47    float r31 = g_tTex2df4a . SampleCmpLevelZero(g_sSamp, float3(0.1, 0.2, 0.3), 0.75, int2(2,3));
48    float r33 = g_tTex2di4a . SampleCmpLevelZero(g_sSamp, float3(0.1, 0.2, 0.3), 0.75, int2(2,3));
49    float r35 = g_tTex2du4a . SampleCmpLevelZero(g_sSamp, float3(0.1, 0.2, 0.3), 0.75, int2(2,3));
50
51    // *** There's no SampleCmpLevelZero on 3D textures
52
53    // This page: https://msdn.microsoft.com/en-us/library/windows/desktop/bb509696(v=vs.85).aspx
54    // claims offset is supported for cube textures, but FXC does not accept it, and that does
55    // not match other methods, so it may be a documentation bug.  Those lines are commented
56    // out below.
57
58    // CubeArray
59    // float r61 = g_tTexcdf4a . SampleCmpLevelZero(g_sSamp, float4(0.1, 0.2, 0.3, 0.4), 0.75, int3(2,3,4));
60    // float r63 = g_tTexcdi4a . SampleCmpLevelZero(g_sSamp, float4(0.1, 0.2, 0.3, 0.4), 0.75, int3(2,3,4));
61    // float r65 = g_tTexcdu4a . SampleCmpLevelZero(g_sSamp, float4(0.1, 0.2, 0.3, 0.4), 0.75, int3(2,3,4));
62
63    psout.Color = 1.0;
64    psout.Depth = 1.0;
65
66    return psout;
67 }