r600g/llvm: Fix alpha_to_one piglit tests
authorVincent Lejeune <vljn@ovi.com>
Wed, 13 Feb 2013 17:49:30 +0000 (18:49 +0100)
committerVincent Lejeune <vljn@ovi.com>
Mon, 18 Feb 2013 14:08:50 +0000 (15:08 +0100)
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
src/gallium/drivers/r600/r600_llvm.c
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/radeon/radeon_llvm.h

index 7a416882cbc835c2cc0cb91496aee2fb489d049a..59047e7779bf4c035c080f6b5830cd4f10668990 100644 (file)
@@ -234,6 +234,8 @@ static void llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
                        elements[chan] = LLVMBuildLoad(base->gallivm->builder,
                                ctx->soa.outputs[i][chan], "");
                }
+               if (ctx->alpha_to_one && ctx->type == TGSI_PROCESSOR_FRAGMENT && ctx->r600_outputs[i].name == TGSI_SEMANTIC_COLOR)
+                       elements[3] = lp_build_const_float(base->gallivm, 1.0f);
                LLVMValueRef output = lp_build_gather_values(base->gallivm, elements, 4);
 
                if (ctx->type == TGSI_PROCESSOR_VERTEX) {
index 59a7f92d2c071a8f11d3cb90b6d0e7518f646607..86424634d0ff237c75841ed01ed55f0c2f2a7166 100644 (file)
@@ -1428,6 +1428,7 @@ static int r600_shader_from_tgsi(struct r600_screen *rscreen,
                radeon_llvm_ctx.fs_color_all = shader->fs_write_all && (rscreen->chip_class >= EVERGREEN);
                radeon_llvm_ctx.stream_outputs = &so;
                radeon_llvm_ctx.clip_vertex = ctx.cv_output;
+               radeon_llvm_ctx.alpha_to_one = key.alpha_to_one;
                mod = r600_tgsi_llvm(&radeon_llvm_ctx, tokens);
                if (debug_get_bool_option("R600_DUMP_SHADERS", FALSE)) {
                        dump = 1;
index 21360e296cf0aa66db954b6b62907eb0eccbfa5f..bfeacb5331f2725792974a4abf46a361bbd966b3 100644 (file)
@@ -64,6 +64,7 @@ struct radeon_llvm_context {
        struct pipe_stream_output_info *stream_outputs;
        unsigned color_buffer_count;
        unsigned fs_color_all;
+       unsigned alpha_to_one;
 
        /*=== Front end configuration ===*/