diff options
-rw-r--r-- | mesalib/src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/shaderapi.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/program/ir_to_mesa.cpp | 37 | ||||
-rw-r--r-- | mesalib/src/mesa/program/prog_optimize.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_blit.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 41 | ||||
-rw-r--r-- | xorg-server/xkeyboard-config/rules/base.o_s.part | 9 | ||||
-rw-r--r-- | xorg-server/xkeyboard-config/rules/base.xml.in | 20 | ||||
-rw-r--r-- | xorg-server/xkeyboard-config/symbols/ctrl | 106 |
9 files changed, 136 insertions, 93 deletions
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index d610107ad..7c4ba3777 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2252,8 +2252,6 @@ struct gl_shader_state */
struct gl_shader_program *ActiveProgram;
- void *MemPool;
-
GLbitfield Flags; /**< Mask of GLSL_x flags */
};
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 94671ea25..501627ce3 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -1125,7 +1125,7 @@ static void validate_program(struct gl_context *ctx, GLuint program)
{
struct gl_shader_program *shProg;
- char errMsg[100];
+ char errMsg[100] = "";
shProg = _mesa_lookup_shader_program_err(ctx, program, "glValidateProgram");
if (!shProg) {
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 326d1fb63..ae0df472d 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -641,8 +641,6 @@ src_reg ir_to_mesa_visitor::get_temp(const glsl_type *type)
{
src_reg src;
- int swizzle[4];
- int i;
src.file = PROGRAM_TEMPORARY;
src.index = next_temp;
@@ -652,12 +650,7 @@ ir_to_mesa_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;
@@ -915,10 +908,30 @@ ir_to_mesa_visitor::try_emit_sat(ir_expression *ir) sat_src->accept(this);
src_reg src = this->result;
- this->result = get_temp(ir->type);
- ir_to_mesa_instruction *inst;
- inst = emit(ir, OPCODE_MOV, dst_reg(this->result), 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();
+ ir_to_mesa_instruction *new_inst;
+ new_inst = (ir_to_mesa_instruction *)this->instructions.get_tail();
+ 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)) {
+ new_inst->saturate = true;
+ } else {
+ this->result = get_temp(ir->type);
+ ir_to_mesa_instruction *inst;
+ inst = emit(ir, OPCODE_MOV, dst_reg(this->result), src);
+ inst->saturate = true;
+ }
return true;
}
diff --git a/mesalib/src/mesa/program/prog_optimize.c b/mesalib/src/mesa/program/prog_optimize.c index bb908067d..70e2d85eb 100644 --- a/mesalib/src/mesa/program/prog_optimize.c +++ b/mesalib/src/mesa/program/prog_optimize.c @@ -472,8 +472,7 @@ can_downward_mov_be_modifed(const struct prog_instruction *mov) mov->SrcReg[0].HasIndex2 == 0 &&
mov->SrcReg[0].RelAddr2 == 0 &&
mov->DstReg.RelAddr == 0 &&
- mov->DstReg.CondMask == COND_TR &&
- mov->SaturateMode == SATURATE_OFF;
+ mov->DstReg.CondMask == COND_TR;
}
@@ -482,7 +481,8 @@ can_upward_mov_be_modifed(const struct prog_instruction *mov) {
return
can_downward_mov_be_modifed(mov) &&
- mov->DstReg.File == PROGRAM_TEMPORARY;
+ mov->DstReg.File == PROGRAM_TEMPORARY &&
+ mov->SaturateMode == SATURATE_OFF;
}
@@ -657,6 +657,8 @@ _mesa_merge_mov_into_inst(struct prog_instruction *inst, if (mask != (inst->DstReg.WriteMask & mask))
return GL_FALSE;
+ inst->SaturateMode |= mov->SaturateMode;
+
/* Depending on the instruction, we may need to recompute the swizzles.
* Also, some other instructions (like TEX) are not linear. We will only
* consider completely active sources and destinations
diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c index 63afc1c24..a890afe74 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; } diff --git a/xorg-server/xkeyboard-config/rules/base.o_s.part b/xorg-server/xkeyboard-config/rules/base.o_s.part index fc01ea82e..015d95336 100644 --- a/xorg-server/xkeyboard-config/rules/base.o_s.part +++ b/xorg-server/xkeyboard-config/rules/base.o_s.part @@ -64,10 +64,11 @@ ctrl:nocaps = +ctrl(nocaps)
ctrl:lctrl_meta = +ctrl(lctrl_meta)
ctrl:swapcaps = +ctrl(swapcaps)
- ctrl:ctrl_ac = +ctrl(ctrl_ac)
- ctrl:ctrl_aa = +ctrl(ctrl_aa)
- ctrl:ctrl_ra = +ctrl(ctrl_ra)
- ctrl:ctrl_menu = +ctrl(ctrl_menu)
+ ctrl:ac_ctrl = +ctrl(ac_ctrl)
+ ctrl:aa_ctrl = +ctrl(aa_ctrl)
+ ctrl:rctrl_ralt = +ctrl(rctrl_ralt)
+ ctrl:menu_rctrl = +ctrl(menu_rctrl)
+ ctrl:ralt_rctrl = +ctrl(ralt_rctrl)
compose:ralt = +compose(ralt)
compose:lwin = +compose(lwin)
compose:rwin = +compose(rwin)
diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in index 7e425f5d0..fcaef0dc4 100644 --- a/xorg-server/xkeyboard-config/rules/base.xml.in +++ b/xorg-server/xkeyboard-config/rules/base.xml.in @@ -5602,13 +5602,13 @@ <option>
<configItem>
<name>ctrl:nocaps</name>
- <_description>Make Caps Lock an additional Ctrl</_description>
+ <_description>Caps Lock as Ctrl</_description>
</configItem>
</option>
<option>
<configItem>
<name>ctrl:lctrl_meta</name>
- <_description>Meta on Left Ctrl</_description>
+ <_description>Left Ctrl as Meta</_description>
</configItem>
</option>
<option>
@@ -5619,26 +5619,32 @@ </option>
<option>
<configItem>
- <name>ctrl:ctrl_ac</name>
+ <name>ctrl:ac_ctrl</name>
<_description>At left of 'A'</_description>
</configItem>
</option>
<option>
<configItem>
- <name>ctrl:ctrl_aa</name>
+ <name>ctrl:aa_ctrl</name>
<_description>At bottom left</_description>
</configItem>
</option>
<option>
<configItem>
- <name>ctrl:ctrl_ra</name>
+ <name>ctrl:rctrl_ralt</name>
<_description>Right Ctrl as Right Alt</_description>
</configItem>
</option>
<option>
<configItem>
- <name>ctrl:ctrl_menu</name>
- <_description>Right Ctrl is mapped to Menu</_description>
+ <name>ctrl:menu_rctrl</name>
+ <_description>Menu as Right Ctrl</_description>
+ </configItem>
+ </option>
+ <option>
+ <configItem>
+ <name>ctrl:ctrl_ralt</name>
+ <_description>Right Alt as Right Ctrl</_description>
</configItem>
</option>
</group>
diff --git a/xorg-server/xkeyboard-config/symbols/ctrl b/xorg-server/xkeyboard-config/symbols/ctrl index 189ce739b..09d76b551 100644 --- a/xorg-server/xkeyboard-config/symbols/ctrl +++ b/xorg-server/xkeyboard-config/symbols/ctrl @@ -1,49 +1,57 @@ -// eliminate the caps lock key completely (replace with control)
-partial modifier_keys
-xkb_symbols "nocaps" {
- replace key <CAPS> { [ Control_L, Control_L ] };
- modifier_map Control { <CAPS>, <LCTL> };
-};
-
-// replace left control with Meta
-xkb_symbols "lctrl_meta" {
- replace key <LCTL> { [ Meta_L ] };
-};
-
-// swap the caps lock key with the left control key
-partial modifier_keys
-xkb_symbols "swapcaps" {
- replace key <CAPS> { [ Control_L ] };
- replace key <LCTL> { [ Caps_Lock ] };
-};
-
-// moves the control key to the middle row and the caps lock
-// to the bottom row. Only works if the geometry or keycodes
-// file has defined appropriate aliases for the keys in question.
-partial modifier_keys
-xkb_symbols "ctrl_ac" {
- replace key <AC00> { [ Control_L ] };
- replace key <AA00> { [ Caps_Lock ] };
-};
-
-// Moves the control key to the bottom row and the caps lock
-// to the middle row. Only works if the geometry or keycodes
-// file has defined appropriate aliases for the keys in question.
-partial modifier_keys
-xkb_symbols "ctrl_aa" {
- replace key <AA00> { [ Control_L ] };
- replace key <AC00> { [ Caps_Lock ] };
-};
-
-// Right Ctrl works as Right Alt
-partial modifier_keys
-xkb_symbols "ctrl_ra" {
- key <RCTL> { symbols[Group1]= [ Alt_R ] };
-};
-
-// Menu works as Right Ctrl
-partial modifier_keys
-xkb_symbols "ctrl_menu" {
- replace key <MENU> { [ Control_R, Control_R ] };
- modifier_map Control { Control_L, <MENU> };
-};
+// eliminate the caps lock key completely (replace with control) +partial modifier_keys +xkb_symbols "nocaps" { + replace key <CAPS> { [ Control_L, Control_L ] }; + modifier_map Control { <CAPS>, <LCTL> }; +}; + +// replace left control with Meta +xkb_symbols "lctrl_meta" { + replace key <LCTL> { [ Meta_L ] }; +}; + +// swap the caps lock key with the left control key +partial modifier_keys +xkb_symbols "swapcaps" { + replace key <CAPS> { [ Control_L ] }; + replace key <LCTL> { [ Caps_Lock ] }; +}; + +// moves the control key to the middle row and the caps lock +// to the bottom row. Only works if the geometry or keycodes +// file has defined appropriate aliases for the keys in question. +partial modifier_keys +xkb_symbols "ac_ctrl" { + replace key <AC00> { [ Control_L ] }; + replace key <AA00> { [ Caps_Lock ] }; +}; + +// Moves the control key to the bottom row and the caps lock +// to the middle row. Only works if the geometry or keycodes +// file has defined appropriate aliases for the keys in question. +partial modifier_keys +xkb_symbols "aa_ctrl" { + replace key <AA00> { [ Control_L ] }; + replace key <AC00> { [ Caps_Lock ] }; +}; + +// Right Ctrl works as Right Alt +partial modifier_keys +xkb_symbols "rctrl_ralt" { + key <RCTL> { symbols[Group1]= [ Alt_R ] }; +}; + +// Menu works as Right Ctrl +partial modifier_keys +xkb_symbols "menu_rctrl" { + replace key <MENU> { [ Control_R, Control_R ] }; + modifier_map Control { Control_L, <MENU> }; +}; + +// right alt functions as another ctrl key +partial modifier_keys +xkb_symbols "ralt_rctrl" { + replace key <RALT> { type[Group1] = "TWO_LEVEL", + symbols[Group1] = [ Control_R, Control_R ] }; + modifier_map Control { <RALT> }; +}; |