~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to debian/patches/118_glsl_initialize_samplers.patch

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-08-23 15:37:30 UTC
  • mfrom: (1.7.6)
  • Revision ID: package-import@ubuntu.com-20120823153730-c499sefj7btu4386
Tags: 9.0~git20120821.c1114c61-0ubuntu1
* Merge from unreleased debian git.
  - Includes support for ATI Trinity PCI IDs (LP: #1009089)
* rules, control, libgl1-mesa-swx11*: Remove swx11 support.
* Refresh patches:
  - drop 115_llvm_dynamic_linking.diff,
    117_nullptr_check_in_query_version.patch, and
    118_glsl_initialize_samplers.patch, all upstream
  - disable 116_use_shared_galliumcore.diff until it's reviewed and
    reworked to apply
* not-installed, libegl1-mesa-drivers-install.linux.in: Updated to
  match the single-pass build.
* libgl1-mesa-dri.*install.in: Drop libglsl.so, it's included in
  libdricore.so now.
* rules: Don't disable GLU on the common flags, we need to build it
  on the dri target.
* libglu*install.in: Fix the source file paths to match the build target.
  Drop the static lib from -dev since only shared libs get built.
* libgl1-mesa-dev.install.in: Fix the source file paths to match the
  build target.
* libgl1-mesa-dri.install.linux.in: Don't try to install libgallium.so,
  which isn't built yet.
* rules: Enable llvmpipe on armhf to see if it works or not.
* rules: Remove bin/install-sh on clean, and don't create a symlink for
  it.
* control: Add Pre-Depends on dpkg-dev due to the binaries using xz
  compression.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
commit b610881317a7775a7ffe5f032099d8b2dc45eff0
2
 
Author: Ian Romanick <ian.d.romanick@intel.com>
3
 
Date:   Tue Apr 10 10:40:11 2012 -0700
4
 
 
5
 
    glsl: Initialize samplers to 0, propagate sampler values to the gl_program
6
 
    
7
 
    The spec requires that samplers be initialized to 0.  Since this
8
 
    differs from the 1-to-1 mapping of samplers to texture units assumed
9
 
    by ARB assembly shaders (and the gl_program structure), be sure to
10
 
    propagate this date from the gl_shader_program to the gl_program.
11
 
    
12
 
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
13
 
    Reviewed-by: Eric Anholt <eric@anholt.net>
14
 
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
15
 
    CC: Vadim Girlin <vadimgirlin@gmail.com>
16
 
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49088
17
 
 
18
 
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
19
 
index 81a995e..92e2a1f 100644
20
 
--- a/src/glsl/link_uniforms.cpp
21
 
+++ b/src/glsl/link_uniforms.cpp
22
 
@@ -329,9 +329,16 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
23
 
       prog->UniformHash = new string_to_uint_map;
24
 
    }
25
 
 
26
 
-   for (unsigned i = 0; i < Elements(prog->SamplerUnits); i++) {
27
 
-      prog->SamplerUnits[i] = i;
28
 
-   }
29
 
+   /* Uniforms that lack an initializer in the shader code have an initial
30
 
+    * value of zero.  This includes sampler uniforms.
31
 
+    *
32
 
+    * Page 24 (page 30 of the PDF) of the GLSL 1.20 spec says:
33
 
+    *
34
 
+    *     "The link time initial value is either the value of the variable's
35
 
+    *     initializer, if present, or 0 if no initializer is present. Sampler
36
 
+    *     types cannot have initializers."
37
 
+    */
38
 
+   memset(prog->SamplerUnits, 0, sizeof(prog->SamplerUnits));
39
 
 
40
 
    /* First pass: Count the uniform resources used by the user-defined
41
 
     * uniforms.  While this happens, each active uniform will have an index
42
 
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
43
 
index be1e172..e6604b1 100644
44
 
--- a/src/mesa/main/uniforms.c
45
 
+++ b/src/mesa/main/uniforms.c
46
 
@@ -65,6 +65,7 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg,
47
 
 {
48
 
    GLuint s;
49
 
 
50
 
+   memcpy(prog->SamplerUnits, shProg->SamplerUnits, sizeof(prog->SamplerUnits));
51
 
    memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
52
 
 
53
 
    for (s = 0; s < MAX_SAMPLERS; s++) {