* queries
*/
-static struct dd_query *
-dd_query(struct pipe_query *query)
-{
- return (struct dd_query *)query;
-}
-
-static struct pipe_query *
-dd_query_unwrap(struct pipe_query *query)
-{
- if (query) {
- return dd_query(query)->query;
- } else {
- return NULL;
- }
-}
-
static struct pipe_query *
dd_context_create_query(struct pipe_context *_pipe, unsigned query_type,
unsigned index)
return pipe->get_query_result(pipe, dd_query_unwrap(query), wait, result);
}
-static void
-dd_context_get_query_result_resource(struct pipe_context *_pipe,
- struct pipe_query *query,
- boolean wait,
- enum pipe_query_value_type result_type,
- int index,
- struct pipe_resource *resource,
- unsigned offset)
-{
- struct pipe_context *pipe = dd_context(_pipe)->pipe;
-
- pipe->get_query_result_resource(pipe, dd_query_unwrap(query), wait,
- result_type, index, resource, offset);
-}
-
static void
dd_context_set_active_query_state(struct pipe_context *_pipe, boolean enable)
{
CTX_INIT(begin_query);
CTX_INIT(end_query);
CTX_INIT(get_query_result);
- CTX_INIT(get_query_result_resource);
CTX_INIT(set_active_query_state);
CTX_INIT(create_blend_state);
CTX_INIT(bind_blend_state);
fprintf(f, "%u", i);
}
+static void
+util_dump_int(FILE *f, int i)
+{
+ fprintf(f, "%d", i);
+}
+
static void
util_dump_hex(FILE *f, unsigned i)
{
/* TODO */
}
+static void
+dd_dump_get_query_result_resource(struct call_get_query_result_resource *info, FILE *f)
+{
+ fprintf(f, "%s:\n", __func__ + 8);
+ DUMP_M(query_type, info, query_type);
+ DUMP_M(uint, info, wait);
+ DUMP_M(query_value_type, info, result_type);
+ DUMP_M(int, info, index);
+ DUMP_M(resource, info, resource);
+ DUMP_M(uint, info, offset);
+}
+
static void
dd_dump_flush_resource(struct dd_draw_state *dstate, struct pipe_resource *res,
FILE *f)
case CALL_GENERATE_MIPMAP:
dd_dump_generate_mipmap(state, f);
break;
+ case CALL_GET_QUERY_RESULT_RESOURCE:
+ dd_dump_get_query_result_resource(&call->info.get_query_result_resource, f);
+ break;
}
}
case CALL_GENERATE_MIPMAP:
pipe_resource_reference(&dst->info.generate_mipmap.res, NULL);
break;
+ case CALL_GET_QUERY_RESULT_RESOURCE:
+ pipe_resource_reference(&dst->info.get_query_result_resource.resource, NULL);
+ break;
}
}
src->info.generate_mipmap.res);
dst->info.generate_mipmap = src->info.generate_mipmap;
break;
+ case CALL_GET_QUERY_RESULT_RESOURCE:
+ pipe_resource_reference(&dst->info.get_query_result_resource.resource,
+ src->info.get_query_result_resource.resource);
+ dst->info.get_query_result_resource = src->info.get_query_result_resource;
+ dst->info.get_query_result_resource.query = NULL;
+ break;
}
}
return result;
}
+static void
+dd_context_get_query_result_resource(struct pipe_context *_pipe,
+ struct pipe_query *query,
+ boolean wait,
+ enum pipe_query_value_type result_type,
+ int index,
+ struct pipe_resource *resource,
+ unsigned offset)
+{
+ struct dd_context *dctx = dd_context(_pipe);
+ struct dd_query *dquery = dd_query(query);
+ struct pipe_context *pipe = dctx->pipe;
+ struct dd_call call;
+
+ call.type = CALL_GET_QUERY_RESULT_RESOURCE;
+ call.info.get_query_result_resource.query = query;
+ call.info.get_query_result_resource.wait = wait;
+ call.info.get_query_result_resource.result_type = result_type;
+ call.info.get_query_result_resource.index = index;
+ call.info.get_query_result_resource.resource = resource;
+ call.info.get_query_result_resource.offset = offset;
+
+ /* In pipelined mode, the query may be deleted by the time we need to
+ * print it.
+ */
+ call.info.get_query_result_resource.query_type = dquery->type;
+
+ dd_before_draw(dctx);
+ pipe->get_query_result_resource(pipe, dquery->query, wait,
+ result_type, index, resource, offset);
+ dd_after_draw(dctx, &call);
+}
+
static void
dd_context_flush_resource(struct pipe_context *_pipe,
struct pipe_resource *resource)
CTX_INIT(clear_texture);
CTX_INIT(flush_resource);
CTX_INIT(generate_mipmap);
+ CTX_INIT(get_query_result_resource);
}
CALL_CLEAR_RENDER_TARGET,
CALL_CLEAR_DEPTH_STENCIL,
CALL_GENERATE_MIPMAP,
+ CALL_GET_QUERY_RESULT_RESOURCE,
};
struct call_resource_copy_region
struct pipe_draw_indirect_info indirect;
};
+struct call_get_query_result_resource {
+ struct pipe_query *query;
+ enum pipe_query_type query_type;
+ boolean wait;
+ enum pipe_query_value_type result_type;
+ int index;
+ struct pipe_resource *resource;
+ unsigned offset;
+};
+
struct dd_call
{
enum call_type type;
struct call_clear clear;
struct call_clear_buffer clear_buffer;
struct call_generate_mipmap generate_mipmap;
+ struct call_get_query_result_resource get_query_result_resource;
} info;
};
return (struct dd_screen*)screen;
}
+static inline struct dd_query *
+dd_query(struct pipe_query *query)
+{
+ return (struct dd_query *)query;
+}
+
+static inline struct pipe_query *
+dd_query_unwrap(struct pipe_query *query)
+{
+ if (query) {
+ return dd_query(query)->query;
+ } else {
+ return NULL;
+ }
+}
+
#define CTX_INIT(_member) \
dctx->base._member = dctx->pipe->_member ? dd_context_##_member : NULL