[Mesa-dev] [PATCH 1/6] mesa, gallium: renumber shader indices according to their placement in pipeline

Brian Paul brianp at vmware.com
Thu Jun 13 08:51:20 PDT 2013


On 06/13/2013 06:25 AM, Marek Olšák wrote:
> See my explanation in mtypes.h.
> ---
>   src/gallium/include/pipe/p_defines.h       |    7 ++++---
>   src/glsl/linker.cpp                        |   16 ++++++++--------
>   src/mesa/drivers/dri/i965/brw_shader.cpp   |    8 ++------
>   src/mesa/main/mtypes.h                     |    8 ++++++--
>   src/mesa/main/shaderobj.h                  |    4 ++--
>   src/mesa/main/uniform_query.cpp            |    2 +-
>   src/mesa/program/ir_to_mesa.cpp            |   10 +++-------
>   src/mesa/program/program.h                 |    2 +-
>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   10 +++-------
>   9 files changed, 30 insertions(+), 37 deletions(-)

Reviewed-by: Brian Paul <brianp at vmware.com>

However, a change for the VMware svga driver is also needed:

diff --git a/src/gallium/drivers/svga/svga_state_constants.c 
b/src/gallium/drive
index 759c6c6..c03f38c 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -58,10 +58,15 @@
  static int
  svga_shader_type(unsigned shader)
  {
-   assert(PIPE_SHADER_VERTEX + 1 == SVGA3D_SHADERTYPE_VS);
-   assert(PIPE_SHADER_FRAGMENT + 1 == SVGA3D_SHADERTYPE_PS);
-   assert(shader <= PIPE_SHADER_FRAGMENT);
-   return shader + 1;
+   switch (shader) {
+   case PIPE_SHADER_VERTEX:
+      return SVGA3D_SHADERTYPE_VS;
+   case PIPE_SHADER_FRAGMENT:
+      return SVGA3D_SHADERTYPE_PS;
+   default:
+      assert(!"Unexpected PIPE_SHADER_ type in svga_shader_type()");
+      return SVGA3D_SHADERTYPE_VS;
+   }
  }





More information about the mesa-dev mailing list