HLSL: Convert run-time sampler assignments to compile-time aliases.

For "s.m = t", a sampler member assigned a sampler, make t an alias
for s.m, and when s.m is flattened, it will flatten to the alias t.
Normally, assignments to samplers are disallowed.
This commit is contained in:
John Kessenich 2017-06-02 16:28:39 -06:00
parent 750c2d07f7
commit f31507421b
5 changed files with 254 additions and 5 deletions

View file

@ -0,0 +1,29 @@
struct OS {
SamplerState ss;
float a;
Texture2D tex;
};
SamplerState gss;
SamplerState gss2;
Texture2D gtex;
float4 osCall(OS s)
{
return s.a * s.tex.Sample(s.ss, float2(0.2, 0.3));
}
float4 main() : SV_TARGET0
{
OS os;
os.ss = gss2;
os.ss = gss;
os.tex = gtex;
os.a = 3.0;
// this should give an error
//SamplerState localss;
//localss = gss2;
return osCall(os);
}