lavapipe: fix some void ptr arithmetic
authorDave Airlie <airlied@redhat.com>
Thu, 18 Feb 2021 01:06:39 +0000 (17:06 -0800)
committerMarge Bot <eric+marge@anholt.net>
Fri, 19 Feb 2021 02:27:15 +0000 (02:27 +0000)
msvc disagrees with it, and they are trivial to fix.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9120>

src/gallium/frontends/lavapipe/lvp_device.c
src/gallium/frontends/lavapipe/lvp_pass.c
src/gallium/frontends/lavapipe/lvp_pipeline.c

index 5bcae80..bbd575b 100644 (file)
@@ -1096,7 +1096,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_MapMemory(
 
    map = device->pscreen->map_memory(device->pscreen, mem->pmem);
 
-   *ppData = map + offset;
+   *ppData = (char *)map + offset;
    return VK_SUCCESS;
 }
 
index 8c0606a..e887e67 100644 (file)
@@ -174,7 +174,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateRenderPass(
                        VK_OBJECT_TYPE_RENDER_PASS);
    pass->attachment_count = pCreateInfo->attachmentCount;
    pass->subpass_count = pCreateInfo->subpassCount;
-   pass->attachments = (void *) pass + attachments_offset;
+   pass->attachments = (struct lvp_render_pass_attachment *)((char *)pass + attachments_offset);
 
    for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
       struct lvp_render_pass_attachment *att = &pass->attachments[i];
index ed9df2f..3388348 100644 (file)
@@ -467,9 +467,9 @@ lvp_shader_compile_to_ir(struct lvp_pipeline *pipeline,
       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((const void *)(data + entry.size) <=
-                spec_info->pData + spec_info->dataSize);
+            (char *)spec_info->pData + entry.offset;
+         assert((const char *)((char *)data + entry.size) <=
+                (char *)spec_info->pData + spec_info->dataSize);
 
          spec_entries[i].id = entry.constantID;
          switch (entry.size) {