"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/amd/vulkan/radv_cmd_buffer.c" between
mesa-21.2.0-rc1.tar.xz and mesa-21.2.0-rc2.tar.xz

About: Mesa is an open-source implementation of the OpenGL specification - a system for rendering interactive 3D graphics (main library code). Release candidate.

radv_cmd_buffer.c  (mesa-21.2.0-rc1.tar.xz):radv_cmd_buffer.c  (mesa-21.2.0-rc2.tar.xz)
skipping to change at line 2936 skipping to change at line 2936
/* If attrib_offset>stride, then the compiler will increase the v ertex index by /* If attrib_offset>stride, then the compiler will increase the v ertex index by
* attrib_offset/stride and decrease the offset by attrib_offset% stride. This is * attrib_offset/stride and decrease the offset by attrib_offset% stride. This is
* only allowed with static strides. * only allowed with static strides.
*/ */
num_records += pipeline->attrib_index_offset[i]; num_records += pipeline->attrib_index_offset[i];
} }
/* GFX10 uses OOB_SELECT_RAW if stride==0, so convert num_records fr om elements into /* GFX10 uses OOB_SELECT_RAW if stride==0, so convert num_records fr om elements into
* into bytes in that case. GFX8 always uses bytes. * into bytes in that case. GFX8 always uses bytes.
*/ */
if (num_records && (chip == GFX8 || (chip >= GFX10 && !stride))) { if (num_records && (chip == GFX8 || (chip != GFX9 && !stride))) {
num_records = (num_records - 1) * stride + attrib_end; num_records = (num_records - 1) * stride + attrib_end;
} else if (!num_records) { } else if (!num_records) {
/* On GFX9 (GFX6/7 untested), it seems bounds checking is disable d if both /* On GFX9, it seems bounds checking is disabled if both
* num_records and stride are zero. This doesn't seem necessary o n GFX8, GFX10 and * num_records and stride are zero. This doesn't seem necessary o n GFX8, GFX10 and
* GFX10.3 but it doesn't hurt. * GFX10.3 but it doesn't hurt.
*/ */
memset(desc, 0, 16); memset(desc, 0, 16);
continue; continue;
} }
} else { } else {
if (chip != GFX8 && stride) if (chip != GFX8 && stride)
num_records = DIV_ROUND_UP(num_records, stride); num_records = DIV_ROUND_UP(num_records, stride);
} }
skipping to change at line 5667 skipping to change at line 5667
enum { enum {
ngg_cull_none = 0, ngg_cull_none = 0,
ngg_cull_front_face = 1, ngg_cull_front_face = 1,
ngg_cull_back_face = 2, ngg_cull_back_face = 2,
ngg_cull_face_is_ccw = 4, ngg_cull_face_is_ccw = 4,
ngg_cull_small_primitives = 8, ngg_cull_small_primitives = 8,
}; };
ALWAYS_INLINE static bool ALWAYS_INLINE static bool
radv_skip_ngg_culling(bool has_tess, const unsigned vtx_cnt, radv_skip_ngg_culling(bool has_tess, const unsigned vtx_cnt,
bool indirect, unsigned num_viewports) bool indirect)
{ {
/* If we have to draw only a few vertices, we get better latency if /* If we have to draw only a few vertices, we get better latency if
* we disable NGG culling. * we disable NGG culling.
* *
* When tessellation is used, what matters is the number of tessellated * When tessellation is used, what matters is the number of tessellated
* vertices, so let's always assume it's not a small draw. * vertices, so let's always assume it's not a small draw.
*
* TODO: Figure out how to do culling with multiple viewports efficiently.
*/ */
return !has_tess && !indirect && vtx_cnt < 512 && num_viewports == 1; return !has_tess && !indirect && vtx_cnt < 512;
} }
ALWAYS_INLINE static uint32_t ALWAYS_INLINE static uint32_t
radv_get_ngg_culling_settings(struct radv_cmd_buffer *cmd_buffer, bool vp_y_inve rted) radv_get_ngg_culling_settings(struct radv_cmd_buffer *cmd_buffer, bool vp_y_inve rted)
{ {
const struct radv_pipeline *pipeline = cmd_buffer->state.pipeline; const struct radv_pipeline *pipeline = cmd_buffer->state.pipeline;
const struct radv_dynamic_state *d = &cmd_buffer->state.dynamic; const struct radv_dynamic_state *d = &cmd_buffer->state.dynamic;
/* Cull every triangle when rasterizer discard is enabled. */ /* Cull every triangle when rasterizer discard is enabled. */
if (d->rasterizer_discard_enable || if (d->rasterizer_discard_enable ||
skipping to change at line 5760 skipping to change at line 5758
const bool dirty = const bool dirty =
cmd_buffer->state.dirty & cmd_buffer->state.dirty &
(RADV_CMD_DIRTY_PIPELINE | (RADV_CMD_DIRTY_PIPELINE |
RADV_CMD_DIRTY_DYNAMIC_CULL_MODE | RADV_CMD_DIRTY_DYNAMIC_FRONT_FACE | RADV_CMD_DIRTY_DYNAMIC_CULL_MODE | RADV_CMD_DIRTY_DYNAMIC_FRONT_FACE |
RADV_CMD_DIRTY_DYNAMIC_RASTERIZER_DISCARD_ENABLE | RADV_CMD_DIRTY_DYNAMIC _VIEWPORT); RADV_CMD_DIRTY_DYNAMIC_RASTERIZER_DISCARD_ENABLE | RADV_CMD_DIRTY_DYNAMIC _VIEWPORT);
/* Check small draw status: /* Check small draw status:
* For small draw calls, we disable culling by setting the SGPR to 0. * For small draw calls, we disable culling by setting the SGPR to 0.
*/ */
const bool skip = const bool skip =
radv_skip_ngg_culling( radv_skip_ngg_culling(stage == MESA_SHADER_TESS_EVAL, draw_info->count, dr
stage == MESA_SHADER_TESS_EVAL, draw_info->count, draw_info->indirect, aw_info->indirect);
cmd_buffer->state.dynamic.viewport.count);
/* See if anything changed. */ /* See if anything changed. */
if (!dirty && skip == cmd_buffer->state.last_nggc_skip) if (!dirty && skip == cmd_buffer->state.last_nggc_skip)
return; return;
/* Remember small draw state. */ /* Remember small draw state. */
cmd_buffer->state.last_nggc_skip = skip; cmd_buffer->state.last_nggc_skip = skip;
const struct radv_shader_variant *v = pipeline->shaders[stage]; const struct radv_shader_variant *v = pipeline->shaders[stage];
assert(v->info.has_ngg_culling == nggc_supported); assert(v->info.has_ngg_culling == nggc_supported);
skipping to change at line 6624 skipping to change at line 6620
state->flush_bits |= state->flush_bits |=
radv_src_access_flush(cmd_buffer, VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE _BIT, image); radv_src_access_flush(cmd_buffer, VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE _BIT, image);
state->flush_bits |= radv_clear_htile(cmd_buffer, image, range, htile_value); state->flush_bits |= radv_clear_htile(cmd_buffer, image, range, htile_value);
if (vk_format_has_stencil(image->vk_format)) if (vk_format_has_stencil(image->vk_format))
aspects |= VK_IMAGE_ASPECT_STENCIL_BIT; aspects |= VK_IMAGE_ASPECT_STENCIL_BIT;
radv_set_ds_clear_metadata(cmd_buffer, image, range, value, aspects); radv_set_ds_clear_metadata(cmd_buffer, image, range, value, aspects);
if (radv_image_is_tc_compat_htile(image)) { if (radv_image_is_tc_compat_htile(image) && (range->aspectMask & VK_IMAGE_ASP ECT_DEPTH_BIT)) {
/* Initialize the TC-compat metada value to 0 because by /* Initialize the TC-compat metada value to 0 because by
* default DB_Z_INFO.RANGE_PRECISION is set to 1, and we only * default DB_Z_INFO.RANGE_PRECISION is set to 1, and we only
* need have to conditionally update its value when performing * need have to conditionally update its value when performing
* a fast depth clear. * a fast depth clear.
*/ */
radv_set_tc_compat_zrange_metadata(cmd_buffer, image, range, 0); radv_set_tc_compat_zrange_metadata(cmd_buffer, image, range, 0);
} }
} }
static void static void
 End of changes. 7 change blocks. 
10 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)