From: Marek Olšák Date: Sun, 8 Jul 2012 13:58:19 +0000 (+0200) Subject: gallium/util: move pipe_tex_to_tgsi_tex helper function into u_inlines X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2dca61bcb357d70be2bb4f2d28321dfc5fc10c69;p=mesa.git gallium/util: move pipe_tex_to_tgsi_tex helper function into u_inlines Reviewed-by: Alex Deucher --- diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 590a6aad817..b31ac2d5cea 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -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, diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 2ec153c5823..2d603e4ddf6 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -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