aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-11 12:00:44 +0200
committermarha <marha@users.sourceforge.net>2012-07-11 12:00:44 +0200
commitdb967c2b0fd8506b9e1cf7574d5fb927bec786c5 (patch)
tree5444de1e304af7b5ae8c4b590a08b1b5964c7eca /mesalib/src/mesa/main
parent6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab (diff)
parent0bef135026040688be97af98cc99cc82f93838e8 (diff)
downloadvcxsrv-db967c2b0fd8506b9e1cf7574d5fb927bec786c5.tar.gz
vcxsrv-db967c2b0fd8506b9e1cf7574d5fb927bec786c5.tar.bz2
vcxsrv-db967c2b0fd8506b9e1cf7574d5fb927bec786c5.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/dix/devices.c
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/dd.h6
-rw-r--r--mesalib/src/mesa/main/dlist.c24
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/get.c15
-rw-r--r--mesalib/src/mesa/main/queryobj.c78
-rw-r--r--mesalib/src/mesa/main/texcompress_etc.h4
6 files changed, 119 insertions, 9 deletions
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 687a38f44..c8a765f47 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -820,6 +820,12 @@ struct dd_function_table {
GLuint name);
void (*DeleteSamplerObject)(struct gl_context *ctx,
struct gl_sampler_object *samp);
+
+ /**
+ * \name Return a timestamp in nanoseconds as defined by GL_ARB_timer_query.
+ * This should be equivalent to glGetInteger64v(GL_TIMESTAMP);
+ */
+ uint64_t (*GetTimestamp)(struct gl_context *ctx);
};
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index a0d84cfdc..a827d132d 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -469,6 +469,9 @@ typedef enum
OPCODE_BEGIN_CONDITIONAL_RENDER,
OPCODE_END_CONDITIONAL_RENDER,
+ /* ARB_timer_query */
+ OPCODE_QUERY_COUNTER,
+
/* The following three are meta instructions */
OPCODE_ERROR, /* raise compiled-in error */
OPCODE_CONTINUE,
@@ -5351,6 +5354,23 @@ save_EndQueryARB(GLenum target)
}
}
+
+static void GLAPIENTRY
+save_QueryCounter(GLuint id, GLenum target)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
+ if (n) {
+ n[1].ui = id;
+ n[2].e = target;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_QueryCounter(ctx->Exec, (id, target));
+ }
+}
+
#endif /* FEATURE_queryobj */
@@ -8345,6 +8365,9 @@ execute_list(struct gl_context *ctx, GLuint list)
case OPCODE_END_QUERY_ARB:
CALL_EndQueryARB(ctx->Exec, (n[1].e));
break;
+ case OPCODE_QUERY_COUNTER:
+ CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
+ break;
#endif
case OPCODE_DRAW_BUFFERS_ARB:
{
@@ -10309,6 +10332,7 @@ _mesa_create_save_table(void)
_mesa_init_queryobj_dispatch(table); /* glGetQuery, etc */
SET_BeginQueryARB(table, save_BeginQueryARB);
SET_EndQueryARB(table, save_EndQueryARB);
+ SET_QueryCounter(table, save_QueryCounter);
#endif
SET_DrawBuffersARB(table, save_DrawBuffersARB);
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 793cc4e24..dbc2813f2 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -139,6 +139,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_texture_rg", o(ARB_texture_rg), GL, 2008 },
{ "GL_ARB_texture_storage", o(ARB_texture_storage), GL, 2011 },
{ "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_transpose_matrix", o(ARB_transpose_matrix), GL, 1999 },
{ "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), GL, 2009 },
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index a83d36721..cff4cf394 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -342,6 +342,7 @@ EXTRA_EXT(ARB_texture_buffer_object);
EXTRA_EXT(OES_EGL_image_external);
EXTRA_EXT(ARB_blend_func_extended);
EXTRA_EXT(ARB_uniform_buffer_object);
+EXTRA_EXT(ARB_timer_query);
static const int
extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = {
@@ -1353,6 +1354,9 @@ static const struct value_desc values[] = {
{ GL_UNIFORM_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_uniform_buffer_object },
+ /* GL_ARB_timer_query */
+ { GL_TIMESTAMP, LOC_CUSTOM, TYPE_INT64, 0, extra_ARB_timer_query }
+
#endif /* FEATURE_GL */
};
@@ -1807,7 +1811,16 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
case GL_UNIFORM_BUFFER_BINDING:
v->value_int = ctx->UniformBuffer->Name;
break;
- }
+ /* GL_ARB_timer_query */
+ case GL_TIMESTAMP:
+ if (ctx->Driver.GetTimestamp) {
+ v->value_int64 = ctx->Driver.GetTimestamp(ctx);
+ }
+ else {
+ _mesa_problem(ctx, "driver doesn't implement GetTimestamp");
+ }
+ break;
+ }
}
/**
diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c
index bae5dad1e..805c031ae 100644
--- a/mesalib/src/mesa/main/queryobj.c
+++ b/mesalib/src/mesa/main/queryobj.c
@@ -353,9 +353,66 @@ _mesa_EndQueryARB(GLenum target)
static void GLAPIENTRY
+_mesa_QueryCounter(GLuint id, GLenum target)
+{
+ struct gl_query_object *q;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glQueryCounter(%u, %s)\n", id,
+ _mesa_lookup_enum_by_nr(target));
+
+ /* error checking */
+ if (target != GL_TIMESTAMP) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glQueryCounter(target)");
+ return;
+ }
+
+ if (id == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glQueryCounter(id==0)");
+ return;
+ }
+
+ q = _mesa_lookup_query_object(ctx, id);
+ if (!q) {
+ /* XXX the Core profile should throw INVALID_OPERATION here */
+
+ /* create new object */
+ q = ctx->Driver.NewQueryObject(ctx, id);
+ if (!q) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glQueryCounter");
+ return;
+ }
+ _mesa_HashInsert(ctx->Query.QueryObjects, id, q);
+ }
+ else {
+ if (q->Target && q->Target != GL_TIMESTAMP) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glQueryCounter(id has an invalid target)");
+ return;
+ }
+ }
+
+ if (q->Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glQueryCounter(id is active)");
+ return;
+ }
+
+ q->Target = target;
+ q->Result = 0;
+ q->Ready = GL_FALSE;
+
+ /* QueryCounter is implemented using EndQuery without BeginQuery
+ * in drivers. This is actually Direct3D and Gallium convention. */
+ ctx->Driver.EndQuery(ctx, q);
+}
+
+
+static void GLAPIENTRY
_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params)
{
- struct gl_query_object *q, **bindpt;
+ struct gl_query_object *q = NULL, **bindpt = NULL;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -364,13 +421,21 @@ _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params)
_mesa_lookup_enum_by_nr(target),
_mesa_lookup_enum_by_nr(pname));
- bindpt = get_query_binding_point(ctx, target);
- if (!bindpt) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryARB(target)");
- return;
+ if (target == GL_TIMESTAMP) {
+ if (!ctx->Extensions.ARB_timer_query) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryARB(target)");
+ return;
+ }
}
+ else {
+ bindpt = get_query_binding_point(ctx, target);
+ if (!bindpt) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryARB(target)");
+ return;
+ }
- q = *bindpt;
+ q = *bindpt;
+ }
switch (pname) {
case GL_QUERY_COUNTER_BITS_ARB:
@@ -581,6 +646,7 @@ _mesa_init_queryobj_dispatch(struct _glapi_table *disp)
SET_GetQueryivARB(disp, _mesa_GetQueryivARB);
SET_GetQueryObjectivARB(disp, _mesa_GetQueryObjectivARB);
SET_GetQueryObjectuivARB(disp, _mesa_GetQueryObjectuivARB);
+ SET_QueryCounter(disp, _mesa_QueryCounter);
SET_GetQueryObjecti64vEXT(disp, _mesa_GetQueryObjecti64vEXT);
SET_GetQueryObjectui64vEXT(disp, _mesa_GetQueryObjectui64vEXT);
diff --git a/mesalib/src/mesa/main/texcompress_etc.h b/mesalib/src/mesa/main/texcompress_etc.h
index 4e166b2b1..8e8427f8f 100644
--- a/mesalib/src/mesa/main/texcompress_etc.h
+++ b/mesalib/src/mesa/main/texcompress_etc.h
@@ -30,10 +30,10 @@
struct swrast_texture_image;
-extern GLboolean
+GLboolean
_mesa_texstore_etc1_rgb8(TEXSTORE_PARAMS);
-extern void
+void
_mesa_fetch_texel_2d_f_etc1_rgb8(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel);