#include "util/u_pack_color.h"
#include "util/u_memory.h"
#include "util/u_framebuffer.h"
+#include "util/u_dual_blend.h"
static uint32_t eg_num_banks(uint32_t nbanks)
{
r600_pipe_state_add_reg(rstate, R_028808_CB_COLOR_CONTROL,
color_control, NULL, 0);
-
+ /* only have dual source on MRT0 */
+ blend->dual_src_blend = util_blend_state_is_dual(state, 0);
for (int i = 0; i < 8; i++) {
/* state->rt entries > 0 only written if independent blending */
const int j = state->independent_blend_enable ? i : 0;
}
rctx->alpha_ref_dirty = true;
+ if (cb == 0)
+ rctx->color0_format = color_info;
offset += r600_resource_va(rctx->context.screen, state->cbufs[cb]->texture);
offset >>= 8;
{
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
- uint32_t shader_mask, tl, br;
+ uint32_t tl, br;
if (rstate == NULL)
return;
evergreen_db(rctx, rstate, state);
}
- shader_mask = 0;
+ rctx->fb_cb_shader_mask = 0;
for (int i = 0; i < state->nr_cbufs; i++) {
- shader_mask |= 0xf << (i * 4);
+ rctx->fb_cb_shader_mask |= 0xf << (i * 4);
}
evergreen_get_scissor_rect(rctx, 0, 0, state->width, state->height, &tl, &br);
r600_pipe_state_add_reg(rstate,
R_028208_PA_SC_WINDOW_SCISSOR_BR, br,
NULL, 0);
- r600_pipe_state_add_reg(rstate, R_02823C_CB_SHADER_MASK,
- shader_mask, NULL, 0);
free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]);
rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate;
/* always at least export 1 component per pixel */
exports_ps = 2;
}
-
+ shader->ps_cb_shader_mask = (1ULL << ((unsigned)num_cout * 4)) - 1;
if (ninterp == 0) {
ninterp = 1;
have_perspective = TRUE;
return 7;
case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
- return 0;
+ return 1;
}
return 0;
}
struct r600_pipe_state rstate;
unsigned cb_target_mask;
unsigned cb_color_control;
+ bool dual_src_blend;
};
struct r600_pipe_dsa {
unsigned sprite_coord_enable;
unsigned flatshade;
unsigned pa_cl_vs_out_cntl;
+ unsigned ps_cb_shader_mask;
struct pipe_stream_output_info so;
};
struct r600_vertex_element *vertex_elements;
struct pipe_framebuffer_state framebuffer;
unsigned cb_target_mask;
+ unsigned fb_cb_shader_mask;
+ unsigned cb_shader_mask;
unsigned cb_color_control;
unsigned pa_sc_line_stipple;
unsigned pa_cl_clip_cntl;
void *dummy_pixel_shader;
bool vertex_buffers_dirty;
+ boolean dual_src_blend;
+ unsigned color0_format;
};
static INLINE void r600_emit_atom(struct r600_context *rctx, struct r600_atom *atom)
#include "util/u_pack_color.h"
#include "util/u_memory.h"
#include "util/u_framebuffer.h"
+#include "util/u_dual_blend.h"
static uint32_t r600_translate_blend_function(int blend_func)
{
}
blend->cb_target_mask = target_mask;
blend->cb_color_control = color_control;
-
+ /* only MRT0 has dual src blend */
+ blend->dual_src_blend = util_blend_state_is_dual(state, 0);
for (int i = 0; i < 8; i++) {
/* state->rt entries > 0 only written if independent blending */
const int j = state->independent_blend_enable ? i : 0;
color_info |= S_0280A0_SOURCE_FORMAT(V_0280A0_EXPORT_NORM);
}
+ if (cb == 0)
+ rctx->color0_format = color_info;
+
r600_pipe_state_add_reg(rstate,
R_028040_CB_COLOR0_BASE + cb * 4,
offset >> 8, &rtex->resource, RADEON_USAGE_READWRITE);
{
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
- uint32_t shader_mask, tl, br, shader_control;
+ uint32_t tl, br, shader_control;
if (rstate == NULL)
return;
r600_db(rctx, rstate, state);
}
- shader_mask = 0;
shader_control = 0;
+ rctx->fb_cb_shader_mask = 0;
for (int i = 0; i < state->nr_cbufs; i++) {
- shader_mask |= 0xf << (i * 4);
shader_control |= 1 << i;
+ rctx->fb_cb_shader_mask |= 0xf << (i * 4);
}
tl = S_028240_TL_X(0) | S_028240_TL_Y(0) | S_028240_WINDOW_OFFSET_DISABLE(1);
br = S_028244_BR_X(state->width) | S_028244_BR_Y(state->height);
r600_pipe_state_add_reg(rstate, R_0287A0_CB_SHADER_CONTROL,
shader_control, NULL, 0);
- r600_pipe_state_add_reg(rstate, R_02823C_CB_SHADER_MASK,
- shader_mask, NULL, 0);
free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]);
rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate;
exports_ps = 2;
}
+ shader->ps_cb_shader_mask = (1ULL << ((unsigned)num_cout * 4)) - 1;
+
spi_ps_in_control_0 = S_0286CC_NUM_INTERP(rshader->ninput) |
S_0286CC_PERSP_GRADIENT_ENA(1)|
S_0286CC_LINEAR_GRADIENT_ENA(need_linear);
rstate = &blend->rstate;
rctx->states[rstate->id] = rstate;
rctx->cb_target_mask = blend->cb_target_mask;
-
/* Replace every bit except MULTIWRITE_ENABLE. */
rctx->cb_color_control &= ~C_028808_MULTIWRITE_ENABLE;
rctx->cb_color_control |= blend->cb_color_control & C_028808_MULTIWRITE_ENABLE;
-
+ rctx->dual_src_blend = blend->dual_src_blend;
r600_context_pipe_state_set(rctx, rstate);
}
r600_context_pipe_state_set(rctx, &rctx->ps_shader->rstate);
}
+ if (rctx->dual_src_blend)
+ rctx->cb_shader_mask = rctx->ps_shader->ps_cb_shader_mask | rctx->fb_cb_shader_mask;
+ else
+ rctx->cb_shader_mask = rctx->fb_cb_shader_mask;
}
static unsigned r600_conv_prim_to_gs_out(unsigned mode)
r600_pipe_state_add_reg(&rctx->vgt, R_008958_VGT_PRIMITIVE_TYPE, prim, NULL, 0);
r600_pipe_state_add_reg(&rctx->vgt, R_028A6C_VGT_GS_OUT_PRIM_TYPE, 0, NULL, 0);
r600_pipe_state_add_reg(&rctx->vgt, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, NULL, 0);
+ r600_pipe_state_add_reg(&rctx->vgt, R_02823C_CB_SHADER_MASK, 0, NULL, 0);
r600_pipe_state_add_reg(&rctx->vgt, R_028408_VGT_INDX_OFFSET, info.index_bias, NULL, 0);
r600_pipe_state_add_reg(&rctx->vgt, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, info.restart_index, NULL, 0);
r600_pipe_state_add_reg(&rctx->vgt, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, info.primitive_restart, NULL, 0);
r600_pipe_state_add_reg(&rctx->vgt, R_028808_CB_COLOR_CONTROL, rctx->cb_color_control, NULL, 0);
r600_pipe_state_add_reg(&rctx->vgt, R_02881C_PA_CL_VS_OUT_CNTL, 0, NULL, 0);
r600_pipe_state_add_reg(&rctx->vgt, R_028810_PA_CL_CLIP_CNTL, 0, NULL, 0);
+
+ if (rctx->chip_class <= R700)
+ r600_pipe_state_add_reg(&rctx->vgt, R_0280A4_CB_COLOR1_INFO, 0, NULL, 0);
+ else
+ r600_pipe_state_add_reg(&rctx->vgt, 0x28CAC, 0, NULL, 0);
}
rctx->vgt.nregs = 0;
r600_pipe_state_mod_reg(&rctx->vgt, prim);
r600_pipe_state_mod_reg(&rctx->vgt, r600_conv_prim_to_gs_out(info.mode));
r600_pipe_state_mod_reg(&rctx->vgt, rctx->cb_target_mask & mask);
+ r600_pipe_state_mod_reg(&rctx->vgt, rctx->cb_shader_mask);
r600_pipe_state_mod_reg(&rctx->vgt, info.index_bias);
r600_pipe_state_mod_reg(&rctx->vgt, info.restart_index);
r600_pipe_state_mod_reg(&rctx->vgt, info.primitive_restart);
rctx->vs_shader->shader.vs_prohibit_ucps ?
0 : rctx->rasterizer->clip_plane_enable & 0x3F));
+ if (rctx->dual_src_blend) {
+ r600_pipe_state_mod_reg(&rctx->vgt,
+ rctx->color0_format);
+ }
+
r600_context_pipe_state_set(rctx, &rctx->vgt);
/* Emit states (the function expects that we emit at most 17 dwords here). */