diff options
Diffstat (limited to 'pylladium.pyx')
-rw-r--r-- | pylladium.pyx | 20 |
1 files changed, 11 insertions, 9 deletions
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() |