[SOLVED]Shader Params on Ogre1.9

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
nickG
Greenskin
Posts: 122
Joined: Fri Jan 20, 2012 6:44 pm
Location: Russia,Moscow
x 1

[SOLVED]Shader Params on Ogre1.9

Post by nickG »

In past version(1.9RC1) all works a fine.
In stable i got error:
02:06:02: OGRE EXCEPTION(2:InvalidParametersException): Parameter called texSize does not exist. in GpuProgramParameters::_findNamedConstantDefinition at src\OgreGpuProgramParams.cpp (line 1719)
02:06:02: Compiler error: invalid parameters in ConeStepMapping.program(21): setting of constant failed
on

Code: Select all

param_named_auto texSize texture_size 0
What's happen?


Shader fragment:

Code: Select all

POut csm_ps(PIn IN,
    uniform float4 texSize,
    uniform float depth, // depth scale of the surface
    uniform sampler2D diffuseMap : TEXUNIT0,
    uniform sampler2D csmMap : TEXUNIT1)
{
    POut OUT;

    float a = -depth / IN.tsPos.z;
    float3 s = float3((IN.tsPos * a).xy, 1);
    // texture-delta-based LOD
    float df = 0.05 * sqrt(length(fwidth(IN.uv)));

    float3 uv = float3(IN.uv, 0);
    intersect_square_cone_exp(csmMap, uv, s, df);

    // expand normal from normal map in local polygon space
    // blue = df/dx
    // alpha = df/dy

    // not used in this little port
    // (you'd use this for NdotL with the tangent-space light direction)
	float4 normal = tex2D(csmMap, uv.xy);
    normal = float4((normal.ba - 0.5) * (-depth * texSize.xy), 1.0, 0.0);
    normal.xyz = normalize(normal.xyz);

    float4 diffuse = tex2D(diffuseMap, uv.xy);

    OUT.colour = diffuse;

    return OUT;
}
Last edited by nickG on Sat Nov 23, 2013 3:36 am, edited 1 time in total.
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: Shader Params on Ogre1.9

Post by scrawl »

texSize is probably optimized out by the shader compiler, since you're not using it (or rather, you're not using normal).
Post Reply