aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-08-08 13:41:53 +0200
committermarha <marha@users.sourceforge.net>2011-08-08 13:41:53 +0200
commit0c2b3e6fd26158cb97f4210cc891e218801b4b25 (patch)
treecd9cabb6972dab80fa1278aebb17704dcc34d8ba /mesalib/src/mesa/state_tracker
parentd105412503ea250e07d3cb008f10f60e6e48bf8a (diff)
downloadvcxsrv-0c2b3e6fd26158cb97f4210cc891e218801b4b25.tar.gz
vcxsrv-0c2b3e6fd26158cb97f4210cc891e218801b4b25.tar.bz2
vcxsrv-0c2b3e6fd26158cb97f4210cc891e218801b4b25.zip
mesa xkeyboard-config git update 8 aug 2011
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_blit.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp41
2 files changed, 30 insertions, 15 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c
index 626db1243..750f541b5 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_blit.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c
@@ -107,8 +107,10 @@ st_BlitFramebuffer_resolve(struct gl_context *ctx,
dstRb = st_renderbuffer(dstDepth->Renderbuffer);
info->mask = (mask & GL_DEPTH_BUFFER_BIT) ? PIPE_MASK_Z : 0;
- if (combined && (mask & GL_STENCIL_BUFFER_BIT))
+ if (combined && (mask & GL_STENCIL_BUFFER_BIT)) {
+ mask &= ~GL_STENCIL_BUFFER_BIT;
info->mask |= PIPE_MASK_S;
+ }
info->src.res = srcRb->texture;
info->src.layer = srcRb->surface->u.tex.first_layer;
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 460bafb38..d7a1ba80e 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -949,8 +949,6 @@ st_src_reg
glsl_to_tgsi_visitor::get_temp(const glsl_type *type)
{
st_src_reg src;
- int swizzle[4];
- int i;
src.type = glsl_version >= 130 ? type->base_type : GLSL_TYPE_FLOAT;
src.file = PROGRAM_TEMPORARY;
@@ -961,12 +959,7 @@ glsl_to_tgsi_visitor::get_temp(const glsl_type *type)
if (type->is_array() || type->is_record()) {
src.swizzle = SWIZZLE_NOOP;
} else {
- for (i = 0; i < type->vector_elements; i++)
- swizzle[i] = i;
- for (; i < 4; i++)
- swizzle[i] = type->vector_elements - 1;
- src.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1],
- swizzle[2], swizzle[3]);
+ src.swizzle = swizzle_for_size(type->vector_elements);
}
src.negate = 0;
@@ -1232,12 +1225,32 @@ glsl_to_tgsi_visitor::try_emit_sat(ir_expression *ir)
sat_src->accept(this);
st_src_reg src = this->result;
- this->result = get_temp(ir->type);
- st_dst_reg result_dst = st_dst_reg(this->result);
- result_dst.writemask = (1 << ir->type->vector_elements) - 1;
- glsl_to_tgsi_instruction *inst;
- inst = emit(ir, TGSI_OPCODE_MOV, result_dst, src);
- inst->saturate = true;
+ /* If we generated an expression instruction into a temporary in
+ * processing the saturate's operand, apply the saturate to that
+ * instruction. Otherwise, generate a MOV to do the saturate.
+ *
+ * Note that we have to be careful to only do this optimization if
+ * the instruction in question was what generated src->result. For
+ * example, ir_dereference_array might generate a MUL instruction
+ * to create the reladdr, and return us a src reg using that
+ * reladdr. That MUL result is not the value we're trying to
+ * saturate.
+ */
+ ir_expression *sat_src_expr = sat_src->as_expression();
+ if (sat_src_expr && (sat_src_expr->operation == ir_binop_mul ||
+ sat_src_expr->operation == ir_binop_add ||
+ sat_src_expr->operation == ir_binop_dot)) {
+ glsl_to_tgsi_instruction *new_inst;
+ new_inst = (glsl_to_tgsi_instruction *)this->instructions.get_tail();
+ new_inst->saturate = true;
+ } else {
+ this->result = get_temp(ir->type);
+ st_dst_reg result_dst = st_dst_reg(this->result);
+ result_dst.writemask = (1 << ir->type->vector_elements) - 1;
+ glsl_to_tgsi_instruction *inst;
+ inst = emit(ir, TGSI_OPCODE_MOV, result_dst, src);
+ inst->saturate = true;
+ }
return true;
}