|
@@ -1,21 +1,15 @@
|
|
-#if D3D12
|
|
|
|
#define BlitRS \
|
|
#define BlitRS \
|
|
"DescriptorTable ( Sampler(s0, space=2), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
|
"DescriptorTable ( Sampler(s0, space=2), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
|
"DescriptorTable ( SRV(t0, space=2), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
|
"DescriptorTable ( SRV(t0, space=2), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
|
"CBV(b0, space=3, visibility = SHADER_VISIBILITY_PIXEL),"\
|
|
"CBV(b0, space=3, visibility = SHADER_VISIBILITY_PIXEL),"\
|
|
|
|
|
|
-#define REG(reg, space) register(reg, space)
|
|
|
|
-#else
|
|
|
|
-#define REG(reg, space) register(reg)
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
struct VertexToPixel
|
|
struct VertexToPixel
|
|
{
|
|
{
|
|
float2 tex : TEXCOORD0;
|
|
float2 tex : TEXCOORD0;
|
|
float4 pos : SV_POSITION;
|
|
float4 pos : SV_POSITION;
|
|
};
|
|
};
|
|
|
|
|
|
-cbuffer SourceRegionBuffer : REG(b0, space3)
|
|
|
|
|
|
+cbuffer SourceRegionBuffer : register(b0, space3)
|
|
{
|
|
{
|
|
float2 UVLeftTop;
|
|
float2 UVLeftTop;
|
|
float2 UVDimensions;
|
|
float2 UVDimensions;
|
|
@@ -23,16 +17,14 @@ cbuffer SourceRegionBuffer : REG(b0, space3)
|
|
float LayerOrDepth;
|
|
float LayerOrDepth;
|
|
};
|
|
};
|
|
|
|
|
|
-Texture2D SourceTexture2D : REG(t0, space2);
|
|
|
|
-Texture2DArray SourceTexture2DArray : REG(t0, space2);
|
|
|
|
-Texture3D SourceTexture3D : REG(t0, space2);
|
|
|
|
-TextureCube SourceTextureCube : REG(t0, space2);
|
|
|
|
-TextureCubeArray SourceTextureCubeArray : REG(t0, space2);
|
|
|
|
-sampler SourceSampler : REG(s0, space2);
|
|
|
|
|
|
+Texture2D SourceTexture2D : register(t0, space2);
|
|
|
|
+Texture2DArray SourceTexture2DArray : register(t0, space2);
|
|
|
|
+Texture3D SourceTexture3D : register(t0, space2);
|
|
|
|
+TextureCube SourceTextureCube : register(t0, space2);
|
|
|
|
+TextureCubeArray SourceTextureCubeArray : register(t0, space2);
|
|
|
|
+sampler SourceSampler : register(s0, space2);
|
|
|
|
|
|
-#if D3D12
|
|
|
|
[RootSignature(BlitRS)]
|
|
[RootSignature(BlitRS)]
|
|
-#endif
|
|
|
|
VertexToPixel FullscreenVert(uint vI : SV_VERTEXID)
|
|
VertexToPixel FullscreenVert(uint vI : SV_VERTEXID)
|
|
{
|
|
{
|
|
float2 inTex = float2((vI << 1) & 2, vI & 2);
|
|
float2 inTex = float2((vI << 1) & 2, vI & 2);
|
|
@@ -42,36 +34,28 @@ VertexToPixel FullscreenVert(uint vI : SV_VERTEXID)
|
|
return Out;
|
|
return Out;
|
|
}
|
|
}
|
|
|
|
|
|
-#if D3D12
|
|
|
|
[RootSignature(BlitRS)]
|
|
[RootSignature(BlitRS)]
|
|
-#endif
|
|
|
|
float4 BlitFrom2D(VertexToPixel input) : SV_Target0
|
|
float4 BlitFrom2D(VertexToPixel input) : SV_Target0
|
|
{
|
|
{
|
|
float2 newCoord = UVLeftTop + UVDimensions * input.tex;
|
|
float2 newCoord = UVLeftTop + UVDimensions * input.tex;
|
|
return SourceTexture2D.SampleLevel(SourceSampler, newCoord, MipLevel);
|
|
return SourceTexture2D.SampleLevel(SourceSampler, newCoord, MipLevel);
|
|
}
|
|
}
|
|
|
|
|
|
-#if D3D12
|
|
|
|
[RootSignature(BlitRS)]
|
|
[RootSignature(BlitRS)]
|
|
-#endif
|
|
|
|
float4 BlitFrom2DArray(VertexToPixel input) : SV_Target0
|
|
float4 BlitFrom2DArray(VertexToPixel input) : SV_Target0
|
|
{
|
|
{
|
|
float3 newCoord = float3(UVLeftTop + UVDimensions * input.tex, (uint)LayerOrDepth);
|
|
float3 newCoord = float3(UVLeftTop + UVDimensions * input.tex, (uint)LayerOrDepth);
|
|
return SourceTexture2DArray.SampleLevel(SourceSampler, newCoord, MipLevel);
|
|
return SourceTexture2DArray.SampleLevel(SourceSampler, newCoord, MipLevel);
|
|
}
|
|
}
|
|
|
|
|
|
-#if D3D12
|
|
|
|
[RootSignature(BlitRS)]
|
|
[RootSignature(BlitRS)]
|
|
-#endif
|
|
|
|
float4 BlitFrom3D(VertexToPixel input) : SV_Target0
|
|
float4 BlitFrom3D(VertexToPixel input) : SV_Target0
|
|
{
|
|
{
|
|
float3 newCoord = float3(UVLeftTop + UVDimensions * input.tex, LayerOrDepth);
|
|
float3 newCoord = float3(UVLeftTop + UVDimensions * input.tex, LayerOrDepth);
|
|
return SourceTexture3D.SampleLevel(SourceSampler, newCoord, MipLevel);
|
|
return SourceTexture3D.SampleLevel(SourceSampler, newCoord, MipLevel);
|
|
}
|
|
}
|
|
|
|
|
|
-#if D3D12
|
|
|
|
[RootSignature(BlitRS)]
|
|
[RootSignature(BlitRS)]
|
|
-#endif
|
|
|
|
float4 BlitFromCube(VertexToPixel input) : SV_Target0
|
|
float4 BlitFromCube(VertexToPixel input) : SV_Target0
|
|
{
|
|
{
|
|
// Thanks, Wikipedia! https://en.wikipedia.org/wiki/Cube_mapping
|
|
// Thanks, Wikipedia! https://en.wikipedia.org/wiki/Cube_mapping
|
|
@@ -91,9 +75,7 @@ float4 BlitFromCube(VertexToPixel input) : SV_Target0
|
|
return SourceTextureCube.SampleLevel(SourceSampler, newCoord, MipLevel);
|
|
return SourceTextureCube.SampleLevel(SourceSampler, newCoord, MipLevel);
|
|
}
|
|
}
|
|
|
|
|
|
-#if D3D12
|
|
|
|
[RootSignature(BlitRS)]
|
|
[RootSignature(BlitRS)]
|
|
-#endif
|
|
|
|
float4 BlitFromCubeArray(VertexToPixel input) : SV_Target0
|
|
float4 BlitFromCubeArray(VertexToPixel input) : SV_Target0
|
|
{
|
|
{
|
|
// Thanks, Wikipedia! https://en.wikipedia.org/wiki/Cube_mapping
|
|
// Thanks, Wikipedia! https://en.wikipedia.org/wiki/Cube_mapping
|