mesa: add Driver.DrawGallium* functions to be used by main/draw.c

This is a new Draw interface using the same parameters as draw_vbo.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7679>
This commit is contained in:
Marek Olšák 2020-11-03 12:14:12 -05:00
parent d1a19907f9
commit 3e7a8c4ac4
2 changed files with 44 additions and 0 deletions

View File

@ -121,6 +121,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
/* Draw functions */
driver->Draw = NULL;
driver->DrawGallium = NULL;
driver->DrawGalliumComplex = NULL;
driver->DrawIndirect = NULL;
driver->DrawTransformFeedback = NULL;

View File

@ -56,6 +56,8 @@ struct ati_fragment_shader;
struct util_queue_monitoring;
struct _mesa_prim;
struct _mesa_index_buffer;
struct pipe_draw_info;
struct pipe_draw_start_count;
/* GL_ARB_vertex_buffer_object */
/* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return
@ -554,6 +556,46 @@ struct dd_function_table {
unsigned min_index, unsigned max_index,
unsigned num_instances, unsigned base_instance);
/**
* Optimal Gallium version of Draw() that doesn't require translation
* of draw info in the state tracker.
*
* The interface is identical to pipe_context::draw_vbo
* with indirect == NULL.
*
* "info" is not const and the following fields can be changed by
* the callee, so callers should be aware:
* - info->index_bounds_valid (if false)
* - info->min_index (if index_bounds_valid is false)
* - info->max_index (if index_bounds_valid is false)
* - info->drawid (if increment_draw_id is true)
* - info->index.gl_bo (if index_size && !has_user_indices)
*/
void (*DrawGallium)(struct gl_context *ctx,
struct pipe_draw_info *info,
const struct pipe_draw_start_count *draws,
unsigned num_draws);
/**
* Same as DrawGallium, but base_vertex and mode can also change between draws.
*
* If index_bias != NULL, index_bias changes for each draw.
* If mode != NULL, mode changes for each draw.
* At least one of them must be non-NULL.
*
* "info" is not const and the following fields can be changed by
* the callee in addition to the fields listed by DrawGallium:
* - info->mode (if mode != NULL)
* - info->index_bias (if index_bias != NULL)
*
* This function exists to decrease complexity of DrawGallium.
*/
void (*DrawGalliumComplex)(struct gl_context *ctx,
struct pipe_draw_info *info,
const struct pipe_draw_start_count *draws,
const unsigned char *mode,
const int *base_vertex,
unsigned num_draws);
/**
* Draw a primitive, getting the vertex count, instance count, start