Jump to content
  • Advertisement
Sign in to follow this  

Invalid values from VS

This topic is 1793 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


I'm trying to draw screen aligned quad with pre-transformed vertices and DrawPrimitiveUP.

Some weird is happening to the output values of the vertex shader:


Here are some samples:


The buffer consist of 4 vertices (screen corners) in the following format:

struct TVertex {
    float pos[3];
    float rhw;
    float uv[2];

The pos.xy are set to the screen corners, the pos.z is 0 and the rhw is 1. The UV members are 0,0/1,0/1,1/0,1

And drawing a trianglefan.


The vertex declaration is as follows:

const D3DVERTEXELEMENT9 dcl[]={

And a very simple shader to make the situation clear:

struct VSIn 
  float4 pos: POSITION;
  float2 uv: TEXCOORD;

struct VSOut {
  float4 pos: SV_POSITION;
  float4 spec: TEXCOORD0;

VSOut VSMain(VSIn input) {
  VSOut output;

  return output;

float4 PSMain(VSOut input): SV_TARGET {
  return input.spec;

I'd expect the whole screen to be white, but it's not!

It looks like the corners get these "spec" values:   (0,0,0,1) (1,0,0,1) (1,1,0,1) (0,1,0,1)


If I use a different register,

float4 spec: TEXCOORD1;

The whole screen is black, the input.spec value is (0,0,0,1)


The same shader works fine with "normal" projected transformation, but not with pre-transformed vertices.


What do I miss here??


Thanks for any help!


Share this post

Link to post
Share on other sites

When using pre-transformed vertices (D3DDECLUSAGE_POSITIONT) the vertex shader is skipped and your pixel shader receives what you provide with your vertex buffer(s) directly.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!