[Mesa-dev] [PATCH 2/2] mesa: remove now unused sampler index handing code

Timothy Arceri timothy.arceri at collabora.com
Sat Feb 6 12:30:28 UTC 2016


---
 src/mesa/Makefile.sources                  |   2 -
 src/mesa/program/ir_to_mesa.cpp            |   1 -
 src/mesa/program/sampler.cpp               | 134 -----------------------------
 src/mesa/program/sampler.h                 |  35 --------
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   1 -
 5 files changed, 173 deletions(-)
 delete mode 100644 src/mesa/program/sampler.cpp
 delete mode 100644 src/mesa/program/sampler.h

diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index ffe560f..17d7d645 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -530,8 +530,6 @@ PROGRAM_FILES = \
 	program/program_parser.h \
 	program/prog_statevars.c \
 	program/prog_statevars.h \
-	program/sampler.cpp \
-	program/sampler.h \
 	program/string_to_uint_map.cpp \
 	program/symbol_table.c \
 	program/symbol_table.h
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index b4d88c9..569284b 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -51,7 +51,6 @@
 #include "program/prog_print.h"
 #include "program/program.h"
 #include "program/prog_parameter.h"
-#include "program/sampler.h"
 
 
 static int swizzle_for_size(int size);
diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp
deleted file mode 100644
index 994495a..0000000
--- a/src/mesa/program/sampler.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2005-2007  Brian Paul   All Rights Reserved.
- * Copyright (C) 2008  VMware, Inc.   All Rights Reserved.
- * Copyright © 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include "main/mtypes.h"
-#include "compiler/glsl_types.h"
-#include "compiler/glsl/ir.h"
-#include "compiler/glsl/ir_uniform.h"
-#include "compiler/glsl/ir_visitor.h"
-#include "compiler/glsl/program.h"
-#include "program/hash_table.h"
-#include "program/prog_parameter.h"
-#include "program/program.h"
-
-
-class get_sampler_name : public ir_hierarchical_visitor
-{
-public:
-   get_sampler_name(ir_dereference *last,
-		    struct gl_shader_program *shader_program)
-   {
-      this->mem_ctx = ralloc_context(NULL);
-      this->shader_program = shader_program;
-      this->name = NULL;
-      this->offset = 0;
-      this->last = last;
-   }
-
-   ~get_sampler_name()
-   {
-      ralloc_free(this->mem_ctx);
-   }
-
-   virtual ir_visitor_status visit(ir_dereference_variable *ir)
-   {
-      this->name = ir->var->name;
-      return visit_continue;
-   }
-
-   virtual ir_visitor_status visit_leave(ir_dereference_record *ir)
-   {
-      this->name = ralloc_asprintf(mem_ctx, "%s.%s", name, ir->field);
-      return visit_continue;
-   }
-
-   virtual ir_visitor_status visit_leave(ir_dereference_array *ir)
-   {
-      ir_constant *index = ir->array_index->as_constant();
-      int i;
-
-      if (index) {
-	 i = index->value.i[0];
-      } else {
-	 /* GLSL 1.10 and 1.20 allowed variable sampler array indices,
-	  * while GLSL 1.30 requires that the array indices be
-	  * constant integer expressions.  We don't expect any driver
-	  * to actually work with a really variable array index, so
-	  * all that would work would be an unrolled loop counter that ends
-	  * up being constant above.
-	  */
-	 ralloc_strcat(&shader_program->InfoLog,
-		       "warning: Variable sampler array index unsupported.\n"
-		       "This feature of the language was removed in GLSL 1.20 "
-		       "and is unlikely to be supported for 1.10 in Mesa.\n");
-	 i = 0;
-      }
-      if (ir != last) {
-	 this->name = ralloc_asprintf(mem_ctx, "%s[%d]", name, i);
-      } else {
-	 offset = i;
-      }
-      return visit_continue;
-   }
-
-   struct gl_shader_program *shader_program;
-   const char *name;
-   void *mem_ctx;
-   int offset;
-   ir_dereference *last;
-};
-
-
-int
-_mesa_get_sampler_uniform_value(class ir_dereference *sampler,
-				struct gl_shader_program *shader_program,
-				const struct gl_program *prog)
-{
-   get_sampler_name getname(sampler, shader_program);
-
-   GLuint shader = _mesa_program_enum_to_shader_stage(prog->Target);
-
-   sampler->accept(&getname);
-
-   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;
-   }
-
-   if (!shader_program->UniformStorage[location].opaque[shader].active) {
-      assert(0 && "cannot return a sampler");
-      linker_error(shader_program,
-		   "cannot return a sampler named %s, because it is not "
-                   "used in this shader stage. This is a driver bug.\n",
-                   getname.name);
-      return 0;
-   }
-
-   return shader_program->UniformStorage[location].opaque[shader].index +
-          getname.offset;
-}
-
diff --git a/src/mesa/program/sampler.h b/src/mesa/program/sampler.h
deleted file mode 100644
index 397805a..0000000
--- a/src/mesa/program/sampler.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2005-2007  Brian Paul   All Rights Reserved.
- * Copyright (C) 2008  VMware, Inc.   All Rights Reserved.
- * Copyright © 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef SAMPLER_H
-#define SAMPLER_H
-
-
-int
-_mesa_get_sampler_uniform_value(class ir_dereference *sampler,
-				struct gl_shader_program *shader_program,
-				const struct gl_program *prog);
-
-#endif /* SAMPLER_H */
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index b8182de..7c2b58a 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -40,7 +40,6 @@
 #include "main/uniforms.h"
 #include "main/shaderapi.h"
 #include "program/prog_instruction.h"
-#include "program/sampler.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_screen.h"
-- 
2.5.0



More information about the mesa-dev mailing list