if (si_shader_ctx->shader->key.ps.alpha_func != PIPE_FUNC_NEVER) {
LLVMValueRef out_ptr = si_shader_ctx->radeon_bld.soa.outputs[index][3];
+ LLVMValueRef alpha_ref = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn,
+ SI_PARAM_ALPHA_REF);
+
LLVMValueRef alpha_pass =
lp_build_cmp(&bld_base->base,
si_shader_ctx->shader->key.ps.alpha_func,
LLVMBuildLoad(gallivm->builder, out_ptr, ""),
- lp_build_const_float(gallivm, si_shader_ctx->shader->key.ps.alpha_ref));
+ alpha_ref);
LLVMValueRef arg =
lp_build_select(&bld_base->base,
alpha_pass,
{
struct lp_build_tgsi_context *bld_base = &si_shader_ctx->radeon_bld.soa.bld_base;
struct gallivm_state *gallivm = bld_base->base.gallivm;
- LLVMTypeRef params[20], f32, i8, i32, v2i32, v3i32;
+ LLVMTypeRef params[21], f32, i8, i32, v2i32, v3i32;
unsigned i, last_sgpr, num_params;
i8 = LLVMInt8TypeInContext(gallivm->context);
break;
case TGSI_PROCESSOR_FRAGMENT:
+ params[SI_PARAM_ALPHA_REF] = f32;
params[SI_PARAM_PRIM_MASK] = i32;
last_sgpr = SI_PARAM_PRIM_MASK;
params[SI_PARAM_PERSP_SAMPLE] = v2i32;
#define SI_SGPR_VERTEX_BUFFER 6 /* VS only */
#define SI_SGPR_SO_BUFFER 8 /* VS only, stream-out */
#define SI_SGPR_START_INSTANCE 10 /* VS only */
+#define SI_SGPR_ALPHA_REF 6 /* PS only */
#define SI_VS_NUM_USER_SGPR 11
-#define SI_PS_NUM_USER_SGPR 6
+#define SI_PS_NUM_USER_SGPR 7
/* LLVM function parameter indices */
#define SI_PARAM_CONST 0
/* the other VS parameters are assigned dynamically */
/* PS only parameters */
-#define SI_PARAM_PRIM_MASK 3
-#define SI_PARAM_PERSP_SAMPLE 4
-#define SI_PARAM_PERSP_CENTER 5
-#define SI_PARAM_PERSP_CENTROID 6
-#define SI_PARAM_PERSP_PULL_MODEL 7
-#define SI_PARAM_LINEAR_SAMPLE 8
-#define SI_PARAM_LINEAR_CENTER 9
-#define SI_PARAM_LINEAR_CENTROID 10
-#define SI_PARAM_LINE_STIPPLE_TEX 11
-#define SI_PARAM_POS_X_FLOAT 12
-#define SI_PARAM_POS_Y_FLOAT 13
-#define SI_PARAM_POS_Z_FLOAT 14
-#define SI_PARAM_POS_W_FLOAT 15
-#define SI_PARAM_FRONT_FACE 16
-#define SI_PARAM_ANCILLARY 17
-#define SI_PARAM_SAMPLE_COVERAGE 18
-#define SI_PARAM_POS_FIXED_PT 19
+#define SI_PARAM_ALPHA_REF 3
+#define SI_PARAM_PRIM_MASK 4
+#define SI_PARAM_PERSP_SAMPLE 5
+#define SI_PARAM_PERSP_CENTER 6
+#define SI_PARAM_PERSP_CENTROID 7
+#define SI_PARAM_PERSP_PULL_MODEL 8
+#define SI_PARAM_LINEAR_SAMPLE 9
+#define SI_PARAM_LINEAR_CENTER 10
+#define SI_PARAM_LINEAR_CENTROID 11
+#define SI_PARAM_LINE_STIPPLE_TEX 12
+#define SI_PARAM_POS_X_FLOAT 13
+#define SI_PARAM_POS_Y_FLOAT 14
+#define SI_PARAM_POS_Z_FLOAT 15
+#define SI_PARAM_POS_W_FLOAT 16
+#define SI_PARAM_FRONT_FACE 17
+#define SI_PARAM_ANCILLARY 18
+#define SI_PARAM_SAMPLE_COVERAGE 19
+#define SI_PARAM_POS_FIXED_PT 20
struct si_shader_io {
unsigned name;
unsigned alpha_func:3;
unsigned flatshade:1;
unsigned alpha_to_one:1;
- float alpha_ref;
} ps;
struct {
unsigned instance_divisors[PIPE_MAX_ATTRIBS];
if (state->alpha.enabled) {
dsa->alpha_func = state->alpha.func;
dsa->alpha_ref = state->alpha.ref_value;
+
+ si_pm4_set_reg(pm4, R_00B030_SPI_SHADER_USER_DATA_PS_0 +
+ SI_SGPR_ALPHA_REF * 4, fui(dsa->alpha_ref));
} else {
dsa->alpha_func = PIPE_FUNC_ALWAYS;
}
rctx->framebuffer.cbufs[0] &&
util_format_is_pure_integer(rctx->framebuffer.cbufs[0]->texture->format))
key->ps.alpha_func = PIPE_FUNC_ALWAYS;
-
- if (key->ps.alpha_func != PIPE_FUNC_ALWAYS &&
- key->ps.alpha_func != PIPE_FUNC_NEVER)
- key->ps.alpha_ref = rctx->queued.named.dsa->alpha_ref;
} else {
key->ps.alpha_func = PIPE_FUNC_ALWAYS;
}