return 1;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 10;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 1;
case PIPE_CAP_OCCLUSION_QUERY:
return 0;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 1;
case PIPE_CAP_OCCLUSION_QUERY:
return 0;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return PIPE_MAX_COLOR_BUFS;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
return 1;
case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
return 8;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return screen->is_nv4x ? 4 : 2;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 1;
/* Unsupported features (boolean caps). */
+ case PIPE_CAP_TIMER_QUERY:
case PIPE_CAP_DUAL_SOURCE_BLEND:
case PIPE_CAP_TGSI_CONT_SUPPORTED:
case PIPE_CAP_INDEP_BLEND_ENABLE:
*/
#include "draw/draw_context.h"
+#include "os/os_time.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
#include "sp_context.h"
#include "sp_state.h"
struct softpipe_query {
+ unsigned type;
uint64_t start;
uint64_t end;
};
softpipe_create_query(struct pipe_context *pipe,
unsigned type)
{
- assert(type == PIPE_QUERY_OCCLUSION_COUNTER);
- return (struct pipe_query *)CALLOC_STRUCT( softpipe_query );
+ struct softpipe_query* sq;
+
+ assert(type == PIPE_QUERY_OCCLUSION_COUNTER || type == PIPE_QUERY_TIME_ELAPSED);
+ sq = CALLOC_STRUCT( softpipe_query );
+ sq->type = type;
+
+ return (struct pipe_query *)sq;
}
struct softpipe_context *softpipe = softpipe_context( pipe );
struct softpipe_query *sq = softpipe_query(q);
- sq->start = softpipe->occlusion_count;
+ switch (sq->type) {
+ case PIPE_QUERY_OCCLUSION_COUNTER:
+ sq->start = softpipe->occlusion_count;
+ break;
+ case PIPE_QUERY_TIME_ELAPSED:
+ sq->start = 1000*os_time_get();
+ break;
+ default:
+ assert(0);
+ break;
+ }
softpipe->active_query_count++;
softpipe->dirty |= SP_NEW_QUERY;
}
struct softpipe_query *sq = softpipe_query(q);
softpipe->active_query_count--;
- sq->end = softpipe->occlusion_count;
+ switch (sq->type) {
+ case PIPE_QUERY_OCCLUSION_COUNTER:
+ sq->end = softpipe->occlusion_count;
+ break;
+ case PIPE_QUERY_TIME_ELAPSED:
+ sq->end = 1000*os_time_get();
+ break;
+ default:
+ assert(0);
+ break;
+ }
softpipe->dirty |= SP_NEW_QUERY;
}
return PIPE_MAX_COLOR_BUFS;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 1;
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
return 1;
case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
return MIN2(result.u, PIPE_MAX_COLOR_BUFS);
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
#define PIPE_QUERY_OCCLUSION_COUNTER 0
#define PIPE_QUERY_PRIMITIVES_GENERATED 1
#define PIPE_QUERY_PRIMITIVES_EMITTED 2
-#define PIPE_QUERY_TYPES 3
+#define PIPE_QUERY_TIME_ELAPSED 3
+#define PIPE_QUERY_TYPES 4
/**
PIPE_CAP_POINT_SPRITE,
PIPE_CAP_MAX_RENDER_TARGETS,
PIPE_CAP_OCCLUSION_QUERY,
+ PIPE_CAP_TIMER_QUERY,
PIPE_CAP_TEXTURE_SHADOW_MAP,
PIPE_CAP_MAX_TEXTURE_2D_LEVELS,
PIPE_CAP_MAX_TEXTURE_3D_LEVELS,
case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
type = PIPE_QUERY_PRIMITIVES_EMITTED;
break;
+ case GL_TIME_ELAPSED_EXT:
+ type = PIPE_QUERY_TIME_ELAPSED;
+ break;
default:
assert(0 && "unexpected query target in st_BeginQuery()");
return;
if (screen->get_param(screen, PIPE_CAP_OCCLUSION_QUERY)) {
ctx->Extensions.ARB_occlusion_query = GL_TRUE;
}
+ if (screen->get_param(screen, PIPE_CAP_TIMER_QUERY)) {
+ ctx->Extensions.EXT_timer_query = GL_TRUE;
+ }
if (screen->get_param(screen, PIPE_CAP_TEXTURE_SHADOW_MAP)) {
ctx->Extensions.ARB_depth_texture = GL_TRUE;