H. Verbeet : wined3d: Cleanup shader_glsl_load_psamplers().

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 2 09:52:08 CDT 2007


Module: wine
Branch: master
Commit: 973496d5e4d73145e60653ac0f3b89d11a1b0e3e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=973496d5e4d73145e60653ac0f3b89d11a1b0e3e

Author: H. Verbeet <hverbeet at gmail.com>
Date:   Sun Jul  1 23:41:57 2007 +0200

wined3d: Cleanup shader_glsl_load_psamplers().

---

 dlls/wined3d/glsl_shader.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 1e77b96..00536b5 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -85,15 +85,17 @@ static void shader_glsl_load_psamplers(
     int i;
     char sampler_name[20];
 
-    for (i=0; i< GL_LIMITS(fragment_samplers); ++i) {
-        if (stateBlock->textures[i] != NULL) {
-            snprintf(sampler_name, sizeof(sampler_name), "Psampler%d", i);
-            name_loc = GL_EXTCALL(glGetUniformLocationARB(programId, sampler_name));
-            if (name_loc != -1) {
-                int mapped_unit = stateBlock->wineD3DDevice->texUnitMap[i];
+    for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) {
+        snprintf(sampler_name, sizeof(sampler_name), "Psampler%d", i);
+        name_loc = GL_EXTCALL(glGetUniformLocationARB(programId, sampler_name));
+        if (name_loc != -1) {
+            int mapped_unit = stateBlock->wineD3DDevice->texUnitMap[i];
+            if (mapped_unit != -1 && mapped_unit < GL_LIMITS(fragment_samplers)) {
                 TRACE("Loading %s for texture %d\n", sampler_name, mapped_unit);
                 GL_EXTCALL(glUniform1iARB(name_loc, mapped_unit));
                 checkGLcall("glUniform1iARB");
+            } else {
+                ERR("Trying to load sampler %s on unsupported unit %d\n", sampler_name, mapped_unit);
             }
         }
     }




More information about the wine-cvs mailing list