I've been trying to set a vertex shader constant or a shared effect parameter in a TVShader and both seem to fail...
For vertex shader constants there is no API so I tried with MDX and TVInternalObjects, but no effect :
Device dev = new Device(InternalObjects.GetDevice3D());
float[] before = dev.GetVertexShaderSingleConstant(0, 4);
dev.SetVertexShaderConstant(0, new Vector4(texelSize.x, texelSize.y, 0, 0));
float[] after = dev.GetVertexShaderSingleConstant(0, 4);
The "after" array gives me the correct values, but as soon as I try to use them in a shader like so :
uniform float2 texelSize : register(c0);
I get 0 all over. And I'm sure that the vertex shader constant gets run at least once.
So I tried shared shader parameters, which I know works in DX9 because I got them working in Fez in XNA. So I just used this syntax in the shader :
shared float2 texelSize;
And replicated that variable in every shader I needed it, but just set it in one shader, it should then propagate to all loaded shaders that use it. But it doesn't, every other shader keeps having {0, 0}...
So in short...
VS constants questions :
- Is there any specific time I should set vertex shader constants?
- Should I not be using the 0th constant?
- Why isn't there any API to set them in TVScene or TVEngine?
Shared params : I suspect they don't work because TVShaders aren't in the same
effect pool... so is it possible to create them inside a common pool, or if not, why?
Thanks!