Added a small workaround for a radeon driver bug.

This commit is contained in:
Josh Yelon 2007-05-17 23:48:26 +00:00
parent 52d2ba31fd
commit f2920e40a3
2 changed files with 30 additions and 19 deletions

View File

@ -686,6 +686,8 @@ reset() {
_shader_caps._active_fprofile = (int)cgGLGetLatestProfile(CG_GL_FRAGMENT);
_shader_caps._ultimate_vprofile = (int)CG_PROFILE_VP40;
_shader_caps._ultimate_fprofile = (int)CG_PROFILE_FP40;
_glBindProgram = (PFNGLBINDPROGRAMARBPROC)
get_extension_func(GLPREFIX_QUOTED, "BindProgramARB");
}
#endif
@ -3383,31 +3385,26 @@ do_issue_shader() {
context = (CLP(ShaderContext) *)(expansion->prepare_now(get_prepared_objects(), this));
}
if (context == 0 || (context && context -> valid ( ) == false)) {
if (context == 0 || (context -> valid ( ) == false)) {
if (_current_shader_context != 0) {
_current_shader_context->unbind();
_current_shader_expansion = 0;
_current_shader_context = 0;
}
return;
}
if (context != _current_shader_context) {
// Use a completely different shader than before.
// Unbind old shader, bind the new one.
if (_current_shader_context != 0) {
_current_shader_context->unbind();
_current_shader_context = 0;
_current_shader_expansion = 0;
}
if (context != 0) {
} else {
if (context != _current_shader_context) {
// Use a completely different shader than before.
// Unbind old shader, bind the new one.
if (_current_shader_context != 0) {
_current_shader_context->unbind();
}
context->bind(this);
_current_shader_expansion = expansion;
_current_shader_context = context;
} else {
// Use the same shader as before, but with new input arguments.
context->issue_parameters(this, true);
}
} else {
// Use the same shader as before, but with new input arguments.
context->issue_parameters(this, true);
}
report_my_gl_errors();
@ -6061,6 +6058,12 @@ update_standard_texture_bindings() {
if (_supports_cube_map) {
GLP(Disable)(GL_TEXTURE_CUBE_MAP);
}
// This shouldn't be necessary, but a bug in the radeon
// driver makes it so.
glDisable(GL_TEXTURE_GEN_R);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_Q);
}
// Save the count of texture stages for next time.
@ -6088,6 +6091,12 @@ disable_standard_texture_bindings() {
if (_supports_cube_map) {
GLP(Disable)(GL_TEXTURE_CUBE_MAP);
}
// This shouldn't be necessary, but a bug in the radeon
// driver makes it so.
glDisable(GL_TEXTURE_GEN_R);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_Q);
}
_num_active_texture_stages = 0;

View File

@ -66,6 +66,7 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, const GLfloat
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
@ -442,6 +443,7 @@ public:
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC _glFramebufferRenderbuffer;
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC _glGetFramebufferAttachmentParameteriv;
PFNGLGENERATEMIPMAPEXTPROC _glGenerateMipmap;
PFNGLBINDPROGRAMARBPROC _glBindProgram;
PFNGLDRAWBUFFERSPROC _glDrawBuffers;