Compute shader code have following lines
Texture2D gInput;
RWTexture2D<float4> gOutput;
#define N 256
#define CacheSize (N + 2*gBlurRadius)
groupshared float4 gCache[CacheSize];
[numthreads(N, 1, 1)]
void HorzBlurCS(int3 groupThreadID : SV_GroupThreadID,
int3 dispatchThreadID : SV_DispatchThreadID)
{
if(groupThreadID.x < gBlurRadius)
{
int x = max(dispatchThreadID.x - gBlurRadius, 0);
gCache[groupThreadID.x] = gInput[int2(x, dispatchThreadID.y)];
}
if(groupThreadID.x >= N-gBlurRadius)
{
int x = min(dispatchThreadID.x + gBlurRadius, gInput.Length.x-1);
gCache[groupThreadID.x+2*gBlurRadius] = gInput[int2(x, dispatchThreadID.y)];
}
gCache[groupThreadID.x+gBlurRadius] = gInput[min(dispatchThreadID.xy, gInput.Length.xy-1)];
What is this gInput.Length.x and gInput.Length.xy ? Texture2D should not have length. In cpp side
InputMap = mFX->GetVariableByName("gInput")->AsShaderResource();
where InputMap is ID3DX11EffectShaderResourceVariable.
void SetInputMap(ID3D11ShaderResourceView* tex) { InputMap->SetResource(tex); }
So this is an SRV. Which means this is Texture2D, not some “hidden” constant buffer struct? But what is the length? I thought it's the width, which I can get from GetDimensions(), but what is xy then?