Module: wine
Branch: master
Commit: 0629585c2401fd41cc8610a2f841a4db2fdeade6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0629585c2401fd41cc8610a2f…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Thu May 7 11:40:44 2009 +0200
wined3d: Work around an ARBFP vs GLSL bug in Mac OS.
---
dlls/wined3d/context.c | 21 +++++++++++++++++++++
dlls/wined3d/wined3d_private.h | 1 +
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 8fb075d..ba1e100 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -946,6 +946,24 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, ...\n");
}
}
+ if(GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {
+ /* MacOS(radeon X1600 at least, but most likely others too) refuses to draw if GLSL and ARBFP are
+ * enabled, but the currently bound arbfp program is 0. Enabling ARBFP with prog 0 is invalid, but
+ * GLSL should bypass this. This causes problems in programs that never use the fixed function pipeline,
+ * because the ARBFP extension is enabled by the ARBFP pipeline at context creation, but no program
+ * is ever assigned.
+ *
+ * So make sure a program is assigned to each context. The first real ARBFP use will set a different
+ * program and the dummy program is destroyed when the context is destroyed.
+ */
+ const char *dummy_program =
+ "!!ARBfp1.0\n"
+ "MOV result.color, fragment.color.primary;\n"
+ "END\n";
+ GL_EXTCALL(glGenProgramsARB(1, &ret->dummy_arbfp_prog));
+ GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, ret->dummy_arbfp_prog));
+ GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(dummy_program), dummy_program));
+ }
for(s = 0; s < GL_LIMITS(point_sprite_units); s++) {
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + s));
@@ -1065,6 +1083,9 @@ void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context) {
TRACE("Destroy dst FBO %d\n", context->dst_fbo);
context_destroy_fbo(This, &context->dst_fbo);
}
+ if(context->dummy_arbfp_prog) {
+ GL_EXTCALL(glDeleteProgramsARB(1, &context->dummy_arbfp_prog));
+ }
LEAVE_GL();
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f136dd8..1698504 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1234,6 +1234,7 @@ struct WineD3DContext {
GLint gl_fog_source;
GLfloat fog_coord_value;
GLfloat color[4], fogstart, fogend, fogcolor[4];
+ GLuint dummy_arbfp_prog;
};
typedef enum ContextUsage {
Module: wine
Branch: master
Commit: 64926223504cf03b5872a8545154bb6b32ae6473
URL: http://source.winehq.org/git/wine.git/?a=commit;h=64926223504cf03b5872a8545…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Tue May 12 20:11:50 2009 +0200
wined3d: sincos for vertex shaders.
SCS is unfortunately a fragment program only instruction. If we have the NV
extensions we can use SIN and COS. Otherwise we have to approximate sine and
cosine with a taylor series. Luckily we're provided with the necessary
constants by the application.
---
dlls/d3d9/tests/visual.c | 77 ++++++++++++++++++++++++++++++
dlls/wined3d/arb_program_shader.c | 95 +++++++++++++++++++++++++++++++++++--
2 files changed, 167 insertions(+), 5 deletions(-)
Diff: http://source.winehq.org/git/wine.git/?a=commitdiff;h=64926223504cf03b5872a…