panvk: Fix first_vertex/base_instance types

gl_Base{VertexARB,Instance} are signed integers, so reflect that in
the types we declare in the sysval struct.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32415>
This commit is contained in:
Boris Brezillon
2024-12-20 09:41:36 +01:00
committed by Marge Bot
parent 19173dfa40
commit 54033bc052
3 changed files with 30 additions and 6 deletions

View File

@@ -49,12 +49,12 @@ struct panvk_draw_info {
} index;
struct {
uint32_t base;
int32_t base;
uint32_t count;
} vertex;
struct {
uint32_t base;
int32_t base;
uint32_t count;
} instance;
@@ -1836,6 +1836,14 @@ panvk_per_arch(CmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount,
if (instanceCount == 0 || vertexCount == 0)
return;
/* gl_BaseVertexARB is a signed integer, and it should expose the value of
* firstVertex in a non-indexed draw. */
assert(firstVertex < INT32_MAX);
/* gl_BaseInstance is a signed integer, and it should expose the value of
* firstInstnace. */
assert(firstInstance < INT32_MAX);
struct panvk_draw_info draw = {
.vertex.base = firstVertex,
.vertex.count = vertexCount,
@@ -1857,10 +1865,14 @@ panvk_per_arch(CmdDrawIndexed)(VkCommandBuffer commandBuffer,
if (instanceCount == 0 || indexCount == 0)
return;
/* gl_BaseInstance is a signed integer, and it should expose the value of
* firstInstnace. */
assert(firstInstance < INT32_MAX);
struct panvk_draw_info draw = {
.index.size = cmdbuf->state.gfx.ib.index_size,
.index.offset = firstIndex,
.vertex.base = (uint32_t)vertexOffset,
.vertex.base = vertexOffset,
.vertex.count = indexCount,
.instance.count = instanceCount,
.instance.base = firstInstance,

View File

@@ -47,7 +47,7 @@ struct panvk_draw_info {
unsigned first_instance;
unsigned instance_count;
int vertex_offset;
unsigned offset_start;
int offset_start;
uint32_t layer_id;
struct mali_invocation_packed invocation;
struct {
@@ -1423,6 +1423,14 @@ panvk_per_arch(CmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount,
if (instanceCount == 0 || vertexCount == 0)
return;
/* gl_BaseVertexARB is a signed integer, and it should expose the value of
* firstVertex in a non-indexed draw. */
assert(firstVertex < INT32_MAX);
/* gl_BaseInstance is a signed integer, and it should expose the value of
* firstInstnace. */
assert(firstInstance < INT32_MAX);
struct panvk_draw_info draw = {
.first_vertex = firstVertex,
.vertex_count = vertexCount,
@@ -1498,6 +1506,10 @@ panvk_per_arch(CmdDrawIndexed)(VkCommandBuffer commandBuffer,
if (instanceCount == 0 || indexCount == 0)
return;
/* gl_BaseInstance is a signed integer, and it should expose the value of
* firstInstnace. */
assert(firstInstance < INT32_MAX);
const struct vk_input_assembly_state *ia =
&cmdbuf->vk.dynamic_graphics_state.ia;
bool primitive_restart = ia->primitive_restart_enable;

View File

@@ -63,8 +63,8 @@ struct panvk_graphics_sysvals {
} blend;
struct {
uint32_t first_vertex;
uint32_t base_instance;
int32_t first_vertex;
int32_t base_instance;
uint32_t noperspective_varyings;
} vs;