• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright 2018 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7Texture3D<float4> TextureF  : register(t0);
8Texture3D<uint4>  TextureUI : register(t0);
9Texture3D<int4>   TextureI  : register(t0);
10
11SamplerState      Sampler   : register(s0);
12
13struct VS_INPUT
14{
15    float2 Position : POSITION;
16    uint   Layer    : LAYER;
17    float3 TexCoord : TEXCOORD;
18};
19
20struct VS_OUTPUT
21{
22    float4 Position : SV_POSITION;
23    uint   Layer    : LAYER;
24    float3 TexCoord : TEXCOORD;
25};
26
27struct GS_OUTPUT
28{
29    float4 Position : SV_POSITION;
30    uint   Layer    : SV_RENDERTARGETARRAYINDEX;
31    float3 TexCoord : TEXCOORD;
32};
33
34VS_OUTPUT VS_Passthrough3D(VS_INPUT input)
35{
36    VS_OUTPUT output;
37
38    output.Position = float4(input.Position, 0.0f, 1.0f);
39    output.Layer = input.Layer;
40    output.TexCoord = input.TexCoord;
41
42    return output;
43}
44
45[maxvertexcount(3)]
46void GS_Passthrough3D(triangle VS_OUTPUT input[3], inout TriangleStream<GS_OUTPUT> outputStream)
47{
48    GS_OUTPUT output;
49
50    for (int i = 0; i < 3; i++)
51    {
52        output.Position = input[i].Position;
53        output.Layer = input[i].Layer;
54        output.TexCoord = input[i].TexCoord;
55
56        outputStream.Append(output);
57    }
58}
59
60float4 PS_PassthroughRGBA3D(GS_OUTPUT input) : SV_TARGET0
61{
62    return TextureF.Sample(Sampler, input.TexCoord).rgba;
63}
64
65uint4 PS_PassthroughRGBA3DUI(GS_OUTPUT input) : SV_TARGET0
66{
67    uint3 size;
68    TextureUI.GetDimensions(size.x, size.y, size.z);
69
70    return TextureUI.Load(int4(size * input.TexCoord, 0)).rgba;
71}
72
73int4 PS_PassthroughRGBA3DI(GS_OUTPUT input) : SV_TARGET0
74{
75    uint3 size;
76    TextureI.GetDimensions(size.x, size.y, size.z);
77
78    return TextureI.Load(int4(size * input.TexCoord, 0)).rgba;
79}
80
81float4 PS_PassthroughRGB3D(GS_OUTPUT input) : SV_TARGET0
82{
83    return float4(TextureF.Sample(Sampler, input.TexCoord).rgb, 1.0f);
84}
85
86uint4 PS_PassthroughRGB3DUI(GS_OUTPUT input) : SV_TARGET0
87{
88    uint3 size;
89    TextureUI.GetDimensions(size.x, size.y, size.z);
90
91    return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).rgb, 0);
92}
93
94int4 PS_PassthroughRGB3DI(GS_OUTPUT input) : SV_TARGET0
95{
96    uint3 size;
97    TextureI.GetDimensions(size.x, size.y, size.z);
98
99    return int4(TextureI.Load(int4(size * input.TexCoord, 0)).rgb, 0);
100}
101
102float4 PS_PassthroughRG3D(GS_OUTPUT input) : SV_TARGET0
103{
104    return float4(TextureF.Sample(Sampler, input.TexCoord).rg, 0.0f, 1.0f);
105}
106
107uint4 PS_PassthroughRG3DUI(GS_OUTPUT input) : SV_TARGET0
108{
109    uint3 size;
110    TextureUI.GetDimensions(size.x, size.y, size.z);
111
112    return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).rg, 0, 0);
113}
114
115int4 PS_PassthroughRG3DI(GS_OUTPUT input) : SV_TARGET0
116{
117    uint3 size;
118    TextureI.GetDimensions(size.x, size.y, size.z);
119
120    return int4(TextureI.Load(int4(size * input.TexCoord, 0)).rg, 0, 0);
121}
122
123float4 PS_PassthroughR3D(GS_OUTPUT input) : SV_TARGET0
124{
125    return float4(TextureF.Sample(Sampler, input.TexCoord).r, 0.0f, 0.0f, 1.0f);
126}
127
128uint4 PS_PassthroughR3DUI(GS_OUTPUT input) : SV_TARGET0
129{
130    uint3 size;
131    TextureUI.GetDimensions(size.x, size.y, size.z);
132
133    return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).r, 0, 0, 0);
134}
135
136int4 PS_PassthroughR3DI(GS_OUTPUT input) : SV_TARGET0
137{
138    uint3 size;
139    TextureI.GetDimensions(size.x, size.y, size.z);
140
141    return int4(TextureI.Load(int4(size * input.TexCoord, 0)).r, 0, 0, 0);
142}
143
144float4 PS_PassthroughLum3D(GS_OUTPUT input) : SV_TARGET0
145{
146    return float4(TextureF.Sample(Sampler, input.TexCoord).rrr, 1.0f);
147}
148
149float4 PS_PassthroughLumAlpha3D(GS_OUTPUT input) : SV_TARGET0
150{
151    return TextureF.Sample(Sampler, input.TexCoord).rrra;
152}
153
154float4 PS_PassthroughRGBA3D_4444(GS_OUTPUT input) : SV_TARGET0
155{
156    return round(TextureF.Sample(Sampler, input.TexCoord) * float4(15, 15, 15, 15)) / float4(15, 15, 15, 15);
157}
158
159float4 PS_PassthroughRGB3D_565(GS_OUTPUT input) : SV_TARGET0
160{
161    return float4(round(TextureF.Sample(Sampler, input.TexCoord).rgb * float3(31, 63, 31)) / float3(31, 63, 31), 1.0f);
162}
163
164float4 PS_PassthroughRGBA3D_5551(GS_OUTPUT input) : SV_TARGET0
165{
166    return round(TextureF.Sample(Sampler, input.TexCoord) * float4(31, 31, 31, 1)) / float4(31, 31, 31, 1);
167}
168
169float4 PS_PassthroughRGBA3D_2101010(GS_OUTPUT input) : SV_TARGET0
170{
171    return round(TextureF.Sample(Sampler, input.TexCoord) * float4(31, 31, 31, 1)) / float4(31, 31, 31, 1);
172}
173
174
175