Jump to content
  • Advertisement
Sign in to follow this  
Tree Penguin

DX11 Is rendering without a VB valid in DX11?

This topic is 2609 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Using DX11, I use a NULL Vertex Buffer and Vertex Layout to render, and the SV_VertexID inside the vertex shader as only input, is that OK?

I tested this on an NVIDIA card with the latest drivers and it seems to work fine, and I dont get any errors/warnings/info from the DX debug layer either. However, all MSDN topics and other pages I can find seem to assume you do pass a valid VB (and note that it must be created with D3D11_BIND_VERTEX_BUFFER etc.) so I still have my doubts...

Can anyone confirm this is indeed OK to do?

Share this post


Link to post
Share on other sites
Advertisement
Never mind, I looked in the wrong places, I found the answer in the msdn page for the ID3D11DeviceContext::Draw method:

The vertex data for a draw call normally comes from a vertex buffer that is bound to the pipeline. However, you could also provide the vertex data from a shader that has vertex data marked with the SV_VertexId system-value semantic.[/quote]

Share this post


Link to post
Share on other sites
Just to add to what you found, this is commonly used to draw a full screen quad to the screen using no vertex buffers
Just draw 4 verts in the c++ code

struct VSQuadOut{
float4 position : SV_Position;
float2 texcoord: TexCoord;
};
VSQuadOut VSQuad(uint VertexID: SV_VertexID){// ouputs a full screen quad with tex coords
VSQuadOut Out;
Out.texcoord = float2( (VertexID << 1) & 2, VertexID & 2 );
Out.position = float4( Out.texcoord * float2( 2.0f, -2.0f ) + float2( -1.0f, 1.0f), 0.0f, 1.0f );
return Out;
}

Share this post


Link to post
Share on other sites
I would like to add to the topic and say that you can also use instancing without vertex buffer and without instance buffer.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!