summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-04-12 17:45:30 +0200
committerMarek Olšák <[email protected]>2017-04-12 17:46:21 +0200
commitf7b1371d2d479b8e97cdacae2aec94d5c2ba1321 (patch)
treee458d831853bbf7e1f1c7c177b291c8abe9771cc /src/gallium/drivers/r600
parentbb847e78cfbf14ce7a8f7022ce3033931291e075 (diff)
Revert "r600g: get rid of dummy pixel shader"
This reverts commit 61e47d92c5196bf0240e322bb1b9d305836559e3. It causes a hang on RS780. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100663
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r--src/gallium/drivers/r600/r600_pipe.c9
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h3
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c58
3 files changed, 40 insertions, 30 deletions
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 7d8efd2c9b3..5014f2525cf 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -82,6 +82,9 @@ static void r600_destroy_context(struct pipe_context *context)
if (rctx->fixed_func_tcs_shader)
rctx->b.b.delete_tcs_state(&rctx->b.b, rctx->fixed_func_tcs_shader);
+ if (rctx->dummy_pixel_shader) {
+ rctx->b.b.delete_fs_state(&rctx->b.b, rctx->dummy_pixel_shader);
+ }
if (rctx->custom_dsa_flush) {
rctx->b.b.delete_depth_stencil_alpha_state(&rctx->b.b, rctx->custom_dsa_flush);
}
@@ -206,6 +209,12 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen,
r600_begin_new_cs(rctx);
+ rctx->dummy_pixel_shader =
+ util_make_fragment_cloneinput_shader(&rctx->b.b, 0,
+ TGSI_SEMANTIC_GENERIC,
+ TGSI_INTERPOLATE_CONSTANT);
+ rctx->b.b.bind_fs_state(&rctx->b.b, rctx->dummy_pixel_shader);
+
return &rctx->b.b;
fail:
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index e636ef00246..7f1ecc278b6 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -432,6 +432,9 @@ struct r600_context {
void *custom_blend_resolve;
void *custom_blend_decompress;
void *custom_blend_fastclear;
+ /* With rasterizer discard, there doesn't have to be a pixel shader.
+ * In that case, we bind this one: */
+ void *dummy_pixel_shader;
/* These dummy CMASK and FMASK buffers are used to get around the R6xx hardware
* bug where valid CMASK and FMASK are required to be present to avoid
* a hardlock in certain operations but aren't actually used
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 0131ea80d27..5be49dcdfe9 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -725,8 +725,7 @@ static inline void r600_shader_selector_key(const struct pipe_context *ctx,
if (!key->vs.as_ls)
key->vs.as_es = (rctx->gs_shader != NULL);
- if (rctx->ps_shader && rctx->ps_shader->current->shader.gs_prim_id_input &&
- !rctx->gs_shader) {
+ if (rctx->ps_shader->current->shader.gs_prim_id_input && !rctx->gs_shader) {
key->vs.as_gs_a = true;
key->vs.prim_id_out = rctx->ps_shader->current->shader.input[rctx->ps_shader->current->shader.ps_prim_id_input].spi_sid;
}
@@ -910,6 +909,9 @@ static void r600_bind_ps_state(struct pipe_context *ctx, void *state)
{
struct r600_context *rctx = (struct r600_context *)ctx;
+ if (!state)
+ state = rctx->dummy_pixel_shader;
+
rctx->ps_shader = (struct r600_pipe_shader_selector *)state;
}
@@ -1476,8 +1478,7 @@ static bool r600_update_derived_state(struct r600_context *rctx)
}
}
- if (rctx->ps_shader)
- SELECT_SHADER_OR_FAIL(ps);
+ SELECT_SHADER_OR_FAIL(ps);
r600_mark_atom_dirty(rctx, &rctx->shader_stages.atom);
@@ -1554,40 +1555,37 @@ static bool r600_update_derived_state(struct r600_context *rctx)
rctx->b.streamout.enabled_stream_buffers_mask = clip_so_current->enabled_stream_buffers_mask;
}
- if (rctx->ps_shader) {
- if (unlikely((ps_dirty || rctx->hw_shader_stages[R600_HW_STAGE_PS].shader != rctx->ps_shader->current ||
- rctx->rasterizer->sprite_coord_enable != rctx->ps_shader->current->sprite_coord_enable ||
- rctx->rasterizer->flatshade != rctx->ps_shader->current->flatshade))) {
+ if (unlikely(ps_dirty || rctx->hw_shader_stages[R600_HW_STAGE_PS].shader != rctx->ps_shader->current ||
+ rctx->rasterizer->sprite_coord_enable != rctx->ps_shader->current->sprite_coord_enable ||
+ rctx->rasterizer->flatshade != rctx->ps_shader->current->flatshade)) {
- if (rctx->cb_misc_state.nr_ps_color_outputs != rctx->ps_shader->current->nr_ps_color_outputs) {
- rctx->cb_misc_state.nr_ps_color_outputs = rctx->ps_shader->current->nr_ps_color_outputs;
- r600_mark_atom_dirty(rctx, &rctx->cb_misc_state.atom);
- }
+ if (rctx->cb_misc_state.nr_ps_color_outputs != rctx->ps_shader->current->nr_ps_color_outputs) {
+ rctx->cb_misc_state.nr_ps_color_outputs = rctx->ps_shader->current->nr_ps_color_outputs;
+ r600_mark_atom_dirty(rctx, &rctx->cb_misc_state.atom);
+ }
- if (rctx->b.chip_class <= R700) {
- bool multiwrite = rctx->ps_shader->current->shader.fs_write_all;
+ if (rctx->b.chip_class <= R700) {
+ bool multiwrite = rctx->ps_shader->current->shader.fs_write_all;
- if (rctx->cb_misc_state.multiwrite != multiwrite) {
- rctx->cb_misc_state.multiwrite = multiwrite;
- r600_mark_atom_dirty(rctx, &rctx->cb_misc_state.atom);
- }
+ if (rctx->cb_misc_state.multiwrite != multiwrite) {
+ rctx->cb_misc_state.multiwrite = multiwrite;
+ r600_mark_atom_dirty(rctx, &rctx->cb_misc_state.atom);
}
+ }
- if (unlikely(!ps_dirty && rctx->rasterizer &&
- ((rctx->rasterizer->sprite_coord_enable != rctx->ps_shader->current->sprite_coord_enable) ||
- (rctx->rasterizer->flatshade != rctx->ps_shader->current->flatshade)))) {
-
- if (rctx->b.chip_class >= EVERGREEN)
- evergreen_update_ps_state(ctx, rctx->ps_shader->current);
- else
- r600_update_ps_state(ctx, rctx->ps_shader->current);
- }
+ if (unlikely(!ps_dirty && rctx->ps_shader && rctx->rasterizer &&
+ ((rctx->rasterizer->sprite_coord_enable != rctx->ps_shader->current->sprite_coord_enable) ||
+ (rctx->rasterizer->flatshade != rctx->ps_shader->current->flatshade)))) {
- r600_mark_atom_dirty(rctx, &rctx->shader_stages.atom);
+ if (rctx->b.chip_class >= EVERGREEN)
+ evergreen_update_ps_state(ctx, rctx->ps_shader->current);
+ else
+ r600_update_ps_state(ctx, rctx->ps_shader->current);
}
- UPDATE_SHADER(R600_HW_STAGE_PS, ps);
+ r600_mark_atom_dirty(rctx, &rctx->shader_stages.atom);
}
+ UPDATE_SHADER(R600_HW_STAGE_PS, ps);
if (rctx->b.chip_class >= EVERGREEN) {
evergreen_update_db_shader_control(rctx);
@@ -1643,7 +1641,7 @@ static bool r600_update_derived_state(struct r600_context *rctx)
}
}
- blend_disable = (rctx->dual_src_blend && rctx->ps_shader &&
+ blend_disable = (rctx->dual_src_blend &&
rctx->ps_shader->current->nr_ps_color_outputs < 2);
if (blend_disable != rctx->force_blend_disable) {