nvk: Constify instance and pdev pointers

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33624>
This commit is contained in:
Faith Ekstrand 2025-02-18 17:25:02 -06:00 committed by Marge Bot
parent 32b20a3f38
commit 8536760016
30 changed files with 96 additions and 88 deletions

View file

@ -160,7 +160,7 @@ nvk_GetDeviceBufferMemoryRequirements(
VkMemoryRequirements2 *pMemoryRequirements)
{
VK_FROM_HANDLE(nvk_device, dev, device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
const uint32_t alignment =
nvk_get_buffer_alignment(nvk_device_physical(dev),
@ -239,7 +239,7 @@ nvk_bind_buffer_memory(struct nvk_device *dev,
{
VK_FROM_HANDLE(nvk_device_memory, mem, info->memory);
VK_FROM_HANDLE(nvk_buffer, buffer, info->buffer);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result = VK_SUCCESS;
if ((pdev->debug_flags & NVK_DEBUG_PUSH_DUMP) &&

View file

@ -16,7 +16,7 @@
#include "clb097.h"
VkFormatFeatureFlags2
nvk_get_buffer_format_features(struct nvk_physical_device *pdev,
nvk_get_buffer_format_features(const struct nvk_physical_device *pdev,
VkFormat vk_format)
{
VkFormatFeatureFlags2 features = 0;
@ -50,7 +50,7 @@ nvk_CreateBufferView(VkDevice _device,
{
VK_FROM_HANDLE(nvk_device, dev, _device);
VK_FROM_HANDLE(nvk_buffer, buffer, pCreateInfo->buffer);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvk_buffer_view *view;
VkResult result;
@ -97,7 +97,7 @@ nvk_DestroyBufferView(VkDevice _device,
{
VK_FROM_HANDLE(nvk_device, dev, _device);
VK_FROM_HANDLE(nvk_buffer_view, view, bufferView);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
if (!view)
return;

View file

@ -14,7 +14,7 @@
struct nvk_physical_device;
VkFormatFeatureFlags2
nvk_get_buffer_format_features(struct nvk_physical_device *pdev,
nvk_get_buffer_format_features(const struct nvk_physical_device *pdev,
VkFormat format);
struct nvk_buffer_view {

View file

@ -520,7 +520,7 @@ nvk_cmd_invalidate_deps(struct nvk_cmd_buffer *cmd,
const VkDependencyInfo *deps)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
enum nvk_barrier barriers = 0;
@ -662,7 +662,7 @@ nvk_bind_descriptor_sets(struct nvk_cmd_buffer *cmd,
{
VK_FROM_HANDLE(vk_pipeline_layout, pipeline_layout, info->layout);
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
union nvk_buffer_descriptor dynamic_buffers[NVK_MAX_DYNAMIC_BUFFERS];
uint8_t set_dynamic_buffer_start[NVK_MAX_SETS];
@ -977,7 +977,7 @@ nvk_cmd_buffer_flush_push_descriptors(struct nvk_cmd_buffer *cmd,
struct nvk_descriptor_state *desc)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
const uint32_t min_cbuf_alignment = nvk_min_cbuf_alignment(&pdev->info);
VkResult result;
@ -1012,7 +1012,7 @@ nvk_cmd_buffer_get_cbuf_addr(struct nvk_cmd_buffer *cmd,
struct nvk_buffer_address *addr_out)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
switch (cbuf->type) {
case NVK_CBUF_TYPE_INVALID:
@ -1090,7 +1090,7 @@ void
nvk_cmd_buffer_dump(struct nvk_cmd_buffer *cmd, FILE *fp)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
util_dynarray_foreach(&cmd->pushes, struct nvk_cmd_push, p) {
if (p->map) {

View file

@ -319,7 +319,7 @@ nvk_CmdClearColorImage(VkCommandBuffer commandBuffer,
{
VK_FROM_HANDLE(nvk_cmd_buffer, cmd, commandBuffer);
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VK_FROM_HANDLE(nvk_image, image, _image);
VkClearValue clear_value = {

View file

@ -24,7 +24,7 @@ static inline uint16_t
nvk_cmd_buffer_copy_cls(struct nvk_cmd_buffer *cmd)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
return pdev->info.cls_copy;
}

View file

@ -28,7 +28,7 @@ VkResult
nvk_push_dispatch_state_init(struct nvk_queue *queue, struct nv_push *p)
{
struct nvk_device *dev = nvk_queue_device(queue);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
P_MTHD(p, NV90C0, SET_OBJECT);
P_NV90C0_SET_OBJECT(p, {
@ -55,7 +55,7 @@ static inline uint16_t
nvk_cmd_buffer_compute_cls(struct nvk_cmd_buffer *cmd)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
return pdev->info.cls_compute;
}
@ -125,7 +125,7 @@ nvk_cmd_upload_qmd(struct nvk_cmd_buffer *cmd,
uint64_t *root_desc_addr_out)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
const uint32_t min_cbuf_alignment = nvk_min_cbuf_alignment(&pdev->info);
VkResult result;

View file

@ -34,7 +34,7 @@ static inline uint16_t
nvk_cmd_buffer_3d_cls(struct nvk_cmd_buffer *cmd)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
return pdev->info.cls_eng3d;
}
@ -107,7 +107,7 @@ VkResult
nvk_push_draw_state_init(struct nvk_queue *queue, struct nv_push *p)
{
struct nvk_device *dev = nvk_queue_device(queue);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
/* 3D state */
P_MTHD(p, NV9097, SET_OBJECT);
@ -1651,7 +1651,7 @@ static void
nvk_flush_vi_state(struct nvk_cmd_buffer *cmd)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct vk_dynamic_graphics_state *dyn =
&cmd->vk.dynamic_graphics_state;
@ -1783,7 +1783,7 @@ static void
nvk_flush_vp_state(struct nvk_cmd_buffer *cmd)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct vk_dynamic_graphics_state *dyn =
&cmd->vk.dynamic_graphics_state;
@ -3345,7 +3345,7 @@ void
nvk_cmd_flush_gfx_cbufs(struct nvk_cmd_buffer *cmd)
{
struct nvk_device *dev = nvk_cmd_buffer_device(cmd);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
const uint32_t min_cbuf_alignment = nvk_min_cbuf_alignment(&pdev->info);
struct nvk_descriptor_state *desc = &cmd->state.gfx.descriptors;

View file

@ -260,7 +260,7 @@ static void
build_process_cs_cmd_seq(nir_builder *b, struct nvk_nir_push *p,
nir_def *in_addr, nir_def *seq_idx,
struct process_cmd_in *in,
struct nvk_physical_device *pdev,
const struct nvk_physical_device *pdev,
const VkIndirectCommandsLayoutCreateInfoEXT *info,
uint32_t *qmd_size_per_seq_B_out)
{
@ -416,7 +416,7 @@ build_process_cs_cmd_seq(nir_builder *b, struct nvk_nir_push *p,
static void
build_gfx_set_exec(nir_builder *b, struct nvk_nir_push *p, nir_def *token_addr,
struct process_cmd_in *in,
struct nvk_physical_device *pdev,
const struct nvk_physical_device *pdev,
const VkIndirectCommandsExecutionSetTokenEXT *token)
{
switch (token->type) {
@ -622,7 +622,7 @@ static void
build_process_gfx_cmd_seq(nir_builder *b, struct nvk_nir_push *p,
nir_def *in_addr, nir_def *seq_idx,
struct process_cmd_in *in,
struct nvk_physical_device *pdev,
const struct nvk_physical_device *pdev,
const VkIndirectCommandsLayoutCreateInfoEXT *info)
{
for (uint32_t t = 0; t < info->tokenCount; t++) {
@ -721,7 +721,7 @@ build_process_shader(struct nvk_device *dev,
uint32_t *cmd_seq_stride_B_out,
uint32_t *qmd_size_per_seq_B_out)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
nir_builder build =
nir_builder_init_simple_shader(MESA_SHADER_COMPUTE, NULL,
@ -912,7 +912,7 @@ nvk_GetGeneratedCommandsMemoryRequirementsEXT(
VK_FROM_HANDLE(nvk_device, dev, _device);
VK_FROM_HANDLE(nvk_indirect_commands_layout, layout,
pInfo->indirectCommandsLayout);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
uint64_t size = layout->cmd_seq_stride_B * (uint64_t)pInfo->maxSequenceCount;
if (layout->qmd_size_per_seq_B > 0) {

View file

@ -38,7 +38,7 @@ nvk_cmd_bind_map_buffer(struct vk_command_buffer *vk_cmd,
VkResult
nvk_device_init_meta(struct nvk_device *dev)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result = vk_meta_device_init(&dev->vk, &dev->meta);
if (result != VK_SUCCESS)

View file

@ -793,7 +793,8 @@ nvk_fill_transform_feedback_state(struct nak_xfb_info *xfb,
}
VkResult
nvk_cg_compile_nir(struct nvk_physical_device *pdev, nir_shader *nir,
nvk_cg_compile_nir(const struct nvk_physical_device *pdev,
nir_shader *nir,
const struct nak_fs_key *fs_key,
struct nvk_shader *shader)
{

View file

@ -167,7 +167,7 @@ write_storage_image_view_desc(struct nvk_descriptor_set *set,
}
static union nvk_buffer_descriptor
ubo_desc(struct nvk_physical_device *pdev,
ubo_desc(const struct nvk_physical_device *pdev,
struct nvk_addr_range addr_range)
{
const uint32_t min_cbuf_alignment = nvk_min_cbuf_alignment(&pdev->info);
@ -192,7 +192,7 @@ ubo_desc(struct nvk_physical_device *pdev,
}
static void
write_ubo_desc(struct nvk_physical_device *pdev,
write_ubo_desc(const struct nvk_physical_device *pdev,
struct nvk_descriptor_set *set,
const VkDescriptorBufferInfo *const info,
uint32_t binding, uint32_t elem)
@ -206,7 +206,7 @@ write_ubo_desc(struct nvk_physical_device *pdev,
}
static void
write_dynamic_ubo_desc(struct nvk_physical_device *pdev,
write_dynamic_ubo_desc(const struct nvk_physical_device *pdev,
struct nvk_descriptor_set *set,
const VkDescriptorBufferInfo *const info,
uint32_t binding, uint32_t elem)
@ -281,7 +281,7 @@ get_edb_buffer_view_desc(struct nvk_device *dev,
}
static void
write_buffer_view_desc(struct nvk_physical_device *pdev,
write_buffer_view_desc(const struct nvk_physical_device *pdev,
struct nvk_descriptor_set *set,
const VkBufferView bufferView,
uint32_t binding, uint32_t elem)
@ -318,7 +318,7 @@ nvk_UpdateDescriptorSets(VkDevice device,
const VkCopyDescriptorSet *pDescriptorCopies)
{
VK_FROM_HANDLE(nvk_device, dev, device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
for (uint32_t w = 0; w < descriptorWriteCount; w++) {
const VkWriteDescriptorSet *write = &pDescriptorWrites[w];
@ -445,7 +445,7 @@ nvk_push_descriptor_set_update(struct nvk_device *dev,
uint32_t write_count,
const VkWriteDescriptorSet *writes)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
assert(layout->non_variable_descriptor_buffer_size < sizeof(push_set->data));
struct nvk_descriptor_set set = {
@ -554,7 +554,7 @@ nvk_CreateDescriptorPool(VkDevice _device,
VkDescriptorPool *pDescriptorPool)
{
VK_FROM_HANDLE(nvk_device, dev, _device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvk_descriptor_pool *pool;
VkResult result;
@ -702,7 +702,7 @@ nvk_descriptor_set_create(struct nvk_device *dev,
uint32_t variable_count,
struct nvk_descriptor_set **out_set)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvk_descriptor_set *set;
VkResult result;
@ -861,7 +861,7 @@ nvk_descriptor_set_write_template(struct nvk_device *dev,
const struct vk_descriptor_update_template *template,
const void *data)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
for (uint32_t i = 0; i < template->entry_count; i++) {
const struct vk_descriptor_template_entry *entry =
@ -1000,7 +1000,7 @@ nvk_GetDescriptorEXT(VkDevice _device,
size_t dataSize, void *pDescriptor)
{
VK_FROM_HANDLE(nvk_device, dev, _device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
switch (pDescriptorInfo->type) {
case VK_DESCRIPTOR_TYPE_SAMPLER: {

View file

@ -134,7 +134,7 @@ nvk_CreateDescriptorSetLayout(VkDevice device,
VkDescriptorSetLayout *pSetLayout)
{
VK_FROM_HANDLE(nvk_device, dev, device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
uint32_t num_bindings = 0;
uint32_t immutable_sampler_count = 0;
@ -386,7 +386,7 @@ nvk_GetDescriptorSetLayoutSupport(VkDevice device,
VkDescriptorSetLayoutSupport *pSupport)
{
VK_FROM_HANDLE(nvk_device, dev, device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
const VkMutableDescriptorTypeCreateInfoEXT *mutable_info =
vk_find_struct_const(pCreateInfo->pNext,

View file

@ -55,7 +55,7 @@ nvk_slm_area_ensure(struct nvk_device *dev,
uint32_t slm_bytes_per_lane,
uint32_t crs_bytes_per_warp)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result;
assert(slm_bytes_per_lane < (1 << 24));

View file

@ -62,8 +62,14 @@ VkResult nvk_device_ensure_slm(struct nvk_device *dev,
uint32_t slm_bytes_per_lane,
uint32_t crs_bytes_per_warp);
static inline const struct nvk_physical_device *
nvk_device_physical(const struct nvk_device *dev)
{
return (struct nvk_physical_device *)dev->vk.physical;
}
static inline struct nvk_physical_device *
nvk_device_physical(struct nvk_device *dev)
nvk_device_physical_mut(struct nvk_device *dev)
{
return (struct nvk_physical_device *)dev->vk.physical;
}

View file

@ -65,7 +65,7 @@ nvk_GetMemoryFdPropertiesKHR(VkDevice device,
VkMemoryFdPropertiesKHR *pMemoryFdProperties)
{
VK_FROM_HANDLE(nvk_device, dev, device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvkmd_mem *mem;
VkResult result;
@ -109,7 +109,7 @@ nvk_AllocateMemory(VkDevice device,
VkDeviceMemory *pMem)
{
VK_FROM_HANDLE(nvk_device, dev, device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvk_physical_device *pdev = nvk_device_physical_mut(dev);
struct nvk_device_memory *mem;
VkResult result = VK_SUCCESS;
@ -246,7 +246,7 @@ nvk_FreeMemory(VkDevice device,
{
VK_FROM_HANDLE(nvk_device, dev, device);
VK_FROM_HANDLE(nvk_device_memory, mem, _mem);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvk_physical_device *pdev = nvk_device_physical_mut(dev);
if (!mem)
return;

View file

@ -125,7 +125,7 @@ VkResult
nvk_edb_bview_cache_init(struct nvk_device *dev,
struct nvk_edb_bview_cache *cache)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result;
cache->cache = _mesa_hash_table_create(NULL, _mesa_hash_pointer,

View file

@ -25,7 +25,7 @@
#include "clc597.h"
static VkFormatFeatureFlags2
nvk_get_image_plane_format_features(struct nvk_physical_device *pdev,
nvk_get_image_plane_format_features(const struct nvk_physical_device *pdev,
VkFormat vk_format, VkImageTiling tiling,
uint64_t drm_format_mod)
{
@ -100,7 +100,7 @@ nvk_get_image_plane_format_features(struct nvk_physical_device *pdev,
}
VkFormatFeatureFlags2
nvk_get_image_format_features(struct nvk_physical_device *pdev,
nvk_get_image_format_features(const struct nvk_physical_device *pdev,
VkFormat vk_format, VkImageTiling tiling,
uint64_t drm_format_mod)
{
@ -164,7 +164,7 @@ nvk_get_image_format_features(struct nvk_physical_device *pdev,
}
void
nvk_get_drm_format_modifier_properties_list(struct nvk_physical_device *pdev,
nvk_get_drm_format_modifier_properties_list(const struct nvk_physical_device *pdev,
VkFormat vk_format,
VkBaseOutStructure *ext)
{
@ -740,7 +740,7 @@ nvk_image_init(struct nvk_device *dev,
struct nvk_image *image,
const VkImageCreateInfo *pCreateInfo)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
vk_image_init(&dev->vk, &image->vk, pCreateInfo);
@ -934,7 +934,7 @@ nvk_image_plane_size_align_B(struct nvk_device *dev,
const struct nvk_image_plane *plane,
uint64_t *size_B_out, uint64_t *align_B_out)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
const bool sparse_bound =
image->vk.create_flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT;
@ -1019,7 +1019,7 @@ nvk_CreateImage(VkDevice _device,
VkImage *pImage)
{
VK_FROM_HANDLE(nvk_device, dev, _device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvk_image *image;
VkResult result;
@ -1135,14 +1135,13 @@ nvk_get_image_memory_requirements(struct nvk_device *dev,
VkImageAspectFlags aspects,
VkMemoryRequirements2 *pMemoryRequirements)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
uint32_t memory_types = (1 << pdev->mem_type_count) - 1;
/* Remove non host visible heaps from the types for host image copy in case
* of potential issues. This should be removed when we get ReBAR.
*/
if (image->vk.usage & VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT) {
struct nvk_physical_device *pdev = nvk_device_physical(dev);
for (uint32_t i = 0; i < pdev->mem_type_count; i++) {
if (!(pdev->mem_types[i].propertyFlags &
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))

View file

@ -42,12 +42,12 @@ struct nvkmd_mem;
struct nvkmd_va;
VkFormatFeatureFlags2
nvk_get_image_format_features(struct nvk_physical_device *pdev,
nvk_get_image_format_features(const struct nvk_physical_device *pdev,
VkFormat format, VkImageTiling tiling,
uint64_t drm_format_mod);
void
nvk_get_drm_format_modifier_properties_list(struct nvk_physical_device *pdev,
nvk_get_drm_format_modifier_properties_list(const struct nvk_physical_device *pdev,
VkFormat vk_format,
VkBaseOutStructure *ext);

View file

@ -102,7 +102,7 @@ nvk_image_view_init(struct nvk_device *dev,
bool driver_internal,
const VkImageViewCreateInfo *pCreateInfo)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VK_FROM_HANDLE(nvk_image, image, pCreateInfo->image);
VkResult result;

View file

@ -18,7 +18,7 @@ nvk_ies_map(struct nvk_indirect_execution_set *ies, uint32_t index)
}
void
nvk_ies_cs_qmd_init(struct nvk_physical_device *pdev,
nvk_ies_cs_qmd_init(const struct nvk_physical_device *pdev,
struct nvk_ies_cs_qmd *qmd,
struct nvk_shader *shader)
{
@ -73,7 +73,7 @@ nvk_ies_set_cs(struct nvk_device *dev,
}
uint16_t
nvk_ies_gfx_pipeline_max_dw_count(struct nvk_physical_device *pdev,
nvk_ies_gfx_pipeline_max_dw_count(const struct nvk_physical_device *pdev,
VkShaderStageFlags stages)
{
gl_shader_stage last_vtgm = MESA_SHADER_VERTEX;
@ -93,7 +93,7 @@ nvk_ies_gfx_pipeline_max_dw_count(struct nvk_physical_device *pdev,
}
static uint32_t
nvk_ies_stride_gfx_pipeline(struct nvk_physical_device *pdev,
nvk_ies_stride_gfx_pipeline(const struct nvk_physical_device *pdev,
VkShaderStageFlags stages)
{
return sizeof(struct nvk_ies_gfx_pipeline) +
@ -145,7 +145,7 @@ nvk_ies_set_gfx_pipeline(struct nvk_device *dev,
}
uint16_t
nvk_ies_gfx_shader_max_dw_count(struct nvk_physical_device *pdev,
nvk_ies_gfx_shader_max_dw_count(const struct nvk_physical_device *pdev,
VkShaderStageFlags stages,
bool last_vtgm)
{
@ -161,7 +161,7 @@ nvk_ies_gfx_shader_max_dw_count(struct nvk_physical_device *pdev,
}
static uint32_t
nvk_ies_stride_gfx_shader(struct nvk_physical_device *pdev,
nvk_ies_stride_gfx_shader(const struct nvk_physical_device *pdev,
VkShaderStageFlags stages)
{
return sizeof(struct nvk_ies_gfx_shader) +
@ -238,7 +238,7 @@ nvk_CreateIndirectExecutionSetEXT(VkDevice _device,
VkIndirectExecutionSetEXT *pIndirectExecutionSet)
{
VK_FROM_HANDLE(nvk_device, dev, _device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result;
struct nvk_indirect_execution_set *ies =

View file

@ -25,12 +25,12 @@ struct nvk_ies_cs_qmd {
PRAGMA_DIAGNOSTIC_POP
static inline uint16_t
nvk_ies_cs_qmd_max_dw_count(struct nvk_physical_device *pdev)
nvk_ies_cs_qmd_max_dw_count(const struct nvk_physical_device *pdev)
{
return 64;
}
void nvk_ies_cs_qmd_init(struct nvk_physical_device *pdev,
void nvk_ies_cs_qmd_init(const struct nvk_physical_device *pdev,
struct nvk_ies_cs_qmd *qmd,
struct nvk_shader *shader);
@ -45,7 +45,7 @@ PRAGMA_DIAGNOSTIC_POP
static_assert(sizeof(struct nvk_ies_gfx_shader) == 4,
"nvk_ies_gfx_shader has no holes");
uint16_t nvk_ies_gfx_shader_max_dw_count(struct nvk_physical_device *pdev,
uint16_t nvk_ies_gfx_shader_max_dw_count(const struct nvk_physical_device *pdev,
VkShaderStageFlags stages,
bool last_vtgm);
@ -59,7 +59,7 @@ PRAGMA_DIAGNOSTIC_POP
static_assert(sizeof(struct nvk_ies_gfx_pipeline) == 4,
"nvk_ies_gfx_pipeline has no holes");
uint16_t nvk_ies_gfx_pipeline_max_dw_count(struct nvk_physical_device *pdev,
uint16_t nvk_ies_gfx_pipeline_max_dw_count(const struct nvk_physical_device *pdev,
VkShaderStageFlags stages);
struct nvk_indirect_execution_set {

View file

@ -1198,7 +1198,7 @@ nvk_get_device_properties(const struct nvk_instance *instance,
static void
nvk_physical_device_init_pipeline_cache(struct nvk_physical_device *pdev)
{
struct nvk_instance *instance = nvk_physical_device_instance(pdev);
const struct nvk_instance *instance = nvk_physical_device_instance(pdev);
struct mesa_sha1 sha_ctx;
_mesa_sha1_init(&sha_ctx);

View file

@ -74,8 +74,8 @@ nvk_use_edb_buffer_views(const struct nvk_physical_device *pdev)
return pdev->debug_flags & NVK_DEBUG_FORCE_EDB_BVIEW;
}
static inline struct nvk_instance *
nvk_physical_device_instance(struct nvk_physical_device *pdev)
static inline const struct nvk_instance *
nvk_physical_device_instance(const struct nvk_physical_device *pdev)
{
return (struct nvk_instance *)pdev->vk.instance;
}

View file

@ -39,7 +39,7 @@ nvk_CreateQueryPool(VkDevice device,
VkQueryPool *pQueryPool)
{
VK_FROM_HANDLE(nvk_device, dev, device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvk_query_pool *pool;
VkResult result;

View file

@ -46,7 +46,7 @@ nvk_queue_state_update(struct nvk_queue *queue,
struct nvk_queue_state *qs)
{
struct nvk_device *dev = nvk_queue_device(queue);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvkmd_mem *mem;
uint32_t alloc_count, bytes_per_warp, bytes_per_tpc;
bool dirty = false;
@ -271,7 +271,7 @@ nvk_queue_submit_exec(struct nvk_queue *queue,
struct vk_queue_submit *submit)
{
struct nvk_device *dev = nvk_queue_device(queue);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result;
const bool sync = pdev->debug_flags & NVK_DEBUG_PUSH_SYNC;
@ -388,7 +388,7 @@ nvk_queue_submit_simple(struct nvk_queue *queue,
uint32_t dw_count, const uint32_t *dw)
{
struct nvk_device *dev = nvk_queue_device(queue);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result;
if (vk_queue_is_lost(&queue->vk))
@ -434,7 +434,7 @@ static VkResult
nvk_queue_init_context_state(struct nvk_queue *queue)
{
struct nvk_device *dev = nvk_queue_device(queue);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result;
uint32_t push_data[4096];
@ -486,7 +486,7 @@ nvk_queue_init(struct nvk_device *dev, struct nvk_queue *queue,
const VkDeviceQueueCreateInfo *pCreateInfo,
uint32_t index_in_family)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result;
assert(pCreateInfo->queueFamilyIndex < pdev->queue_family_count);

View file

@ -289,7 +289,7 @@ nvk_CreateSampler(VkDevice device,
VkSampler *pSampler)
{
VK_FROM_HANDLE(nvk_device, dev, device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvk_sampler *sampler;
VkResult result;

View file

@ -402,7 +402,7 @@ nvk_lower_nir(struct nvk_device *dev, nir_shader *nir,
struct vk_descriptor_set_layout * const *set_layouts,
struct nvk_cbuf_map *cbuf_map_out)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
NIR_PASS(_, nir, nir_lower_input_attachments,
@ -544,7 +544,7 @@ nvk_shader_dump(struct nvk_shader *shader)
#endif
static VkResult
nvk_compile_nir_with_nak(struct nvk_physical_device *pdev,
nvk_compile_nir_with_nak(const struct nvk_physical_device *pdev,
nir_shader *nir,
VkShaderCreateFlagsEXT shader_flags,
const struct vk_pipeline_robustness_state *rs,
@ -579,7 +579,7 @@ nvk_compile_nir(struct nvk_device *dev, nir_shader *nir,
const struct nak_fs_key *fs_key,
struct nvk_shader *shader)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result;
if (use_nak(pdev, nir->info.stage)) {
@ -615,7 +615,7 @@ nvk_compile_nir(struct nvk_device *dev, nir_shader *nir,
static VkResult
nvk_shader_upload(struct nvk_device *dev, struct nvk_shader *shader)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
uint32_t hdr_size = 0;
if (shader->info.stage != MESA_SHADER_COMPUTE) {
@ -712,7 +712,7 @@ nvk_pipeline_bind_group(gl_shader_stage stage)
}
uint16_t
nvk_max_shader_push_dw(struct nvk_physical_device *pdev,
nvk_max_shader_push_dw(const struct nvk_physical_device *pdev,
gl_shader_stage stage, bool last_vtgm)
{
if (stage == MESA_SHADER_COMPUTE)
@ -739,7 +739,7 @@ nvk_shader_fill_push(struct nvk_device *dev,
struct nvk_shader *shader,
const VkAllocationCallbacks* pAllocator)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
ASSERTED uint16_t max_dw_count = 0;
uint32_t push_dw[200];
@ -1032,7 +1032,7 @@ nvk_compile_nir_shader(struct nvk_device *dev, nir_shader *nir,
const VkAllocationCallbacks *alloc,
struct nvk_shader **shader_out)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct vk_pipeline_robustness_state rs_none = {
.uniform_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT,
@ -1042,7 +1042,8 @@ nvk_compile_nir_shader(struct nvk_device *dev, nir_shader *nir,
assert(nir->info.stage == MESA_SHADER_COMPUTE);
if (nir->options == NULL)
nir->options = nvk_get_nir_options(&pdev->vk, nir->info.stage, &rs_none);
nir->options = nvk_get_nir_options((struct vk_physical_device *)&pdev->vk,
nir->info.stage, &rs_none);
struct vk_shader_compile_info info = {
.stage = nir->info.stage,

View file

@ -80,7 +80,7 @@ struct nvk_cbuf_map {
};
uint16_t
nvk_max_shader_push_dw(struct nvk_physical_device *pdev,
nvk_max_shader_push_dw(const struct nvk_physical_device *pdev,
gl_shader_stage stage, bool last_vtgm);
struct nvk_shader {
@ -167,7 +167,8 @@ nvk_cg_nir_options(const struct nvk_physical_device *pdev,
void nvk_cg_preprocess_nir(nir_shader *nir);
void nvk_cg_optimize_nir(nir_shader *nir);
VkResult nvk_cg_compile_nir(struct nvk_physical_device *pdev, nir_shader *nir,
VkResult nvk_cg_compile_nir(const struct nvk_physical_device *pdev,
nir_shader *nir,
const struct nak_fs_key *fs_key,
struct nvk_shader *shader);

View file

@ -62,7 +62,7 @@ VkResult
nvk_upload_queue_init(struct nvk_device *dev,
struct nvk_upload_queue *queue)
{
struct nvk_physical_device *pdev = nvk_device_physical(dev);
const struct nvk_physical_device *pdev = nvk_device_physical(dev);
VkResult result;
memset(queue, 0, sizeof(*queue));