python: Allow to use trace pipe driver with python.

This commit is contained in:
José Fonseca
2008-08-14 10:58:23 +01:00
parent 92675f6e22
commit ffaa4e816f
3 changed files with 34 additions and 9 deletions

View File

@@ -30,5 +30,5 @@ if 'python' in env['statetrackers']:
source = [ source = [
'st_hardpipe_winsys.c', 'st_hardpipe_winsys.c',
], ],
LIBS = [pyst, softpipe] + auxiliaries + env['LIBS'], LIBS = [pyst, softpipe, trace] + auxiliaries + env['LIBS'],
) )

View File

@@ -33,6 +33,9 @@
#include "pipe/p_inlines.h" #include "pipe/p_inlines.h"
#include "cso_cache/cso_context.h" #include "cso_cache/cso_context.h"
#include "util/u_simple_shaders.h" #include "util/u_simple_shaders.h"
#include "trace/tr_screen.h"
#include "trace/tr_context.h"
#include "st_device.h" #include "st_device.h"
#include "st_winsys.h" #include "st_winsys.h"
@@ -71,9 +74,17 @@ st_device_create_from_st_winsys(const struct st_winsys *st_ws)
st_dev->refcount = 1; st_dev->refcount = 1;
st_dev->st_ws = st_ws; st_dev->st_ws = st_ws;
st_dev->screen = st_ws->screen_create(); st_dev->real_screen = st_ws->screen_create();
if(!st_dev->screen) if(!st_dev->real_screen) {
st_device_destroy(st_dev); st_device_destroy(st_dev);
return NULL;
}
st_dev->screen = trace_screen_create(st_dev->real_screen);
if(!st_dev->screen) {
st_device_destroy(st_dev);
return NULL;
}
return st_dev; return st_dev;
} }
@@ -130,13 +141,23 @@ st_context_create(struct st_device *st_dev)
st_ctx->st_dev = st_dev; st_ctx->st_dev = st_dev;
++st_dev->refcount; ++st_dev->refcount;
st_ctx->pipe = st_dev->st_ws->context_create(st_dev->screen); st_ctx->real_pipe = st_dev->st_ws->context_create(st_dev->real_screen);
if(!st_ctx->pipe) if(!st_ctx->real_pipe) {
st_context_destroy(st_ctx); st_context_destroy(st_ctx);
return NULL;
}
st_ctx->cso = cso_create_context(st_ctx->pipe); st_ctx->pipe = trace_context_create(st_dev->screen, st_ctx->real_pipe);
if(!st_ctx->cso) if(!st_ctx->pipe) {
st_context_destroy(st_ctx); st_context_destroy(st_ctx);
return NULL;
}
st_ctx->cso = cso_create_context(st_ctx->pipe);
if(!st_ctx->cso) {
st_context_destroy(st_ctx);
return NULL;
}
/* disabled blending/masking */ /* disabled blending/masking */
{ {
@@ -291,8 +312,10 @@ st_buffer_create(struct st_device *st_dev,
st_buf->st_dev = st_dev; st_buf->st_dev = st_dev;
st_buf->buffer = winsys->buffer_create(winsys, alignment, usage, size); st_buf->buffer = winsys->buffer_create(winsys, alignment, usage, size);
if(!st_buf->buffer) if(!st_buf->buffer) {
st_buffer_destroy(st_buf); st_buffer_destroy(st_buf);
return NULL;
}
return st_buf; return st_buf;
} }

View File

@@ -48,6 +48,7 @@ struct st_buffer {
struct st_context { struct st_context {
struct st_device *st_dev; struct st_device *st_dev;
struct pipe_context *real_pipe;
struct pipe_context *pipe; struct pipe_context *pipe;
struct cso_context *cso; struct cso_context *cso;
@@ -68,7 +69,8 @@ struct st_context {
struct st_device { struct st_device {
const struct st_winsys *st_ws; const struct st_winsys *st_ws;
struct pipe_screen *real_screen;
struct pipe_screen *screen; struct pipe_screen *screen;
/* FIXME: we also need to refcount for textures and surfaces... */ /* FIXME: we also need to refcount for textures and surfaces... */