summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/python
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-14 10:58:23 +0100
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-14 11:01:43 +0100
commitffaa4e816fb1d7360e6c14cbbfd4df8e027b9573 (patch)
tree83148aa0792c14dcec592b4db5e85dd9c82e54f8 /src/gallium/state_trackers/python
parent92675f6e22a1caa11146c2e9f3b2fb2285fdccea (diff)
python: Allow to use trace pipe driver with python.
Diffstat (limited to 'src/gallium/state_trackers/python')
-rw-r--r--src/gallium/state_trackers/python/SConscript2
-rw-r--r--src/gallium/state_trackers/python/st_device.c35
-rw-r--r--src/gallium/state_trackers/python/st_device.h4
3 files changed, 33 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/python/SConscript b/src/gallium/state_trackers/python/SConscript
index 973d96d55a..1581182aec 100644
--- a/src/gallium/state_trackers/python/SConscript
+++ b/src/gallium/state_trackers/python/SConscript
@@ -30,5 +30,5 @@ if 'python' in env['statetrackers']:
source = [
'st_hardpipe_winsys.c',
],
- LIBS = [pyst, softpipe] + auxiliaries + env['LIBS'],
+ LIBS = [pyst, softpipe, trace] + auxiliaries + env['LIBS'],
)
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index c82261e4e7..a1889539dc 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -33,6 +33,9 @@
#include "pipe/p_inlines.h"
#include "cso_cache/cso_context.h"
#include "util/u_simple_shaders.h"
+#include "trace/tr_screen.h"
+#include "trace/tr_context.h"
+
#include "st_device.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->st_ws = st_ws;
- st_dev->screen = st_ws->screen_create();
- if(!st_dev->screen)
+ st_dev->real_screen = st_ws->screen_create();
+ if(!st_dev->real_screen) {
+ 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;
}
@@ -130,13 +141,23 @@ st_context_create(struct st_device *st_dev)
st_ctx->st_dev = st_dev;
++st_dev->refcount;
- st_ctx->pipe = st_dev->st_ws->context_create(st_dev->screen);
- if(!st_ctx->pipe)
+ st_ctx->real_pipe = st_dev->st_ws->context_create(st_dev->real_screen);
+ if(!st_ctx->real_pipe) {
st_context_destroy(st_ctx);
+ return NULL;
+ }
+ st_ctx->pipe = trace_context_create(st_dev->screen, st_ctx->real_pipe);
+ if(!st_ctx->pipe) {
+ st_context_destroy(st_ctx);
+ return NULL;
+ }
+
st_ctx->cso = cso_create_context(st_ctx->pipe);
- if(!st_ctx->cso)
+ if(!st_ctx->cso) {
st_context_destroy(st_ctx);
+ return NULL;
+ }
/* disabled blending/masking */
{
@@ -291,8 +312,10 @@ st_buffer_create(struct st_device *st_dev,
st_buf->st_dev = st_dev;
st_buf->buffer = winsys->buffer_create(winsys, alignment, usage, size);
- if(!st_buf->buffer)
+ if(!st_buf->buffer) {
st_buffer_destroy(st_buf);
+ return NULL;
+ }
return st_buf;
}
diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h
index 644c263b53..7cfe6de9f6 100644
--- a/src/gallium/state_trackers/python/st_device.h
+++ b/src/gallium/state_trackers/python/st_device.h
@@ -48,6 +48,7 @@ struct st_buffer {
struct st_context {
struct st_device *st_dev;
+ struct pipe_context *real_pipe;
struct pipe_context *pipe;
struct cso_context *cso;
@@ -68,7 +69,8 @@ struct st_context {
struct st_device {
const struct st_winsys *st_ws;
-
+
+ struct pipe_screen *real_screen;
struct pipe_screen *screen;
/* FIXME: we also need to refcount for textures and surfaces... */