i965: Fix Crystal Well PCI IDs.
[mesa.git] / src / mesa / program / sampler.cpp
index 12c4a40a25fe90698692d3c5bc34092eba45bb80..e3641aaa958670b4f5b24aa43cde8230dd6ce13b 100644 (file)
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <cstdio>
 #include "ir.h"
 #include "glsl_types.h"
 #include "ir_visitor.h"
+#include "../glsl/program.h"
+#include "program/hash_table.h"
+#include "ir_uniform.h"
 
 extern "C" {
 #include "main/compiler.h"
@@ -34,18 +36,6 @@ extern "C" {
 #include "program/prog_parameter.h"
 }
 
-static void fail_link(struct gl_shader_program *prog, const char *fmt, ...) PRINTFLIKE(2, 3);
-
-static void fail_link(struct gl_shader_program *prog, const char *fmt, ...)
-{
-   va_list args;
-   va_start(args, fmt);
-   ralloc_vasprintf_append(&prog->InfoLog, fmt, args);
-   va_end(args);
-
-   prog->LinkStatus = GL_FALSE;
-}
-
 class get_sampler_name : public ir_hierarchical_visitor
 {
 public:
@@ -122,17 +112,13 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
 
    sampler->accept(&getname);
 
-   GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1,
-                                             getname.name);
-
-   if (index < 0) {
-      fail_link(shader_program,
-               "failed to find sampler named %s.\n", getname.name);
+   unsigned location;
+   if (!shader_program->UniformHash->get(location, getname.name)) {
+      linker_error(shader_program,
+                  "failed to find sampler named %s.\n", getname.name);
       return 0;
    }
 
-   index += getname.offset;
-
-   return prog->Parameters->ParameterValues[index][0];
+   return shader_program->UniformStorage[location].sampler + getname.offset;
 }
 }