diff options
Diffstat (limited to 'mesalib/src/mesa/main/varray.c')
-rw-r--r-- | mesalib/src/mesa/main/varray.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 213b845c9..db0945e30 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -18,9 +18,10 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ @@ -33,7 +34,6 @@ #include "hash.h" #include "image.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "varray.h" #include "arrayobj.h" @@ -269,7 +269,6 @@ update_array(struct gl_context *ctx, ctx->Array.ArrayBufferObj); ctx->NewState |= _NEW_ARRAY; - ctx->Array.ArrayObj->NewArrays |= VERT_BIT(attrib); } @@ -521,7 +520,6 @@ _mesa_EnableVertexAttribArray(GLuint index) FLUSH_VERTICES(ctx, _NEW_ARRAY); arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE; arrayObj->_Enabled |= VERT_BIT_GENERIC(index); - arrayObj->NewArrays |= VERT_BIT_GENERIC(index); } } @@ -547,7 +545,6 @@ _mesa_DisableVertexAttribArray(GLuint index) FLUSH_VERTICES(ctx, _NEW_ARRAY); arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE; arrayObj->_Enabled &= ~VERT_BIT_GENERIC(index); - arrayObj->NewArrays |= VERT_BIT_GENERIC(index); } } @@ -1112,10 +1109,9 @@ _mesa_PrimitiveRestartIndex(GLuint index) return; } - ctx->Array.RestartIndex = index; - if (ctx->Array.PrimitiveRestart && ctx->Array._RestartIndex != index) { + if (ctx->Array.RestartIndex != index) { FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Array._RestartIndex = index; + ctx->Array.RestartIndex = index; } } @@ -1148,11 +1144,34 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor) if (array->InstanceDivisor != divisor) { FLUSH_VERTICES(ctx, _NEW_ARRAY); array->InstanceDivisor = divisor; - ctx->Array.ArrayObj->NewArrays |= VERT_BIT(VERT_ATTRIB_GENERIC(index)); } } +unsigned +_mesa_primitive_restart_index(const struct gl_context *ctx, GLenum ib_type) +{ + /* From the OpenGL 4.3 core specification, page 302: + * "If both PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are + * enabled, the index value determined by PRIMITIVE_RESTART_FIXED_INDEX + * is used." + */ + if (ctx->Array.PrimitiveRestartFixedIndex) { + switch (ib_type) { + case GL_UNSIGNED_BYTE: + return 0xff; + case GL_UNSIGNED_SHORT: + return 0xffff; + case GL_UNSIGNED_INT: + return 0xffffffff; + default: + assert(!"_mesa_primitive_restart_index: Invalid index buffer type."); + } + } + + return ctx->Array.RestartIndex; +} + /** * Copy one client vertex array to another. |