Mesa (master): mesa: Remove Array._DrawArrays.
Module: Mesa Branch: master Commit: 881d2fcafaddd391b03753173d126148c9dafbcf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=881d2fcafaddd391b03753173d126148c9dafbcf Author: Mathias Fröhlich Date: Sun Apr 1 20:18:36 2018 +0200 mesa: Remove Array._DrawArrays. Only tnl based drivers still use this array. So remove it from core mesa and use Array._DrawVAO instead. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 4 ++-- src/mesa/main/arrayobj.c | 1 - src/mesa/main/attrib.c | 1 - src/mesa/main/mtypes.h | 6 -- src/mesa/main/varray.h | 14 -- src/mesa/tnl/t_draw.c| 11 +-- src/mesa/tnl/tnl.h | 2 +- 7 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c index 79b444cf55..d031ebeabd 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c @@ -550,9 +550,9 @@ TAG(vbo_draw)(struct gl_context *ctx, struct gl_buffer_object *indirect) { /* Borrow and update the inputs list from the tnl context */ - _tnl_bind_inputs(ctx); + const struct gl_vertex_array* arrays = _tnl_bind_inputs(ctx); - TAG(vbo_check_render_prims)(ctx, ctx->Array._DrawArrays, + TAG(vbo_check_render_prims)(ctx, arrays, prims, nr_prims, ib, index_bounds_valid, min_index, max_index, tfb_vertcount, stream, indirect); diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 05af50ef40..5ee68cf9e9 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -970,7 +970,6 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, bool no_error) * or to prevent a crash if the VAO being unbound is going to be * deleted. */ - _mesa_set_drawing_arrays(ctx, NULL); _mesa_set_draw_vao(ctx, ctx->Array._EmptyVAO, 0); ctx->NewState |= _NEW_ARRAY; diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index e565750a89..cbe93ab6fa 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1588,7 +1588,6 @@ copy_array_attrib(struct gl_context *ctx, /* skip IndexBufferObj */ /* Invalidate array state. It will be updated during the next draw. */ - _mesa_set_drawing_arrays(ctx, NULL); _mesa_set_draw_vao(ctx, ctx->Array._EmptyVAO, 0); } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index e751704386..0b55a510b0 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1629,12 +1629,6 @@ struct gl_array_attrib */ struct gl_vertex_array_object *_EmptyVAO; - /** -* Vertex arrays as consumed by a driver. -* The array pointer is set up only by the VBO module. -*/ - const struct gl_vertex_array *_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */ - /** Legal array datatypes and the API for which they have been computed */ GLbitfield LegalTypesMask; gl_api LegalTypesMaskAPI; diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 25d2a29e73..6ab55ed36a 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -53,20 +53,6 @@ _mesa_attr_zero_aliases_vertex(const struct gl_context *ctx) } -/** - * This specifies the set of vertex arrays used by the driver for drawing. - */ -static inline void -_mesa_set_drawing_arrays(struct gl_context *ctx, - const struct gl_vertex_array *arrays) -{ - if (ctx->Array._DrawArrays != arrays) { - ctx->Array._DrawArrays = arrays; - ctx->NewDriverState |= ctx->DriverFlags.NewArray; - } -} - - extern void _mesa_update_array_format(struct gl_context *ctx, struct gl_vertex_array_object *vao, diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index a83b98eede..9814cdcec1 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -537,12 +537,12 @@ void _tnl_draw_prims(struct gl_context *ctx, } -void +const struct gl_vertex_array* _tnl_bind_inputs( struct gl_context *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); - _mesa_set_drawing_arrays(ctx, tnl->draw_arrays.inputs); _vbo_update_inputs(ctx, &tnl->draw_arrays); + return tnl->draw_arrays.inputs; } @@ -558,12 +558,11 @@ _tnl_draw(struct gl_context *ctx, struct gl_transform_feedback_object *tfb_vertcount, unsigned stream, struct gl_buffer_object *indirect) { - /* Update TNLcontext::draw_arrays and set that pointer -* into Array._DrawArrays. + /* Update TNLcontext::draw_arrays and return that pointer. */ - _tnl_bind_inputs(ctx); + const struct gl_vertex_array* arrays = _tnl_bind_inputs(ctx); - _tnl_draw_prims(ctx, ctx->Array._DrawArrays, prim, nr_prims, ib,
Mesa (master): st/mesa: Use Array._DrawVAO in st_atom_array.c.
Module: Mesa Branch: master Commit: 19a91841c347107d877bc750371c5fa4e9b4de19 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=19a91841c347107d877bc750371c5fa4e9b4de19 Author: Mathias Fröhlich Date: Sun Apr 1 20:18:36 2018 +0200 st/mesa: Use Array._DrawVAO in st_atom_array.c. Finally make use of the binding information in the VAO when setting up arrays for draw. v2: Emit less relocations also for interleaved userspace arrays. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/state_tracker/st_atom_array.c | 433 - 1 file changed, 108 insertions(+), 325 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c index 2fd67e8d84..9a0935e21a 100644 --- a/src/mesa/state_tracker/st_atom_array.c +++ b/src/mesa/state_tracker/st_atom_array.c @@ -48,6 +48,7 @@ #include "main/bufferobj.h" #include "main/glformats.h" #include "main/varray.h" +#include "main/arrayobj.h" /* vertex_formats[gltype - GL_BYTE][integer*2 + normalized][size - 1] */ static const uint16_t vertex_formats[][4][4] = { @@ -306,79 +307,6 @@ st_pipe_vertex_format(const struct gl_array_attributes *attrib) return vertex_formats[type - GL_BYTE][index][size-1]; } -static const struct gl_vertex_array * -get_client_array(const struct gl_vertex_array *arrays, - unsigned mesaAttr) -{ - /* st_program uses 0x to denote a double placeholder attribute */ - if (mesaAttr == ST_DOUBLE_ATTRIB_PLACEHOLDER) - return NULL; - return &arrays[mesaAttr]; -} - -/** - * Examine the active arrays to determine if we have interleaved - * vertex arrays all living in one VBO, or all living in user space. - */ -static GLboolean -is_interleaved_arrays(const struct st_vertex_program *vp, - const struct gl_vertex_array *arrays, - unsigned num_inputs) -{ - GLuint attr; - const struct gl_buffer_object *firstBufObj = NULL; - GLint firstStride = -1; - const GLubyte *firstPtr = NULL; - GLboolean userSpaceBuffer = GL_FALSE; - - for (attr = 0; attr < num_inputs; attr++) { - const struct gl_vertex_array *array; - const struct gl_vertex_buffer_binding *binding; - const struct gl_array_attributes *attrib; - const GLubyte *ptr; - const struct gl_buffer_object *bufObj; - GLsizei stride; - - array = get_client_array(arrays, vp->index_to_input[attr]); - if (!array) -continue; - - binding = array->BufferBinding; - attrib = array->VertexAttrib; - stride = binding->Stride; /* in bytes */ - ptr = _mesa_vertex_attrib_address(attrib, binding); - - /* To keep things simple, don't allow interleaved zero-stride attribs. */ - if (stride == 0) - return false; - - bufObj = binding->BufferObj; - if (attr == 0) { - /* save info about the first array */ - firstStride = stride; - firstPtr = ptr; - firstBufObj = bufObj; - userSpaceBuffer = !_mesa_is_bufferobj(bufObj); - } - else { - /* check if other arrays interleave with the first, in same buffer */ - if (stride != firstStride) -return GL_FALSE; /* strides don't match */ - - if (bufObj != firstBufObj) -return GL_FALSE; /* arrays in different VBOs */ - - if (llabs(ptr - firstPtr) > firstStride) -return GL_FALSE; /* arrays start too far apart */ - - if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer) -return GL_FALSE; /* mix of VBO and user-space arrays */ - } - } - - return GL_TRUE; -} - static void init_velement(struct pipe_vertex_element *velement, int src_offset, int format, int instance_divisor, int vbo_index) @@ -392,13 +320,14 @@ static void init_velement(struct pipe_vertex_element *velement, static void init_velement_lowered(const struct st_vertex_program *vp, struct pipe_vertex_element *velements, - int src_offset, int format, - int instance_divisor, int vbo_index, - int nr_components, GLboolean doubles, - GLuint *attr_idx) + const struct gl_array_attributes *attrib, + int src_offset, int instance_divisor, + int vbo_index, int idx) { - int idx = *attr_idx; - if (doubles) { + const unsigned format = st_pipe_vertex_format(attrib); + const GLubyte nr_components = attrib->Size; + + if (attrib->Doubles) { int lower_format; if (nr_components < 2) @@ -427,15 +356,11 @@ static void init_velement_lowered(const struct st_vertex_program *vp, init_velement(&velements[idx], src_offset, PIPE_FORMAT_R32G32_UINT, instance_d
Mesa (master): st/mesa: Make the input_to_index array available.
Module: Mesa Branch: master Commit: 9987a072cbc00306eb4d34409f6325ae29728a2f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9987a072cbc00306eb4d34409f6325ae29728a2f Author: Mathias Fröhlich Date: Sun Apr 1 20:18:36 2018 +0200 st/mesa: Make the input_to_index array available. The input_to_index array is already available internally when preparing vertex programs. Store the map in struct st_vertex_program. Also store the bitmask of mesa vertex processing inputs in struct st_vp_variant. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/state_tracker/st_program.c | 17 - src/mesa/state_tracker/st_program.h | 5 + src/mesa/state_tracker/st_shader_cache.c | 4 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index fe72ddaf2c..f256e2e862 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -388,11 +388,11 @@ st_translate_vertex_program(struct st_context *st, enum pipe_error error; unsigned num_outputs = 0; unsigned attr; - ubyte input_to_index[VERT_ATTRIB_MAX] = {0}; ubyte output_semantic_name[VARYING_SLOT_MAX] = {0}; ubyte output_semantic_index[VARYING_SLOT_MAX] = {0}; stvp->num_inputs = 0; + memset(stvp->input_to_index, ~0, sizeof(stvp->input_to_index)); if (stvp->Base.arb.IsPositionInvariant) _mesa_insert_mvp_code(st->ctx, &stvp->Base); @@ -403,7 +403,7 @@ st_translate_vertex_program(struct st_context *st, */ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { if ((stvp->Base.info.inputs_read & BITFIELD64_BIT(attr)) != 0) { - input_to_index[attr] = stvp->num_inputs; + stvp->input_to_index[attr] = stvp->num_inputs; stvp->index_to_input[stvp->num_inputs] = attr; stvp->num_inputs++; if ((stvp->Base.info.vs.double_inputs_read & @@ -415,7 +415,7 @@ st_translate_vertex_program(struct st_context *st, } } /* bit of a hack, presetup potentially unused edgeflag input */ - input_to_index[VERT_ATTRIB_EDGEFLAG] = stvp->num_inputs; + stvp->input_to_index[VERT_ATTRIB_EDGEFLAG] = stvp->num_inputs; stvp->index_to_input[stvp->num_inputs] = VERT_ATTRIB_EDGEFLAG; /* Compute mapping of vertex program outputs to slots. @@ -495,7 +495,7 @@ st_translate_vertex_program(struct st_context *st, &stvp->Base, /* inputs */ stvp->num_inputs, - input_to_index, + stvp->input_to_index, NULL, /* inputSlotToAttr */ NULL, /* input semantic name */ NULL, /* input semantic index */ @@ -518,7 +518,7 @@ st_translate_vertex_program(struct st_context *st, &stvp->Base, /* inputs */ stvp->num_inputs, -input_to_index, +stvp->input_to_index, NULL, /* input semantic name */ NULL, /* input semantic index */ NULL, @@ -598,6 +598,13 @@ st_create_vp_variant(struct st_context *st, fprintf(stderr, "mesa: cannot emulate deprecated features\n"); } + for (unsigned index = 0; index < vpv->num_inputs; ++index) { + unsigned attr = stvp->index_to_input[index]; + if (attr == ST_DOUBLE_ATTRIB_PLACEHOLDER) + continue; + vpv->vert_attrib_mask |= 1u << attr; + } + if (ST_DEBUG & DEBUG_TGSI) { tgsi_dump(vpv->tgsi.tokens, 0); debug_printf("\n"); diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index a520ffbecb..f67ea5eb20 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -196,6 +196,9 @@ struct st_vp_variant /** similar to that in st_vertex_program, but with edgeflags info too */ GLuint num_inputs; + + /** Bitfield of VERT_BIT_* bits of mesa vertex processing inputs */ + GLbitfield vert_attrib_mask; }; @@ -215,6 +218,8 @@ struct st_vertex_program /** maps a TGSI input index back to a Mesa VERT_ATTRIB_x */ ubyte index_to_input[PIPE_MAX_ATTRIBS]; ubyte num_inputs; + /** Reverse mapping of the above */ + ubyte input_to_index[VERT_ATTRIB_MAX]; /** Maps VARYING_SLOT_x to slot */ ubyte result_to_output[VARYING_SLOT_MAX]; diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c index 3ca3fef1df..17f84180ca 100644 --- a/src/mesa/state_tracker/st_shader_cache.c +++ b/src/mesa/state_tracker/st_shader_cache.c @@ -84,6 +84,8 @@ st
Mesa (master): st/mesa: Make feedback draw and rasterpos use _DrawVAO.
Module: Mesa Branch: master Commit: 4c77f0d065d1690f1fd0265a07ac9f6e5d40ea68 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c77f0d065d1690f1fd0265a07ac9f6e5d40ea68 Author: Mathias Fröhlich Date: Thu Apr 26 23:17:20 2018 +0200 st/mesa: Make feedback draw and rasterpos use _DrawVAO. Instead of playing with Array._DrawArrays, make the feedback draw path use Array._DrawVAO. Also st_RasterPos needs to use the VAO then. v2: Use helper methods to get the offset values for array and binding. Update comments. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/state_tracker/st_cb_rasterpos.c | 43 ++--- src/mesa/state_tracker/st_draw_feedback.c | 46 ++- 2 files changed, 24 insertions(+), 65 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index b73d543653..cf4718f8cb 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -38,9 +38,11 @@ #include "main/imports.h" #include "main/macros.h" +#include "main/arrayobj.h" #include "main/feedback.h" #include "main/rastpos.h" -#include "glformats.h" +#include "main/state.h" +#include "main/varray.h" #include "st_context.h" #include "st_atom.h" @@ -61,9 +63,7 @@ struct rastpos_stage struct gl_context *ctx;/**< Rendering context */ /* vertex attrib info we can setup once and re-use */ - struct gl_vertex_buffer_binding binding; - struct gl_array_attributes attrib[VERT_ATTRIB_MAX]; - struct gl_vertex_array array[VERT_ATTRIB_MAX]; + struct gl_vertex_array_object *VAO; struct _mesa_prim prim; }; @@ -103,6 +103,8 @@ rastpos_line( struct draw_stage *stage, struct prim_header *prim ) static void rastpos_destroy(struct draw_stage *stage) { + struct rastpos_stage *rstage = (struct rastpos_stage*)stage; + _mesa_reference_vao(rstage->ctx, &rstage->VAO, NULL); free(stage); } @@ -182,8 +184,6 @@ static struct rastpos_stage * new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw) { struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage); - GLuint i; - GLuint elementSize; rs->stage.draw = draw; rs->stage.next = NULL; @@ -196,20 +196,11 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw) rs->stage.destroy = rastpos_destroy; rs->ctx = ctx; - rs->binding.Stride = 0; - rs->binding.BufferObj = NULL; - - elementSize = _mesa_bytes_per_vertex_attrib(4, GL_FLOAT); - for (i = 0; i < ARRAY_SIZE(rs->array); i++) { - rs->attrib[i].Size = 4; - rs->attrib[i].Type = GL_FLOAT; - rs->attrib[i].Format = GL_RGBA; - rs->attrib[i].Ptr = (GLubyte *) ctx->Current.Attrib[i]; - rs->attrib[i].Normalized = GL_TRUE; - rs->attrib[i]._ElementSize = elementSize; - rs->array[i].BufferBinding = &rs->binding; - rs->array[i].VertexAttrib = &rs->attrib[i]; - } + rs->VAO = _mesa_new_vao(ctx, ~((GLuint)0)); + _mesa_vertex_attrib_binding(ctx, rs->VAO, VERT_ATTRIB_POS, 0, false); + _mesa_update_array_format(ctx, rs->VAO, VERT_ATTRIB_POS, 4, GL_FLOAT, + GL_RGBA, GL_FALSE, GL_FALSE, GL_FALSE, 0); + _mesa_enable_vertex_array_attrib(ctx, rs->VAO, 0, false); rs->prim.mode = GL_POINTS; rs->prim.indexed = 0; @@ -229,7 +220,6 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4]) struct st_context *st = st_context(ctx); struct draw_context *draw = st_get_draw_context(st); struct rastpos_stage *rs; - const struct gl_vertex_array *saved_arrays = ctx->Array._DrawArrays; if (!st->draw) return; @@ -265,16 +255,13 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4]) /* All vertex attribs but position were previously initialized above. * Just plug in position pointer now. */ - rs->attrib[0].Ptr = (GLubyte *) v; + rs->VAO->VertexAttrib[VERT_ATTRIB_POS].Ptr = (GLubyte *) v; + rs->VAO->NewArrays |= VERT_BIT_POS; + _mesa_set_draw_vao(ctx, rs->VAO, VERT_BIT_POS); - /* Draw the point. -* -* Don't set DriverFlags.NewArray. -* st_feedback_draw_vbo doesn't check for that flag. */ - ctx->Array._DrawArrays = rs->array; + /* Draw the point. */ st_feedback_draw_vbo(ctx, &rs->prim, 1, NULL, GL_TRUE, 0, 1, NULL, 0, NULL); - ctx->Array._DrawArrays = saved_arrays; /* restore draw's rasterization stage depending on rendermode */ if (ctx->RenderMode == GL_FEEDBACK) { diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index fa96b4e2e2..eb05ac9669 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -26,6 +26,7 @@ **/ #include "main/imports.h" +#include "main/arrayobj.h" #include "main/image.h" #include "main/macros.h" #include "
Mesa (master): st/mesa: Remove the now unused gl_vertex_array.
Module: Mesa Branch: master Commit: 79eb6ab7b6dc187baa2837d90b3608c6b7a5f366 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=79eb6ab7b6dc187baa2837d90b3608c6b7a5f366 Author: Mathias Fröhlich Date: Sun Apr 1 20:18:36 2018 +0200 st/mesa: Remove the now unused gl_vertex_array. Was meant to be temporary in gallium. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/state_tracker/st_cb_feedback.c | 32 ++-- src/mesa/state_tracker/st_context.c | 3 --- src/mesa/state_tracker/st_context.h | 3 --- src/mesa/state_tracker/st_draw.c| 8 4 files changed, 2 insertions(+), 44 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index b7a082fca3..6e48be6f5d 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -273,34 +273,6 @@ draw_glselect_stage(struct gl_context *ctx, struct draw_context *draw) static void -feedback_draw_vbo(struct gl_context *ctx, - const struct _mesa_prim *prims, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLboolean index_bounds_valid, - GLuint min_index, - GLuint max_index, - struct gl_transform_feedback_object *tfb_vertcount, - unsigned stream, - struct gl_buffer_object *indirect) -{ - struct st_context *st = st_context(ctx); - - /* The initial pushdown of the inputs array into the drivers */ - _mesa_set_drawing_arrays(ctx, st->draw_arrays.inputs); - _vbo_update_inputs(ctx, &st->draw_arrays); - - /* The above needs to happen outside of st_feedback_draw_vbo, -* since st_RasterPossets _DrawArrays and does not want that to be -* overwritten by _mesa_set_drawing_arrays. -*/ - st_feedback_draw_vbo(ctx, prims, nr_prims, ib, index_bounds_valid, -min_index, max_index, tfb_vertcount, -stream, indirect); -} - - -static void st_RenderMode(struct gl_context *ctx, GLenum newMode ) { struct st_context *st = st_context(ctx); @@ -318,7 +290,7 @@ st_RenderMode(struct gl_context *ctx, GLenum newMode ) st->selection_stage = draw_glselect_stage(ctx, draw); draw_set_rasterize_stage(draw, st->selection_stage); /* Plug in new vbo draw function */ - ctx->Driver.Draw = feedback_draw_vbo; + ctx->Driver.Draw = st_feedback_draw_vbo; } else { struct gl_program *vp = st->ctx->VertexProgram._Current; @@ -327,7 +299,7 @@ st_RenderMode(struct gl_context *ctx, GLenum newMode ) st->feedback_stage = draw_glfeedback_stage(ctx, draw); draw_set_rasterize_stage(draw, st->feedback_stage); /* Plug in new vbo draw function */ - ctx->Driver.Draw = feedback_draw_vbo; + ctx->Driver.Draw = st_feedback_draw_vbo; /* need to generate/use a vertex program that emits pos/color/tex */ if (vp) st->dirty |= ST_NEW_VERTEX_PROGRAM(st, st_vertex_program(vp)); diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index ee76e07a7d..061b8b9c4c 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -552,9 +552,6 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, /* Initialize context's winsys buffers list */ LIST_INITHEAD(&st->winsys_buffers); - /* Keep our list of gl_vertex_array inputs */ - _vbo_init_inputs(&st->draw_arrays); - return st; } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 5125fc5839..9f5bfba3fd 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -295,9 +295,6 @@ struct st_context /* Winsys buffers */ struct list_head winsys_buffers; - - /* For the initial pushdown, keep the list of vbo inputs. */ - struct vbo_inputs draw_arrays; }; diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 6243659b50..12cae85f40 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -146,10 +146,6 @@ st_draw_vbo(struct gl_context *ctx, unsigned i; unsigned start = 0; - /* The initial pushdown of the inputs array into the drivers */ - _mesa_set_drawing_arrays(ctx, st->draw_arrays.inputs); - _vbo_update_inputs(ctx, &st->draw_arrays); - prepare_draw(st, ctx); if (st->vertex_array_out_of_memory) @@ -255,10 +251,6 @@ st_indirect_draw_vbo(struct gl_context *ctx, struct pipe_draw_info info; struct pipe_draw_indirect_info indirect; - /* The initial pushdown of the inputs array into the drivers */ - _mesa_set_drawing_arrays(ctx, st->draw_arrays.inputs); - _vbo_update_inputs(ctx, &st->draw_arrays); - assert(stride); prepare_draw(st, ctx); _
Mesa (master): mesa: Compute effective buffer bindings in the vao.
Module: Mesa Branch: master Commit: d1698d4311a63e1054e458ae1a27d7684595faee URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d1698d4311a63e1054e458ae1a27d7684595faee Author: Mathias Fröhlich Date: Sun Apr 1 20:18:36 2018 +0200 mesa: Compute effective buffer bindings in the vao. Compute VAO buffer binding information past the position/generic0 mapping. Scan for duplicate buffer bindings and collapse them into derived effective buffer binding index and effective attribute mask variables. Provide a set of helper functions to access the distilled information in the VAO. All of them prefixed with _mesa_draw_... to indicate that they are meant to query draw information. v2: Also group user space arrays containing interleaved arrays. Add _Eff*Offset to be copied on attribute and binding copy. Update comments. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/main/arrayobj.c | 390 - src/mesa/main/arrayobj.h | 186 + src/mesa/main/attrib.c | 1 + src/mesa/main/mtypes.h | 64 src/mesa/main/varray.c | 9 ++ src/mesa/vbo/vbo.h | 8 + src/mesa/vbo/vbo_context.c | 17 ++ src/mesa/vbo/vbo_private.h | 14 +- 8 files changed, 682 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 899d4dec01..05af50ef40 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -451,8 +451,116 @@ _mesa_initialize_vao(struct gl_context *ctx, /** - * Updates the derived gl_vertex_arrays when a gl_array_attributes - * or a gl_vertex_buffer_binding has changed. + * Compute the offset range for the provided binding. + * + * This is a helper function for the below. + */ +static void +compute_vbo_offset_range(const struct gl_vertex_array_object *vao, + const struct gl_vertex_buffer_binding *binding, + GLsizeiptr* min, GLsizeiptr* max) +{ + /* The function is meant to work on VBO bindings */ + assert(_mesa_is_bufferobj(binding->BufferObj)); + + /* Start with an inverted range of relative offsets. */ + GLuint min_offset = ~(GLuint)0; + GLuint max_offset = 0; + + /* We work on the unmapped originaly VAO array entries. */ + GLbitfield mask = vao->_Enabled & binding->_BoundArrays; + /* The binding should be active somehow, not to return inverted ranges */ + assert(mask); + while (mask) { + const int i = u_bit_scan(&mask); + const GLuint off = vao->VertexAttrib[i].RelativeOffset; + min_offset = MIN2(off, min_offset); + max_offset = MAX2(off, max_offset); + } + + *min = binding->Offset + (GLsizeiptr)min_offset; + *max = binding->Offset + (GLsizeiptr)max_offset; +} + + +/** + * Update the unique binding and pos/generic0 map tracking in the vao. + * + * The idea is to build up information in the vao so that a consuming + * backend can execute the following to set up buffer and vertex element + * information: + * + * const GLbitfield inputs_read = VERT_BIT_ALL; // backend vp inputs + * + * // Attribute data is in a VBO. + * GLbitfield vbomask = inputs_read & _mesa_draw_vbo_array_bits(ctx); + * while (vbomask) { + *// The attribute index to start pulling a binding + *const gl_vert_attrib i = ffs(vbomask) - 1; + *const struct gl_vertex_buffer_binding *const binding + * = _mesa_draw_buffer_binding(vao, i); + * + * + * + *const GLbitfield boundmask = _mesa_draw_bound_attrib_bits(binding); + *GLbitfield attrmask = vbomask & boundmask; + *assert(attrmask); + *// Walk attributes belonging to the binding + *while (attrmask) { + * const gl_vert_attrib attr = u_bit_scan(&attrmask); + * const struct gl_array_attributes *const attrib + * = _mesa_draw_array_attrib(vao, attr); + * + * + *} + *vbomask &= ~boundmask; + * } + * + * // Process user space buffers + * GLbitfield usermask = inputs_read & _mesa_draw_user_array_bits(ctx); + * while (usermask) { + *// The attribute index to start pulling a binding + *const gl_vert_attrib i = ffs(usermask) - 1; + *const struct gl_vertex_buffer_binding *const binding + * = _mesa_draw_buffer_binding(vao, i); + * + * + * + *const GLbitfield boundmask = _mesa_draw_bound_attrib_bits(binding); + *GLbitfield attrmask = usermask & boundmask; + *assert(attrmask); + *// Walk interleaved attributes with a common stride and instance divisor + *while (attrmask) { + * const gl_vert_attrib attr = u_bit_scan(&attrmask); + * const struct gl_array_attributes *const attrib + * = _mesa_draw_array_attrib(vao, attr); + * + * + *} + *usermask &= ~boundmask; + * } + * + * // Process values that should have better been uniforms in the application + * GLbitfield curmask = inputs_read & _mesa_draw_current_bits(ctx); + * while (curmask) { + *const gl_vert_attrib attr = u_bit_scan(&curmas
Mesa (master): i965: Remove the now unused gl_vertex_array.
Module: Mesa Branch: master Commit: 899476b6b1d41c5ed08391843110c7d62b2ca863 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=899476b6b1d41c5ed08391843110c7d62b2ca863 Author: Mathias Fröhlich Date: Sun Apr 1 20:18:36 2018 +0200 i965: Remove the now unused gl_vertex_array. Was meant to be temporary in i965. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/drivers/dri/i965/brw_context.h | 4 src/mesa/drivers/dri/i965/brw_draw.c| 7 --- 2 files changed, 11 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index d3c2450a88..7dcbd040f0 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -37,7 +37,6 @@ #include "main/macros.h" #include "main/mtypes.h" #include "main/errors.h" -#include "vbo/vbo.h" #include "brw_structs.h" #include "brw_pipe_control.h" #include "compiler/brw_compiler.h" @@ -966,9 +965,6 @@ struct brw_context * These bitfields indicate which workarounds are needed. */ uint8_t attrib_wa_flags[VERT_ATTRIB_MAX]; - - /* For the initial pushdown, keep the list of vbo inputs. */ - struct vbo_inputs draw_arrays; } vb; struct { diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 3b47dc7b26..ae3b7be2dd 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -936,10 +936,6 @@ brw_draw_prims(struct gl_context *ctx, struct brw_transform_feedback_object *xfb_obj = (struct brw_transform_feedback_object *) gl_xfb_obj; - /* The initial pushdown of the inputs array into the drivers */ - _mesa_set_drawing_arrays(ctx, brw->vb.draw_arrays.inputs); - _vbo_update_inputs(ctx, &brw->vb.draw_arrays); - if (!brw_check_conditional_render(brw)) return; @@ -1078,9 +1074,6 @@ brw_init_draw_functions(struct dd_function_table *functions) void brw_draw_init(struct brw_context *brw) { - /* Keep our list of gl_vertex_array inputs */ - _vbo_init_inputs(&brw->vb.draw_arrays); - for (int i = 0; i < VERT_ATTRIB_MAX; i++) brw->vb.inputs[i].buffer = -1; brw->vb.nr_buffers = 0; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Implement all_varyings_in_vbos in terms of Array._DrawVAO.
Module: Mesa Branch: master Commit: 172c9a908f7d6405b41ff2a0087169ec83a3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=172c9a908f7d6405b41ff2a0087169ec83a3 Author: Mathias Fröhlich Date: Sun Apr 1 20:18:36 2018 +0200 i965: Implement all_varyings_in_vbos in terms of Array._DrawVAO. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/drivers/dri/i965/brw_draw.c | 17 ++--- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 25ba372c44..c5f04264fa 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -25,6 +25,7 @@ #include +#include "main/arrayobj.h" #include "main/blend.h" #include "main/context.h" #include "main/condrender.h" @@ -917,20 +918,6 @@ retry: } -static bool -all_varyings_in_vbos(const struct gl_vertex_array *arrays) -{ - GLuint i; - - for (i = 0; i < VERT_ATTRIB_MAX; i++) - if (arrays[i].BufferBinding->Stride && - arrays[i].BufferBinding->BufferObj->Name == 0) - return false; - - return true; -} - - void brw_draw_prims(struct gl_context *ctx, @@ -982,7 +969,7 @@ brw_draw_prims(struct gl_context *ctx, * get the minimum and maximum of their index buffer so we know what range * to upload. */ - if (!index_bounds_valid && !all_varyings_in_vbos(arrays)) { + if (!index_bounds_valid && _mesa_draw_user_array_bits(ctx) != 0) { perf_debug("Scanning index buffer to compute index buffer bounds. " "Use glDrawRangeElements() to avoid this.\n"); vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index, nr_prims); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa/vbo/tnl: Move gl_vertex_array related stuff to tnl.
Module: Mesa Branch: master Commit: f6606830271192dc0232b54b776ec263235c0688 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6606830271192dc0232b54b776ec263235c0688 Author: Mathias Fröhlich Date: Sun Apr 1 20:18:36 2018 +0200 mesa/vbo/tnl: Move gl_vertex_array related stuff to tnl. The only remaining users of gl_vertex_array are tnl based drivers. So move everything related to that into tnl and rename it accordingly. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 38 +-- src/mesa/main/mtypes.h | 14 src/mesa/main/varray.h | 12 src/mesa/state_tracker/st_draw.h | 1 - src/mesa/tnl/t_context.c | 4 +- src/mesa/tnl/t_context.h | 41 +++- src/mesa/tnl/t_draw.c| 95 ++-- src/mesa/tnl/t_rebase.c | 4 +- src/mesa/tnl/t_rebase.h | 2 +- src/mesa/tnl/t_split.c | 2 +- src/mesa/tnl/t_split.h | 4 +- src/mesa/tnl/t_split_copy.c | 34 ++ src/mesa/tnl/t_split_inplace.c | 4 +- src/mesa/tnl/tnl.h | 24 +-- src/mesa/vbo/vbo.h | 37 --- src/mesa/vbo/vbo_exec.c | 86 - 16 files changed, 199 insertions(+), 203 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c index d031ebeabd..3900c770cb 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c @@ -41,7 +41,7 @@ * structures. */ static int -get_array_stride(struct gl_context *ctx, const struct gl_vertex_array *a) +get_array_stride(struct gl_context *ctx, const struct tnl_vertex_array *a) { struct nouveau_render_state *render = to_render_state(ctx); const struct gl_vertex_buffer_binding *binding = a->BufferBinding; @@ -57,7 +57,7 @@ get_array_stride(struct gl_context *ctx, const struct gl_vertex_array *a) static void vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib, - const struct gl_vertex_array *arrays) + const struct tnl_vertex_array *arrays) { struct nouveau_render_state *render = to_render_state(ctx); GLboolean imm = (render->mode == IMM); @@ -78,7 +78,7 @@ vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib, } FOR_EACH_BOUND_ATTR(render, i, attr) { - const struct gl_vertex_array *array = &arrays[attr]; + const struct tnl_vertex_array *array = &arrays[attr]; const struct gl_vertex_buffer_binding *binding = array->BufferBinding; const struct gl_array_attributes *attrib = array->VertexAttrib; @@ -94,7 +94,7 @@ vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib, static void vbo_deinit_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib, - const struct gl_vertex_array *arrays) + const struct tnl_vertex_array *arrays) { struct nouveau_render_state *render = to_render_state(ctx); int i, attr; @@ -118,7 +118,7 @@ vbo_deinit_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib, /* Make some rendering decisions from the GL context. */ static void -vbo_choose_render_mode(struct gl_context *ctx, const struct gl_vertex_array *arrays) +vbo_choose_render_mode(struct gl_context *ctx, const struct tnl_vertex_array *arrays) { struct nouveau_render_state *render = to_render_state(ctx); int i; @@ -136,12 +136,12 @@ vbo_choose_render_mode(struct gl_context *ctx, const struct gl_vertex_array *arr } static void -vbo_emit_attr(struct gl_context *ctx, const struct gl_vertex_array *arrays, +vbo_emit_attr(struct gl_context *ctx, const struct tnl_vertex_array *arrays, int attr) { struct nouveau_pushbuf *push = context_push(ctx); struct nouveau_render_state *render = to_render_state(ctx); - const struct gl_vertex_array *array = &arrays[attr]; + const struct tnl_vertex_array *array = &arrays[attr]; const struct gl_vertex_buffer_binding *binding = array->BufferBinding; const struct gl_array_attributes *attrib = array->VertexAttrib; const GLubyte *p = _mesa_vertex_attrib_address(attrib, binding); @@ -179,7 +179,7 @@ vbo_emit_attr(struct gl_context *ctx, const struct gl_vertex_array *arrays, #define MAT(a) VERT_ATTRIB_MAT(MAT_ATTRIB_##a) static void -vbo_choose_attrs(struct gl_context *ctx, const struct gl_vertex_array *arrays) +vbo_choose_attrs(struct gl_context *ctx, const struct tnl_vertex_array *arrays) { struct nouveau_render_state *render = to_render_state
Mesa (master): i965: Remove the gl_vertex_array indirection.
Module: Mesa Branch: master Commit: 0fabd5530623bb7b6a13ce35c24b665d3661f76f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0fabd5530623bb7b6a13ce35c24b665d3661f76f Author: Mathias Fröhlich Date: Sun Apr 1 20:18:36 2018 +0200 i965: Remove the gl_vertex_array indirection. For now store binding and attrib in brw_vertex_element. The i965 driver still provides lots of opportunity to make use of the unique binding information in the VAO which is currently not taken from the VAO. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/drivers/dri/i965/brw_context.h | 3 ++- src/mesa/drivers/dri/i965/brw_draw.c | 25 + src/mesa/drivers/dri/i965/brw_draw_upload.c | 31 +-- src/mesa/drivers/dri/i965/genX_state_upload.c | 12 --- 4 files changed, 31 insertions(+), 40 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index d8b0d94aaf..d3c2450a88 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -440,7 +440,8 @@ struct brw_vertex_buffer { GLuint step_rate; }; struct brw_vertex_element { - const struct gl_vertex_array *glarray; + const struct gl_array_attributes *glattrib; + const struct gl_vertex_buffer_binding *glbinding; int buffer; bool is_dual_slot; diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index c5f04264fa..3b47dc7b26 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -278,8 +278,7 @@ brw_emit_prim(struct brw_context *brw, static void -brw_merge_inputs(struct brw_context *brw, - const struct gl_vertex_array *arrays) +brw_merge_inputs(struct brw_context *brw) { const struct gen_device_info *devinfo = &brw->screen->devinfo; const struct gl_context *ctx = &brw->ctx; @@ -292,8 +291,10 @@ brw_merge_inputs(struct brw_context *brw, brw->vb.nr_buffers = 0; for (i = 0; i < VERT_ATTRIB_MAX; i++) { - brw->vb.inputs[i].buffer = -1; - brw->vb.inputs[i].glarray = &arrays[i]; + struct brw_vertex_element *input = &brw->vb.inputs[i]; + input->buffer = -1; + _mesa_draw_attrib_and_binding(ctx, i, +&input->glattrib, &input->glbinding); } if (devinfo->gen < 8 && !devinfo->is_haswell) { @@ -306,7 +307,7 @@ brw_merge_inputs(struct brw_context *brw, uint8_t wa_flags = 0; i = u_bit_scan64(&mask); - glattrib = brw->vb.inputs[i].glarray->VertexAttrib; + glattrib = brw->vb.inputs[i].glattrib; switch (glattrib->Type) { @@ -693,7 +694,6 @@ brw_postdraw_reconcile_align_wa_slices(struct brw_context *brw) static void brw_prepare_drawing(struct gl_context *ctx, -const struct gl_vertex_array *arrays, const struct _mesa_index_buffer *ib, bool index_bounds_valid, GLuint min_index, @@ -746,7 +746,7 @@ brw_prepare_drawing(struct gl_context *ctx, /* Bind all inputs, derive varying and size information: */ - brw_merge_inputs(brw, arrays); + brw_merge_inputs(brw); brw->ib.ib = ib; brw->ctx.NewDriverState |= BRW_NEW_INDICES; @@ -780,7 +780,6 @@ brw_finish_drawing(struct gl_context *ctx) */ static void brw_draw_single_prim(struct gl_context *ctx, - const struct gl_vertex_array *arrays, const struct _mesa_prim *prim, unsigned prim_id, struct brw_transform_feedback_object *xfb_obj, @@ -811,7 +810,7 @@ brw_draw_single_prim(struct gl_context *ctx, brw->baseinstance = prim->base_instance; if (prim_id > 0) { /* For i == 0 we just did this before the loop */ brw->ctx.NewDriverState |= BRW_NEW_VERTICES; - brw_merge_inputs(brw, arrays); + brw_merge_inputs(brw); } } @@ -933,14 +932,12 @@ brw_draw_prims(struct gl_context *ctx, { unsigned i; struct brw_context *brw = brw_context(ctx); - const struct gl_vertex_array *arrays; int predicate_state = brw->predicate.state; struct brw_transform_feedback_object *xfb_obj = (struct brw_transform_feedback_object *) gl_xfb_obj; /* The initial pushdown of the inputs array into the drivers */ _mesa_set_drawing_arrays(ctx, brw->vb.draw_arrays.inputs); - arrays = ctx->Array._DrawArrays; _vbo_update_inputs(ctx, &brw->vb.draw_arrays); if (!brw_check_conditional_render(brw)) @@ -976,8 +973,7 @@ brw_draw_prims(struct gl_context *ctx, index_bounds_valid = true; } - brw_prepare_drawing(ctx, arrays, ib, index_bounds_valid, min_index, - max_index); + brw_prepare_drawing(ctx, ib, index_bounds_valid, min_index, max_index); /* Try drawing with the hardware, but don't do anything else if we can't * manage it. sw
Mesa (master): st/mesa: Use _DrawVAO for edgeflag enabled check.
Module: Mesa Branch: master Commit: f24bf4521023658012b2636a24cf2387fd55695a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f24bf4521023658012b2636a24cf2387fd55695a Author: Mathias Fröhlich Date: Sun Apr 1 20:18:36 2018 +0200 st/mesa: Use _DrawVAO for edgeflag enabled check. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/state_tracker/st_atom.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index 45a45960a3..df1a94e831 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -27,6 +27,7 @@ #include +#include "main/arrayobj.h" #include "main/glheader.h" #include "main/context.h" @@ -138,19 +139,15 @@ static void check_program_state( struct st_context *st ) static void check_attrib_edgeflag(struct st_context *st) { - const struct gl_vertex_array *arrays = st->ctx->Array._DrawArrays; - const struct gl_vertex_buffer_binding *binding; GLboolean vertdata_edgeflags, edgeflag_culls_prims, edgeflags_enabled; struct gl_program *vp = st->ctx->VertexProgram._Current; - if (!arrays) - return; - edgeflags_enabled = st->ctx->Polygon.FrontMode != GL_FILL || st->ctx->Polygon.BackMode != GL_FILL; - binding = arrays[VERT_ATTRIB_EDGEFLAG].BufferBinding; - vertdata_edgeflags = edgeflags_enabled && binding->Stride != 0; + vertdata_edgeflags = edgeflags_enabled && + _mesa_draw_edge_flag_array_enabled(st->ctx); + if (vertdata_edgeflags != st->vertdata_edgeflags) { st->vertdata_edgeflags = vertdata_edgeflags; if (vp) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): virgl: Add support for passing GL_ANY_SAMPLES_PASSED_CONSERVATIVE
Module: Mesa Branch: master Commit: fb4011ace9022e674639f2743272b7eba650cde3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb4011ace9022e674639f2743272b7eba650cde3 Author: Gert Wollny Date: Wed May 9 16:51:49 2018 +0200 virgl: Add support for passing GL_ANY_SAMPLES_PASSED_CONSERVATIVE This is needed for fixing CTS: dEQP-GLES3.functional.occlusion_query.conservative* Reviewed-by: Dave Airlie Signed-off-by: Gert Wollny --- src/gallium/drivers/virgl/virgl_query.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/virgl/virgl_query.c b/src/gallium/drivers/virgl/virgl_query.c index 3a930d2966..e4d955442b 100644 --- a/src/gallium/drivers/virgl/virgl_query.c +++ b/src/gallium/drivers/virgl/virgl_query.c @@ -48,12 +48,13 @@ struct virgl_query { #define VIRGL_QUERY_SO_OVERFLOW_PREDICATE 8 #define VIRGL_QUERY_GPU_FINISHED 9 #define VIRGL_QUERY_PIPELINE_STATISTICS 10 +#define VIRGL_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE 11 static const int pquery_map[] = { VIRGL_QUERY_OCCLUSION_COUNTER, VIRGL_QUERY_OCCLUSION_PREDICATE, - -1, + VIRGL_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE, VIRGL_QUERY_TIMESTAMP, VIRGL_QUERY_TIMESTAMP_DISJOINT, VIRGL_QUERY_TIME_ELAPSED, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600: fix constant buffer bounds.
Module: Mesa Branch: master Commit: ce027ac5c798b39582288e5d7d9973b3cdda591e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce027ac5c798b39582288e5d7d9973b3cdda591e Author: Dave Airlie Date: Wed May 9 23:17:09 2018 +0100 r600: fix constant buffer bounds. If you have an indirect access to a constant buffer on r600/eg use a vertex fetch in the shader. However apps have expected behaviour on those out of bounds accessess (even if illegal). If the constants were being uploaded as part of a larger upload buffer, we'd set the range of allowed access to a lot larger than required so apps would get values back from other parts of the upload buffer instead of the expected out of bounds access. This fixes rendering bugs in Trine and Witcher 1, thanks to iive for nagging me effectively until I figured it out :-) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91808 Cc: Reviewed-by: Roland Scheidegger --- src/gallium/drivers/r600/evergreen_state.c | 2 +- src/gallium/drivers/r600/r600_state.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 48934158bd..05f4a65059 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -2202,7 +2202,7 @@ static void evergreen_emit_constant_buffers(struct r600_context *rctx, radeon_emit(cs, PKT3(PKT3_SET_RESOURCE, 8, 0) | pkt_flags); radeon_emit(cs, (buffer_id_base + buffer_index) * 8); radeon_emit(cs, va); /* RESOURCEi_WORD0 */ - radeon_emit(cs, rbuffer->b.b.width0 - cb->buffer_offset - 1); /* RESOURCEi_WORD1 */ + radeon_emit(cs, cb->buffer_size -1); /* RESOURCEi_WORD1 */ radeon_emit(cs, /* RESOURCEi_WORD2 */ S_030008_ENDIAN_SWAP(gs_ring_buffer ? ENDIAN_NONE : r600_endian_swap(32)) | S_030008_STRIDE(gs_ring_buffer ? 4 : 16) | diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 923817119f..a37a701837 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1729,7 +1729,7 @@ static void r600_emit_constant_buffers(struct r600_context *rctx, radeon_emit(cs, PKT3(PKT3_SET_RESOURCE, 7, 0)); radeon_emit(cs, (buffer_id_base + buffer_index) * 7); radeon_emit(cs, offset); /* RESOURCEi_WORD0 */ - radeon_emit(cs, rbuffer->b.b.width0 - offset - 1); /* RESOURCEi_WORD1 */ + radeon_emit(cs, cb->buffer_size - 1); /* RESOURCEi_WORD1 */ radeon_emit(cs, /* RESOURCEi_WORD2 */ S_038008_ENDIAN_SWAP(gs_ring_buffer ? ENDIAN_NONE : r600_endian_swap(32)) | S_038008_STRIDE(gs_ring_buffer ? 4 : 16)); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965,anv: Set the CS stall bit on the ISP disable PIPE_CONTROL
Module: Mesa Branch: master Commit: a8a740f272a808a2694524b43fc33d2f0c0e3709 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8a740f272a808a2694524b43fc33d2f0c0e3709 Author: Jason Ekstrand Date: Wed May 9 15:06:13 2018 -0700 i965,anv: Set the CS stall bit on the ISP disable PIPE_CONTROL From the bspec docs for "Indirect State Pointers Disable": "At the completion of the post-sync operation associated with this pipe control packet, the indirect state pointers in the hardware are considered invalid" So the ISP disable is a post-sync type of operation which means that it should be combined with a CS stall. Without this, the simulator throws an error. Fixes: 766d801ca "anv: emit pixel scoreboard stall before ISP disable" Fixes: f536097f6 "i965: require pixel scoreboard stall prior to ISP disable" Reviewed-by: Lionel Landwerlin --- src/intel/vulkan/genX_cmd_buffer.c | 1 + src/mesa/drivers/dri/i965/brw_pipe_control.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 526e18af10..afccad8ef8 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1434,6 +1434,7 @@ emit_isp_disable(struct anv_cmd_buffer *cmd_buffer) } anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { pc.IndirectStatePointersDisable = true; + pc.CommandStreamerStallEnable = true; } } diff --git a/src/mesa/drivers/dri/i965/brw_pipe_control.c b/src/mesa/drivers/dri/i965/brw_pipe_control.c index 879bfb660e..e31d625ddb 100644 --- a/src/mesa/drivers/dri/i965/brw_pipe_control.c +++ b/src/mesa/drivers/dri/i965/brw_pipe_control.c @@ -362,7 +362,8 @@ gen10_emit_isp_disable(struct brw_context *brw) PIPE_CONTROL_CS_STALL, NULL, 0, 0); brw_emit_pipe_control(brw, - PIPE_CONTROL_ISP_DIS, + PIPE_CONTROL_ISP_DIS | + PIPE_CONTROL_CS_STALL, NULL, 0, 0); brw->vs.base.push_constants_dirty = true; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radv: handle arrays in the fmask descriptor.
Module: Mesa Branch: master Commit: 56766b8515bf73a0f4fc84fad81ba808a520391a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=56766b8515bf73a0f4fc84fad81ba808a520391a Author: Dave Airlie Date: Mon Mar 19 07:13:46 2018 + radv: handle arrays in the fmask descriptor. This fixes the fmask descriptor generation to handle 2d ms arrays. Reviewed-by: Samuel Pitoiset --- src/amd/vulkan/radv_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index bfe497caa3..ad480901ee 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -619,7 +619,7 @@ si_make_texture_descriptor(struct radv_device *device, S_008F1C_DST_SEL_Y(V_008F1C_SQ_SEL_X) | S_008F1C_DST_SEL_Z(V_008F1C_SQ_SEL_X) | S_008F1C_DST_SEL_W(V_008F1C_SQ_SEL_X) | - S_008F1C_TYPE(radv_tex_dim(image->type, view_type, 1, 0, false, false)); + S_008F1C_TYPE(radv_tex_dim(image->type, view_type, image->info.array_size, 0, false, false)); fmask_state[4] = 0; fmask_state[5] = S_008F24_BASE_ARRAY(first_layer); fmask_state[6] = 0; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): configure.ac: Check for grep with AC_PROG_GREP
Module: Mesa Branch: master Commit: 00979402230e659fff57dec612f60987665157fa URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=00979402230e659fff57dec612f60987665157fa Author: Matt Turner Date: Wed May 9 16:32:12 2018 -0700 configure.ac: Check for grep with AC_PROG_GREP Perhaps with a new version of autoconf, I began seeing: | checking the name lister (/usr/bin/nm -B) interface... ./configure: line 6973: External.*some_variable: command not found | BSD nm This is because AC_PROG_NM expands to ... if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi ... I'm not sure if it's a bug in AC_PROG_NM that it doesn't call AC_PROG_GREP, but it's easy enough for us to do it. --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index c0fbfe9413..4bb89607e2 100644 --- a/configure.ac +++ b/configure.ac @@ -119,6 +119,7 @@ dnl other CC/CXX flags related help AC_ARG_VAR([CXX11_CXXFLAGS], [Compiler flag to enable C++11 support (only needed if not enabled by default and different from -std=c++11)]) AM_PROG_CC_C_O +AC_PROG_GREP AC_PROG_NM AM_PROG_AS AX_CHECK_GNU_MAKE ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/tests: Fix assignment of EXTRA_DIST
Module: Mesa Branch: master Commit: 0f959215c340150cb6075f5c2d3ccfc5d109558f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f959215c340150cb6075f5c2d3ccfc5d109558f Author: Matt Turner Date: Wed May 9 16:36:58 2018 -0700 gallium/tests: Fix assignment of EXTRA_DIST Fixes: 6754c2e83d79 ("autotools: Include new meson files") --- src/gallium/tests/unit/Makefile.am | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gallium/tests/unit/Makefile.am b/src/gallium/tests/unit/Makefile.am index f1192af17a..74d125fe44 100644 --- a/src/gallium/tests/unit/Makefile.am +++ b/src/gallium/tests/unit/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/src/gallium/Automake.inc -EXTRA_DIST = SConscript +EXTRA_DIST = SConscript meson.build AM_CFLAGS = \ $(GALLIUM_CFLAGS) @@ -32,5 +32,3 @@ u_format_test_SOURCES = u_format_test.c u_format_compatible_test_SOURCES = u_format_compatible_test.c translate_test_SOURCES = translate_test.c - -EXTRA_DIST = meson.build ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): main: return 0 length when the queried program object's not linked
Module: Mesa Branch: master Commit: 08c1444c9582f8654f9c688b79230ba2acbc2027 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08c1444c9582f8654f9c688b79230ba2acbc2027 Author: Xiong, James Date: Thu Apr 26 18:39:57 2018 -0700 main: return 0 length when the queried program object's not linked Signed-off-by: Xiong, James Reviewed-by: Timothy Arceri --- src/mesa/main/shaderapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 44b18af492..caa42541ca 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -837,7 +837,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, *params = shProg->BinaryRetreivableHint; return; case GL_PROGRAM_BINARY_LENGTH: - if (ctx->Const.NumProgramBinaryFormats == 0) { + if (ctx->Const.NumProgramBinaryFormats == 0 || !shProg->data->LinkStatus) { *params = 0; } else { _mesa_get_program_binary_length(ctx, shProg, params); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): main: fail texture_storage() call if the size is not okay
Module: Mesa Branch: master Commit: 0ab266dc1ba10ec13601e3bdb5b949e610eca5de URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ab266dc1ba10ec13601e3bdb5b949e610eca5de Author: Xiong, James Date: Fri Apr 27 08:34:47 2018 -0700 main: fail texture_storage() call if the size is not okay Signed-off-by: Xiong, James Reviewed-by: Nicolai Hähnle --- src/mesa/main/texstorage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index 44edba3323..9cb8b90065 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -445,6 +445,7 @@ texture_storage(struct gl_context *ctx, GLuint dims, _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTex%sStorage%uD(texture too large)", suffix, dims); +return; } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Shut up unused variable warnings.
Module: Mesa Branch: master Commit: a83face48ae5ce762d8c48a7485dc75b45dccf58 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a83face48ae5ce762d8c48a7485dc75b45dccf58 Author: Kenneth Graunke Date: Wed May 9 16:20:50 2018 -0700 i965: Shut up unused variable warnings. These are only used in assertions. --- src/mesa/drivers/dri/i965/brw_queryobj.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c index da3df6b4bd..0015a4ee9d 100644 --- a/src/mesa/drivers/dri/i965/brw_queryobj.c +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c @@ -134,7 +134,7 @@ brw_queryobj_get_results(struct gl_context *ctx, struct brw_query_object *query) { struct brw_context *brw = brw_context(ctx); - const struct gen_device_info *devinfo = &brw->screen->devinfo; + UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo; int i; uint64_t *results; @@ -261,7 +261,7 @@ brw_begin_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_context *brw = brw_context(ctx); struct brw_query_object *query = (struct brw_query_object *)q; - const struct gen_device_info *devinfo = &brw->screen->devinfo; + UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo; assert(devinfo->gen < 6); @@ -333,7 +333,7 @@ brw_end_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_context *brw = brw_context(ctx); struct brw_query_object *query = (struct brw_query_object *)q; - const struct gen_device_info *devinfo = &brw->screen->devinfo; + UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo; assert(devinfo->gen < 6); @@ -387,7 +387,8 @@ brw_end_query(struct gl_context *ctx, struct gl_query_object *q) static void brw_wait_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_query_object *query = (struct brw_query_object *)q; - const struct gen_device_info *devinfo = &brw_context(ctx)->screen->devinfo; + UNUSED const struct gen_device_info *devinfo = + &brw_context(ctx)->screen->devinfo; assert(devinfo->gen < 6); @@ -405,7 +406,7 @@ static void brw_check_query(struct gl_context *ctx, struct gl_query_object *q) { struct brw_context *brw = brw_context(ctx); struct brw_query_object *query = (struct brw_query_object *)q; - const struct gen_device_info *devinfo = &brw->screen->devinfo; + UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo; assert(devinfo->gen < 6); @@ -435,7 +436,7 @@ static void ensure_bo_has_space(struct gl_context *ctx, struct brw_query_object *query) { struct brw_context *brw = brw_context(ctx); - const struct gen_device_info *devinfo = &brw->screen->devinfo; + UNUSED const struct gen_device_info *devinfo = &brw->screen->devinfo; assert(devinfo->gen < 6); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): src/intel/Makefile.vulkan.am: add missing MKDIR_GEN
Module: Mesa Branch: master Commit: 1755654d9f533240dc19954b0dbccaf74e645265 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1755654d9f533240dc19954b0dbccaf74e645265 Author: Ross Burton Date: Wed May 9 21:48:43 2018 +0100 src/intel/Makefile.vulkan.am: add missing MKDIR_GEN Out of tree builds can try to write into a directory that doesn't exist yet: | Traceback (most recent call last): | File "../../../mesa-18.0.2/src/intel/vulkan/anv_icd.py", line 46, in | with open(args.out, 'w') as f: | IOError: [Errno 2] No such file or directory: 'vulkan/intel_icd.x86_64.json' | Makefile:4882: recipe for target 'vulkan/intel_icd.x86_64.json' failed Add missing MKDIR_GEN calls to solve this. Cc: Reviewed-by: Matt Turner --- src/intel/Makefile.vulkan.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am index 0bcbf0419c..4125cb205a 100644 --- a/src/intel/Makefile.vulkan.am +++ b/src/intel/Makefile.vulkan.am @@ -64,10 +64,12 @@ EXTRA_DIST += \ vulkan/TODO vulkan/dev_icd.json : vulkan/anv_extensions.py vulkan/anv_icd.py + $(MKDIR_GEN) $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_icd.py \ --lib-path="${abs_top_builddir}/${LIB_DIR}" --out $@ vulkan/intel_icd.@host_cpu@.json : vulkan/anv_extensions.py vulkan/anv_icd.py + $(MKDIR_GEN) $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_icd.py \ --lib-path="${libdir}" --out $@ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: fix error handling in get_framebuffer_parameteriv
Module: Mesa Branch: master Commit: 5ac16ed0476d9914927b8e7a592d8d7ac1589586 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ac16ed0476d9914927b8e7a592d8d7ac1589586 Author: Rhys Perry Date: Fri May 4 23:27:51 2018 +0100 mesa: fix error handling in get_framebuffer_parameteriv CC: Signed-off-by: Rhys Perry Reviewed-by: Tapani Pälli Reviewed-by: Ian Romanick --- src/mesa/main/fbobject.c | 72 +++- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index c72204e11a..a63e8b8de5 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1488,45 +1488,66 @@ _mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param) } static bool -_pname_valid_for_default_framebuffer(struct gl_context *ctx, - GLenum pname) +validate_get_framebuffer_parameteriv_pname(struct gl_context *ctx, + struct gl_framebuffer *fb, + GLuint pname, const char *func) { - if (!_mesa_is_desktop_gl(ctx)) - return false; + bool cannot_be_winsys_fbo = true; switch (pname) { + case GL_FRAMEBUFFER_DEFAULT_LAYERS: + /* + * According to the OpenGL ES 3.1 specification section 9.2.3, the + * GL_FRAMEBUFFER_LAYERS parameter name is not supported. + */ + if (_mesa_is_gles31(ctx) && !ctx->Extensions.OES_geometry_shader) { + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname); + return false; + } + break; + case GL_FRAMEBUFFER_DEFAULT_WIDTH: + case GL_FRAMEBUFFER_DEFAULT_HEIGHT: + case GL_FRAMEBUFFER_DEFAULT_SAMPLES: + case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS: + break; case GL_DOUBLEBUFFER: case GL_IMPLEMENTATION_COLOR_READ_FORMAT: case GL_IMPLEMENTATION_COLOR_READ_TYPE: case GL_SAMPLES: case GL_SAMPLE_BUFFERS: case GL_STEREO: - return true; + /* From OpenGL 4.5 spec, section 9.2.3 "Framebuffer Object Queries: + * + *"An INVALID_OPERATION error is generated by GetFramebufferParameteriv + * if the default framebuffer is bound to target and pname is not one + * of the accepted values from table 23.73, other than + * SAMPLE_POSITION." + * + * For OpenGL ES, using default framebuffer raises INVALID_OPERATION + * for any pname. + */ + cannot_be_winsys_fbo = !_mesa_is_desktop_gl(ctx); + break; default: + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname); return false; } + + if (cannot_be_winsys_fbo && _mesa_is_winsys_fbo(fb)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(invalid pname=0x%x for default framebuffer)", func, pname); + return false; + } + + return true; } static void get_framebuffer_parameteriv(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum pname, GLint *params, const char *func) { - /* From OpenGL 4.5 spec, section 9.2.3 "Framebuffer Object Queries: -* -*"An INVALID_OPERATION error is generated by GetFramebufferParameteriv -* if the default framebuffer is bound to target and pname is not one -* of the accepted values from table 23.73, other than -* SAMPLE_POSITION." -* -* For OpenGL ES, using default framebuffer still raises INVALID_OPERATION -* for any pname. -*/ - if (_mesa_is_winsys_fbo(fb) && - !_pname_valid_for_default_framebuffer(ctx, pname)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "%s(invalid pname=0x%x for default framebuffer)", func, pname); + if (!validate_get_framebuffer_parameteriv_pname(ctx, fb, pname, func)) return; - } switch (pname) { case GL_FRAMEBUFFER_DEFAULT_WIDTH: @@ -1536,14 +1557,6 @@ get_framebuffer_parameteriv(struct gl_context *ctx, struct gl_framebuffer *fb, *params = fb->DefaultGeometry.Height; break; case GL_FRAMEBUFFER_DEFAULT_LAYERS: - /* - * According to the OpenGL ES 3.1 specification section 9.2.3, the - * GL_FRAMEBUFFER_LAYERS parameter name is not supported. - */ - if (_mesa_is_gles31(ctx) && !ctx->Extensions.OES_geometry_shader) { - _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", func, pname); - break; - } *params = fb->DefaultGeometry.Layers; break; case GL_FRAMEBUFFER_DEFAULT_SAMPLES: @@ -1570,9 +1583,6 @@ get_framebuffer_parameteriv(struct gl_context *ctx, struct gl_framebuffer *fb, case GL_STEREO: *params = fb->Visual.stereoMode; break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "%s(pname=0x%x)", func, pname); } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.o
Mesa (master): i965: require pixel scoreboard stall prior to ISP disable
Module: Mesa Branch: master Commit: f536097f67521180dafd270b28ac9a852af9c141 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f536097f67521180dafd270b28ac9a852af9c141 Author: Lionel Landwerlin Date: Tue May 1 12:32:45 2018 +0100 i965: require pixel scoreboard stall prior to ISP disable Invalidating the indirect state pointers might affect a previously scheduled & still running 3DPRIMITIVE (causing page fault). So stall on pixel scoreboard before that. v2: Fix compile issue :( v3: Stall on pixel scoreboard v4: Drop the post sync operation (Lionel) Signed-off-by: Lionel Landwerlin Reviewed-by: Rafael Antognolli Fixes: ca19ee33d7d39 ("i965/gen10: Ignore push constant packets during context restore.") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106243 --- src/mesa/drivers/dri/i965/brw_pipe_control.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_pipe_control.c b/src/mesa/drivers/dri/i965/brw_pipe_control.c index 02278be6d6..879bfb660e 100644 --- a/src/mesa/drivers/dri/i965/brw_pipe_control.c +++ b/src/mesa/drivers/dri/i965/brw_pipe_control.c @@ -349,14 +349,21 @@ gen7_emit_vs_workaround_flush(struct brw_context *brw) * context restore, so the mentioned hang doesn't happen. However, * software must program push constant commands for all stages prior to * rendering anything, so we flag them as dirty. + * + * Finally, we also make sure to stall at pixel scoreboard to make sure the + * constants have been loaded into the EUs prior to disable the push constants + * so that it doesn't hang a previous 3DPRIMITIVE. */ void gen10_emit_isp_disable(struct brw_context *brw) { brw_emit_pipe_control(brw, - PIPE_CONTROL_ISP_DIS | + PIPE_CONTROL_STALL_AT_SCOREBOARD | PIPE_CONTROL_CS_STALL, NULL, 0, 0); + brw_emit_pipe_control(brw, + PIPE_CONTROL_ISP_DIS, + NULL, 0, 0); brw->vs.base.push_constants_dirty = true; brw->tcs.base.push_constants_dirty = true; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): anv: emit pixel scoreboard stall before ISP disable
Module: Mesa Branch: master Commit: 766d801ca32118a722fb2e58a48ee9a96897d3b7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=766d801ca32118a722fb2e58a48ee9a96897d3b7 Author: Lionel Landwerlin Date: Tue May 8 17:25:55 2018 +0100 anv: emit pixel scoreboard stall before ISP disable We want to make sure that all indirect state data has been loaded into the EUs before disable the pointers. Signed-off-by: Lionel Landwerlin Reviewed-by: Rafael Antognolli Fixes: 78c125af3904c ("anv/gen10: Ignore push constant packets during context restore.") --- src/intel/vulkan/genX_cmd_buffer.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 2882cf3650..526e18af10 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1420,14 +1420,21 @@ genX(BeginCommandBuffer)( * context restore, so the mentioned hang doesn't happen. However, * software must program push constant commands for all stages prior to * rendering anything. So we flag them dirty in BeginCommandBuffer. + * + * Finally, we also make sure to stall at pixel scoreboard to make sure the + * constants have been loaded into the EUs prior to disable the push constants + * so that it doesn't hang a previous 3DPRIMITIVE. */ static void emit_isp_disable(struct anv_cmd_buffer *cmd_buffer) { anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { - pc.IndirectStatePointersDisable = true; + pc.StallAtPixelScoreboard = true; pc.CommandStreamerStallEnable = true; } + anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) { + pc.IndirectStatePointersDisable = true; + } } VkResult ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): 28 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=561348caa14a849dd50ed1df1d8f7abba7de66f7 Author: Jason Ekstrand Date: Fri Jan 26 11:43:24 2018 -0800 intel/isl: Allow CCS_E on 1010102 formats On CNL and above, CCS_E supports 1010102 formats and R11G11B10F. We had shut them off during early enabling because blorp_copy couldn't handle them. Now it can handle 1010102 formats so we can turn them back on. Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ccb44b8a94654fc827eda784653e607062de3ca1 Author: Jason Ekstrand Date: Fri Jan 26 11:42:35 2018 -0800 intel/blorp: Allow CCS copies of 1010102 formats Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1978de66f7160b5af8eac8041dfa8c4e0ec3bb83 Author: Jason Ekstrand Date: Fri Jan 26 11:41:02 2018 -0800 intel/blorp: Add support for more format bitcasting nir_format_bitcast_uint_vec_unmasked can only be used to cast between formats with uniform channel sizes. In particular, it cannot handle 10_10_10_2 formats. By making use of the NIR helper for uint vector casts, we should now be able to bitcast between any two uint formats so long as their channels are in RGBA order (possibly with channels missing). In order to do this we need to rework the key a bit to pass the actual formats instead of just the number of bits in each. Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7998fe268e727c49388aeed854bc0d6ff1ef6a89 Author: Jason Ekstrand Date: Fri Jan 26 11:35:04 2018 -0800 intel/blorp: Use nir_format_bitcast_uint_vec_unmasked Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=047e68389f0aa56213503e99d31d5357284acdde Author: Jason Ekstrand Date: Fri Jan 26 11:34:04 2018 -0800 nir/format_convert: Add code for bitcasting vectors This is a fairly direct port from blorp. The only real change is that the nir_format_convert version doesn't assume that everything is a vec4. Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6b66a7b26ae1cc01355d3ccfaa604a5c8e1dae5 Author: Jason Ekstrand Date: Fri Jan 26 10:44:51 2018 -0800 intel/blorp: Use ISL instead of bitcast_color_value_to_uint Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=09ced6542049986f7fe52af8087aec9fc23d9f16 Author: Jason Ekstrand Date: Thu Jun 22 18:45:24 2017 -0700 intel/isl: Add format conversion code This adds helpers to ISL to convert an isl_color_value to and from binary data encoded with a given isl_format. The conversion is done using ISL's built-in format introspection so it's fairly slow as format conversions go but it should be fine for a single pixel value. In particular, we can use this to convert clear colors. As a side-effect, we now rely on the sRGB helpers in libmesautil so we need to tweak the build system a bit. All prior uses of src/util in ISL were header-only. Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8152c60e012605df2ac3a3522974e17c2362b770 Author: Jason Ekstrand Date: Thu Jun 22 23:18:06 2017 -0700 intel/isl/format: Get rid of the ALPHA colorspace Alpha-only formats are just linear. There's no need to specially deliminate them as being in their own colorspace. Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ab73790efbce705c84c5fd6e598d91ffe02b579 Author: Jason Ekstrand Date: Thu Jun 22 17:12:36 2017 -0700 intel/isl/format: Add field locations informations to channel_layout Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=96598fbc02d2277a923d10aad168a7a3be0fb08b Author: Jason Ekstrand Date: Thu Jun 22 16:52:56 2017 -0700 intel/isl/format: Add a column for channel order to the table Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d08d6a3da88aa3a07e0c867428c93ab7be23c9e4 Author: Jason Ekstrand Date: Fri Jan 20 22:36:30 2017 -0800 i965/blorp: Remove a pile of blorp_blit restrictions Previously, blorp could only blit into something that was renderable. Thanks to recent additions to blorp, it can now blit into basically anything so long as it isn't compressed. Reviewed-by: Topi Pohjolainen URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=465d8566cdff545343388a11a56fe6048024c13c Author: Jason Ekstrand Date: Wed May 9 09:48:29 2018 -0700 i965/blorp: Allow blorp blits for 16x MSAA BLORP has supported 16x MSAA for quite a while now, we just never bothered to enable it for CopyTexSubImage. Reviewed-by: Topi Pohjolainen U
Mesa (master): i965: silence unused variable
Module: Mesa Branch: master Commit: 3853f1c6f4b97edde22c767a80c137da6e39904a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3853f1c6f4b97edde22c767a80c137da6e39904a Author: Lionel Landwerlin Date: Wed May 9 16:40:37 2018 +0100 i965: silence unused variable Signed-off-by: Lionel Landwerlin Fixes: 2dc29e095f9da ("i965: Don't leak blorp on Gen4-5.") Reviewed-by: Caio Marcelo de Oliveira Filho --- src/mesa/drivers/dri/i965/brw_context.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index ec3fe3be40..bd1e20845f 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -1098,7 +1098,6 @@ intelDestroyContext(__DRIcontext * driContextPriv) struct brw_context *brw = (struct brw_context *) driContextPriv->driverPrivate; struct gl_context *ctx = &brw->ctx; - const struct gen_device_info *devinfo = &brw->screen->devinfo; _mesa_meta_free(&brw->ctx); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel: devinfo: silence coverity warning
Module: Mesa Branch: master Commit: 11d36c373adcb62016dce9a250120299cfb6e7d8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=11d36c373adcb62016dce9a250120299cfb6e7d8 Author: Lionel Landwerlin Date: Wed May 9 15:08:03 2018 +0100 intel: devinfo: silence coverity warning It's just not possible to have a device with no subslices. CID: 1433511 Signed-off-by: Lionel Landwerlin Reviewed-by: Rafael Antognolli --- src/intel/dev/gen_device_info.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/intel/dev/gen_device_info.c b/src/intel/dev/gen_device_info.c index aa72d96e17..653cece6d7 100644 --- a/src/intel/dev/gen_device_info.c +++ b/src/intel/dev/gen_device_info.c @@ -1034,6 +1034,7 @@ gen_device_info_update_from_topology(struct gen_device_info *devinfo, } n_subslices += devinfo->num_subslices[s]; } + assert(n_subslices > 0); uint32_t eu_mask_len = topology->eu_stride * topology->max_subslices * topology->max_slices; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): dri3: Only update number of back buffers in loader_dri3_get_buffers
Module: Mesa Branch: master Commit: 6f81e07ecb8c0793dc482307d5d96fd3df95b7d2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f81e07ecb8c0793dc482307d5d96fd3df95b7d2 Author: Michel Dänzer Date: Fri Apr 27 17:41:48 2018 +0200 dri3: Only update number of back buffers in loader_dri3_get_buffers And only free no longer needed back buffers there as well. We want to stick to the same back buffer throughout a frame, otherwise we can run into various issues. Bugzilla: https://bugs.freedesktop.org/105906 Bugzilla: https://bugs.freedesktop.org/106399 Fixes: 3160cb86aa92 "egl/x11: Re-allocate buffers if format is suboptimal" Reported-by: Sergii Romantsov Tested-by: Eero Tamminen Acked-by: Daniel Stone --- src/loader/loader_dri3_helper.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c index 23729f7ecb..6db8303d26 100644 --- a/src/loader/loader_dri3_helper.c +++ b/src/loader/loader_dri3_helper.c @@ -420,13 +420,6 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw, if (buf && buf->pixmap == ie->pixmap) buf->busy = 0; - - if (buf && draw->cur_blit_source != b && !buf->busy && - (buf->reallocate || - (draw->num_back <= b && b < LOADER_DRI3_MAX_BACK))) { -dri3_free_render_buffer(draw, buf); -draw->buffers[b] = NULL; - } } break; } @@ -559,7 +552,6 @@ dri3_find_back(struct loader_dri3_drawable *draw) /* Check whether we need to reuse the current back buffer as new back. * In that case, wait until it's not busy anymore. */ - dri3_update_num_back(draw); num_to_consider = draw->num_back; if (!loader_dri3_have_image_blit(draw) && draw->cur_blit_source != -1) { num_to_consider = 1; @@ -1815,6 +1807,7 @@ loader_dri3_get_buffers(__DRIdrawable *driDrawable, { struct loader_dri3_drawable *draw = loaderPrivate; struct loader_dri3_buffer *front, *back; + int buf_id; buffers->image_mask = 0; buffers->front = NULL; @@ -1826,6 +1819,16 @@ loader_dri3_get_buffers(__DRIdrawable *driDrawable, if (!dri3_update_drawable(driDrawable, draw)) return false; + dri3_update_num_back(draw); + + /* Free no longer needed back buffers */ + for (buf_id = draw->num_back; buf_id < LOADER_DRI3_MAX_BACK; buf_id++) { + if (draw->cur_blit_source != buf_id && draw->buffers[buf_id]) { + dri3_free_render_buffer(draw, draw->buffers[buf_id]); + draw->buffers[buf_id] = NULL; + } + } + /* pixmaps always have front buffers. * Exchange swaps also mandate fake front buffers. */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): anv: ignore pColorBlendState if all color attachments of the subpass are unused
Module: Mesa Branch: master Commit: 2cf64fdb4623cb145e51f615cf0baf85de23234d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2cf64fdb4623cb145e51f615cf0baf85de23234d Author: Samuel Iglesias Gonsálvez Date: Mon May 7 08:42:56 2018 +0200 anv: ignore pColorBlendState if all color attachments of the subpass are unused According to Vulkan spec: "pColorBlendState is a pointer to an instance of the VkPipelineColorBlendStateCreateInfo structure, and is ignored if the pipeline has rasterization disabled or if the subpass of the render pass the pipeline is created against does not use any color attachments." Fixes tests from CL#2505: dEQP-VK.renderpass.*.simple.color_unused_omit_blend_state v2: - Check that blend is not NULL before usage. Signed-off-by: Samuel Iglesias Gonsálvez Reviewed-by: Jason Ekstrand --- src/intel/vulkan/anv_pipeline.c | 14 -- src/intel/vulkan/genX_pipeline.c | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 87788de10a..8f30136b10 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -1247,8 +1247,18 @@ anv_pipeline_validate_create_info(const VkGraphicsPipelineCreateInfo *info) if (subpass && subpass->depth_stencil_attachment.attachment != VK_ATTACHMENT_UNUSED) assert(info->pDepthStencilState); - if (subpass && subpass->color_count > 0) - assert(info->pColorBlendState); + if (subpass && subpass->color_count > 0) { + bool all_color_unused = true; + for (int i = 0; i < subpass->color_count; i++) { +if (subpass->color_attachments[i].attachment != VK_ATTACHMENT_UNUSED) + all_color_unused = false; + } + /* pColorBlendState is ignored if the pipeline has rasterization + * disabled or if the subpass of the render pass the pipeline is + * created against does not use any color attachments. + */ + assert(info->pColorBlendState || all_color_unused); + } } for (uint32_t i = 0; i < info->stageCount; ++i) { diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index d3af9304ba..6016d25758 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -1361,7 +1361,7 @@ has_color_buffer_write_enabled(const struct anv_pipeline *pipeline, if (binding->index == UINT32_MAX) continue; - if (blend->pAttachments[binding->index].colorWriteMask != 0) + if (blend && blend->pAttachments[binding->index].colorWriteMask != 0) return true; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit