mzanin
25-08-2010 17:26:17
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?
smiley80
25-08-2010 17:46:01
Is there an error message in ogre.log?
mzanin
26-08-2010 01:03:16
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?!
mzanin
27-08-2010 05:59:49
I'm getting random AccessViolationException's when I use SetNamedConstant in different situations as well.
One simple example is:
var fragmentParameters = m_BorderColorPass.GetFragmentProgramParameters();
fragmentParameters.SetNamedConstant("BorderColor", m_BorderColor);
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.
mzanin
27-08-2010 06:41:52
Using the Mogre/Ogre debug dll's
I get Assertion failed...
OgreGpuProgramParams.cpp
Line: 948.
Expression: physicalIndex + count <= mFloatConstants.size()
Is this a bug in Ogre/Mogre?
smiley80
27-08-2010 22:39:34
Can you post your shader code?
mzanin
28-08-2010 09:56:13
Sure. I'll only paste the glsl shader here (but the problem happens with hlsl too).
The material is
fragment_program GLSL/FontBorderColorPS glsl
{
source FontBorderColorProgram.glsl
default_params
{
param_named BackgroundFontSampler int 0
param_named BorderColor float4 1 1 1 1
}
}
// Unified definition
fragment_program FontBorderColorPS unified
{
delegate HLSL/FontBorderColorPS
delegate GLSL/FontBorderColorPS
}
The program is:
uniform vec4 BorderColor;
uniform sampler2D BackgroundFontSampler;
void main(void)
{
vec2 texCoord = vec2( gl_TexCoord[0] );
float alpha = texture2D( BackgroundFontSampler, texCoord ).a;
vec4 color = vec4( BorderColor.rgb, BorderColor.a * alpha );
// Output
gl_FragColor = color;
}
I've tried so many different things to fix this problem but I'm running out of ideas here
mzanin
28-08-2010 10:19:51
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.
GantZ
28-08-2010 11:44:37
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.
mzanin
05-11-2010 20:51:16
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).