• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1SamplerState       g_sSamp : register(s0);
2uniform sampler2D          g_sSamp2d
3{
4    AddressU = MIRROR;
5    AddressV = WRAP;
6    MinLOD = 0;
7    MaxLOD = 10;
8    MaxAnisotropy = 2;
9    MipLodBias = 0.2;
10}, g_sSamp2D_b;
11
12Texture1D          g_tTex1df4a : register(t1);
13
14uniform Texture1D <float4> g_tTex1df4 : register(t0);
15Texture1D <int4>   g_tTex1di4;
16Texture1D <uint4>  g_tTex1du4;
17
18Texture2D <float4> g_tTex2df4;
19Texture2D <int4>   g_tTex2di4;
20Texture2D <uint4>  g_tTex2du4;
21
22Texture3D <float4> g_tTex3df4;
23Texture3D <int4>   g_tTex3di4;
24Texture3D <uint4>  g_tTex3du4;
25
26TextureCube <float4> g_tTexcdf4;
27TextureCube <int4>   g_tTexcdi4;
28TextureCube <uint4>  g_tTexcdu4;
29
30struct MemberTest
31{
32    int Sample;                          // in HLSL, method names are valid struct members.
33    int CalculateLevelOfDetail;          // ...
34    int CalculateLevelOfDetailUnclamped; // ...
35    int Gather;                          // ...
36    int GetDimensions;                   // ...
37    int GetSamplePosition;               // ...
38    int Load;                            // ...
39    int SampleBias;                      // ...
40    int SampleCmp;                       // ...
41    int SampleCmpLevelZero;              // ...
42    int SampleGrad;                      // ...
43    int SampleLevel;                     // ...
44};
45
46struct PS_OUTPUT
47{
48    float4 Color : SV_Target0;
49    float  Depth : SV_Depth;
50};
51
52PS_OUTPUT main()
53{
54   PS_OUTPUT psout;
55
56   MemberTest mtest;
57   mtest.CalculateLevelOfDetail = 1;          // in HLSL, method names are valid struct members.
58   mtest.CalculateLevelOfDetailUnclamped = 1; // ...
59   mtest.Gather = 1;                          // ...
60   mtest.GetDimensions = 1;                   // ...
61   mtest.GetSamplePosition = 1;               // ...
62   mtest.Load = 1;                            // ...
63   mtest.Sample = 1;                          // ...
64   mtest.SampleBias = 1;                      // ...
65   mtest.SampleCmp = 1;                       // ...
66   mtest.SampleCmpLevelZero = 1;              // ...
67   mtest.SampleGrad = 1;                      // ...
68   mtest.SampleLevel = 1;                     // ...
69
70   float4 txval10 = g_tTex1df4 . Sample(g_sSamp, 0.1);
71   int4   txval11 = g_tTex1di4 . Sample(g_sSamp, 0.2);
72   uint4  txval12 = g_tTex1du4 . Sample(g_sSamp, 0.3);
73
74   float4 txval20 = g_tTex2df4 . Sample(g_sSamp, float2(0.1, 0.2));
75   int4   txval21 = g_tTex2di4 . Sample(g_sSamp, float2(0.3, 0.4));
76   uint4  txval22 = g_tTex2du4 . Sample(g_sSamp, float2(0.5, 0.6));
77
78   float4 txval30 = g_tTex3df4 . Sample(g_sSamp, float3(0.1, 0.2, 0.3));
79   int4   txval31 = g_tTex3di4 . Sample(g_sSamp, float3(0.4, 0.5, 0.6));
80   uint4  txval32 = g_tTex3du4 . Sample(g_sSamp, float3(0.7, 0.8, 0.9));
81
82   float4 txval40 = g_tTexcdf4 . Sample(g_sSamp, float3(0.1, 0.2, 0.3));
83   int4   txval41 = g_tTexcdi4 . Sample(g_sSamp, float3(0.4, 0.5, 0.6));
84   uint4  txval42 = g_tTexcdu4 . Sample(g_sSamp, float3(0.7, 0.8, 0.9));
85
86   psout.Color = 1.0;
87   psout.Depth = 1.0;
88
89   return psout;
90}
91