2024-03-25 21:14:16 -07:00
|
|
|
% Unlike assignment syntax, only these names are allowed.
|
|
|
|
% The parameter count is also checked.
|
2024-03-19 12:06:12 -07:00
|
|
|
[pixel shader]
|
2024-03-25 21:14:16 -07:00
|
|
|
sampler sam
|
|
|
|
{
|
2024-06-06 13:00:18 -07:00
|
|
|
SetBlendState(foo, bar, baz); // 3 parameters
|
|
|
|
SetDepthStencilState(foo, 2); // 2 parameters
|
|
|
|
SetRasterizerState(foo); // 1 parameter
|
|
|
|
SetVertexShader(vs); // 1 parameter
|
|
|
|
SetDomainShader(ds); // 1 paramter
|
|
|
|
SetHullShader(100); // 1 parameter
|
|
|
|
SetGeometryShader(foo + bar); // 1 parameter
|
|
|
|
SetPixelShader(ps1); // 1 parameter
|
|
|
|
SetComputeShader(ARG); // 1 parameter
|
2024-03-25 21:14:16 -07:00
|
|
|
OMSetRenderTargets(RTV0, RTV1, RTV2, RTV3, RTV4, RTV5, RTV6, RTV7, DSV); // 2 to 9 parameters
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
|
2024-06-06 13:00:18 -07:00
|
|
|
[pixel shader todo]
|
|
|
|
sampler sam
|
|
|
|
{
|
|
|
|
SetComputeShader("random string");
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
|
2024-06-06 14:50:05 -07:00
|
|
|
[pixel shader fail(sm<6)]
|
2024-03-25 21:14:16 -07:00
|
|
|
sampler sam
|
|
|
|
{
|
|
|
|
SetSomeotherState();
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
|
2024-06-06 14:50:05 -07:00
|
|
|
[pixel shader fail(sm<6)]
|
2024-06-06 15:08:34 -07:00
|
|
|
sampler sam
|
|
|
|
{
|
|
|
|
Setblendstate(1, 2, 3); // Test case-sensitivity.
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
|
2024-03-25 21:14:16 -07:00
|
|
|
% It is allowed to use functions together with assignment syntax.
|
2024-03-19 12:06:12 -07:00
|
|
|
[pixel shader]
|
2024-03-25 21:14:16 -07:00
|
|
|
sampler sam
|
|
|
|
{
|
|
|
|
SetDepthStencilState(foo, bar);
|
|
|
|
arbitrary_field = 42;
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
|
|
|
|
% Test complex expression on the arguments, including function calls.
|
2024-03-19 12:06:12 -07:00
|
|
|
[pixel shader]
|
2024-03-25 21:14:16 -07:00
|
|
|
float4 addition(float4 a, float4 b)
|
|
|
|
{
|
|
|
|
return a + b;
|
|
|
|
}
|
|
|
|
|
|
|
|
sampler sam
|
|
|
|
{
|
|
|
|
SetBlendState(addition(foo, bar), p + q, p / q);
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
|
|
|
|
% Test the same thing on technique passes
|
2024-03-19 12:06:12 -07:00
|
|
|
[pixel shader]
|
2024-03-25 21:14:16 -07:00
|
|
|
technique tech1
|
|
|
|
{
|
|
|
|
pass pass1
|
|
|
|
{
|
|
|
|
SetBlendState(foo, bar, baz);
|
|
|
|
SetDepthStencilState(foo, 2);
|
|
|
|
SetRasterizerState(foo);
|
|
|
|
SetVertexShader(vs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
|
|
|
|
% It is not allowed to call the functions to set state blocks on the rhs using the assignment syntax
|
|
|
|
% for state groups or passes.
|
|
|
|
[pixel shader fail(sm<6)]
|
|
|
|
float4 main() : sv_target { return 0; }
|
|
|
|
|
|
|
|
technique
|
|
|
|
{
|
|
|
|
pass
|
|
|
|
{
|
|
|
|
cat = SetPixelShader(foobar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
% It not allowed to call the functions to set states outside state blocks or passes.
|
|
|
|
[pixel shader fail]
|
|
|
|
DepthStencilState dss1
|
|
|
|
{
|
|
|
|
DepthEnable = false;
|
|
|
|
DepthWriteMask = Zero;
|
|
|
|
DepthFunc = Less;
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main() : sv_target
|
|
|
|
{
|
|
|
|
SetDepthStencilState(NULL, dss1);
|
|
|
|
return 0;
|
|
|
|
}
|