So, I am pretty sure this is unsupported, with concern to https://github.com/MonoGame/MonoGame/issues/2602
But, has anyone found work arounds for this? I want to use the tex2D (or tex2Dlod) function inside my vertex shader. I want to construct a gpu based particle very similar to this system http://nullprogram.com/blog/2014/06/29/
The basic idea is to store the position of each particle within a pixel on a large texture, and feed that into the vertex shader. It doesn’t matter so much the particle system, the real concern is being able to sample a texture from the vertex shader. I have some super basic test code…
sampler DataSampler : register(s0) {
Texture = (DataSampler);
magfilter = LINEAR;
minfilter = LINEAR;
mipfilter = LINEAR;
AddressU = clamp;
AddressV = clamp;
};
struct VS_INPUT {
float4 Position : SV_POSITION0;
};
struct PS_INPUT {
float4 Position : SV_POSITION;
};
//------------------------ VERTEX SHADER ---------------------------------------
PS_INPUT VertexShaderFunction(VS_INPUT input)
{
PS_INPUT output;
output.Position = tex2Dlod(DataSampler, float4(0, 0, 0, 0));
return output;
}
//------------------------ PIXEL SHADER ----------------------------------------
float4 PixelShaderFunction(PS_INPUT input) : SV_TARGET0
{
float4 output = float4(1,1,1,1);
return output;
}
//-------------------------- TECHNIQUES ----------------------------------------
technique Tech
{
pass OnlyPass
{
VertexShader = compile vs_4_0_level_9_1 VertexShaderFunction();
PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
}
}
When I pass it through MGFX with /Profile:DirectX_11
I get this error…
Particle_Render.fx(1,9): error X4509: maximum sampler register index exceeded, target has 0 slots, manual bind to slot s0 failed
Have I done something incorrectly, or is this still simply not supported in mojoshader? Please excuse the question if its been asked before, but I couldn’t find a conclusive answer to the problem.
Thanks
-Chris