summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2010-07-26 22:18:25 -0700
committerCorbin Simpson <MostAwesomeDude@gmail.com>2010-07-26 22:18:25 -0700
commitfeb9057c2e44d4aff0a398ac4929dfd09d82a42f (patch)
tree4f868bf94c625a4c98cfa2608a32337a092c7e89
parent1f473294b58f3dcf79f1a943976aad81ad561092 (diff)
Make Context init work.
-rwxr-xr-xmain.py4
-rw-r--r--pylladium.pyx20
2 files changed, 15 insertions, 9 deletions
diff --git a/main.py b/main.py
index 8d8fabe..84bbdf2 100755
--- a/main.py
+++ b/main.py
@@ -36,3 +36,7 @@ g = pylladium.Geom()
for name, number in pylladium.by_name.iteritems():
if s.is_format_supported(number, 2, b, g):
print "%s is an acceptable FBO colorbuf" % name
+
+c = pylladium.Context(s)
+
+print "Created context"
diff --git a/pylladium.pyx b/pylladium.pyx
index 4b30e70..45e4ca2 100644
--- a/pylladium.pyx
+++ b/pylladium.pyx
@@ -4,6 +4,12 @@ from ctypes import *
import pprint
import sys
+cdef extern from "gallium/pipe/p_context.h":
+ cdef struct pipe_context:
+ # ...
+ void destroy(pipe_context*)
+ # ...
+
cdef extern from "gallium/pipe/p_screen.h":
cdef struct pipe_screen:
void destroy(pipe_screen*)
@@ -11,7 +17,7 @@ cdef extern from "gallium/pipe/p_screen.h":
char* get_vendor(pipe_screen*)
int get_param(pipe_screen*, int)
float get_paramf(pipe_screen*, int)
- # ...
+ pipe_context* context_create(pipe_screen*, void*)
bint is_format_supported(pipe_screen*,
int, int, unsigned int, unsigned int)
# ...
@@ -97,17 +103,13 @@ cdef class Screen:
return self.screen.is_format_supported(self.screen,
format, target, bindings.value, geom_flags.value)
-cdef extern from "gallium/pipe/p_context.h":
- cdef struct pipe_context:
- # ...
- void destroy(pipe_context*)
- # ...
-
cdef class Context:
cdef pipe_context *context
- def __init__(self, int context):
- self.context = <pipe_context*>context
+ def __init__(self, Screen screen):
+ self.context = screen.screen.context_create(screen.screen, NULL)
+ if self.context is NULL:
+ raise Exception, "Couldn't create Context from given Screen"
def __del__(self):
self.destroy()