Ok, I'm trying to use vertex shader, but I have some problem...
Here's the code I'm using (note that the shader doesn't really do anything... it just expects the world*view*projection matrix in c0->c4 and then passes the data through as it is):
[code]
const char VertexShader[] =
"vs.1.1
"
"m4x4 oPos, v0, c0
"
"mov oT0, v7";
ID3DXBuffer *VertexShaderBuffer;
DWORD declaration[] =
{
D3DVSD_STREAM(0),
D3DVSD_REG(D3DVSDE_POSITION, D3DVSDT_FLOAT3),
D3DVSD_REG(D3DVSDE_NORMAL, D3DVSDT_FLOAT3),
D3DVSD_REG(D3DVSDE_TEXCOORD0, D3DVSDT_FLOAT2),
D3DVSD_END()
};
if (FAILED(D3DXAssembleShader(VertexShader, lstrlen(VertexShader), D3DXASM_DEBUG, NULL, &VertexShaderBuffer, NULL)))
return false;
if (FAILED(D3DDevice->CreateVertexShader(declaration, (DWORD*)VertexShaderBuffer->GetBufferPointer(), &VertexShaderHandle, 0)))
return false;
VertexShaderBuffer->Release();
return true;
[/code]
The problem is with CreateVertexShader that returns D3DERR_INVALIDCALL.
I don't really understand where's the error, so I hope that someone out there can find it for me!!! ;-)
Thank you
nICO
[hr]
[italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
JOHN KEATS
Comments
: Here's the code I'm using (note that the shader doesn't really do anything... it just expects the world*view*projection matrix in c0->c4 and then passes the data through as it is):
:
: [code]
: const char VertexShader[] =
: "vs.1.1
"
: "m4x4 oPos, v0, c0
"
: "mov oT0, v7";
: ID3DXBuffer *VertexShaderBuffer;
:
: DWORD declaration[] =
: {
: D3DVSD_STREAM(0),
: D3DVSD_REG(D3DVSDE_POSITION, D3DVSDT_FLOAT3),
: D3DVSD_REG(D3DVSDE_NORMAL, D3DVSDT_FLOAT3),
: D3DVSD_REG(D3DVSDE_TEXCOORD0, D3DVSDT_FLOAT2),
: D3DVSD_END()
: };
:
: if (FAILED(D3DXAssembleShader(VertexShader, lstrlen(VertexShader), D3DXASM_DEBUG, NULL, &VertexShaderBuffer, NULL)))
: return false;
:
: if (FAILED(D3DDevice->CreateVertexShader(declaration, (DWORD*)VertexShaderBuffer->GetBufferPointer(), &VertexShaderHandle, 0)))
: return false;
:
: VertexShaderBuffer->Release();
: return true;
: [/code]
:
: The problem is with CreateVertexShader that returns D3DERR_INVALIDCALL.
: I don't really understand where's the error, so I hope that someone out there can find it for me!!! ;-)
:
: Thank you
: nICO
:
: [hr]
: [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
: JOHN KEATS
:
:
Try to use this:
: [code]
: if (FAILED(D3DXAssembleShader(VertexShader, lstrlen(VertexShader)-1, D3DXASM_DEBUG, NULL, &VertexShaderBuffer, NULL)))
: return false;
: [/code]
Btw, now it's all working!
nICO
[hr]
[italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
JOHN KEATS