diff options
Diffstat (limited to 'mesalib/src/mesa')
25 files changed, 466 insertions, 76 deletions
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index cf6aaf0c6..ece0a2b4a 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -593,26 +593,42 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx, GLboolean _mesa_validate_DrawTransformFeedback(struct gl_context *ctx, GLenum mode, - struct gl_transform_feedback_object *obj) + struct gl_transform_feedback_object *obj, + GLuint stream, + GLsizei numInstances) { ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); FLUSH_CURRENT(ctx, 0); - if (!_mesa_valid_prim_mode(ctx, mode, "glDrawTransformFeedback")) { + if (!_mesa_valid_prim_mode(ctx, mode, "glDrawTransformFeedback*(mode)")) { return GL_FALSE; } if (!obj) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDrawTransformFeedback(name)"); + _mesa_error(ctx, GL_INVALID_VALUE, "glDrawTransformFeedback*(name)"); return GL_FALSE; } if (!obj->EndedAnytime) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback"); + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback*"); return GL_FALSE; } - if (!check_valid_to_render(ctx, "glDrawTransformFeedback")) { + if (stream >= ctx->Const.MaxVertexStreams) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glDrawTransformFeedbackStream*(index>=MaxVertexStream)"); + return GL_FALSE; + } + + if (numInstances <= 0) { + if (numInstances < 0) + _mesa_error(ctx, GL_INVALID_VALUE, + "glDrawTransformFeedback*Instanced(numInstances=%d)", + numInstances); + return GL_FALSE; + } + + if (!check_valid_to_render(ctx, "glDrawTransformFeedback*")) { return GL_FALSE; } diff --git a/mesalib/src/mesa/main/api_validate.h b/mesalib/src/mesa/main/api_validate.h index 59f329768..8dc8df4b2 100644 --- a/mesalib/src/mesa/main/api_validate.h +++ b/mesalib/src/mesa/main/api_validate.h @@ -83,7 +83,9 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx, extern GLboolean _mesa_validate_DrawTransformFeedback(struct gl_context *ctx, GLenum mode, - struct gl_transform_feedback_object *obj); + struct gl_transform_feedback_object *obj, + GLuint stream, + GLsizei numInstances); #endif diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 7de714b81..d5ccce076 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -655,6 +655,7 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxTransformFeedbackBuffers = MAX_FEEDBACK_BUFFERS; ctx->Const.MaxTransformFeedbackSeparateComponents = 4 * MAX_FEEDBACK_ATTRIBS; ctx->Const.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS; + ctx->Const.MaxVertexStreams = 1; /** GL_ARB_uniform_buffer_object */ ctx->Const.MaxCombinedUniformBlocks = 36; diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index c8a765f47..e60d019bb 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -1052,6 +1052,14 @@ typedef struct { GLsizei primcount, GLint basevertex, GLuint baseinstance); void (GLAPIENTRYP DrawTransformFeedback)(GLenum mode, GLuint name); + void (GLAPIENTRYP DrawTransformFeedbackStream)(GLenum mode, GLuint name, + GLuint stream); + void (GLAPIENTRYP DrawTransformFeedbackInstanced)(GLenum mode, GLuint name, + GLsizei primcount); + void (GLAPIENTRYP DrawTransformFeedbackStreamInstanced)(GLenum mode, + GLuint name, + GLuint stream, + GLsizei primcount); /*@}*/ /** diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c index a827d132d..40961b15c 100644 --- a/mesalib/src/mesa/main/dlist.c +++ b/mesalib/src/mesa/main/dlist.c @@ -472,6 +472,15 @@ typedef enum /* ARB_timer_query */ OPCODE_QUERY_COUNTER, + /* ARB_transform_feedback3 */ + OPCODE_BEGIN_QUERY_INDEXED, + OPCODE_END_QUERY_INDEXED, + OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, + + /* ARB_transform_feedback_instanced */ + OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, + OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, + /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_CONTINUE, @@ -504,6 +513,7 @@ union gl_dlist_node GLuint ui; GLenum e; GLfloat f; + GLsizei si; GLvoid *data; void *next; /* If prev node's opcode==OPCODE_CONTINUE */ }; @@ -5338,7 +5348,6 @@ save_BeginQueryARB(GLenum target, GLuint id) } } - static void GLAPIENTRY save_EndQueryARB(GLenum target) { @@ -5354,7 +5363,6 @@ save_EndQueryARB(GLenum target) } } - static void GLAPIENTRY save_QueryCounter(GLuint id, GLenum target) { @@ -5371,6 +5379,39 @@ save_QueryCounter(GLuint id, GLenum target) } } +static void GLAPIENTRY +save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3); + if (n) { + n[1].e = target; + n[2].ui = index; + n[3].ui = id; + } + if (ctx->ExecuteFlag) { + CALL_BeginQueryIndexed(ctx->Exec, (target, index, id)); + } +} + +static void GLAPIENTRY +save_EndQueryIndexed(GLenum target, GLuint index) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2); + if (n) { + n[1].e = target; + n[2].ui = index; + } + if (ctx->ExecuteFlag) { + CALL_EndQueryIndexed(ctx->Exec, (target, index)); + } +} + #endif /* FEATURE_queryobj */ @@ -6441,6 +6482,60 @@ save_DrawTransformFeedback(GLenum mode, GLuint name) } } +static void GLAPIENTRY +save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3); + if (n) { + n[1].e = mode; + n[2].ui = name; + n[3].ui = stream; + } + if (ctx->ExecuteFlag) { + CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream)); + } +} + +static void GLAPIENTRY +save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name, + GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3); + if (n) { + n[1].e = mode; + n[2].ui = name; + n[3].si = primcount; + } + if (ctx->ExecuteFlag) { + CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount)); + } +} + +static void GLAPIENTRY +save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name, + GLuint stream, GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4); + if (n) { + n[1].e = mode; + n[2].ui = name; + n[3].ui = stream; + n[4].si = primcount; + } + if (ctx->ExecuteFlag) { + CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream, + primcount)); + } +} /* aka UseProgram() */ static void GLAPIENTRY @@ -8368,6 +8463,12 @@ execute_list(struct gl_context *ctx, GLuint list) case OPCODE_QUERY_COUNTER: CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e)); break; + case OPCODE_BEGIN_QUERY_INDEXED: + CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui)); + break; + case OPCODE_END_QUERY_INDEXED: + CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui)); + break; #endif case OPCODE_DRAW_BUFFERS_ARB: { @@ -8686,6 +8787,18 @@ execute_list(struct gl_context *ctx, GLuint list) case OPCODE_DRAW_TRANSFORM_FEEDBACK: CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui)); break; + case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM: + CALL_DrawTransformFeedbackStream(ctx->Exec, + (n[1].e, n[2].ui, n[3].ui)); + break; + case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED: + CALL_DrawTransformFeedbackInstanced(ctx->Exec, + (n[1].e, n[2].ui, n[3].si)); + break; + case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED: + CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, + (n[1].e, n[2].ui, n[3].ui, n[4].si)); + break; case OPCODE_BIND_SAMPLER: @@ -10461,6 +10574,15 @@ _mesa_create_save_table(void) SET_PauseTransformFeedback(table, save_PauseTransformFeedback); SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback); SET_DrawTransformFeedback(table, save_DrawTransformFeedback); + SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream); + SET_DrawTransformFeedbackInstanced(table, + save_DrawTransformFeedbackInstanced); + SET_DrawTransformFeedbackStreamInstanced(table, + save_DrawTransformFeedbackStreamInstanced); +#if FEATURE_queryobj + SET_BeginQueryIndexed(table, save_BeginQueryIndexed); + SET_EndQueryIndexed(table, save_EndQueryIndexed); +#endif #endif /* GL_ARB_instanced_arrays */ diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index dbc2813f2..0675ce75d 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -141,6 +141,8 @@ static const struct extension extension_table[] = { { "GL_ARB_texture_swizzle", o(EXT_texture_swizzle), GL, 2008 }, { "GL_ARB_timer_query", o(ARB_timer_query), GL, 2010 }, { "GL_ARB_transform_feedback2", o(ARB_transform_feedback2), GL, 2010 }, + { "GL_ARB_transform_feedback3", o(ARB_transform_feedback3), GL, 2010 }, + { "GL_ARB_transform_feedback_instanced", o(ARB_transform_feedback_instanced), GL, 2011 }, { "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), GL, 1999 }, { "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), GL, 2009 }, { "GL_ARB_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 }, diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index cfaea62bb..4370c7218 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -1296,6 +1296,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_RGB10_A2UI: return ctx->Extensions.ARB_texture_rgb10_a2ui ? GL_RGBA : 0; + + case GL_RGB565: + return ctx->Extensions.ARB_ES2_compatibility ? GL_RGB : 0; default: return 0; } diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index ccc0b1707..c65c9c2e1 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -1860,8 +1860,7 @@ _mesa_format_image_size(gl_format format, GLsizei width, const GLuint wblocks = (width + bw - 1) / bw; const GLuint hblocks = (height + bh - 1) / bh; const GLuint sz = wblocks * hblocks * info->BytesPerBlock; - assert(depth == 1); - return sz; + return sz * depth; } else { /* non-compressed */ @@ -1887,8 +1886,7 @@ _mesa_format_image_size64(gl_format format, GLsizei width, const uint64_t wblocks = (width + bw - 1) / bw; const uint64_t hblocks = (height + bh - 1) / bh; const uint64_t sz = wblocks * hblocks * info->BytesPerBlock; - assert(depth == 1); - return sz; + return sz * depth; } else { /* non-compressed */ diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index cff4cf394..15de321e4 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -328,6 +328,7 @@ EXTRA_EXT(ARB_sync); EXTRA_EXT(ARB_vertex_shader); EXTRA_EXT(EXT_transform_feedback); EXTRA_EXT(ARB_transform_feedback2); +EXTRA_EXT(ARB_transform_feedback3); EXTRA_EXT(EXT_pixel_buffer_object); EXTRA_EXT(ARB_vertex_program); EXTRA_EXT2(NV_point_sprite, ARB_point_sprite); @@ -1247,6 +1248,14 @@ static const struct value_desc values[] = { { GL_TRANSFORM_FEEDBACK_BINDING, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_transform_feedback2 }, + /* GL_ARB_transform_feedback3 */ + { GL_MAX_TRANSFORM_FEEDBACK_BUFFERS, + CONTEXT_INT(Const.MaxTransformFeedbackBuffers), + extra_ARB_transform_feedback3 }, + { GL_MAX_VERTEX_STREAMS, + CONTEXT_INT(Const.MaxVertexStreams), + extra_ARB_transform_feedback3 }, + /* GL_ARB_geometry_shader4 */ { GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB, CONTEXT_INT(Const.MaxGeometryTextureImageUnits), diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c index b6c2645e9..678dfeb2b 100644 --- a/mesalib/src/mesa/main/image.c +++ b/mesalib/src/mesa/main/image.c @@ -770,6 +770,7 @@ _mesa_is_color_format(GLenum format) case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: + case GL_RGB565: case GL_RGB8: case GL_RGB10: case GL_RGB12: diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index bdbb5137e..1f74e6a83 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2837,6 +2837,7 @@ struct gl_constants GLuint MaxTransformFeedbackBuffers; GLuint MaxTransformFeedbackSeparateComponents; GLuint MaxTransformFeedbackInterleavedComponents; + GLuint MaxVertexStreams; /** GL_EXT_gpu_shader4 */ GLint MinProgramTexelOffset, MaxProgramTexelOffset; @@ -2937,6 +2938,8 @@ struct gl_extensions GLboolean ARB_texture_storage; GLboolean ARB_timer_query; GLboolean ARB_transform_feedback2; + GLboolean ARB_transform_feedback3; + GLboolean ARB_transform_feedback_instanced; GLboolean ARB_transpose_matrix; GLboolean ARB_uniform_buffer_object; GLboolean ARB_vertex_array_object; diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c index 805c031ae..a578aa594 100644 --- a/mesalib/src/mesa/main/queryobj.c +++ b/mesalib/src/mesa/main/queryobj.c @@ -263,28 +263,51 @@ _mesa_IsQueryARB(GLuint id) return GL_FALSE; } +static GLboolean +query_error_check_index(struct gl_context *ctx, GLenum target, GLuint index) +{ + switch (target) { + case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: + case GL_PRIMITIVES_GENERATED: + if (index >= ctx->Const.MaxVertexStreams) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glBeginQueryIndexed(index>=MaxVertexStreams)"); + return GL_FALSE; + } + break; + default: + if (index > 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBeginQueryIndexed(index>0)"); + return GL_FALSE; + } + } + return GL_TRUE; +} static void GLAPIENTRY -_mesa_BeginQueryARB(GLenum target, GLuint id) +_mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id) { struct gl_query_object *q, **bindpt; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glBeginQuery(%s, %u)\n", - _mesa_lookup_enum_by_nr(target), id); + _mesa_debug(ctx, "glBeginQueryIndexed(%s, %u, %u)\n", + _mesa_lookup_enum_by_nr(target), index, id); + + if (!query_error_check_index(ctx, target, index)) + return; FLUSH_VERTICES(ctx, _NEW_DEPTH); bindpt = get_query_binding_point(ctx, target); if (!bindpt) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQuery{Indexed}(target)"); return; } if (id == 0) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB(id==0)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQuery{Indexed}(id==0)"); return; } @@ -293,7 +316,7 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) /* create new object */ q = ctx->Driver.NewQueryObject(ctx, id); if (!q) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQueryARB"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQuery{Indexed}"); return; } _mesa_HashInsert(ctx->Query.QueryObjects, id, q); @@ -302,7 +325,7 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) /* pre-existing object */ if (q->Active) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glBeginQueryARB(query already active)"); + "glBeginQuery{Indexed}(query already active)"); return; } } @@ -320,20 +343,24 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) static void GLAPIENTRY -_mesa_EndQueryARB(GLenum target) +_mesa_EndQueryIndexed(GLenum target, GLuint index) { struct gl_query_object *q, **bindpt; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glEndQuery(%s)\n", _mesa_lookup_enum_by_nr(target)); + _mesa_debug(ctx, "glEndQueryIndexed(%s, %u)\n", + _mesa_lookup_enum_by_nr(target), index); + + if (!query_error_check_index(ctx, target, index)) + return; FLUSH_VERTICES(ctx, _NEW_DEPTH); bindpt = get_query_binding_point(ctx, target); if (!bindpt) { - _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glEndQuery{Indexed}(target)"); return; } @@ -343,7 +370,7 @@ _mesa_EndQueryARB(GLenum target) if (!q || !q->Active) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glEndQueryARB(no matching glBeginQueryARB)"); + "glEndQuery{Indexed}(no matching glBeginQuery{Indexed})"); return; } @@ -351,6 +378,17 @@ _mesa_EndQueryARB(GLenum target) ctx->Driver.EndQuery(ctx, q); } +static void GLAPIENTRY +_mesa_BeginQueryARB(GLenum target, GLuint id) +{ + _mesa_BeginQueryIndexed(target, 0, id); +} + +static void GLAPIENTRY +_mesa_EndQueryARB(GLenum target) +{ + _mesa_EndQueryIndexed(target, 0); +} static void GLAPIENTRY _mesa_QueryCounter(GLuint id, GLenum target) @@ -410,17 +448,22 @@ _mesa_QueryCounter(GLuint id, GLenum target) static void GLAPIENTRY -_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) +_mesa_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname, + GLint *params) { struct gl_query_object *q = NULL, **bindpt = NULL; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glGetQueryiv(%s, %s)\n", + _mesa_debug(ctx, "glGetQueryIndexediv(%s, %u, %s)\n", _mesa_lookup_enum_by_nr(target), + index, _mesa_lookup_enum_by_nr(pname)); + if (!query_error_check_index(ctx, target, index)) + return; + if (target == GL_TIMESTAMP) { if (!ctx->Extensions.ARB_timer_query) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryARB(target)"); @@ -430,7 +473,7 @@ _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) else { bindpt = get_query_binding_point(ctx, target); if (!bindpt) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryARB(target)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glGetQuery{Indexed}iv(target)"); return; } @@ -445,11 +488,16 @@ _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) *params = q ? q->Id : 0; break; default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(pname)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glGetQuery{Indexed}iv(pname)"); return; } } +static void GLAPIENTRY +_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) +{ + _mesa_GetQueryIndexediv(target, 0, pname, params); +} static void GLAPIENTRY _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) @@ -650,6 +698,10 @@ _mesa_init_queryobj_dispatch(struct _glapi_table *disp) SET_GetQueryObjecti64vEXT(disp, _mesa_GetQueryObjecti64vEXT); SET_GetQueryObjectui64vEXT(disp, _mesa_GetQueryObjectui64vEXT); + + SET_BeginQueryIndexed(disp, _mesa_BeginQueryIndexed); + SET_EndQueryIndexed(disp, _mesa_EndQueryIndexed); + SET_GetQueryIndexediv(disp, _mesa_GetQueryIndexediv); } diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index 5fdc2ab1f..26bcbc10a 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -258,6 +258,16 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, ; /* fallthrough */ } + if (ctx->Extensions.ARB_ES2_compatibility) { + switch (internalFormat) { + case GL_RGB565: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); + break; + default: + ; /* fallthrough */ + } + } + if (ctx->Extensions.MESA_ycbcr_texture) { if (internalFormat == GL_YCBCR_MESA) { if (type == GL_UNSIGNED_SHORT_8_8_MESA) diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index b16baaf91..126386ebe 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -138,6 +138,15 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) } } + if (ctx->Extensions.ARB_ES2_compatibility) { + switch (internalFormat) { + case GL_RGB565: + return GL_RGB; + default: + ; /* fallthrough */ + } + } + if (ctx->Extensions.ARB_depth_texture) { switch (internalFormat) { case GL_DEPTH_COMPONENT: diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index 6f8221201..7679b4b08 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -603,6 +603,38 @@ _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count, return; } + if (ctx->Extensions.ARB_transform_feedback3) { + if (bufferMode == GL_INTERLEAVED_ATTRIBS) { + unsigned buffers = 1; + + for (i = 0; i < count; i++) { + if (strcmp(varyings[i], "gl_NextBuffer") == 0) + buffers++; + } + + if (buffers > ctx->Const.MaxTransformFeedbackBuffers) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTransformFeedbackVaryings(too many gl_NextBuffer " + "occurences)"); + return; + } + } else { + for (i = 0; i < count; i++) { + if (strcmp(varyings[i], "gl_NextBuffer") == 0 || + strcmp(varyings[i], "gl_SkipComponents1") == 0 || + strcmp(varyings[i], "gl_SkipComponents2") == 0 || + strcmp(varyings[i], "gl_SkipComponents3") == 0 || + strcmp(varyings[i], "gl_SkipComponents4") == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTransformFeedbackVaryings(SEPARATE_ATTRIBS," + "varying=%s)", + varyings[i]); + return; + } + } + } + } + /* free existing varyings, if any */ for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) { free(shProg->TransformFeedback.VaryingNames[i]); diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c index a27596a98..bf7a54c0a 100644 --- a/mesalib/src/mesa/main/vtxfmt.c +++ b/mesalib/src/mesa/main/vtxfmt.c @@ -111,6 +111,11 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_DrawElementsInstancedBaseVertex(tab, vfmt->DrawElementsInstancedBaseVertex); SET_DrawElementsInstancedBaseVertexBaseInstance(tab, vfmt->DrawElementsInstancedBaseVertexBaseInstance); SET_DrawTransformFeedback(tab, vfmt->DrawTransformFeedback); + SET_DrawTransformFeedbackStream(tab, vfmt->DrawTransformFeedbackStream); + SET_DrawTransformFeedbackInstanced(tab, + vfmt->DrawTransformFeedbackInstanced); + SET_DrawTransformFeedbackStreamInstanced(tab, + vfmt->DrawTransformFeedbackStreamInstanced); /* GL_NV_vertex_program */ SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV); diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c index 27da2c633..1486779fd 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_blit.c +++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c @@ -242,7 +242,7 @@ st_BlitFramebuffer(struct gl_context *ctx, srcX0, srcY0, srcX1, srcY1, srcAtt->Zoffset + srcAtt->CubeMapFace, dstSurf, dstX0, dstY0, dstX1, dstY1, - 0.0, pFilter); + 0.0, pFilter, TGSI_WRITEMASK_XYZW, 0); } else { struct st_renderbuffer *srcRb = @@ -257,7 +257,7 @@ st_BlitFramebuffer(struct gl_context *ctx, srcX0, srcY0, srcX1, srcY1, srcSurf->u.tex.first_layer, dstSurf, dstX0, dstY0, dstX1, dstY1, - 0.0, pFilter); + 0.0, pFilter, TGSI_WRITEMASK_XYZW, 0); } } @@ -281,6 +281,13 @@ st_BlitFramebuffer(struct gl_context *ctx, struct pipe_surface *dstDepthSurf = dstDepthRb ? dstDepthRb->surface : NULL; + struct st_renderbuffer *srcStencilRb = + st_renderbuffer(readFB->Attachment[BUFFER_STENCIL].Renderbuffer); + struct st_renderbuffer *dstStencilRb = + st_renderbuffer(drawFB->Attachment[BUFFER_STENCIL].Renderbuffer); + struct pipe_surface *dstStencilSurf = + dstStencilRb ? dstStencilRb->surface : NULL; + if ((mask & depthStencil) == depthStencil && st_is_depth_stencil_combined(srcDepth, srcStencil) && st_is_depth_stencil_combined(dstDepth, dstStencil)) { @@ -294,7 +301,15 @@ st_BlitFramebuffer(struct gl_context *ctx, srcX0, srcY0, srcX1, srcY1, srcDepthRb->surface->u.tex.first_layer, dstDepthSurf, dstX0, dstY0, dstX1, dstY1, - 0.0, pFilter); + 0.0, pFilter, 0, + BLIT_WRITEMASK_Z | + (st->has_stencil_export ? BLIT_WRITEMASK_STENCIL + : 0)); + + if (!st->has_stencil_export) { + _mesa_problem(ctx, "st_BlitFramebuffer(STENCIL) " + "software fallback not implemented"); + } } else { /* blitting depth and stencil separately */ @@ -305,12 +320,22 @@ st_BlitFramebuffer(struct gl_context *ctx, srcX0, srcY0, srcX1, srcY1, srcDepthRb->surface->u.tex.first_layer, dstDepthSurf, dstX0, dstY0, dstX1, dstY1, - 0.0, pFilter); + 0.0, pFilter, 0, BLIT_WRITEMASK_Z); } if (mask & GL_STENCIL_BUFFER_BIT) { - /* blit stencil only */ - _mesa_problem(ctx, "st_BlitFramebuffer(STENCIL) not completed"); + if (st->has_stencil_export) { + util_blit_pixels(st->blit, srcStencilRb->texture, + srcStencilRb->surface->u.tex.level, + srcX0, srcY0, srcX1, srcY1, + srcStencilRb->surface->u.tex.first_layer, + dstStencilSurf, dstX0, dstY0, dstX1, dstY1, + 0.0, pFilter, 0, BLIT_WRITEMASK_STENCIL); + } + else { + _mesa_problem(ctx, "st_BlitFramebuffer(STENCIL) " + "software fallback not implemented"); + } } } } diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 2bcbada4f..c5f36316b 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -403,6 +403,8 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type) case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: + return GL_RGB565; + case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: return GL_RGB5_A1; @@ -1165,27 +1167,8 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, * The stencil is written using the shader stencil export * functionality. */ if (write_stencil) { - enum pipe_format stencil_format = PIPE_FORMAT_NONE; - - switch (pt->format) { - case PIPE_FORMAT_Z24_UNORM_S8_UINT: - case PIPE_FORMAT_X24S8_UINT: - stencil_format = PIPE_FORMAT_X24S8_UINT; - break; - case PIPE_FORMAT_S8_UINT_Z24_UNORM: - case PIPE_FORMAT_S8X24_UINT: - stencil_format = PIPE_FORMAT_S8X24_UINT; - break; - case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: - case PIPE_FORMAT_X32_S8X24_UINT: - stencil_format = PIPE_FORMAT_X32_S8X24_UINT; - break; - case PIPE_FORMAT_S8_UINT: - stencil_format = PIPE_FORMAT_S8_UINT; - break; - default: - assert(0); - } + enum pipe_format stencil_format = + util_format_stencil_only(pt->format); sv[1] = st_create_texture_sampler_view_format(st->pipe, pt, stencil_format); diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index 67c3f9590..a7f57b96f 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -944,7 +944,7 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, struct pipe_screen *screen = pipe->screen; enum pipe_format dest_format, src_format; GLboolean matching_base_formats; - GLuint format_writemask, sample_count; + GLuint color_writemask, zs_writemask, sample_count; struct pipe_surface *dest_surface = NULL; GLboolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP); struct pipe_surface surf_tmpl; @@ -1025,15 +1025,17 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, } if (texBaseFormat == GL_DEPTH_COMPONENT) { - format_writemask = TGSI_WRITEMASK_XYZW; + color_writemask = 0; + zs_writemask = BLIT_WRITEMASK_Z; dst_usage = PIPE_BIND_DEPTH_STENCIL; } else { - format_writemask = compatible_src_dst_formats(ctx, &strb->Base, texImage); + color_writemask = compatible_src_dst_formats(ctx, &strb->Base, texImage); + zs_writemask = 0; dst_usage = PIPE_BIND_RENDER_TARGET; } - if (!format_writemask || + if ((!color_writemask && !zs_writemask) || !screen->is_format_supported(screen, src_format, PIPE_TEXTURE_2D, sample_count, PIPE_BIND_SAMPLER_VIEW) || @@ -1066,17 +1068,17 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, dest_surface = pipe->create_surface(pipe, stImage->pt, &surf_tmpl); - util_blit_pixels_writemask(st->blit, - strb->texture, - strb->surface->u.tex.level, - srcX, srcY0, - srcX + width, srcY1, - strb->surface->u.tex.first_layer, - dest_surface, - destX, destY, - destX + width, destY + height, - 0.0, PIPE_TEX_MIPFILTER_NEAREST, - format_writemask); + util_blit_pixels(st->blit, + strb->texture, + strb->surface->u.tex.level, + srcX, srcY0, + srcX + width, srcY1, + strb->surface->u.tex.first_layer, + dest_surface, + destX, destY, + destX + width, destY + height, + 0.0, PIPE_TEX_MIPFILTER_NEAREST, + color_writemask, zs_writemask); pipe_surface_reference(&dest_surface, NULL); /* Restore conditional rendering state. */ diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 132dcc02f..117ea90f8 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -187,6 +187,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe ) st->pixel_xfer.cache = _mesa_new_program_cache(); st->force_msaa = st_get_msaa(); + st->has_stencil_export = + screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT); /* GL limits and extensions */ st_init_limits(st); diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index 734b4d9c1..a3f44b3ab 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -81,7 +81,7 @@ struct st_context struct draw_stage *rastpos_stage; /**< For glRasterPos */ GLboolean clamp_frag_color_in_shader; GLboolean clamp_vert_color_in_shader; - + boolean has_stencil_export; /**< can do shader stencil export? */ /* On old libGL's for linux we need to invalidate the drawables * on glViewpport calls, this is set via a option. diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 5b333ad2c..5099acdb5 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -355,6 +355,7 @@ void st_init_extensions(struct st_context *st) { o(ARB_shadow), PIPE_CAP_TEXTURE_SHADOW_MAP }, { o(ARB_texture_non_power_of_two), PIPE_CAP_NPOT_TEXTURES }, { o(ARB_transform_feedback2), PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME }, + { o(ARB_transform_feedback3), PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME }, { o(EXT_blend_equation_separate), PIPE_CAP_BLEND_EQUATION_SEPARATE }, { o(EXT_draw_buffers2), PIPE_CAP_INDEP_BLEND_ENABLE }, @@ -641,4 +642,9 @@ void st_init_extensions(struct st_context *st) screen->get_param(screen, PIPE_CAP_QUERY_TIMESTAMP)) { ctx->Extensions.ARB_timer_query = GL_TRUE; } + + if (ctx->Extensions.ARB_transform_feedback2 && + ctx->Extensions.ARB_draw_instanced) { + ctx->Extensions.ARB_transform_feedback_instanced = GL_TRUE; + } } diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index 4265d14b4..57d34411f 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -793,6 +793,10 @@ static const struct format_mapping format_map[] = { { PIPE_FORMAT_B5G6R5_UNORM, PIPE_FORMAT_B5G5R5A1_UNORM, DEFAULT_RGBA_FORMATS } }, + { + { GL_RGB565 }, + { PIPE_FORMAT_B5G6R5_UNORM, DEFAULT_RGBA_FORMATS } + }, /* basic Alpha formats */ { diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index d2854dd6c..a923aa1fa 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -1286,12 +1286,17 @@ vbo_exec_MultiDrawElementsBaseVertex(GLenum mode, static void vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode, struct gl_transform_feedback_object *obj, - GLuint numInstances) + GLuint stream, GLuint numInstances) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; struct _mesa_prim prim[2]; + if (!_mesa_validate_DrawTransformFeedback(ctx, mode, obj, stream, + numInstances)) { + return; + } + vbo_bind_arrays(ctx); /* init most fields to zero */ @@ -1334,11 +1339,52 @@ vbo_exec_DrawTransformFeedback(GLenum mode, GLuint name) _mesa_debug(ctx, "glDrawTransformFeedback(%s, %d)\n", _mesa_lookup_enum_by_nr(mode), name); - if (!_mesa_validate_DrawTransformFeedback(ctx, mode, obj)) { - return; - } + vbo_draw_transform_feedback(ctx, mode, obj, 0, 1); +} + +static void GLAPIENTRY +vbo_exec_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_transform_feedback_object *obj = + _mesa_lookup_transform_feedback_object(ctx, name); + + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, "glDrawTransformFeedbackStream(%s, %u, %u)\n", + _mesa_lookup_enum_by_nr(mode), name, stream); + + vbo_draw_transform_feedback(ctx, mode, obj, stream, 1); +} + +static void GLAPIENTRY +vbo_exec_DrawTransformFeedbackInstanced(GLenum mode, GLuint name, + GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_transform_feedback_object *obj = + _mesa_lookup_transform_feedback_object(ctx, name); + + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, "glDrawTransformFeedbackInstanced(%s, %d)\n", + _mesa_lookup_enum_by_nr(mode), name); + + vbo_draw_transform_feedback(ctx, mode, obj, 0, primcount); +} + +static void GLAPIENTRY +vbo_exec_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name, + GLuint stream, GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_transform_feedback_object *obj = + _mesa_lookup_transform_feedback_object(ctx, name); + + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, "glDrawTransformFeedbackStreamInstanced" + "(%s, %u, %u, %i)\n", + _mesa_lookup_enum_by_nr(mode), name, stream, primcount); - vbo_draw_transform_feedback(ctx, mode, obj, 1); + vbo_draw_transform_feedback(ctx, mode, obj, stream, primcount); } #endif @@ -1365,6 +1411,12 @@ vbo_exec_array_init( struct vbo_exec_context *exec ) exec->vtxfmt.DrawElementsInstancedBaseVertexBaseInstance = vbo_exec_DrawElementsInstancedBaseVertexBaseInstance; #if FEATURE_EXT_transform_feedback exec->vtxfmt.DrawTransformFeedback = vbo_exec_DrawTransformFeedback; + exec->vtxfmt.DrawTransformFeedbackStream = + vbo_exec_DrawTransformFeedbackStream; + exec->vtxfmt.DrawTransformFeedbackInstanced = + vbo_exec_DrawTransformFeedbackInstanced; + exec->vtxfmt.DrawTransformFeedbackStreamInstanced = + vbo_exec_DrawTransformFeedbackStreamInstanced; #endif } diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c index d27525812..a02a13db5 100644 --- a/mesalib/src/mesa/vbo/vbo_save_api.c +++ b/mesalib/src/mesa/vbo/vbo_save_api.c @@ -1068,6 +1068,45 @@ _save_DrawTransformFeedback(GLenum mode, GLuint name) static void GLAPIENTRY +_save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream) +{ + GET_CURRENT_CONTEXT(ctx); + (void) mode; + (void) name; + (void) stream; + _mesa_compile_error(ctx, GL_INVALID_OPERATION, + "glDrawTransformFeedbackStream"); +} + + +static void GLAPIENTRY +_save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name, + GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + (void) mode; + (void) name; + (void) primcount; + _mesa_compile_error(ctx, GL_INVALID_OPERATION, + "glDrawTransformFeedbackInstanced"); +} + + +static void GLAPIENTRY +_save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name, + GLuint stream, GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + (void) mode; + (void) name; + (void) stream; + (void) primcount; + _mesa_compile_error(ctx, GL_INVALID_OPERATION, + "glDrawTransformFeedbackStreamInstanced"); +} + + +static void GLAPIENTRY _save_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) { GET_CURRENT_CONTEXT(ctx); @@ -1416,9 +1455,13 @@ _save_vtxfmt_init(struct gl_context *ctx) vfmt->DrawRangeElements = _save_DrawRangeElements; vfmt->DrawElementsBaseVertex = _save_DrawElementsBaseVertex; vfmt->DrawRangeElementsBaseVertex = _save_DrawRangeElementsBaseVertex; - vfmt->DrawTransformFeedback = _save_DrawTransformFeedback; vfmt->MultiDrawElementsEXT = _save_MultiDrawElements; vfmt->MultiDrawElementsBaseVertex = _save_MultiDrawElementsBaseVertex; + vfmt->DrawTransformFeedback = _save_DrawTransformFeedback; + vfmt->DrawTransformFeedbackStream = _save_DrawTransformFeedbackStream; + vfmt->DrawTransformFeedbackInstanced = _save_DrawTransformFeedbackInstanced; + vfmt->DrawTransformFeedbackStreamInstanced = + _save_DrawTransformFeedbackStreamInstanced; } |