mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 08:40:11 +01:00
mesa/st: move draw indirect and xfb to direct calls.
These don't get used any other way. Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14100>
This commit is contained in:
parent
132ffc46dc
commit
5312511ea5
4 changed files with 30 additions and 55 deletions
|
|
@ -204,48 +204,6 @@ struct dd_function_table {
|
|||
const unsigned char *mode,
|
||||
unsigned num_draws);
|
||||
|
||||
/**
|
||||
* Draw a primitive, getting the vertex count, instance count, start
|
||||
* vertex, etc. from a buffer object.
|
||||
* \param mode GL_POINTS, GL_LINES, GL_TRIANGLE_STRIP, etc.
|
||||
* \param indirect_data buffer to get "DrawArrays/ElementsIndirectCommand"
|
||||
* data
|
||||
* \param indirect_offset offset of first primitive in indrect_data buffer
|
||||
* \param draw_count number of primitives to draw
|
||||
* \param stride stride, in bytes, between
|
||||
* "DrawArrays/ElementsIndirectCommand" objects
|
||||
* \param indirect_draw_count_buffer if non-NULL specifies a buffer to get
|
||||
* the real draw_count value. Used for
|
||||
* GL_ARB_indirect_parameters.
|
||||
* \param indirect_draw_count_offset offset to the draw_count value in
|
||||
* indirect_draw_count_buffer
|
||||
* \param ib index buffer for indexed drawing, NULL otherwise.
|
||||
*/
|
||||
void (*DrawIndirect)(struct gl_context *ctx, GLuint mode,
|
||||
struct gl_buffer_object *indirect_data,
|
||||
GLsizeiptr indirect_offset, unsigned draw_count,
|
||||
unsigned stride,
|
||||
struct gl_buffer_object *indirect_draw_count_buffer,
|
||||
GLsizeiptr indirect_draw_count_offset,
|
||||
const struct _mesa_index_buffer *ib,
|
||||
bool primitive_restart,
|
||||
unsigned restart_index);
|
||||
|
||||
/**
|
||||
* Driver implementation of glDrawTransformFeedback.
|
||||
*
|
||||
* \param mode Primitive type
|
||||
* \param num_instances instance count from ARB_draw_instanced
|
||||
* \param stream If called via DrawTransformFeedbackStream, specifies
|
||||
* the vertex stream buffer from which to get the vertex
|
||||
* count.
|
||||
* \param tfb_vertcount if non-null, indicates which transform feedback
|
||||
* object has the vertex count.
|
||||
*/
|
||||
void (*DrawTransformFeedback)(struct gl_context *ctx, GLenum mode,
|
||||
unsigned num_instances, unsigned stream,
|
||||
struct gl_transform_feedback_object *tfb_vertcount);
|
||||
|
||||
void (*DrawGalliumVertexState)(struct gl_context *ctx,
|
||||
struct pipe_vertex_state *state,
|
||||
struct pipe_draw_vertex_state_info info,
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@
|
|||
#include "transformfeedback.h"
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
#include "state_tracker/st_draw.h"
|
||||
|
||||
typedef struct {
|
||||
GLuint count;
|
||||
GLuint primCount;
|
||||
|
|
@ -2299,7 +2301,7 @@ _mesa_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
|
|||
* (like in DrawArrays), but we have no way to know how many vertices
|
||||
* will be rendered. */
|
||||
|
||||
ctx->Driver.DrawTransformFeedback(ctx, mode, numInstances, stream, obj);
|
||||
st_draw_transform_feedback(ctx, mode, numInstances, stream, obj);
|
||||
|
||||
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
|
||||
_mesa_flush(ctx);
|
||||
|
|
@ -2373,9 +2375,9 @@ _mesa_validated_multidrawarraysindirect(struct gl_context *ctx, GLenum mode,
|
|||
if (drawcount == 0)
|
||||
return;
|
||||
|
||||
ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, indirect,
|
||||
drawcount, stride, drawcount_buffer,
|
||||
drawcount_offset, NULL, false, 0);
|
||||
st_indirect_draw_vbo(ctx, mode, ctx->DrawIndirectBuffer, indirect,
|
||||
drawcount, stride, drawcount_buffer,
|
||||
drawcount_offset, NULL, false, 0);
|
||||
|
||||
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
|
||||
_mesa_flush(ctx);
|
||||
|
|
@ -2401,11 +2403,11 @@ _mesa_validated_multidrawelementsindirect(struct gl_context *ctx,
|
|||
ib.ptr = NULL;
|
||||
ib.index_size_shift = get_index_size_shift(type);
|
||||
|
||||
ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, indirect,
|
||||
drawcount, stride, drawcount_buffer,
|
||||
drawcount_offset, &ib,
|
||||
ctx->Array._PrimitiveRestart[ib.index_size_shift],
|
||||
ctx->Array._RestartIndex[ib.index_size_shift]);
|
||||
st_indirect_draw_vbo(ctx, mode, ctx->DrawIndirectBuffer, indirect,
|
||||
drawcount, stride, drawcount_buffer,
|
||||
drawcount_offset, &ib,
|
||||
ctx->Array._PrimitiveRestart[ib.index_size_shift],
|
||||
ctx->Array._RestartIndex[ib.index_size_shift]);
|
||||
|
||||
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
|
||||
_mesa_flush(ctx);
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ st_draw_gallium_multimode(struct gl_context *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
st_indirect_draw_vbo(struct gl_context *ctx,
|
||||
GLuint mode,
|
||||
struct gl_buffer_object *indirect_data,
|
||||
|
|
@ -287,7 +287,7 @@ st_indirect_draw_vbo(struct gl_context *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
st_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
|
||||
unsigned num_instances, unsigned stream,
|
||||
struct gl_transform_feedback_object *tfb_vertcount)
|
||||
|
|
@ -375,8 +375,6 @@ st_init_draw_functions(struct pipe_screen *screen,
|
|||
functions->Draw = NULL;
|
||||
functions->DrawGallium = st_draw_gallium;
|
||||
functions->DrawGalliumMultiMode = st_draw_gallium_multimode;
|
||||
functions->DrawIndirect = st_indirect_draw_vbo;
|
||||
functions->DrawTransformFeedback = st_draw_transform_feedback;
|
||||
|
||||
if (screen->get_param(screen, PIPE_CAP_DRAW_VERTEX_STATE)) {
|
||||
functions->DrawGalliumVertexState = st_draw_gallium_vertex_state;
|
||||
|
|
|
|||
|
|
@ -82,4 +82,21 @@ st_draw_quad(struct st_context *st,
|
|||
const float *color,
|
||||
unsigned num_instances);
|
||||
|
||||
void
|
||||
st_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
|
||||
unsigned num_instances, unsigned stream,
|
||||
struct gl_transform_feedback_object *tfb_vertcount);
|
||||
|
||||
void
|
||||
st_indirect_draw_vbo(struct gl_context *ctx,
|
||||
GLuint mode,
|
||||
struct gl_buffer_object *indirect_data,
|
||||
GLsizeiptr indirect_offset,
|
||||
unsigned draw_count,
|
||||
unsigned stride,
|
||||
struct gl_buffer_object *indirect_draw_count,
|
||||
GLsizeiptr indirect_draw_count_offset,
|
||||
const struct _mesa_index_buffer *ib,
|
||||
bool primitive_restart,
|
||||
unsigned restart_index);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue