nil: Rename rendering to color_target

Also, add a helper for depth/stencil formats and use
nil_format_supports_color_targets() helper to compute Vulkan format
features rather than checking for a non-zero color format.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand
2023-01-30 20:11:54 -06:00
committed by Marge Bot
parent e6866593d5
commit 0c6c2fe2cf
3 changed files with 21 additions and 9 deletions
+12 -4
View File
@@ -330,16 +330,24 @@ static const struct nil_format_info nil_format_infos[PIPE_FORMAT_COUNT] =
};
bool
nil_format_supports_render(struct nouveau_ws_device *dev,
enum pipe_format format)
nil_format_supports_color_targets(struct nouveau_ws_device *dev,
enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
const struct nil_format_info *fmt = &nil_format_infos[format];
return fmt->czt != 0;
}
uint32_t
nil_format_to_render(enum pipe_format format)
uint8_t
nil_format_to_color_target(enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
const struct nil_format_info *fmt = &nil_format_infos[format];
return fmt->czt;
}
uint8_t
nil_format_to_depth_stencil(enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
const struct nil_format_info *fmt = &nil_format_infos[format];
+5 -3
View File
@@ -11,10 +11,12 @@ struct nouveau_ws_device;
/* We don't have our own format enum; we use PIPE_FORMAT for everything */
bool nil_format_supports_render(struct nouveau_ws_device *dev,
enum pipe_format format);
bool nil_format_supports_color_targets(struct nouveau_ws_device *dev,
enum pipe_format format);
uint32_t nil_format_to_render(enum pipe_format format);
uint8_t nil_format_to_color_target(enum pipe_format format);
uint8_t nil_format_to_depth_stencil(enum pipe_format format);
struct nil_tic_format {
unsigned comp_sizes:8;
+4 -2
View File
@@ -434,7 +434,8 @@ nvk_CmdBeginRendering(VkCommandBuffer commandBuffer,
P_NV9097_SET_COLOR_TARGET_HEIGHT(p, i, iview->vk.extent.height);
const enum pipe_format p_format =
vk_format_to_pipe_format(iview->vk.format);
P_NV9097_SET_COLOR_TARGET_FORMAT(p, i, nil_format_to_render(p_format));
const uint8_t ct_format = nil_format_to_color_target(p_format);
P_NV9097_SET_COLOR_TARGET_FORMAT(p, i, ct_format);
P_NV9097_SET_COLOR_TARGET_MEMORY(p, i, {
.block_width = BLOCK_WIDTH_ONE_GOB,
.block_height = level->tiling.y_log2,
@@ -497,7 +498,8 @@ nvk_CmdBeginRendering(VkCommandBuffer commandBuffer,
P_NV9097_SET_ZT_B(p, addr);
const enum pipe_format p_format =
vk_format_to_pipe_format(iview->vk.format);
P_NV9097_SET_ZT_FORMAT(p, nil_format_to_render(p_format));
const uint8_t zs_format = nil_format_to_depth_stencil(p_format);
P_NV9097_SET_ZT_FORMAT(p, zs_format);
assert(image->nil.dim != NIL_IMAGE_DIM_3D);
P_NV9097_SET_ZT_BLOCK_SIZE(p, {
.width = WIDTH_ONE_GOB,