v3dv: fix dynamic blend constants

We were pre-packing the constants from the pipeline state and then
always emitting that at draw time, ignoring dynamic state. This makes
it so we don't prepack at pipeline creation time and we always emit
the correct constants directly the command buffer dynamic state.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga 2020-05-13 12:32:29 +02:00 committed by Marge Bot
parent 98ade03113
commit 1957689249
3 changed files with 8 additions and 12 deletions

View file

@ -23,6 +23,7 @@
#include "v3dv_private.h"
#include "broadcom/cle/v3dx_pack.h"
#include "util/half_float.h"
#include "util/u_pack_color.h"
#include "vk_format_info.h"
@ -2633,7 +2634,13 @@ emit_blend(struct v3dv_cmd_buffer *cmd_buffer)
if (pipeline->blend.needs_color_constants &&
cmd_buffer->state.dirty & V3DV_CMD_DIRTY_BLEND_CONSTANTS) {
cl_emit_prepacked(&job->bcl, &pipeline->blend.constant_color);
struct v3dv_dynamic_state *dynamic = &cmd_buffer->state.dynamic;
cl_emit(&job->bcl, BLEND_CONSTANT_COLOR, color) {
color.red_f16 = _mesa_float_to_half(dynamic->blend_constants[0]);
color.green_f16 = _mesa_float_to_half(dynamic->blend_constants[1]);
color.blue_f16 = _mesa_float_to_half(dynamic->blend_constants[2]);
color.alpha_f16 = _mesa_float_to_half(dynamic->blend_constants[3]);
}
cmd_buffer->state.dirty &= ~V3DV_CMD_DIRTY_BLEND_CONSTANTS;
}
}

View file

@ -1756,15 +1756,6 @@ pack_blend(struct v3dv_pipeline *pipeline,
}
}
if (pipeline->blend.needs_color_constants) {
v3dv_pack(pipeline->blend.constant_color, BLEND_CONSTANT_COLOR, color) {
color.red_f16 = _mesa_float_to_half(cb_info->blendConstants[0]);
color.green_f16 = _mesa_float_to_half(cb_info->blendConstants[1]);
color.blue_f16 = _mesa_float_to_half(cb_info->blendConstants[2]);
color.alpha_f16 = _mesa_float_to_half(cb_info->blendConstants[3]);
}
}
pipeline->blend.color_write_masks = color_write_masks;
}

View file

@ -1301,8 +1301,6 @@ struct v3dv_pipeline {
* color constants.
*/
bool needs_color_constants;
/* Blend constants packet */
uint8_t constant_color[cl_packet_length(BLEND_CONSTANT_COLOR)];
/* Mask with enabled color channels for each RT (4 bits per RT) */
uint32_t color_write_masks;
} blend;