Skip to main content
GameDev.net gamedev.net
🔒 Locked

Error X3539

Started by Njguy Sep 2, 2008 at 12:39 PM 3 replies 5.4k views
Original Post
Njguy
Njguy
When I try to load my application I get this dialog error error x3539: Ps_1_x is no longer supported; use /Gec in fxc to automatically upgrade to ps_2_0 error x3539: Alternately, fxc's /LD option allows use of the old compiler DLL. etc... I am guessing this means that it is working properly, except that my video card no longer supports that version of the pixel shader or something. Does anyone have any ideas??
Jalibr
Jalibr
It means that you're compiling to a target (ps_1_x) that we've deprecated in the compiler. It gives two workarounds we've provided, which is to change it to the lowest target (ps_2_0) or to use an older DLL (and we've conveniently provided a compiler switch/flag that does this for you).
Njguy
Njguy
ok but how do i go about doing this
sirob
sirob
Quote:
Original post by Njguy
ok but how do i go about doing this


There are a few options, depending on which technique you're using to create the shader. Your best bet is to paste the code to loading the shader, and the source of the actual shader here, and someone can help you out.

Alternatively, look for places that have ps_1_x in your code, and try changing them to ps_2_0.
Sirob Yes.» - status: Work-O-Rama.
Njguy
Njguy
Ok the code below is what I was using, its probably pretty old. However, if it is not up to date, what would I have to do, to use shaders generated out of fxcomposer?? I use directx 9


//---------------------------------------------------------------------------
//
//
// SceneLighting.fx
// Chris Bate; August, 2006
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Matricies
//---------------------------------------------------------------------------
float4x4 matWorldViewProj :WORLDVIEWPROJ;
float4x4 matWorldView :WORLDVIEW;
float4x4 matWorld :WORLD;

//---------------------------------------------------------------------------
// Light properties.
//---------------------------------------------------------------------------
float4 lightColor;
float4 lightPos;
float3 ambientColor;

//---------------------------------------------------------------------------
// Material properties.
//---------------------------------------------------------------------------
float4 ambientMat;
float4 diffuseMat;
float3 specularMat;
float3 emissive;
float shininess;
texture tex0;
texture tex1;
float3 cameraPos;

//---------------------------------------------------------------------------
// Sampler0 State
//---------------------------------------------------------------------------
sampler Sampler0 = sampler_state
{
Texture = (tex0);
MIPFILTER = LINEAR;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
};

//---------------------------------------------------------------------------
// Sampler1 State
//---------------------------------------------------------------------------
sampler Sampler1 = sampler_state
{
Texture = (tex1);
MIPFILTER = LINEAR;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
};

//---------------------------------------------------------------------------
// VertexShaderOut
//---------------------------------------------------------------------------
struct VertexShaderOut
{
float4 vertexPos : POSITION;
float2 tex : TEXCOORD0;
float4 position : TEXCOORD1;
float3 normal : TEXCOORD2;
};

//---------------------------------------------------------------------------
// VertexShaderNL
//---------------------------------------------------------------------------
struct VertexShaderOutNL
{
float4 vertexPos : POSITION;
float2 tex : TEXCOORD0;
};

//---------------------------------------------------------------------------
// VertexShaderNM
//---------------------------------------------------------------------------
struct VertexShaderOutNM
{
float4 vertexPos : POSITION;
float2 tex : TEXCOORD0;
float3 lightDir : TEXCOORD1;
float3 view : TEXCOORD2;
};

//---------------------------------------------------------------------------
// PixelShaderOut
//---------------------------------------------------------------------------
struct PixelShaderOut
{
float4 color : COLOR0;
};

//---------------------------------------------------------------------------
// VertexShader
//---------------------------------------------------------------------------
VertexShaderOut VertexShaderPP( float4 vertexPos : POSITION0,
float3 normal : NORMAL,
float2 tex : TEXCOORD0 )
{
VertexShaderOut output;

output.vertexPos = mul( vertexPos, matWorldViewProj );
output.tex = tex;

output.position = vertexPos;
output.normal = normal;

return output;
}

//---------------------------------------------------------------------------
// Pixel Shader
//---------------------------------------------------------------------------
void PixelShaderPP( in VertexShaderOut IN, out PixelShaderOut OUT )
{
// Calculate ambient.
float3 ambient = ambientMat * ambientColor;
float3 normal = normalize( IN.normal );

// Calculate diffuse.
float3 lightVec = normalize( lightPos - IN.position );
float dp = max( dot( normal, lightVec ), 0 );
float3 diffuse = diffuseMat * lightColor * dp;

// Calculate highlight.
float3 eyeVec = normalize( cameraPos - IN.position );
float3 halfVec = normalize( lightVec + eyeVec );
float specularLight = pow( max( dot( normal, halfVec ), 0 ), shininess );

// Check for diffuse.
if( dp <= 0 ) specularLight = 0;

// Calculate specular.
float3 specular = specularMat * lightColor * specularLight;

// Output.
OUT.color.xyz = ( ambient + diffuse + emissive + specular ) * tex2D( Sampler0, IN.tex );
OUT.color.w = 1;
}

//---------------------------------------------------------------------------
// VertexShaderNL
//---------------------------------------------------------------------------
VertexShaderOutNL VertexShaderNL( float4 vertexPos : POSITION0,
float2 tex : TEXCOORD0 )
{
VertexShaderOutNL output;

output.vertexPos = mul( vertexPos, matWorldViewProj );
output.tex = tex;

return output;
}

//---------------------------------------------------------------------------
// Pixel ShaderNL
//---------------------------------------------------------------------------
void PixelShaderNL( in VertexShaderOutNL IN, out PixelShaderOut OUT )
{
// Output.
OUT.color = tex2D( Sampler0, IN.tex );
}

//---------------------------------------------------------------------------
// VertexShaderNM
//---------------------------------------------------------------------------
VertexShaderOutNM VertexShaderNM( float4 vertexPos : POSITION,
float3 normal : NORMAL,
float2 tex : TEXCOORD0,
float3 tangent : TANGENT,
float3 binormal : BINORMAL )
{
VertexShaderOutNM output;

output.vertexPos = mul( vertexPos, matWorldViewProj );
output.tex = tex;

float3x3 TBN;
TBN[0] = mul( tangent, matWorldView );
TBN[1] = mul( binormal, matWorldView );
TBN[2] = mul( normal, matWorldView );

output.lightDir = lightPos - vertexPos;
output.lightDir = mul( TBN, output.lightDir );

float3 posWorld = normalize( mul( vertexPos, matWorld ) );
float3 viewer = cameraPos - posWorld;
output.view = mul( TBN, viewer );

return output;
}

//---------------------------------------------------------------------------
// Pixel ShaderNM
//---------------------------------------------------------------------------
void PixelShaderNM( in VertexShaderOutNM IN, out PixelShaderOut OUT )
{
float4 texColor = tex2D( Sampler0, IN.tex );
float4 normColor = 2 * ( tex2D( Sampler1, IN.tex ) - 0.5 );

// Normalize light dir.
float3 lightDir = normalize( IN.lightDir );
float3 viewDir = normalize( IN.view );

// Calculate diffuse.
float4 diffuse = saturate( dot( normColor, lightDir ) );
float shadow = saturate( 4 * diffuse );
float3 Reflect = normalize( 2 * diffuse * normColor -lightDir );
float4 specular = min( pow( saturate( dot( Reflect, viewDir ) ), 3 ), texColor.w );

// Combine final color.
OUT.color = 0.2 * texColor + shadow * texColor * diffuse + specular;
// Output.
//float3 ambient = ambientMat * ambientColor;
//float3 diffuse2 = diffuse * lightColor * diffuseMat;
//OUT.color.xyz = ( ambient + diffuse2 + emissive + specular ) * tex2D( Sampler0, IN.tex );
//OUT.color.w = 1;
}

//---------------------------------------------------------------------------
// PPLightingTech
//---------------------------------------------------------------------------
technique PPLighting
{
pass p0
{
VertexShader = compile vs_2_0 VertexShaderPP();
PixelShader = compile ps_2_0 PixelShaderPP();
}
}

//---------------------------------------------------------------------------
// PPLightingNMTech
//---------------------------------------------------------------------------
technique PPLightingNM
{
pass p0
{
VertexShader = compile vs_2_0 VertexShaderNM();
PixelShader = compile ps_2_0 PixelShaderNM();
}
}

//---------------------------------------------------------------------------
// NoLightingTech
//---------------------------------------------------------------------------
technique NoLighting
{
pass p0
{
VertexShader = compile vs_1_1 VertexShaderNL();
PixelShader = compile ps_1_1 PixelShaderNL();
}
}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.