}
static ALWAYS_INLINE bool
-upload_vertices(struct gl_context *ctx, unsigned attrib_mask,
+upload_vertices(struct gl_context *ctx, unsigned user_buffer_mask,
unsigned start_vertex, unsigned num_vertices,
unsigned start_instance, unsigned num_instances,
- struct glthread_attrib_binding *attribs)
+ struct glthread_attrib_binding *buffers)
{
struct glthread_vao *vao = ctx->GLThread.CurrentVAO;
- unsigned attrib_mask_iter = attrib_mask;
- unsigned num_attribs = 0;
+ unsigned attrib_mask_iter = user_buffer_mask;
+ unsigned num_buffers = 0;
- assert((num_vertices || !(attrib_mask & ~vao->NonZeroDivisorMask)) &&
- (num_instances || !(attrib_mask & vao->NonZeroDivisorMask)));
+ assert((num_vertices || !(user_buffer_mask & ~vao->NonZeroDivisorMask)) &&
+ (num_instances || !(user_buffer_mask & vao->NonZeroDivisorMask)));
while (attrib_mask_iter) {
unsigned i = u_bit_scan(&attrib_mask_iter);
size, &upload_offset, &upload_buffer, NULL);
assert(upload_buffer);
- attribs[num_attribs].buffer = upload_buffer;
- attribs[num_attribs].offset = upload_offset - offset;
- attribs[num_attribs].original_pointer = ptr;
- num_attribs++;
+ buffers[num_buffers].buffer = upload_buffer;
+ buffers[num_buffers].offset = upload_offset - offset;
+ buffers[num_buffers].original_pointer = ptr;
+ num_buffers++;
}
return true;
}
GLsizei count;
GLsizei instance_count;
GLuint baseinstance;
- GLuint non_vbo_attrib_mask;
+ GLuint user_buffer_mask;
};
void
const GLsizei count = cmd->count;
const GLsizei instance_count = cmd->instance_count;
const GLuint baseinstance = cmd->baseinstance;
- const GLuint non_vbo_attrib_mask = cmd->non_vbo_attrib_mask;
- const struct glthread_attrib_binding *attribs =
+ const GLuint user_buffer_mask = cmd->user_buffer_mask;
+ const struct glthread_attrib_binding *buffers =
(const struct glthread_attrib_binding *)(cmd + 1);
/* Bind uploaded buffers if needed. */
- if (non_vbo_attrib_mask) {
- _mesa_InternalBindVertexBuffers(ctx, attribs, non_vbo_attrib_mask,
+ if (user_buffer_mask) {
+ _mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
false);
}
baseinstance));
/* Restore states. */
- if (non_vbo_attrib_mask) {
- _mesa_InternalBindVertexBuffers(ctx, attribs, non_vbo_attrib_mask,
+ if (user_buffer_mask) {
+ _mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
true);
}
}
static ALWAYS_INLINE void
draw_arrays_async(struct gl_context *ctx, GLenum mode, GLint first,
GLsizei count, GLsizei instance_count, GLuint baseinstance,
- unsigned non_vbo_attrib_mask,
- const struct glthread_attrib_binding *attribs)
+ unsigned user_buffer_mask,
+ const struct glthread_attrib_binding *buffers)
{
- int attribs_size = util_bitcount(non_vbo_attrib_mask) * sizeof(attribs[0]);
+ int buffers_size = util_bitcount(user_buffer_mask) * sizeof(buffers[0]);
int cmd_size = sizeof(struct marshal_cmd_DrawArraysInstancedBaseInstance) +
- attribs_size;
+ buffers_size;
struct marshal_cmd_DrawArraysInstancedBaseInstance *cmd;
cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DrawArraysInstancedBaseInstance,
cmd->count = count;
cmd->instance_count = instance_count;
cmd->baseinstance = baseinstance;
- cmd->non_vbo_attrib_mask = non_vbo_attrib_mask;
+ cmd->user_buffer_mask = user_buffer_mask;
- if (non_vbo_attrib_mask)
- memcpy(cmd + 1, attribs, attribs_size);
+ if (user_buffer_mask)
+ memcpy(cmd + 1, buffers, buffers_size);
}
static ALWAYS_INLINE void
GET_CURRENT_CONTEXT(ctx);
struct glthread_vao *vao = ctx->GLThread.CurrentVAO;
- unsigned non_vbo_attrib_mask = vao->UserPointerMask & vao->Enabled;
+ unsigned user_buffer_mask = vao->UserPointerMask & vao->Enabled;
if (compiled_into_dlist && ctx->GLThread.inside_dlist) {
_mesa_glthread_finish_before(ctx, "DrawArrays");
* This is also an error path. Zero counts should still call the driver
* for possible GL errors.
*/
- if (ctx->API == API_OPENGL_CORE || !non_vbo_attrib_mask ||
+ if (ctx->API == API_OPENGL_CORE || !user_buffer_mask ||
count <= 0 || instance_count <= 0) {
draw_arrays_async(ctx, mode, first, count, instance_count, baseinstance,
0, NULL);
}
/* Upload and draw. */
- struct glthread_attrib_binding attribs[VERT_ATTRIB_MAX];
+ struct glthread_attrib_binding buffers[VERT_ATTRIB_MAX];
if (!ctx->GLThread.SupportsNonVBOUploads ||
- !upload_vertices(ctx, non_vbo_attrib_mask, first, count, baseinstance,
- instance_count, attribs)) {
+ !upload_vertices(ctx, user_buffer_mask, first, count, baseinstance,
+ instance_count, buffers)) {
_mesa_glthread_finish_before(ctx, "DrawArrays");
CALL_DrawArraysInstancedBaseInstance(ctx->CurrentServerDispatch,
(mode, first, count, instance_count,
}
draw_arrays_async(ctx, mode, first, count, instance_count, baseinstance,
- non_vbo_attrib_mask, attribs);
+ user_buffer_mask, buffers);
}
struct marshal_cmd_MultiDrawArrays
struct marshal_cmd_base cmd_base;
GLenum mode;
GLsizei draw_count;
- GLuint non_vbo_attrib_mask;
+ GLuint user_buffer_mask;
};
void
{
const GLenum mode = cmd->mode;
const GLsizei draw_count = cmd->draw_count;
- const GLuint non_vbo_attrib_mask = cmd->non_vbo_attrib_mask;
+ const GLuint user_buffer_mask = cmd->user_buffer_mask;
const char *variable_data = (const char *)(cmd + 1);
const GLint *first = (GLint *)variable_data;
variable_data += sizeof(GLint) * draw_count;
const GLsizei *count = (GLsizei *)variable_data;
variable_data += sizeof(GLsizei) * draw_count;
- const struct glthread_attrib_binding *attribs =
+ const struct glthread_attrib_binding *buffers =
(const struct glthread_attrib_binding *)variable_data;
/* Bind uploaded buffers if needed. */
- if (non_vbo_attrib_mask) {
- _mesa_InternalBindVertexBuffers(ctx, attribs, non_vbo_attrib_mask,
+ if (user_buffer_mask) {
+ _mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
false);
}
(mode, first, count, draw_count));
/* Restore states. */
- if (non_vbo_attrib_mask) {
- _mesa_InternalBindVertexBuffers(ctx, attribs, non_vbo_attrib_mask,
+ if (user_buffer_mask) {
+ _mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
true);
}
}
static ALWAYS_INLINE void
multi_draw_arrays_async(struct gl_context *ctx, GLenum mode,
const GLint *first, const GLsizei *count,
- GLsizei draw_count, unsigned non_vbo_attrib_mask,
- const struct glthread_attrib_binding *attribs)
+ GLsizei draw_count, unsigned user_buffer_mask,
+ const struct glthread_attrib_binding *buffers)
{
int first_size = sizeof(GLint) * draw_count;
int count_size = sizeof(GLsizei) * draw_count;
- int attribs_size = util_bitcount(non_vbo_attrib_mask) * sizeof(attribs[0]);
+ int buffers_size = util_bitcount(user_buffer_mask) * sizeof(buffers[0]);
int cmd_size = sizeof(struct marshal_cmd_MultiDrawArrays) +
- first_size + count_size + attribs_size;
+ first_size + count_size + buffers_size;
struct marshal_cmd_MultiDrawArrays *cmd;
cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_MultiDrawArrays,
cmd_size);
cmd->mode = mode;
cmd->draw_count = draw_count;
- cmd->non_vbo_attrib_mask = non_vbo_attrib_mask;
+ cmd->user_buffer_mask = user_buffer_mask;
char *variable_data = (char*)(cmd + 1);
memcpy(variable_data, first, first_size);
variable_data += first_size;
memcpy(variable_data, count, count_size);
- if (non_vbo_attrib_mask) {
+ if (user_buffer_mask) {
variable_data += count_size;
- memcpy(variable_data, attribs, attribs_size);
+ memcpy(variable_data, buffers, buffers_size);
}
}
GET_CURRENT_CONTEXT(ctx);
struct glthread_vao *vao = ctx->GLThread.CurrentVAO;
- unsigned non_vbo_attrib_mask = vao->UserPointerMask & vao->Enabled;
+ unsigned user_buffer_mask = vao->UserPointerMask & vao->Enabled;
if (ctx->GLThread.inside_dlist)
goto sync;
if (draw_count >= 0 &&
- (ctx->API == API_OPENGL_CORE || !non_vbo_attrib_mask)) {
+ (ctx->API == API_OPENGL_CORE || !user_buffer_mask)) {
multi_draw_arrays_async(ctx, mode, first, count, draw_count, 0, NULL);
return;
}
}
/* Upload and draw. */
- struct glthread_attrib_binding attribs[VERT_ATTRIB_MAX];
- if (!upload_vertices(ctx, non_vbo_attrib_mask, min_index, num_vertices,
- 0, 1, attribs))
+ struct glthread_attrib_binding buffers[VERT_ATTRIB_MAX];
+ if (!upload_vertices(ctx, user_buffer_mask, min_index, num_vertices,
+ 0, 1, buffers))
goto sync;
multi_draw_arrays_async(ctx, mode, first, count, draw_count,
- non_vbo_attrib_mask, attribs);
+ user_buffer_mask, buffers);
return;
sync:
GLuint baseinstance;
GLuint min_index;
GLuint max_index;
- GLuint non_vbo_attrib_mask;
+ GLuint user_buffer_mask;
const GLvoid *indices;
struct gl_buffer_object *index_buffer;
};
const GLuint baseinstance = cmd->baseinstance;
const GLuint min_index = cmd->min_index;
const GLuint max_index = cmd->max_index;
- const GLuint non_vbo_attrib_mask = cmd->non_vbo_attrib_mask;
+ const GLuint user_buffer_mask = cmd->user_buffer_mask;
struct gl_buffer_object *index_buffer = cmd->index_buffer;
- const struct glthread_attrib_binding *attribs =
+ const struct glthread_attrib_binding *buffers =
(const struct glthread_attrib_binding *)(cmd + 1);
/* Bind uploaded buffers if needed. */
- if (non_vbo_attrib_mask) {
- _mesa_InternalBindVertexBuffers(ctx, attribs, non_vbo_attrib_mask,
+ if (user_buffer_mask) {
+ _mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
false);
}
if (index_buffer) {
if (index_buffer) {
_mesa_InternalBindElementBuffer(ctx, NULL);
}
- if (non_vbo_attrib_mask) {
- _mesa_InternalBindVertexBuffers(ctx, attribs, non_vbo_attrib_mask,
+ if (user_buffer_mask) {
+ _mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
true);
}
}
GLint basevertex, GLuint baseinstance,
bool index_bounds_valid, GLuint min_index, GLuint max_index,
struct gl_buffer_object *index_buffer,
- unsigned non_vbo_attrib_mask,
- const struct glthread_attrib_binding *attribs)
+ unsigned user_buffer_mask,
+ const struct glthread_attrib_binding *buffers)
{
- int attribs_size = util_bitcount(non_vbo_attrib_mask) * sizeof(attribs[0]);
+ int buffers_size = util_bitcount(user_buffer_mask) * sizeof(buffers[0]);
int cmd_size = sizeof(struct marshal_cmd_DrawElementsInstancedBaseVertexBaseInstance) +
- attribs_size;
+ buffers_size;
struct marshal_cmd_DrawElementsInstancedBaseVertexBaseInstance *cmd;
cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_DrawElementsInstancedBaseVertexBaseInstance, cmd_size);
cmd->baseinstance = baseinstance;
cmd->min_index = min_index;
cmd->max_index = max_index;
- cmd->non_vbo_attrib_mask = non_vbo_attrib_mask;
+ cmd->user_buffer_mask = user_buffer_mask;
cmd->index_bounds_valid = index_bounds_valid;
cmd->index_buffer = index_buffer;
- if (non_vbo_attrib_mask)
- memcpy(cmd + 1, attribs, attribs_size);
+ if (user_buffer_mask)
+ memcpy(cmd + 1, buffers, buffers_size);
}
static void
GET_CURRENT_CONTEXT(ctx);
struct glthread_vao *vao = ctx->GLThread.CurrentVAO;
- unsigned non_vbo_attrib_mask = vao->UserPointerMask & vao->Enabled;
+ unsigned user_buffer_mask = vao->UserPointerMask & vao->Enabled;
bool has_user_indices = vao->CurrentElementBufferName == 0;
if (compiled_into_dlist && ctx->GLThread.inside_dlist)
if (ctx->API == API_OPENGL_CORE ||
count <= 0 || instance_count <= 0 || max_index < min_index ||
!is_index_type_valid(type) ||
- (!non_vbo_attrib_mask && !has_user_indices)) {
+ (!user_buffer_mask && !has_user_indices)) {
draw_elements_async(ctx, mode, count, type, indices, instance_count,
basevertex, baseinstance, index_bounds_valid,
min_index, max_index, 0, 0, NULL);
if (!ctx->GLThread.SupportsNonVBOUploads)
goto sync;
- bool need_index_bounds = non_vbo_attrib_mask & ~vao->NonZeroDivisorMask;
+ bool need_index_bounds = user_buffer_mask & ~vao->NonZeroDivisorMask;
unsigned index_size = get_index_size(type);
if (need_index_bounds && !index_bounds_valid) {
if (util_is_vbo_upload_ratio_too_large(count, num_vertices))
goto sync;
- struct glthread_attrib_binding attribs[VERT_ATTRIB_MAX];
- if (non_vbo_attrib_mask &&
- !upload_vertices(ctx, non_vbo_attrib_mask, start_vertex, num_vertices,
- baseinstance, instance_count, attribs))
+ struct glthread_attrib_binding buffers[VERT_ATTRIB_MAX];
+ if (user_buffer_mask &&
+ !upload_vertices(ctx, user_buffer_mask, start_vertex, num_vertices,
+ baseinstance, instance_count, buffers))
goto sync;
/* Upload indices. */
draw_elements_async(ctx, mode, count, type, indices, instance_count,
basevertex, baseinstance, index_bounds_valid,
min_index, max_index, index_buffer,
- non_vbo_attrib_mask, attribs);
+ user_buffer_mask, buffers);
return;
sync:
GLenum mode;
GLenum type;
GLsizei draw_count;
- GLuint non_vbo_attrib_mask;
+ GLuint user_buffer_mask;
struct gl_buffer_object *index_buffer;
};
const GLenum mode = cmd->mode;
const GLenum type = cmd->type;
const GLsizei draw_count = cmd->draw_count;
- const GLuint non_vbo_attrib_mask = cmd->non_vbo_attrib_mask;
+ const GLuint user_buffer_mask = cmd->user_buffer_mask;
struct gl_buffer_object *index_buffer = cmd->index_buffer;
const bool has_base_vertex = cmd->has_base_vertex;
basevertex = (GLsizei *)variable_data;
variable_data += sizeof(GLsizei) * draw_count;
}
- const struct glthread_attrib_binding *attribs =
+ const struct glthread_attrib_binding *buffers =
(const struct glthread_attrib_binding *)variable_data;
/* Bind uploaded buffers if needed. */
- if (non_vbo_attrib_mask) {
- _mesa_InternalBindVertexBuffers(ctx, attribs, non_vbo_attrib_mask,
+ if (user_buffer_mask) {
+ _mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
false);
}
if (index_buffer) {
if (index_buffer) {
_mesa_InternalBindElementBuffer(ctx, NULL);
}
- if (non_vbo_attrib_mask) {
- _mesa_InternalBindVertexBuffers(ctx, attribs, non_vbo_attrib_mask,
+ if (user_buffer_mask) {
+ _mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask,
true);
}
}
const GLvoid *const *indices, GLsizei draw_count,
const GLsizei *basevertex,
struct gl_buffer_object *index_buffer,
- unsigned non_vbo_attrib_mask,
- const struct glthread_attrib_binding *attribs)
+ unsigned user_buffer_mask,
+ const struct glthread_attrib_binding *buffers)
{
int count_size = sizeof(GLsizei) * draw_count;
int indices_size = sizeof(indices[0]) * draw_count;
int basevertex_size = basevertex ? sizeof(GLsizei) * draw_count : 0;
- int attribs_size = util_bitcount(non_vbo_attrib_mask) * sizeof(attribs[0]);
+ int buffers_size = util_bitcount(user_buffer_mask) * sizeof(buffers[0]);
int cmd_size = sizeof(struct marshal_cmd_MultiDrawElementsBaseVertex) +
- count_size + indices_size + basevertex_size + attribs_size;
+ count_size + indices_size + basevertex_size + buffers_size;
struct marshal_cmd_MultiDrawElementsBaseVertex *cmd;
cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_MultiDrawElementsBaseVertex, cmd_size);
cmd->mode = mode;
cmd->type = type;
cmd->draw_count = draw_count;
- cmd->non_vbo_attrib_mask = non_vbo_attrib_mask;
+ cmd->user_buffer_mask = user_buffer_mask;
cmd->index_buffer = index_buffer;
cmd->has_base_vertex = basevertex != NULL;
variable_data += basevertex_size;
}
- if (non_vbo_attrib_mask)
- memcpy(variable_data, attribs, attribs_size);
+ if (user_buffer_mask)
+ memcpy(variable_data, buffers, buffers_size);
}
void GLAPIENTRY
GET_CURRENT_CONTEXT(ctx);
struct glthread_vao *vao = ctx->GLThread.CurrentVAO;
- unsigned non_vbo_attrib_mask = vao->UserPointerMask & vao->Enabled;
+ unsigned user_buffer_mask = vao->UserPointerMask & vao->Enabled;
bool has_user_indices = vao->CurrentElementBufferName == 0;
if (ctx->GLThread.inside_dlist)
if (draw_count >= 0 &&
(ctx->API == API_OPENGL_CORE ||
!is_index_type_valid(type) ||
- (!non_vbo_attrib_mask && !has_user_indices))) {
+ (!user_buffer_mask && !has_user_indices))) {
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
basevertex, 0, 0, NULL);
return;
}
- bool need_index_bounds = non_vbo_attrib_mask & ~vao->NonZeroDivisorMask;
+ bool need_index_bounds = user_buffer_mask & ~vao->NonZeroDivisorMask;
/* If the draw count is too high or negative, the queue can't be used.
*
}
/* Upload vertices. */
- struct glthread_attrib_binding attribs[VERT_ATTRIB_MAX];
- if (non_vbo_attrib_mask &&
- !upload_vertices(ctx, non_vbo_attrib_mask, min_index, num_vertices,
- 0, 1, attribs))
+ struct glthread_attrib_binding buffers[VERT_ATTRIB_MAX];
+ if (user_buffer_mask &&
+ !upload_vertices(ctx, user_buffer_mask, min_index, num_vertices,
+ 0, 1, buffers))
goto sync;
/* Upload indices. */
/* Draw asynchronously. */
multi_draw_elements_async(ctx, mode, count, type, indices, draw_count,
- basevertex, index_buffer, non_vbo_attrib_mask,
- attribs);
+ basevertex, index_buffer, user_buffer_mask,
+ buffers);
return;
sync: