[SlimDX/DirectX11] Problems with a pixel shader-only effect pass

Started by
2 comments, last by Erik Rufelt 12 years, 7 months ago
Hi everyone !

I don't know if this is a bug of SlimDX but here it is a weird behavior :

I have an effect technique which has one single pass, and this pass have only one pixel shader (no vertex shader nor compute shader). I can load it, no problem.
In my code, I must get the description of the pass. But it fails saying 'ArgumentOutOfRangeException' (coming from the DataStream that is used to create the EffectPassDescription). After checking the DX11 documentation, it seems that if a pass does not have a vertex shader nor a compute shader, the pIAInputSignature (of D3DX11_PASS_DESC) is NULL.
I think that SlimDX does not take care of this particular case and fails while it shouldn't.

I hope I helped you making a better SlimDX !
For now, I'll try to find another way to avoid this problem.

Good bye !
Advertisement
I didn't want to say "compute shader". Please replace these words by "geometry shader". wink.gif
Another thing is that the E_INVALIDARG which is returned by the function ID3D11::CreateInputLayout does not necessarily indicate that the function has failed. See Microsoft Documentation §Remarks. Therefore, the InputLayout constructor shouldn't throw an exception "E_INVALIDARG", and should return a new, valid, InputLayout instance.
I do not think that's what the Remarks section says at all, and if the function fails the input layout has not been created. The Remarks only talk about a debug warning.

You must have a vertex shader. Try adding a vertex shader to your effect and see if that fixes the problem. The input layout always translates the vertex buffer to the vertex shader input, and therefore there can not be an input without a vertex shader. Also, even if you don't have any input at all (for example generate geometry in the geometry shader), you still need an empty vertex shader.

If you don't want to do anything in the vertex shader just return the input to pass it along to the next shader stage, like this:

struct VertexInput {
float4 position;
etc..
};

VertexInput VertexShader(VertexInput input) {
return input;
}

This topic is closed to new replies.

Advertisement