Convert unsigned long to uintptr_t for fixes compiling error on win32/mingw64
```
../src/vrend_renderer.c:5162:75: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
5162 | glDrawElementsInstancedBaseVertex(mode, info->count, elsz, (void *)(unsigned long)sub_ctx->ib.offset, info->instance_count, info->index_bias);
```
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 4a490cc..0ef692b 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -4297,9 +4297,9 @@
enable_bitmask |= (1 << loc);
if (util_format_is_pure_integer(ve->base.src_format)) {
- glVertexAttribIPointer(loc, size, ve->type, vbo->base.stride, (void *)(unsigned long)(ve->base.src_offset + vbo->base.buffer_offset));
+ glVertexAttribIPointer(loc, size, ve->type, vbo->base.stride, (void *)(uintptr_t)(ve->base.src_offset + vbo->base.buffer_offset));
} else {
- glVertexAttribPointer(loc, size, ve->type, ve->norm, vbo->base.stride, (void *)(unsigned long)(ve->base.src_offset + vbo->base.buffer_offset));
+ glVertexAttribPointer(loc, size, ve->type, ve->norm, vbo->base.stride, (void *)(uintptr_t)(ve->base.src_offset + vbo->base.buffer_offset));
}
glVertexAttribDivisorARB(loc, ve->base.instance_divisor);
}
@@ -5073,12 +5073,12 @@
if (indirect_handle) {
if (indirect_params_res)
- glMultiDrawArraysIndirectCountARB(mode, (GLvoid const *)(unsigned long)info->indirect.offset,
+ glMultiDrawArraysIndirectCountARB(mode, (GLvoid const *)(uintptr_t)info->indirect.offset,
info->indirect.indirect_draw_count_offset, info->indirect.draw_count, info->indirect.stride);
else if (info->indirect.draw_count > 1)
- glMultiDrawArraysIndirect(mode, (GLvoid const *)(unsigned long)info->indirect.offset, info->indirect.draw_count, info->indirect.stride);
+ glMultiDrawArraysIndirect(mode, (GLvoid const *)(uintptr_t)info->indirect.offset, info->indirect.draw_count, info->indirect.stride);
else
- glDrawArraysIndirect(mode, (GLvoid const *)(unsigned long)info->indirect.offset);
+ glDrawArraysIndirect(mode, (GLvoid const *)(uintptr_t)info->indirect.offset);
} else if (info->instance_count > 0) {
if (info->start_instance > 0)
glDrawArraysInstancedBaseInstance(mode, start, count, info->instance_count, info->start_instance);
@@ -5104,31 +5104,31 @@
if (indirect_handle) {
if (indirect_params_res)
- glMultiDrawElementsIndirectCountARB(mode, elsz, (GLvoid const *)(unsigned long)info->indirect.offset,
+ glMultiDrawElementsIndirectCountARB(mode, elsz, (GLvoid const *)(uintptr_t)info->indirect.offset,
info->indirect.indirect_draw_count_offset, info->indirect.draw_count, info->indirect.stride);
else if (info->indirect.draw_count > 1)
- glMultiDrawElementsIndirect(mode, elsz, (GLvoid const *)(unsigned long)info->indirect.offset, info->indirect.draw_count, info->indirect.stride);
+ glMultiDrawElementsIndirect(mode, elsz, (GLvoid const *)(uintptr_t)info->indirect.offset, info->indirect.draw_count, info->indirect.stride);
else
- glDrawElementsIndirect(mode, elsz, (GLvoid const *)(unsigned long)info->indirect.offset);
+ glDrawElementsIndirect(mode, elsz, (GLvoid const *)(uintptr_t)info->indirect.offset);
} else if (info->index_bias) {
if (info->instance_count > 0) {
if (info->start_instance > 0)
- glDrawElementsInstancedBaseVertexBaseInstance(mode, info->count, elsz, (void *)(unsigned long)sub_ctx->ib.offset,
+ glDrawElementsInstancedBaseVertexBaseInstance(mode, info->count, elsz, (void *)(uintptr_t)sub_ctx->ib.offset,
info->instance_count, info->index_bias, info->start_instance);
else
- glDrawElementsInstancedBaseVertex(mode, info->count, elsz, (void *)(unsigned long)sub_ctx->ib.offset, info->instance_count, info->index_bias);
+ glDrawElementsInstancedBaseVertex(mode, info->count, elsz, (void *)(uintptr_t)sub_ctx->ib.offset, info->instance_count, info->index_bias);
} else if (info->min_index != 0 || info->max_index != (unsigned)-1)
- glDrawRangeElementsBaseVertex(mode, info->min_index, info->max_index, info->count, elsz, (void *)(unsigned long)sub_ctx->ib.offset, info->index_bias);
+ glDrawRangeElementsBaseVertex(mode, info->min_index, info->max_index, info->count, elsz, (void *)(uintptr_t)sub_ctx->ib.offset, info->index_bias);
else
- glDrawElementsBaseVertex(mode, info->count, elsz, (void *)(unsigned long)sub_ctx->ib.offset, info->index_bias);
+ glDrawElementsBaseVertex(mode, info->count, elsz, (void *)(uintptr_t)sub_ctx->ib.offset, info->index_bias);
} else if (info->instance_count > 1) {
- glDrawElementsInstancedARB(mode, info->count, elsz, (void *)(unsigned long)sub_ctx->ib.offset, info->instance_count);
+ glDrawElementsInstancedARB(mode, info->count, elsz, (void *)(uintptr_t)sub_ctx->ib.offset, info->instance_count);
} else if (info->min_index != 0 || info->max_index != (unsigned)-1)
- glDrawRangeElements(mode, info->min_index, info->max_index, info->count, elsz, (void *)(unsigned long)sub_ctx->ib.offset);
+ glDrawRangeElements(mode, info->min_index, info->max_index, info->count, elsz, (void *)(uintptr_t)sub_ctx->ib.offset);
else
- glDrawElements(mode, info->count, elsz, (void *)(unsigned long)sub_ctx->ib.offset);
+ glDrawElements(mode, info->count, elsz, (void *)(uintptr_t)sub_ctx->ib.offset);
}
if (info->primitive_restart) {
diff --git a/src/vrend_winsys_egl.c b/src/vrend_winsys_egl.c
index cda67e9..c9695d6 100644
--- a/src/vrend_winsys_egl.c
+++ b/src/vrend_winsys_egl.c
@@ -496,7 +496,7 @@
}
image = eglCreateImageKHR(egl->egl_display, eglGetCurrentContext(), EGL_GL_TEXTURE_2D_KHR,
- (EGLClientBuffer)(unsigned long)tex_id, NULL);
+ (EGLClientBuffer)(uintptr_t)tex_id, NULL);
if (!image)
return EINVAL;
@@ -521,7 +521,7 @@
int ret = EINVAL;
EGLImageKHR image = eglCreateImageKHR(egl->egl_display, eglGetCurrentContext(),
EGL_GL_TEXTURE_2D_KHR,
- (EGLClientBuffer)(unsigned long)tex_id, NULL);
+ (EGLClientBuffer)(uintptr_t)tex_id, NULL);
if (!image)
return EINVAL;
if (!has_bit(egl->extension_bits, EGL_MESA_IMAGE_DMA_BUF_EXPORT))
@@ -546,7 +546,7 @@
EGLBoolean success;
int ret;
image = eglCreateImageKHR(egl->egl_display, eglGetCurrentContext(), EGL_GL_TEXTURE_2D_KHR,
- (EGLClientBuffer)(unsigned long)tex_id, NULL);
+ (EGLClientBuffer)(uintptr_t)tex_id, NULL);
if (!image)
return EINVAL;