HLSL sampler inside struct possible?
I'm using the DirectX 9 effect framework.
I'd like to create a struct which contains a sampler like so:
struct Test
{
texture tex;
sampler texSamp = sampler_state
{
Texture = <tex>;
};
};
However the shader compiler fails with:
internal error: this-relative Test::tex 'tex' found outsideof function scope
It seems like the i开发者_Python百科dea of the this-relative reference is kind of working, but I need to somehow declare it inside a function, but I'm not sure how that could work, since declaring samplers inside functions doesn't work? Anyone have any ideas?
I though that in HLSL everything is a value type. You know what implication this would have?
Each time you assigned this struct to some other variable you would do a copy of the sampler. There are limitation in shading language on many things like number of samplings, not only number of samplers.
It seems that non-numeric types are not supported inside HLSL structs, which is a crying shame for my application.
精彩评论