mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 09:30:11 +01:00
radv: Pointer arithmetic on char/uint8_t, not void
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7793>
This commit is contained in:
parent
879b5f41f4
commit
2e81ed2a47
5 changed files with 14 additions and 14 deletions
|
|
@ -5594,7 +5594,7 @@ VkResult radv_MapMemory(
|
|||
*ppData = device->ws->buffer_map(mem->bo);
|
||||
|
||||
if (*ppData) {
|
||||
*ppData += offset;
|
||||
*ppData = (uint8_t*)*ppData + offset;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ VkResult radv_CreateRenderPass(
|
|||
|
||||
pass->attachment_count = pCreateInfo->attachmentCount;
|
||||
pass->subpass_count = pCreateInfo->subpassCount;
|
||||
pass->attachments = (void *) pass + attachments_offset;
|
||||
pass->attachments = (struct radv_render_pass_attachment *)((uint8_t *) pass + attachments_offset);
|
||||
|
||||
vk_foreach_struct(ext, pCreateInfo->pNext) {
|
||||
switch(ext->sType) {
|
||||
|
|
@ -590,7 +590,7 @@ VkResult radv_CreateRenderPass2(
|
|||
|
||||
pass->attachment_count = pCreateInfo->attachmentCount;
|
||||
pass->subpass_count = pCreateInfo->subpassCount;
|
||||
pass->attachments = (void *) pass + attachments_offset;
|
||||
pass->attachments = (struct radv_render_pass_attachment *)((uint8_t *) pass + attachments_offset);
|
||||
|
||||
for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
|
||||
struct radv_render_pass_attachment *att = &pass->attachments[i];
|
||||
|
|
|
|||
|
|
@ -477,8 +477,8 @@ radv_pipeline_cache_load(struct radv_pipeline_cache *cache,
|
|||
if (memcmp(header.uuid, device->physical_device->cache_uuid, VK_UUID_SIZE) != 0)
|
||||
return false;
|
||||
|
||||
char *end = (void *) data + size;
|
||||
char *p = (void *) data + header.header_size;
|
||||
char *end = (char *) data + size;
|
||||
char *p = (char *) data + header.header_size;
|
||||
|
||||
while (end - p >= sizeof(struct cache_entry)) {
|
||||
struct cache_entry *entry = (struct cache_entry*)p;
|
||||
|
|
@ -580,14 +580,14 @@ VkResult radv_GetPipelineCacheData(
|
|||
*pDataSize = 0;
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
void *p = pData, *end = pData + *pDataSize;
|
||||
void *p = pData, *end = (char *) pData + *pDataSize;
|
||||
header = p;
|
||||
header->header_size = align(sizeof(*header), alignof(struct cache_entry));
|
||||
header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
|
||||
header->vendor_id = ATI_VENDOR_ID;
|
||||
header->device_id = device->physical_device->rad_info.pci_id;
|
||||
memcpy(header->uuid, device->physical_device->cache_uuid, VK_UUID_SIZE);
|
||||
p += header->header_size;
|
||||
p = (char *)p + header->header_size;
|
||||
|
||||
struct cache_entry *entry;
|
||||
for (uint32_t i = 0; i < cache->table_size; i++) {
|
||||
|
|
@ -595,7 +595,7 @@ VkResult radv_GetPipelineCacheData(
|
|||
continue;
|
||||
entry = cache->hash_table[i];
|
||||
const uint32_t size_of_entry = entry_size(entry);
|
||||
if (end < p + size_of_entry) {
|
||||
if ((char *)end < (char *)p + size_of_entry) {
|
||||
result = VK_INCOMPLETE;
|
||||
break;
|
||||
}
|
||||
|
|
@ -603,9 +603,9 @@ VkResult radv_GetPipelineCacheData(
|
|||
memcpy(p, entry, size_of_entry);
|
||||
for(int j = 0; j < MESA_SHADER_STAGES; ++j)
|
||||
((struct cache_entry*)p)->variants[j] = NULL;
|
||||
p += size_of_entry;
|
||||
p = (char *)p + size_of_entry;
|
||||
}
|
||||
*pDataSize = p - pData;
|
||||
*pDataSize = (char *)p - (char *)pData;
|
||||
|
||||
radv_pipeline_cache_unlock(cache);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -412,8 +412,8 @@ radv_shader_compile_to_nir(struct radv_device *device,
|
|||
spec_entries = calloc(num_spec_entries, sizeof(*spec_entries));
|
||||
for (uint32_t i = 0; i < num_spec_entries; i++) {
|
||||
VkSpecializationMapEntry entry = spec_info->pMapEntries[i];
|
||||
const void *data = spec_info->pData + entry.offset;
|
||||
assert(data + entry.size <= spec_info->pData + spec_info->dataSize);
|
||||
const void *data = (uint8_t *)spec_info->pData + entry.offset;
|
||||
assert((uint8_t *)data + entry.size <= (uint8_t *)spec_info->pData + spec_info->dataSize);
|
||||
|
||||
spec_entries[i].id = spec_info->pMapEntries[i].constantID;
|
||||
switch (entry.size) {
|
||||
|
|
|
|||
|
|
@ -579,8 +579,8 @@ radv_get_thread_trace(struct radv_queue *queue,
|
|||
for (unsigned se = 0; se < max_se; se++) {
|
||||
uint64_t info_offset = ac_thread_trace_get_info_offset(se);
|
||||
uint64_t data_offset = ac_thread_trace_get_data_offset(&device->thread_trace, se);
|
||||
void *info_ptr = thread_trace_ptr + info_offset;
|
||||
void *data_ptr = thread_trace_ptr + data_offset;
|
||||
void *info_ptr = (uint8_t *)thread_trace_ptr + info_offset;
|
||||
void *data_ptr = (uint8_t *)thread_trace_ptr + data_offset;
|
||||
struct ac_thread_trace_info *info =
|
||||
(struct ac_thread_trace_info *)info_ptr;
|
||||
struct ac_thread_trace_se thread_trace_se = {0};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue