mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-17 06:00:35 +01:00
radv/meta: fix depth/stencil resolves with different regions
This is possible since VK_KHR_maintenance10. This fixes new VKCTS coverage in dEQP-VK.pipeline.*.multisample.m10_resolve.*. Cc: mesa-stable Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39956>
This commit is contained in:
parent
2fa85edd75
commit
ab6147e8ef
3 changed files with 23 additions and 10 deletions
|
|
@ -487,7 +487,9 @@ radv_meta_resolve_depth_stencil_cs(struct radv_cmd_buffer *cmd_buffer, struct ra
|
|||
|
||||
radv_meta_bind_compute_pipeline(cmd_buffer, pipeline);
|
||||
|
||||
const uint32_t push_constants[2] = {region->srcOffset.x, region->srcOffset.y};
|
||||
const uint32_t push_constants[5] = {
|
||||
region->srcOffset.x, region->srcOffset.y, region->dstOffset.x, region->dstOffset.y, region->dstOffset.z,
|
||||
};
|
||||
|
||||
radv_meta_push_constants(cmd_buffer, layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(push_constants), push_constants);
|
||||
|
||||
|
|
|
|||
|
|
@ -590,6 +590,14 @@ radv_meta_resolve_depth_stencil_fs(struct radv_cmd_buffer *cmd_buffer, struct ra
|
|||
radv_meta_set_viewport_and_scissor(cmd_buffer, resolve_area.offset.x, resolve_area.offset.y,
|
||||
resolve_area.extent.width, resolve_area.extent.height);
|
||||
|
||||
const uint32_t push_constants[2] = {
|
||||
region->srcOffset.x - region->dstOffset.x,
|
||||
region->srcOffset.y - region->dstOffset.y,
|
||||
};
|
||||
|
||||
radv_meta_push_constants(cmd_buffer, layout, VK_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(push_constants),
|
||||
push_constants);
|
||||
|
||||
radv_CmdDraw(radv_cmd_buffer_to_handle(cmd_buffer), 3, 1, 0, 0);
|
||||
|
||||
const VkRenderingEndInfoKHR end_info = {
|
||||
|
|
|
|||
|
|
@ -1300,19 +1300,21 @@ radv_meta_nir_build_depth_stencil_resolve_compute_shader(struct radv_device *dev
|
|||
|
||||
nir_def *global_id = radv_meta_nir_get_global_ids(&b, 3);
|
||||
|
||||
nir_def *offset = nir_load_push_constant(&b, 2, 32, nir_imm_int(&b, 0), .range = 8);
|
||||
nir_def *src_offset = nir_load_push_constant(&b, 2, 32, nir_imm_int(&b, 0), .range = 8);
|
||||
nir_def *dst_offset = nir_load_push_constant(&b, 3, 32, nir_imm_int(&b, 8), .range = 20);
|
||||
|
||||
nir_def *resolve_coord = nir_iadd(&b, nir_trim_vector(&b, global_id, 2), offset);
|
||||
nir_def *src_coord = nir_iadd(&b, nir_trim_vector(&b, global_id, 2), src_offset);
|
||||
nir_def *dst_coord = nir_iadd(&b, global_id, dst_offset);
|
||||
|
||||
nir_def *img_coord =
|
||||
nir_vec3(&b, nir_channel(&b, resolve_coord, 0), nir_channel(&b, resolve_coord, 1), nir_channel(&b, global_id, 2));
|
||||
nir_def *src_img_coord =
|
||||
nir_vec3(&b, nir_channel(&b, src_coord, 0), nir_channel(&b, src_coord, 1), nir_channel(&b, global_id, 2));
|
||||
|
||||
nir_deref_instr *input_img_deref = nir_build_deref_var(&b, input_img);
|
||||
nir_def *outval = nir_txf_ms(&b, img_coord, nir_imm_int(&b, 0), .texture_deref = input_img_deref);
|
||||
nir_def *outval = nir_txf_ms(&b, src_img_coord, nir_imm_int(&b, 0), .texture_deref = input_img_deref);
|
||||
|
||||
if (resolve_mode != VK_RESOLVE_MODE_SAMPLE_ZERO_BIT) {
|
||||
for (int i = 1; i < samples; i++) {
|
||||
nir_def *si = nir_txf_ms(&b, img_coord, nir_imm_int(&b, i), .texture_deref = input_img_deref);
|
||||
nir_def *si = nir_txf_ms(&b, src_img_coord, nir_imm_int(&b, i), .texture_deref = input_img_deref);
|
||||
|
||||
switch (resolve_mode) {
|
||||
case VK_RESOLVE_MODE_AVERAGE_BIT:
|
||||
|
|
@ -1340,8 +1342,8 @@ radv_meta_nir_build_depth_stencil_resolve_compute_shader(struct radv_device *dev
|
|||
outval = nir_fdiv_imm(&b, outval, samples);
|
||||
}
|
||||
|
||||
nir_def *coord = nir_vec4(&b, nir_channel(&b, img_coord, 0), nir_channel(&b, img_coord, 1),
|
||||
nir_channel(&b, img_coord, 2), nir_undef(&b, 1, 32));
|
||||
nir_def *coord = nir_vec4(&b, nir_channel(&b, dst_coord, 0), nir_channel(&b, dst_coord, 1),
|
||||
nir_channel(&b, dst_coord, 2), nir_undef(&b, 1, 32));
|
||||
nir_image_deref_store(&b, &nir_build_deref_var(&b, output_img)->def, coord, nir_undef(&b, 1, 32), outval,
|
||||
nir_imm_int(&b, 0), .image_dim = GLSL_SAMPLER_DIM_2D, .image_array = true);
|
||||
return b.shader;
|
||||
|
|
@ -1400,10 +1402,11 @@ radv_meta_nir_build_depth_stencil_resolve_fragment_shader(struct radv_device *de
|
|||
fs_out->data.location = index == RADV_META_DEPTH_RESOLVE ? FRAG_RESULT_DEPTH : FRAG_RESULT_STENCIL;
|
||||
|
||||
nir_def *pos_in = nir_trim_vector(&b, nir_load_frag_coord(&b), 2);
|
||||
nir_def *src_offset = nir_load_push_constant(&b, 2, 32, nir_imm_int(&b, 0), .range = 8);
|
||||
|
||||
nir_def *pos_int = nir_f2i32(&b, pos_in);
|
||||
|
||||
nir_def *img_coord = nir_trim_vector(&b, pos_int, 2);
|
||||
nir_def *img_coord = nir_trim_vector(&b, nir_iadd(&b, pos_int, src_offset), 2);
|
||||
|
||||
nir_deref_instr *input_img_deref = nir_build_deref_var(&b, input_img);
|
||||
nir_def *outval = nir_txf_ms(&b, img_coord, nir_imm_int(&b, 0), .texture_deref = input_img_deref);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue