1
Window / Re: AMD/ATI graphics driver crash
« on: July 18, 2013, 12:07:54 am »
So yea you are right, it is a shader problem.
So yea here is our vertex shader:
And then we have 3 difrent shader fragment shaders depending on how much we scale the textures.
The last shader does the exact same thing as this one just another 10times or so..
If I comment out "state.shader = mShader;" it runs ok and doesnt crash how ever if I set it to load any of the above fragment shader it crashes
EDIT: I'll just update with the code loading the shader incase that is the problem.
Also, have tested the shader in RenderMonkey.. works fine there without any warnings
LAST EDIT: I updated SFML to the nightly build I found on eXpl0it3r's homepage and now it works..
So I have actually no idea what was wrong
Thx expl0it3r!
link if you have same problem: http://sfml.my-gate.net/nightly/
So yea here is our vertex shader:
//Vertex Program
void main( void )
{
// transform the vertex position
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
// transform the texture coordinates
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
// forward the vertex color
gl_FrontColor = gl_Color;
}
void main( void )
{
// transform the vertex position
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
// transform the texture coordinates
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
// forward the vertex color
gl_FrontColor = gl_Color;
}
And then we have 3 difrent shader fragment shaders depending on how much we scale the textures.
//Fragment Program
uniform sampler2D texture;
void main (void)
{
vec4 textColor = texture2D( texture, gl_TexCoord[0].st);
gl_FragColor = textColor;
}
uniform sampler2D texture;
void main (void)
{
vec4 textColor = texture2D( texture, gl_TexCoord[0].st);
gl_FragColor = textColor;
}
The last shader does the exact same thing as this one just another 10times or so..
//Fragment Program
uniform sampler2D texture;
uniform vec2 texelSize;
void main (void)
{
vec4 textColor;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(0.0 * texelSize.x, 0.0 * texelSize.y)) * 0.2;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(-1.0 * texelSize.x, -1.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(1.0 * texelSize.x, -1.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(-1.0 * texelSize.x, 1.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(1.0 * texelSize.x, 1.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(0.0 * texelSize.x, -1.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(1.0 * texelSize.x, 0.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(-1.0 * texelSize.x, 0.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(1.0 * texelSize.x, 0.0 * texelSize.y)) * 0.125;
gl_FragColor = textColor;
}
uniform sampler2D texture;
uniform vec2 texelSize;
void main (void)
{
vec4 textColor;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(0.0 * texelSize.x, 0.0 * texelSize.y)) * 0.2;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(-1.0 * texelSize.x, -1.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(1.0 * texelSize.x, -1.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(-1.0 * texelSize.x, 1.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(1.0 * texelSize.x, 1.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(0.0 * texelSize.x, -1.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(1.0 * texelSize.x, 0.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(-1.0 * texelSize.x, 0.0 * texelSize.y)) * 0.125;
textColor += texture2D( texture, gl_TexCoord[0].st + vec2(1.0 * texelSize.x, 0.0 * texelSize.y)) * 0.125;
gl_FragColor = textColor;
}
If I comment out "state.shader = mShader;" it runs ok and doesnt crash how ever if I set it to load any of the above fragment shader it crashes
EDIT: I'll just update with the code loading the shader incase that is the problem.
Also, have tested the shader in RenderMonkey.. works fine there without any warnings
mShader = new sf::Shader();
mShader->loadFromFile("filtering.vert", sf::Shader::Type::Vertex);
float totalScale = (mScale.x + mScale.y) / 2;
if (totalScale < 1.1f)
{
mShader->loadFromFile("filtering_0.frag", sf::Shader::Type::Fragment);
}
else if (totalScale < 2.1f)
{
mShader->loadFromFile("filtering_1.frag", sf::Shader::Type::Fragment);
mShader->setParameter("texelSize", mTexelSize);
}
else
{
mShader->loadFromFile("filtering_2.frag", sf::Shader::Type::Fragment);
mShader->setParameter("texelSize", mTexelSize);
}
mShader->setParameter("texture", *mTexture);
mShader->loadFromFile("filtering.vert", sf::Shader::Type::Vertex);
float totalScale = (mScale.x + mScale.y) / 2;
if (totalScale < 1.1f)
{
mShader->loadFromFile("filtering_0.frag", sf::Shader::Type::Fragment);
}
else if (totalScale < 2.1f)
{
mShader->loadFromFile("filtering_1.frag", sf::Shader::Type::Fragment);
mShader->setParameter("texelSize", mTexelSize);
}
else
{
mShader->loadFromFile("filtering_2.frag", sf::Shader::Type::Fragment);
mShader->setParameter("texelSize", mTexelSize);
}
mShader->setParameter("texture", *mTexture);
LAST EDIT: I updated SFML to the nightly build I found on eXpl0it3r's homepage and now it works..
So I have actually no idea what was wrong
Thx expl0it3r!
link if you have same problem: http://sfml.my-gate.net/nightly/