Advertisement Jump to content
Sign in to follow this  

a problem with "Device-CreateVertexShader" need help!!

This topic is 4932 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 use the function below to read transform.txt
hr = D3DXCompileShaderFromFile(
		"Main",  // entry point function name
		"vs_1_1",// shader version to compile to
and then create shader:
hr = Device->CreateVertexShader(
Note that an error occur, the return value is always D3DERR_INVALIDCALL code in transform.txt is below:
// Global variable to store a combined view and projection
// transformation matrix.  We initialize this variable
// from the application.
matrix ViewProjMatrix;

// Initialize a global blue color vector.
vector Blue = {0.0f, 0.0f, 1.0f, 1.0f};

// Structures

// Input structure describes the vertex that is input
// into the shader.  Here the input vertex contains
// a position component only.
struct VS_INPUT
    vector position  : POSITION;

// Output structure describes the vertex that is
// output from the shader.  Here the output
// vertex contains a position and color component.
struct VS_OUTPUT
    vector position : POSITION;
    vector diffuse  : COLOR;

// Main Entry Point, observe the main function 
// receives a copy of the input vertex through
// its parameter and returns a copy of the output
// vertex it computes.

    // zero out members of output
    VS_OUTPUT output = (VS_OUTPUT)0;
    // transform to view space and project
    output.position  = mul(input.position, ViewProjMatrix);

    // set vertex diffuse color to blue
    output.diffuse = Blue;

    return output;
i don't know why.. all code is come from <<Introduction to 3D Game Programming with DirectX® 9.0>> Wordware Publishing My video card is an old one: Radeon 7200.. Is it cased by my video card??? [Edited by - Coder on July 23, 2005 1:07:21 PM]

Share this post

Link to post
Share on other sites
For future reference, using the [ source ] tags makes your post a lot cleaner and easier to read [smile]

Your old hardware might be the problem, iirc, the 7x00 cards were the first ATI offered with any sort of programmable unit... but a vs_1_1 shader should be okay for that. Run your program using the Reference Rasterizer (D3DDEVTYPE_REF) to verify that it is your hardware rather than your code that is the issue.

For any hardware-support questions, you need to check out the DirectX Caps viewer and/or perform suitable enumeration.

Have you checked all the returned params? no NULL pointers?

The next thing is to run against the debug runtime with a maximum debug output level - it should give you a much better idea of what it doesn't like about your function call. See this NeXe article if you're not familiar with the debug runtimes...


Share this post

Link to post
Share on other sites
check if your card supports vertex shader, by checking 'VertexShaderVersion' of D3DCAPS9 structure

Share this post

Link to post
Share on other sites
Original post by bladefenix
i don't know that there is a [ source ] tag until u tell me ....

It's all included in the Forum FAQ - although, in fairness, a lot of people don't seem to find/read it [smile]

Good luck with solving your problem!


Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!