diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/ff_fragment_shader.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 008da0d0e3d..3e736fa1500 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -632,15 +632,19 @@ emit_combine_source(struct texenv_fragment_program *p, new(p->mem_ctx) ir_constant(1.0f), src); - case OPR_SRC_ALPHA: - return new(p->mem_ctx) ir_swizzle(src, 3, 3, 3, 3, 1); + case OPR_SRC_ALPHA: + return src->type->is_scalar() + ? src : (ir_rvalue *) new(p->mem_ctx) ir_swizzle(src, 3, 3, 3, 3, 1); + + case OPR_ONE_MINUS_SRC_ALPHA: { + ir_rvalue *const scalar = (src->type->is_scalar()) + ? src : (ir_rvalue *) new(p->mem_ctx) ir_swizzle(src, 3, 3, 3, 3, 1); - case OPR_ONE_MINUS_SRC_ALPHA: return new(p->mem_ctx) ir_expression(ir_binop_sub, new(p->mem_ctx) ir_constant(1.0f), - new(p->mem_ctx) ir_swizzle(src, - 3, 3, - 3, 3, 1)); + scalar); + } + case OPR_ZERO: return new(p->mem_ctx) ir_constant(0.0f); case OPR_ONE: |