mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 02:20:11 +01:00
v3dv: fix sRGB blending workaround
This workaround needs to set a flag in the current job but it was implemented at pipeline binding time, which can happen outside a render pass. Move it to the pre-draw handler, where it belongs. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4645 Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10255>
This commit is contained in:
parent
08ea007664
commit
1cf36797bf
1 changed files with 22 additions and 21 deletions
|
|
@ -3140,25 +3140,6 @@ bind_graphics_pipeline(struct v3dv_cmd_buffer *cmd_buffer,
|
||||||
if (cmd_buffer->state.gfx.pipeline == pipeline)
|
if (cmd_buffer->state.gfx.pipeline == pipeline)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Enable always flush if we are blending to sRGB render targets. This
|
|
||||||
* fixes test failures in:
|
|
||||||
* dEQP-VK.pipeline.blend.format.r8g8b8a8_srgb.*
|
|
||||||
*
|
|
||||||
* FIXME: not sure why we need this. The tile buffer is always linear, with
|
|
||||||
* conversion from/to sRGB happening on tile load/store operations. This
|
|
||||||
* means that when we enable flushing the only difference is that we convert
|
|
||||||
* to sRGB on the store after each draw call and we convert from sRGB on the
|
|
||||||
* load before each draw call, but the blend happens in linear format in the
|
|
||||||
* tile buffer anyway, which is the same scenario as if we didn't flush.
|
|
||||||
*/
|
|
||||||
assert(pipeline->subpass);
|
|
||||||
if (pipeline->subpass->has_srgb_rt && pipeline->blend.enables) {
|
|
||||||
assert(cmd_buffer->state.job);
|
|
||||||
cmd_buffer->state.job->always_flush = true;
|
|
||||||
perf_debug("flushing draw calls for subpass %d because bound pipeline "
|
|
||||||
"uses sRGB blending\n", cmd_buffer->state.subpass_idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd_buffer->state.gfx.pipeline = pipeline;
|
cmd_buffer->state.gfx.pipeline = pipeline;
|
||||||
|
|
||||||
cmd_buffer_bind_pipeline_static_state(cmd_buffer, &pipeline->dynamic_state);
|
cmd_buffer_bind_pipeline_static_state(cmd_buffer, &pipeline->dynamic_state);
|
||||||
|
|
@ -4347,8 +4328,9 @@ emit_index_buffer(struct v3dv_cmd_buffer *cmd_buffer)
|
||||||
static void
|
static void
|
||||||
cmd_buffer_emit_pre_draw(struct v3dv_cmd_buffer *cmd_buffer)
|
cmd_buffer_emit_pre_draw(struct v3dv_cmd_buffer *cmd_buffer)
|
||||||
{
|
{
|
||||||
assert(cmd_buffer->state.gfx.pipeline);
|
struct v3dv_pipeline *pipeline = cmd_buffer->state.gfx.pipeline;
|
||||||
assert(!(cmd_buffer->state.gfx.pipeline->active_stages & VK_SHADER_STAGE_COMPUTE_BIT));
|
assert(pipeline);
|
||||||
|
assert(!(pipeline->active_stages & VK_SHADER_STAGE_COMPUTE_BIT));
|
||||||
|
|
||||||
/* If we emitted a pipeline barrier right before this draw we won't have
|
/* If we emitted a pipeline barrier right before this draw we won't have
|
||||||
* an active job. In that case, create a new job continuing the current
|
* an active job. In that case, create a new job continuing the current
|
||||||
|
|
@ -4362,6 +4344,25 @@ cmd_buffer_emit_pre_draw(struct v3dv_cmd_buffer *cmd_buffer)
|
||||||
/* Restart single sample job for MSAA pipeline if needed */
|
/* Restart single sample job for MSAA pipeline if needed */
|
||||||
cmd_buffer_restart_job_for_msaa_if_needed(cmd_buffer);
|
cmd_buffer_restart_job_for_msaa_if_needed(cmd_buffer);
|
||||||
|
|
||||||
|
/* Enable always flush if we are blending to sRGB render targets. This
|
||||||
|
* fixes test failures in:
|
||||||
|
* dEQP-VK.pipeline.blend.format.r8g8b8a8_srgb.*
|
||||||
|
*
|
||||||
|
* FIXME: not sure why we need this. The tile buffer is always linear, with
|
||||||
|
* conversion from/to sRGB happening on tile load/store operations. This
|
||||||
|
* means that when we enable flushing the only difference is that we convert
|
||||||
|
* to sRGB on the store after each draw call and we convert from sRGB on the
|
||||||
|
* load before each draw call, but the blend happens in linear format in the
|
||||||
|
* tile buffer anyway, which is the same scenario as if we didn't flush.
|
||||||
|
*/
|
||||||
|
assert(pipeline->subpass);
|
||||||
|
assert(cmd_buffer->state.job);
|
||||||
|
if (pipeline->subpass->has_srgb_rt && pipeline->blend.enables) {
|
||||||
|
cmd_buffer->state.job->always_flush = true;
|
||||||
|
perf_debug("flushing draw calls for subpass %d because bound pipeline "
|
||||||
|
"uses sRGB blending\n", cmd_buffer->state.subpass_idx);
|
||||||
|
}
|
||||||
|
|
||||||
/* If the job is configured to flush on every draw call we need to create
|
/* If the job is configured to flush on every draw call we need to create
|
||||||
* a new job now.
|
* a new job now.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue