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 7Texture2DArray<float4> TextureF : register(t0); 8Texture2DArray<uint4> TextureUI : register(t0); 9Texture2DArray<int4> TextureI : register(t0); 10 11SamplerState Sampler : register(s0); 12 13float4 PS_PassthroughRGBA2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 14{ 15 return TextureF.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgba; 16} 17 18uint4 PS_PassthroughRGBA2DArrayUI(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 19{ 20 uint3 size; 21 TextureUI.GetDimensions(size.x, size.y, size.z); 22 23 int4 location = int4(size.xy * inTexCoord.xy, inLayer, 0); 24 25 return TextureUI.Load(location).rgba; 26} 27 28int4 PS_PassthroughRGBA2DArrayI(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 29{ 30 uint3 size; 31 TextureI.GetDimensions(size.x, size.y, size.z); 32 33 int4 location = int4(size.xy * inTexCoord.xy, inLayer, 0); 34 35 return TextureI.Load(location).rgba; 36} 37 38float4 PS_PassthroughRGB2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 39{ 40 return float4(TextureF.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgb, 1.0f); 41} 42 43uint4 PS_PassthroughRGB2DArrayUI(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 44{ 45 uint3 size; 46 TextureUI.GetDimensions(size.x, size.y, size.z); 47 48 int4 location = int4(size.xy * inTexCoord.xy, inLayer, 0); 49 50 return uint4(TextureUI.Load(location).rgb, 1.0f); 51} 52 53int4 PS_PassthroughRGB2DArrayI(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 54{ 55 uint3 size; 56 TextureI.GetDimensions(size.x, size.y, size.z); 57 58 int4 location = int4(size.xy * inTexCoord.xy, inLayer, 0); 59 60 return int4(TextureI.Load(location).rgb, 1.0f); 61} 62 63float4 PS_PassthroughRG2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 64{ 65 return float4(TextureF.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rg, 0.0f, 1.0f); 66} 67 68uint4 PS_PassthroughRG2DArrayUI(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 69{ 70 uint3 size; 71 TextureUI.GetDimensions(size.x, size.y, size.z); 72 73 int4 location = int4(size.xy * inTexCoord.xy, inLayer, 0); 74 75 return uint4(TextureUI.Load(location).rg, 0.0f, 1.0f); 76} 77 78int4 PS_PassthroughRG2DArrayI(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 79{ 80 uint3 size; 81 TextureI.GetDimensions(size.x, size.y, size.z); 82 83 int4 location = int4(size.xy * inTexCoord.xy, inLayer, 0); 84 85 return int4(TextureI.Load(location).rg, 0.0f, 1.0f); 86} 87 88float4 PS_PassthroughR2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 89{ 90 return float4(TextureF.Sample(Sampler, float3(inTexCoord.xy, inLayer)).r, 0.0f, 0.0f, 1.0f); 91} 92 93uint4 PS_PassthroughR2DArrayUI(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 94{ 95 uint3 size; 96 TextureUI.GetDimensions(size.x, size.y, size.z); 97 98 int4 location = int4(size.xy * inTexCoord.xy, inLayer, 0); 99 100 return uint4(TextureUI.Load(location).r, 0.0f, 0.0f, 1.0f); 101} 102 103int4 PS_PassthroughR2DArrayI(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 104{ 105 uint3 size; 106 TextureI.GetDimensions(size.x, size.y, size.z); 107 108 int4 location = int4(size.xy * inTexCoord.xy, inLayer, 0); 109 110 return int4(TextureI.Load(location).r, 0.0f, 0.0f, 1.0f); 111} 112 113float4 PS_PassthroughLum2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 114{ 115 return float4(TextureF.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rrr, 1.0f); 116} 117 118float4 PS_PassthroughLumAlpha2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 119{ 120 return TextureF.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rrra; 121} 122 123float4 PS_PassthroughRGBA2DArray_4444(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 124{ 125 return round(TextureF.Sample(Sampler, float3(inTexCoord.xy, inLayer)) * float4(15, 15, 15, 15)) / float4(15, 15, 15, 15); 126} 127 128float4 PS_PassthroughRGB2DArray_565(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 129{ 130 return float4(round(TextureF.Sample(Sampler, float3(inTexCoord.xy, inLayer)).rgb * float3(31, 63, 31)) / float3(31, 63, 31), 1.0f); 131} 132 133float4 PS_PassthroughRGBA2DArray_5551(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0 134{ 135 return round(TextureF.Sample(Sampler, float3(inTexCoord.xy, inLayer)) * float4(31, 31, 31, 1)) / float4(31, 31, 31, 1); 136} 137