gallium/util: move pipe_tex_to_tgsi_tex helper function into u_inlines
authorMarek Olšák <maraeo@gmail.com>
Sun, 8 Jul 2012 13:58:19 +0000 (15:58 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 12 Jul 2012 00:08:30 +0000 (02:08 +0200)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_inlines.h

index 590a6aad81726b988eb748071ced272fc371bf45..b31ac2d5ceaff4cc5f082dce2269163b9396bfa9 100644 (file)
@@ -664,32 +664,6 @@ void *blitter_get_fs_col(struct blitter_context_priv *ctx, unsigned num_cbufs,
    }
 }
 
-/** Convert PIPE_TEXTURE_x to TGSI_TEXTURE_x */
-static unsigned
-pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target)
-{
-   switch (pipe_tex_target) {
-   case PIPE_TEXTURE_1D:
-      return TGSI_TEXTURE_1D;
-   case PIPE_TEXTURE_2D:
-      return TGSI_TEXTURE_2D;
-   case PIPE_TEXTURE_RECT:
-      return TGSI_TEXTURE_RECT;
-   case PIPE_TEXTURE_3D:
-      return TGSI_TEXTURE_3D;
-   case PIPE_TEXTURE_CUBE:
-      return TGSI_TEXTURE_CUBE;
-   case PIPE_TEXTURE_1D_ARRAY:
-      return TGSI_TEXTURE_1D_ARRAY;
-   case PIPE_TEXTURE_2D_ARRAY:
-      return TGSI_TEXTURE_2D_ARRAY;
-   default:
-      assert(0 && "unexpected texture target");
-      return TGSI_TEXTURE_UNKNOWN;
-   }
-}
-
-
 static INLINE
 void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
                                   unsigned tex_target)
@@ -700,7 +674,7 @@ void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
 
    /* Create the fragment shader on-demand. */
    if (!ctx->fs_texfetch_col[tex_target]) {
-      unsigned tgsi_tex = pipe_tex_to_tgsi_tex(tex_target);
+      unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
 
       ctx->fs_texfetch_col[tex_target] =
         util_make_fragment_tex_shader(pipe, tgsi_tex, TGSI_INTERPOLATE_LINEAR);
@@ -719,7 +693,7 @@ void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx,
 
    /* Create the fragment shader on-demand. */
    if (!ctx->fs_texfetch_depth[tex_target]) {
-      unsigned tgsi_tex = pipe_tex_to_tgsi_tex(tex_target);
+      unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
 
       ctx->fs_texfetch_depth[tex_target] =
          util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex,
@@ -739,7 +713,7 @@ void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx,
 
    /* Create the fragment shader on-demand. */
    if (!ctx->fs_texfetch_depthstencil[tex_target]) {
-      unsigned tgsi_tex = pipe_tex_to_tgsi_tex(tex_target);
+      unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
 
       ctx->fs_texfetch_depthstencil[tex_target] =
          util_make_fragment_tex_shader_writedepthstencil(pipe, tgsi_tex,
@@ -759,7 +733,7 @@ void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
 
    /* Create the fragment shader on-demand. */
    if (!ctx->fs_texfetch_stencil[tex_target]) {
-      unsigned tgsi_tex = pipe_tex_to_tgsi_tex(tex_target);
+      unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
 
       ctx->fs_texfetch_stencil[tex_target] =
          util_make_fragment_tex_shader_writestencil(pipe, tgsi_tex,
index 2ec153c582371547e19d8f494372f7d1a13d3a5d..2d603e4ddf65ffa56ee460b16d7e754888c9c727 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
+#include "pipe/p_shader_tokens.h"
 #include "pipe/p_state.h"
 #include "pipe/p_screen.h"
 #include "util/u_debug.h"
@@ -545,6 +546,31 @@ util_query_clear_result(union pipe_query_result *result, unsigned type)
    }
 }
 
+/** Convert PIPE_TEXTURE_x to TGSI_TEXTURE_x */
+static INLINE unsigned
+util_pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target)
+{
+   switch (pipe_tex_target) {
+   case PIPE_TEXTURE_1D:
+      return TGSI_TEXTURE_1D;
+   case PIPE_TEXTURE_2D:
+      return TGSI_TEXTURE_2D;
+   case PIPE_TEXTURE_RECT:
+      return TGSI_TEXTURE_RECT;
+   case PIPE_TEXTURE_3D:
+      return TGSI_TEXTURE_3D;
+   case PIPE_TEXTURE_CUBE:
+      return TGSI_TEXTURE_CUBE;
+   case PIPE_TEXTURE_1D_ARRAY:
+      return TGSI_TEXTURE_1D_ARRAY;
+   case PIPE_TEXTURE_2D_ARRAY:
+      return TGSI_TEXTURE_2D_ARRAY;
+   default:
+      assert(0 && "unexpected texture target");
+      return TGSI_TEXTURE_UNKNOWN;
+   }
+}
+
 #ifdef __cplusplus
 }
 #endif