NecroDOME
26-04-2007, 10:32 PM
I cant compile a shader, error message: error X3501: 'main': entrypoint not found
Delphi caode (Code is a valid string, I checked in the debugger)
if Failed(D3DXCompileShader(PChar(Code), SizeOf(Code)-1, nil, nil, 'main',
PChar(Profile), 0, @pCode, @pErrors, @ConstantTable)) then
begin
if LogErrors then
begin
Log('Error compiling vertex shader '+Profile);
Log(PChar(pErrors.GetBufferPointer));
end;
Errors := PChar(pErrors.GetBufferPointer);
Exit;
end;
Shader code:
float4x4 World : register(c0);
float4x4 View : register(c4);
float4x4 Proj : register(c8);
struct VS_OUTPUT
{
float4 Pos : POSITION;
float4 Diffuse : COLOR0;
float2 Tex : TEXCOORD0;
};
struct VS_INPUT
{
float3 Pos : POSITION;
float3 Normal : NORMAL;
float2 Tex : TEXCOORD0;
};
VS_OUTPUT main(const VS_INPUT Input)
{
float3 Pos = mul(float4(Input.Pos, 1), World);
Pos = mul(float4(Pos, 1), (float4x3)View);
VS_OUTPUT Out;
Out.Pos = mul(float4(Pos, 1), Proj);
Out.Diffuse = float4(1, 1, 1, 1);
Out.Tex = Input.Tex;
return Out;
}
Maybe we need to write a pascal interpeter so we can write shaders in pascal :P
Delphi caode (Code is a valid string, I checked in the debugger)
if Failed(D3DXCompileShader(PChar(Code), SizeOf(Code)-1, nil, nil, 'main',
PChar(Profile), 0, @pCode, @pErrors, @ConstantTable)) then
begin
if LogErrors then
begin
Log('Error compiling vertex shader '+Profile);
Log(PChar(pErrors.GetBufferPointer));
end;
Errors := PChar(pErrors.GetBufferPointer);
Exit;
end;
Shader code:
float4x4 World : register(c0);
float4x4 View : register(c4);
float4x4 Proj : register(c8);
struct VS_OUTPUT
{
float4 Pos : POSITION;
float4 Diffuse : COLOR0;
float2 Tex : TEXCOORD0;
};
struct VS_INPUT
{
float3 Pos : POSITION;
float3 Normal : NORMAL;
float2 Tex : TEXCOORD0;
};
VS_OUTPUT main(const VS_INPUT Input)
{
float3 Pos = mul(float4(Input.Pos, 1), World);
Pos = mul(float4(Pos, 1), (float4x3)View);
VS_OUTPUT Out;
Out.Pos = mul(float4(Pos, 1), Proj);
Out.Diffuse = float4(1, 1, 1, 1);
Out.Tex = Input.Tex;
return Out;
}
Maybe we need to write a pascal interpeter so we can write shaders in pascal :P