I am currently writing an HLSL shader for a basic Gaussian blur. The shader code is straight forward, but I keep getting an error:
DX9 style intristics are disabled when not in dx9 compatibility mode. (LN#: 19)
This tells me that line 19 in my code is the issue, and I believe it is either due to tex2D or Sampler in that particular line.
#include "Common.hlsl"
Texture2D Texture0 : register(t0);
SamplerState Sampler : register(s0);
float4 PSMain(PixelShaderInput pixel) : SV_Target {
float2 uv = pixel.TextureUV; // This is TEXCOORD0.
float4 result = 0.0f;
float offsets[21] = { ... };
float weights[21] = { ... };
// Blur horizontally.
for (int x = 0; x < 21; x++)
result += tex2D(Sampler, float2(uv.x + offsets[x], uv.y)) * weights[x];
return result;
}
See below for notes about the code, and my questions.
Notes
I have to hand type my code into StackOverflow due to my code being on a computer without a connection. Therefore:
- Any spelling or case errors present here do not exist in code.
- The absence of values inside of
offsetsandweightsis intentional.- This is because there are 21 values in each and I didn't feel like typing them all.
offsetsis every integer from-10to10.weightsranges from0.01to0.25and back to0.01.
- The line count here is smaller due to the absence mentioned prior.
- The line number of the error here is
15. - The column range is
13 - 59which encapsulatestex2DandSampler.
- The line number of the error here is
My Questions
- Am I using the wrong data type for
Samplerin thetex2Dcall? - Is
tex2Ddeprecated inDirectX 11? - What should I be using instead?
- What am I doing wrong here as that is my only error.