From: José Fonseca Date: Thu, 2 Sep 2010 11:14:39 +0000 (+0100) Subject: gallivm: Move the texture modifiers to the header. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=58daea741fa21fe3f89fd7bf106df1545c5b21af;p=mesa.git gallivm: Move the texture modifiers to the header. Useful to pass these around. --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h index 4d415b6d416..e60ad1d9044 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h @@ -45,6 +45,15 @@ struct lp_build_context; struct lp_build_mask_context; +enum lp_build_tex_modifier { + LP_BLD_TEX_MODIFIER_NONE = 0, + LP_BLD_TEX_MODIFIER_PROJECTED, + LP_BLD_TEX_MODIFIER_LOD_BIAS, + LP_BLD_TEX_MODIFIER_EXPLICIT_LOD, + LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV +}; + + /** * Sampler code generation interface. * diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 871bec2a411..cd5b132b41d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -816,18 +816,10 @@ emit_store( * High-level instruction translators. */ -enum tex_modifier { - TEX_MODIFIER_NONE = 0, - TEX_MODIFIER_PROJECTED, - TEX_MODIFIER_LOD_BIAS, - TEX_MODIFIER_EXPLICIT_LOD, - TEX_MODIFIER_EXPLICIT_DERIV -}; - static void emit_tex( struct lp_build_tgsi_soa_context *bld, const struct tgsi_full_instruction *inst, - enum tex_modifier modifier, + enum lp_build_tex_modifier modifier, LLVMValueRef *texel) { unsigned unit; @@ -867,11 +859,11 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, return; } - if (modifier == TEX_MODIFIER_LOD_BIAS) { + if (modifier == LP_BLD_TEX_MODIFIER_LOD_BIAS) { lod_bias = emit_fetch( bld, inst, 0, 3 ); explicit_lod = NULL; } - else if (modifier == TEX_MODIFIER_EXPLICIT_LOD) { + else if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_LOD) { lod_bias = NULL; explicit_lod = emit_fetch( bld, inst, 0, 3 ); } @@ -880,21 +872,21 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, explicit_lod = NULL; } - if (modifier == TEX_MODIFIER_PROJECTED) { + if (modifier == LP_BLD_TEX_MODIFIER_PROJECTED) { oow = emit_fetch( bld, inst, 0, 3 ); oow = lp_build_rcp(&bld->base, oow); } for (i = 0; i < num_coords; i++) { coords[i] = emit_fetch( bld, inst, 0, i ); - if (modifier == TEX_MODIFIER_PROJECTED) + if (modifier == LP_BLD_TEX_MODIFIER_PROJECTED) coords[i] = lp_build_mul(&bld->base, coords[i], oow); } for (i = num_coords; i < 3; i++) { coords[i] = bld->base.undef; } - if (modifier == TEX_MODIFIER_EXPLICIT_DERIV) { + if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV) { for (i = 0; i < num_coords; i++) { ddx[i] = emit_fetch( bld, inst, 1, i ); ddy[i] = emit_fetch( bld, inst, 2, i ); @@ -1627,11 +1619,11 @@ emit_instruction( break; case TGSI_OPCODE_TEX: - emit_tex( bld, inst, TEX_MODIFIER_NONE, dst0 ); + emit_tex( bld, inst, LP_BLD_TEX_MODIFIER_NONE, dst0 ); break; case TGSI_OPCODE_TXD: - emit_tex( bld, inst, TEX_MODIFIER_EXPLICIT_DERIV, dst0 ); + emit_tex( bld, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV, dst0 ); break; case TGSI_OPCODE_UP2H: @@ -1735,7 +1727,7 @@ emit_instruction( break; case TGSI_OPCODE_TXB: - emit_tex( bld, inst, TEX_MODIFIER_LOD_BIAS, dst0 ); + emit_tex( bld, inst, LP_BLD_TEX_MODIFIER_LOD_BIAS, dst0 ); break; case TGSI_OPCODE_NRM: @@ -1840,11 +1832,11 @@ emit_instruction( break; case TGSI_OPCODE_TXL: - emit_tex( bld, inst, TEX_MODIFIER_EXPLICIT_LOD, dst0 ); + emit_tex( bld, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_LOD, dst0 ); break; case TGSI_OPCODE_TXP: - emit_tex( bld, inst, TEX_MODIFIER_PROJECTED, dst0 ); + emit_tex( bld, inst, LP_BLD_TEX_MODIFIER_PROJECTED, dst0 ); break; case TGSI_OPCODE_BRK: