@ToolmakerSteve wrote:
This is a fragment from an XNA 3.1 "v3" .fx file (this won't build on its own, but this is part of a large file; hopefully this is enough to understand the problem):
float4 GaussianBlur_PS1_V1(VS_Simple_Terrain_Out input, uniform float2 vDir) : COLOR0 { float4 vColor = 0.0f; for (int i = 0; i < iGB_KERNEL_SIZE; i++) { float4 vTexCoords = float4(input.vTexCoords + vDiffuseTexelSize.xy * fGB_TexelScale.xx * vDir.xy * fGB_PixelKernel[i].xx, 0, iGB_LOD); vColor += tex2Dlod(sDiffuseTexture, vTexCoords) * fGB_BlurWeights[i] * fGB_Strength; } return vColor; } technique GaussianBlurH1_V1 { pass p0 { VertexShader = compile vs_4_0 VS_Simple_Terrain(); PixelShader = compile ps_4_0 GaussianBlur_PS1_V1(float2(1.0f, 0.0f)); } } technique GaussianBlurV1_V1 { pass p0 { VertexShader = compile vs_4_0 VS_Simple_Terrain(); PixelShader = compile ps_4_0 GaussianBlur_PS1_V1(float2(0.0f, 1.0f)); } } technique GaussianBlurV1 { pass horizontal { VertexShader = compile vs_4_0 VS_Simple_Terrain(); PixelShader = compile ps_4_0 GaussianBlur_PS1_V1(float2(1.0f, 0.0f)); } pass vertical { VertexShader = compile vs_4_0 VS_Simple_Terrain(); PixelShader = compile ps_4_0 GaussianBlur_PS1_V1(float2(0.0f, 1.0f)); } }
Above, I've replaced "vs_3_0"/"ps_3_0" with "vs_4_0"/"ps_4_0"; otherwise MGPT won't compile it. Most of the file compiles (and I have successfully compiled other files as well, by making this change).
But on all the "compile ps_4_0" lines above I get error:
Unexpected token 'f' found. Expected CloseParenthesis.
Unexpected toekn 'f' found. Expected CloseBracket.I can get this to build by removing the parameter being passed:
PixelShader = compile ps_4_0 GaussianBlur_PS1_V1(float2(1.0f, 0.0f));
=>
PixelShader = compile ps_4_0 GaussianBlur_PS1_V1();
BUT that won't produce the desired effect - that parameter is being used to make different variants of the PixelShader.
Q: How should I make these different variants, in ps_4_0 / MGPT?
That is, how can I pass in this parameter during compilation, or what is an alternative technique for producing these variants?(Using "4_0" under the theory that I should first make the minimum version upgrade necessary to build with MGPT. If it helps, I can use any shader version supported by D3D 11 - though I would need to know if that will require additional changes.)
Posts: 1
Participants: 1