The default is 512 KB, but radeonsi wants 4 MB.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4154>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4154>
case PIPE_CAP_PSIZ_CLAMPED:
return 0;
+ case PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE:
+ return 512 * 1024;
+
default:
unreachable("bad PIPE_CAP_*");
}
* ``PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED``: Driver needs the nir_lower_viewport_transform pass to be enabled. This also means that the gl_Position value is modified and should be lowered for transform feedback, if needed. Defaults to false.
* ``PIPE_CAP_PSIZ_CLAMPED``: Driver needs for the point size to be clamped. Additionally, the gl_PointSize has been modified and its value should be lowered for transform feedback, if needed. Defaults to false.
* ``PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICES``: pipe_draw_info::start can be non-zero with user indices.
+* ``PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE``: Buffer size used to upload vertices for glBegin/glEnd.
.. _pipe_capf:
/* Optimal number for good TexSubImage performance on Polaris10. */
return 64 * 1024 * 1024;
+ case PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE:
+ return 4096 * 1024;
+
case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
return MIN2(sscreen->info.max_alloc_size, INT_MAX);
PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED,
PIPE_CAP_PSIZ_CLAMPED,
PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICES,
+ PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE,
};
/**
consts->ConservativeRasterDilateRange[0] = 0.0;
consts->ConservativeRasterDilateRange[1] = 0.0;
consts->ConservativeRasterDilateGranularity = 0.0;
+
+ consts->glBeginEndBufferSize = 512 * 1024;
}
struct spirv_supported_extensions *SpirVExtensions;
char *VendorOverride;
+
+ /** Buffer size used to upload vertices from glBegin/glEnd. */
+ unsigned glBeginEndBufferSize;
};
c->MultiDrawWithUserIndices =
screen->get_param(screen, PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICES);
+
+ c->glBeginEndBufferSize =
+ screen->get_param(screen, PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE);
}
#define VBO_MAX_PRIM 64
-/**
- * Size (in bytes) of the VBO to use for glBegin/glVertex/glEnd-style rendering.
- */
-#define VBO_VERT_BUFFER_SIZE (1024 * 512)
-
-
struct vbo_exec_eval1_map {
struct gl_1d_map *map;
GLuint sz;
&exec->vtx.bufferobj,
ctx->Shared->NullBufferObj);
- exec->vtx.buffer_map = _mesa_align_malloc(VBO_VERT_BUFFER_SIZE, 64);
+ exec->vtx.buffer_map =
+ _mesa_align_malloc(ctx->Const.glBeginEndBufferSize, 64);
exec->vtx.buffer_ptr = exec->vtx.buffer_map;
}
exec->vtx.buffer_used += (exec->vtx.buffer_ptr -
exec->vtx.buffer_map) * sizeof(float);
- assert(exec->vtx.buffer_used <= VBO_VERT_BUFFER_SIZE);
+ assert(exec->vtx.buffer_used <= exec->ctx->Const.glBeginEndBufferSize);
assert(exec->vtx.buffer_ptr != NULL);
ctx->Driver.UnmapBuffer(ctx, exec->vtx.bufferobj, MAP_INTERNAL);
static bool
vbo_exec_buffer_has_space(struct vbo_exec_context *exec)
{
- return VBO_VERT_BUFFER_SIZE > exec->vtx.buffer_used + 1024;
+ return exec->ctx->Const.glBeginEndBufferSize > exec->vtx.buffer_used + 1024;
}
exec->vtx.buffer_map = (fi_type *)
ctx->Driver.MapBufferRange(ctx,
exec->vtx.buffer_used,
- VBO_VERT_BUFFER_SIZE
+ ctx->Const.glBeginEndBufferSize
- exec->vtx.buffer_used,
accessRange,
exec->vtx.bufferobj,
exec->vtx.buffer_used = 0;
if (ctx->Driver.BufferData(ctx, GL_ARRAY_BUFFER_ARB,
- VBO_VERT_BUFFER_SIZE,
+ ctx->Const.glBeginEndBufferSize,
NULL, usage,
GL_MAP_WRITE_BIT |
(ctx->Extensions.ARB_buffer_storage ?
/* buffer allocation worked, now map the buffer */
exec->vtx.buffer_map =
(fi_type *)ctx->Driver.MapBufferRange(ctx,
- 0, VBO_VERT_BUFFER_SIZE,
+ 0, ctx->Const.glBeginEndBufferSize,
accessRange,
exec->vtx.bufferobj,
MAP_INTERNAL);
static inline unsigned
vbo_compute_max_verts(const struct vbo_exec_context *exec)
{
- unsigned n = (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) /
- (exec->vtx.vertex_size * sizeof(GLfloat));
+ unsigned n = (exec->ctx->Const.glBeginEndBufferSize -
+ exec->vtx.buffer_used) /
+ (exec->vtx.vertex_size * sizeof(GLfloat));
if (n == 0)
return 0;
/* Subtract one so we're always sure to have room for an extra