summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.h2
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap_shader.c11
-rw-r--r--src/mesa/state_tracker/st_program.c1
3 files changed, 11 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.h b/src/mesa/state_tracker/st_cb_bitmap.h
index 4d1ae222b81..323158ea11d 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.h
+++ b/src/mesa/state_tracker/st_cb_bitmap.h
@@ -49,7 +49,7 @@ st_flush_bitmap_cache(struct st_context *st);
extern const struct tgsi_token *
st_get_bitmap_shader(const struct tgsi_token *tokens,
- unsigned sampler_index,
+ unsigned tex_target, unsigned sampler_index,
bool use_texcoord, bool swizzle_xxxx);
#endif /* ST_CB_BITMAP_H */
diff --git a/src/mesa/state_tracker/st_cb_bitmap_shader.c b/src/mesa/state_tracker/st_cb_bitmap_shader.c
index 42aa0337af9..a0b9be33415 100644
--- a/src/mesa/state_tracker/st_cb_bitmap_shader.c
+++ b/src/mesa/state_tracker/st_cb_bitmap_shader.c
@@ -36,6 +36,7 @@ struct tgsi_bitmap_transform {
struct tgsi_transform_context base;
struct tgsi_shader_info info;
unsigned sampler_index;
+ unsigned tex_target;
bool use_texcoord;
bool swizzle_xxxx;
bool first_instruction_emitted;
@@ -53,6 +54,8 @@ transform_instr(struct tgsi_transform_context *tctx,
{
struct tgsi_bitmap_transform *ctx = tgsi_bitmap_transform(tctx);
struct tgsi_full_instruction inst;
+ unsigned tgsi_tex_target = ctx->tex_target == PIPE_TEXTURE_2D
+ ? TGSI_TEXTURE_2D : TGSI_TEXTURE_RECT;
unsigned i, semantic;
int texcoord_index = -1;
@@ -92,7 +95,7 @@ transform_instr(struct tgsi_transform_context *tctx,
tgsi_transform_tex_inst(tctx,
TGSI_FILE_TEMPORARY, 0,
TGSI_FILE_INPUT, texcoord_index,
- TGSI_TEXTURE_2D, ctx->sampler_index);
+ tgsi_tex_target, ctx->sampler_index);
/* KIL if -tmp0 < 0 # texel=0 -> keep / texel=0 -> discard */
inst = tgsi_default_full_instruction();
@@ -121,15 +124,19 @@ transform_instr(struct tgsi_transform_context *tctx,
const struct tgsi_token *
st_get_bitmap_shader(const struct tgsi_token *tokens,
- unsigned sampler_index,
+ unsigned tex_target, unsigned sampler_index,
bool use_texcoord, bool swizzle_xxxx)
{
struct tgsi_bitmap_transform ctx;
struct tgsi_token *newtoks;
int newlen;
+ assert(tex_target == PIPE_TEXTURE_2D ||
+ tex_target == PIPE_TEXTURE_RECT);
+
memset(&ctx, 0, sizeof(ctx));
ctx.base.transform_instruction = transform_instr;
+ ctx.tex_target = tex_target;
ctx.sampler_index = sampler_index;
ctx.use_texcoord = use_texcoord;
ctx.swizzle_xxxx = swizzle_xxxx;
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index c9f390aa9a2..d4ff845a023 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -871,6 +871,7 @@ st_create_fp_variant(struct st_context *st,
variant->bitmap_sampler = ffs(~stfp->Base.Base.SamplersUsed) - 1;
tokens = st_get_bitmap_shader(tgsi.tokens,
+ st->internal_target,
variant->bitmap_sampler,
st->needs_texcoord_semantic,
st->bitmap.tex_format ==