Random AccessViolationException on SetNamedConstant
I get random AccessViolationException's when I'm calling SetNamedConstant(string name, double val) for a fragment shader.
I'm using Mogre 1.7.1 (also happens with 1.7, haven't tried 1.6).
This is quite a serious issue as it just shuts down the application.
Any suggestions as to what the cause of this problem might be?
Is there an error message in ogre.log?
Nope nothing it just crashes, I had to replace the release Ogre/Mogre dll's with the Debug dll's for it to break on the offending line.
The shader code is also very simple. I'm just setting a float?!
I'm getting random AccessViolationException's when I use SetNamedConstant in different situations as well.
One simple example is:
var fragmentParameters = m_BorderColorPass.GetFragmentProgramParameters();
But I can get it happening when I pass a simple float to the shader too.
Oh and I'm using GLSL, but it happens with HLSL too.
This is killing our users as it happens after just a few minutes of running the application.
Using the Mogre/Ogre debug dll's
I get Assertion failed...
Expression: physicalIndex + count <= mFloatConstants.size()
Is this a bug in Ogre/Mogre?
Can you post your shader code?
Sure. I'll only paste the glsl shader here (but the problem happens with hlsl too).
The material is
fragment_program GLSL/FontBorderColorPS glsl
param_named BackgroundFontSampler int 0
param_named BorderColor float4 1 1 1 1
// Unified definition
fragment_program FontBorderColorPS unified
The program is:
uniform vec4 BorderColor;
uniform sampler2D BackgroundFontSampler;
vec2 texCoord = vec2( gl_TexCoord );
float alpha = texture2D( BackgroundFontSampler, texCoord ).a;
vec4 color = vec4( BorderColor.rgb, BorderColor.a * alpha );
gl_FragColor = color;
I've tried so many different things to fix this problem but I'm running out of ideas here
Btw, this is 1.7.1 Mogre/Ogre which I compiled myself with vs 2010 (32-bit).
I need to have double precision enabled.
I'm going to try 1.6 now to see if I still get the crashes as well.
could be a bug with mogre 1.7, OgreGpuProgramParams.h have greatly change in 1.7 version from the 1.6, i remember i got headache trying to make it work : viewtopic.php?f=8&t=12051#p69607
. could be worth checking out the sourcecode, and compare it with 1.6 to see what have changed.
I found a workaround for this isssue. What seems to be happening in my application is the SetNamedConstant get's called every render with the same value ... after a while this just causes an AccessViolationException and kills the app.
So now I check the value to see if it has changed before calling SetNamedConstant (thankfully I don't have values that are constantly changing).