Jump to content
  • Advertisement
Sign in to follow this  
bladefenix

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

This topic is 4867 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(
		"transform.txt",
		0,
		0,
		"Main",  // entry point function name
		"vs_1_1",// shader version to compile to
		D3DXSHADER_DEBUG, 
		&shader,
		&errorBuffer,
		&TransformConstantTable);
and then create shader:
hr = Device->CreateVertexShader(
		(DWORD*)shader->GetBufferPointer(),
		&TransformShader);
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.
//

VS_OUTPUT Main(VS_INPUT input)
{
    // 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
Advertisement
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...

hth
Jack

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
Quote:
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!

Cheers,
Jack

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!