[WINED3D 9/9] Allow drawPrim to create and use the GLSL program

Jason Green jave27 at gmail.com
Fri Jun 9 02:37:45 CDT 2006


-------------- next part --------------
From nobody Mon Sep 17 00:00:00 2001
From: Jason <jason at jave02.(none)>
Date: Fri, 9 Jun 2006 03:30:18 -0400
Subject: [PATCH 9/9] Allow drawPrim to create and use the GLSL program

- Now that we can fully create a GLSL program, this patch lets us actually use it.
- At this point, the user should be able to run [some] vertex and/or pixel shader programs using GLSL
 - only if they have the HKLU\Software\Wine\Direct3D\UseGLSL key = "enabled"

---

 dlls/wined3d/drawprim.c        |   15 ++++++++++++++-
 dlls/wined3d/wined3d_private.h |    3 +++
 2 files changed, 17 insertions(+), 1 deletions(-)

a1cf1a5bad244af14bbe0ebcb9020f9ee6e96fd4
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 853518f..f12e046 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -1920,7 +1920,20 @@ #endif
 
         TRACE("Loaded arrays\n");
 
-        /* TODO: Bind the correct GLSL shader program here. */
+        /* Bind the correct GLSL shader program based on the currently set vertex & pixel shaders. */
+        if (wined3d_settings.shader_mode == SHADER_GLSL) {
+            GLhandleARB programId;
+            
+            set_glsl_shader_program(iface);
+            programId = This->stateBlock->shaderPrgId;    
+
+            if (programId != 0) {
+                /* Start using this program ID */
+                TRACE_(d3d_shader)("Using GLSL program %u\n", programId);
+                GL_EXTCALL(glUseProgramObjectARB(programId));
+                checkGLcall("glUseProgramObjectARB");
+            } 
+        }
         
         if (useVertexShaderFunction) {
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 31afe74..f1ec8bc 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1317,6 +1317,9 @@ extern const SHADER_OPCODE* shader_get_o
 /* ARB shader program Prototypes */
 extern void shader_hw_def(SHADER_OPCODE_ARG *arg);
 
+/* GLSL helper programs */
+extern void set_glsl_shader_program(IWineD3DDevice *iface);
+
 /** The following translate DirectX pixel/vertex shader opcodes to GLSL lines */
 extern void shader_glsl_map2gl(SHADER_OPCODE_ARG* arg);
 extern void shader_glsl_arith(SHADER_OPCODE_ARG* arg);
-- 
1.3.3


More information about the wine-patches mailing list