diff options
author | Chia-I Wu <olv@lunarg.com> | 2010-04-16 18:12:37 +0800 |
---|---|---|
committer | Chia-I Wu <olv@lunarg.com> | 2010-05-07 10:41:12 +0800 |
commit | 75143ef05576ee9f25ee176bc28c3c4d03705bf5 (patch) | |
tree | d8d1bd7f30088a95c8d773a8544a5c29fdcdde0f /src/gallium/state_trackers/vega | |
parent | bdc4504252692b2eb971c08114182828870cc0f8 (diff) |
st/vega: Use vgapi.
Rename vgFooBar to vegaFooBar and use vgapi as the dispatcher. This
makes sure there is always a current context when the internal functions
are called. And eglGetProcAddress is finally supported.
Diffstat (limited to 'src/gallium/state_trackers/vega')
-rw-r--r-- | src/gallium/state_trackers/vega/Makefile | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api.c | 88 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api.h | 51 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_context.c | 7 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_filters.c | 69 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_images.c | 91 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_masks.c | 38 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_misc.c | 7 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_paint.c | 15 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_params.c | 83 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_path.c | 93 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_text.c | 53 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_transform.c | 17 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/vg_context.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/vg_context.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/vg_manager.c | 4 |
16 files changed, 393 insertions, 235 deletions
diff --git a/src/gallium/state_trackers/vega/Makefile b/src/gallium/state_trackers/vega/Makefile index b871990cd9..f6c80899ff 100644 --- a/src/gallium/state_trackers/vega/Makefile +++ b/src/gallium/state_trackers/vega/Makefile @@ -13,6 +13,7 @@ VG_TINY = 0 ### Lists of source files, included by Makefiles VG_SOURCES = \ + api.c \ api_context.c \ api_filters.c \ api_images.c \ @@ -42,13 +43,14 @@ VG_SOURCES = \ VG_OBJECTS = $(VG_SOURCES:.c=.o) -VG_LIBS = $(GALLIUM_AUXILIARIES) +VG_LIBS = $(GALLIUM_AUXILIARIES) $(TOP)/src/mapi/vgapi/libvgapi.a VG_LIB_DEPS = $(EXTRA_LIB_PATH) -lm ### Include directories INCLUDE_DIRS = \ -I$(TOP)/include \ + -I$(TOP)/src/mapi \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/auxiliary diff --git a/src/gallium/state_trackers/vega/api.c b/src/gallium/state_trackers/vega/api.c new file mode 100644 index 0000000000..bf1d37493a --- /dev/null +++ b/src/gallium/state_trackers/vega/api.c @@ -0,0 +1,88 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#include "mapi/mapi.h" + +#include "api.h" + +static const char vega_spec[] = + "1" +#define MAPI_ABI_ENTRY(ret, name, params) \ + "\0" #name "\0" +#define MAPI_ALIAS_ENTRY(alias, ret, name, params) \ + #name "\0" +#include "vgapi/vgapi_tmp.h" + "\0"; + +static const mapi_proc vega_procs[] = { +#define MAPI_ABI_ENTRY(ret, name, params) \ + (mapi_proc) vega ## name, +#include "vgapi/vgapi_tmp.h" +}; + +static void api_init(void) +{ + static boolean initialized = FALSE; + if (!initialized) { + mapi_init(vega_spec); + initialized = TRUE; + } +} + +struct mapi_table *api_create_dispatch(void) +{ + struct mapi_table *tbl; + + api_init(); + + tbl = mapi_table_create(); + if (tbl) + mapi_table_fill(tbl, vega_procs); + + return tbl; +} + +void api_destroy_dispatch(struct mapi_table *tbl) +{ + mapi_table_destroy(tbl); +} + +void api_make_dispatch_current(const struct mapi_table *tbl) +{ + mapi_table_make_current(tbl); +} + +mapi_proc api_get_proc_address(const char *proc_name) +{ + if (!proc_name || proc_name[0] != 'v' || proc_name[1] != 'g') + return NULL; + proc_name += 2; + + api_init(); + return mapi_get_proc_address(proc_name); +} diff --git a/src/gallium/state_trackers/vega/api.h b/src/gallium/state_trackers/vega/api.h new file mode 100644 index 0000000000..955508dae9 --- /dev/null +++ b/src/gallium/state_trackers/vega/api.h @@ -0,0 +1,51 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#ifndef API_H +#define API_H + +#include "VG/openvg.h" +#include "VG/vgext.h" +#include "vg_manager.h" + +/* declare the prototypes */ +#define MAPI_ABI_ENTRY(ret, name, params) \ + ret VG_API_ENTRY vega ## name params; +#include "vgapi/vgapi_tmp.h" + +struct mapi_table; + +struct mapi_table *api_create_dispatch(void); + +void api_destroy_dispatch(struct mapi_table *tbl); + +void api_make_dispatch_current(const struct mapi_table *tbl); + +st_proc_t api_get_proc_address(const char *proc_name); + +#endif /* API_H */ diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c index eb2fbe26e7..0d04d8e871 100644 --- a/src/gallium/state_trackers/vega/api_context.c +++ b/src/gallium/state_trackers/vega/api_context.c @@ -28,11 +28,12 @@ #include "vg_manager.h" #include "vg_context.h" +#include "api.h" #include "pipe/p_context.h" #include "pipe/p_screen.h" -VGErrorCode vgGetError(void) +VGErrorCode vegaGetError(void) { struct vg_context *ctx = vg_current_context(); VGErrorCode error = VG_NO_CONTEXT_ERROR; @@ -46,7 +47,7 @@ VGErrorCode vgGetError(void) return error; } -void vgFlush(void) +void vegaFlush(void) { struct vg_context *ctx = vg_current_context(); struct pipe_context *pipe; @@ -60,7 +61,7 @@ void vgFlush(void) vg_manager_flush_frontbuffer(ctx); } -void vgFinish(void) +void vegaFinish(void) { struct vg_context *ctx = vg_current_context(); struct pipe_fence_handle *fence = NULL; diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c index b1c08af938..144fb8f323 100644 --- a/src/gallium/state_trackers/vega/api_filters.c +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -28,6 +28,7 @@ #include "vg_context.h" #include "image.h" +#include "api.h" #include "renderer.h" #include "shaders_cache.h" #include "st_inlines.h" @@ -361,8 +362,8 @@ static void execute_filter(struct vg_context *ctx, pipe_surface_reference(&dst_surf, NULL); } -void vgColorMatrix(VGImage dst, VGImage src, - const VGfloat * matrix) +void vegaColorMatrix(VGImage dst, VGImage src, + const VGfloat * matrix) { struct vg_context *ctx = vg_current_context(); struct vg_image *d, *s; @@ -403,13 +404,13 @@ static VGfloat texture_offset(VGfloat width, VGint kernelSize, VGint current, VG return diff / width; } -void vgConvolve(VGImage dst, VGImage src, - VGint kernelWidth, VGint kernelHeight, - VGint shiftX, VGint shiftY, - const VGshort * kernel, - VGfloat scale, - VGfloat bias, - VGTilingMode tilingMode) +void vegaConvolve(VGImage dst, VGImage src, + VGint kernelWidth, VGint kernelHeight, + VGint shiftX, VGint shiftY, + const VGshort * kernel, + VGfloat scale, + VGfloat bias, + VGTilingMode tilingMode) { struct vg_context *ctx = vg_current_context(); VGfloat *buffer; @@ -508,15 +509,15 @@ void vgConvolve(VGImage dst, VGImage src, free(buffer); } -void vgSeparableConvolve(VGImage dst, VGImage src, - VGint kernelWidth, - VGint kernelHeight, - VGint shiftX, VGint shiftY, - const VGshort * kernelX, - const VGshort * kernelY, - VGfloat scale, - VGfloat bias, - VGTilingMode tilingMode) +void vegaSeparableConvolve(VGImage dst, VGImage src, + VGint kernelWidth, + VGint kernelHeight, + VGint shiftX, VGint shiftY, + const VGshort * kernelX, + const VGshort * kernelY, + VGfloat scale, + VGfloat bias, + VGTilingMode tilingMode) { struct vg_context *ctx = vg_current_context(); VGshort *kernel; @@ -600,10 +601,10 @@ static void compute_gaussian_kernel(VGfloat *kernel, } } -void vgGaussianBlur(VGImage dst, VGImage src, - VGfloat stdDeviationX, - VGfloat stdDeviationY, - VGTilingMode tilingMode) +void vegaGaussianBlur(VGImage dst, VGImage src, + VGfloat stdDeviationX, + VGfloat stdDeviationY, + VGTilingMode tilingMode) { struct vg_context *ctx = vg_current_context(); struct vg_image *d, *s; @@ -699,13 +700,13 @@ void vgGaussianBlur(VGImage dst, VGImage src, free(kernel); } -void vgLookup(VGImage dst, VGImage src, - const VGubyte * redLUT, - const VGubyte * greenLUT, - const VGubyte * blueLUT, - const VGubyte * alphaLUT, - VGboolean outputLinear, - VGboolean outputPremultiplied) +void vegaLookup(VGImage dst, VGImage src, + const VGubyte * redLUT, + const VGubyte * greenLUT, + const VGubyte * blueLUT, + const VGubyte * alphaLUT, + VGboolean outputLinear, + VGboolean outputPremultiplied) { struct vg_context *ctx = vg_current_context(); struct vg_image *d, *s; @@ -758,11 +759,11 @@ void vgLookup(VGImage dst, VGImage src, pipe_sampler_view_reference(&lut_texture_view, NULL); } -void vgLookupSingle(VGImage dst, VGImage src, - const VGuint * lookupTable, - VGImageChannel sourceChannel, - VGboolean outputLinear, - VGboolean outputPremultiplied) +void vegaLookupSingle(VGImage dst, VGImage src, + const VGuint * lookupTable, + VGImageChannel sourceChannel, + VGboolean outputLinear, + VGboolean outputPremultiplied) { struct vg_context *ctx = vg_current_context(); struct vg_image *d, *s; diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c index 6c7fd3b346..547508f815 100644 --- a/src/gallium/state_trackers/vega/api_images.c +++ b/src/gallium/state_trackers/vega/api_images.c @@ -32,6 +32,7 @@ #include "vg_translate.h" #include "api_consts.h" #include "image.h" +#include "api.h" #include "pipe/p_context.h" #include "pipe/p_screen.h" @@ -92,9 +93,9 @@ static INLINE VGboolean supported_image_format(VGImageFormat format) return VG_FALSE; } -VGImage vgCreateImage(VGImageFormat format, - VGint width, VGint height, - VGbitfield allowedQuality) +VGImage vegaCreateImage(VGImageFormat format, + VGint width, VGint height, + VGbitfield allowedQuality) { struct vg_context *ctx = vg_current_context(); @@ -126,7 +127,7 @@ VGImage vgCreateImage(VGImageFormat format, return (VGImage)image_create(format, width, height); } -void vgDestroyImage(VGImage image) +void vegaDestroyImage(VGImage image) { struct vg_context *ctx = vg_current_context(); struct vg_image *img = (struct vg_image *)image; @@ -142,9 +143,9 @@ void vgDestroyImage(VGImage image) image_destroy(img); } -void vgClearImage(VGImage image, - VGint x, VGint y, - VGint width, VGint height) +void vegaClearImage(VGImage image, + VGint x, VGint y, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); struct vg_image *img; @@ -167,12 +168,12 @@ void vgClearImage(VGImage image, } -void vgImageSubData(VGImage image, - const void * data, - VGint dataStride, - VGImageFormat dataFormat, - VGint x, VGint y, - VGint width, VGint height) +void vegaImageSubData(VGImage image, + const void * data, + VGint dataStride, + VGImageFormat dataFormat, + VGint x, VGint y, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); struct vg_image *img; @@ -195,12 +196,12 @@ void vgImageSubData(VGImage image, x, y, width, height); } -void vgGetImageSubData(VGImage image, - void * data, - VGint dataStride, - VGImageFormat dataFormat, - VGint x, VGint y, - VGint width, VGint height) +void vegaGetImageSubData(VGImage image, + void * data, + VGint dataStride, + VGImageFormat dataFormat, + VGint x, VGint y, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); struct vg_image *img; @@ -222,9 +223,9 @@ void vgGetImageSubData(VGImage image, x, y, width, height); } -VGImage vgChildImage(VGImage parent, - VGint x, VGint y, - VGint width, VGint height) +VGImage vegaChildImage(VGImage parent, + VGint x, VGint y, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); struct vg_image *p; @@ -252,7 +253,7 @@ VGImage vgChildImage(VGImage parent, return (VGImage)image_child_image(p, x, y, width, height); } -VGImage vgGetParent(VGImage image) +VGImage vegaGetParent(VGImage image) { struct vg_context *ctx = vg_current_context(); struct vg_image *img; @@ -269,10 +270,10 @@ VGImage vgGetParent(VGImage image) return image; } -void vgCopyImage(VGImage dst, VGint dx, VGint dy, - VGImage src, VGint sx, VGint sy, - VGint width, VGint height, - VGboolean dither) +void vegaCopyImage(VGImage dst, VGint dx, VGint dy, + VGImage src, VGint sx, VGint sy, + VGint width, VGint height, + VGboolean dither) { struct vg_context *ctx = vg_current_context(); @@ -291,7 +292,7 @@ void vgCopyImage(VGImage dst, VGint dx, VGint dy, width, height, dither); } -void vgDrawImage(VGImage image) +void vegaDrawImage(VGImage image) { struct vg_context *ctx = vg_current_context(); @@ -307,9 +308,9 @@ void vgDrawImage(VGImage image) image_draw((struct vg_image*)image); } -void vgSetPixels(VGint dx, VGint dy, - VGImage src, VGint sx, VGint sy, - VGint width, VGint height) +void vegaSetPixels(VGint dx, VGint dy, + VGImage src, VGint sx, VGint sy, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); @@ -327,9 +328,9 @@ void vgSetPixels(VGint dx, VGint dy, height); } -void vgGetPixels(VGImage dst, VGint dx, VGint dy, - VGint sx, VGint sy, - VGint width, VGint height) +void vegaGetPixels(VGImage dst, VGint dx, VGint dy, + VGint sx, VGint sy, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); struct vg_image *img; @@ -349,10 +350,10 @@ void vgGetPixels(VGImage dst, VGint dx, VGint dy, sx, sy, width, height); } -void vgWritePixels(const void * data, VGint dataStride, - VGImageFormat dataFormat, - VGint dx, VGint dy, - VGint width, VGint height) +void vegaWritePixels(const void * data, VGint dataStride, + VGImageFormat dataFormat, + VGint dx, VGint dy, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); struct pipe_context *pipe = ctx->pipe; @@ -390,10 +391,10 @@ void vgWritePixels(const void * data, VGint dataStride, pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); } -void vgReadPixels(void * data, VGint dataStride, - VGImageFormat dataFormat, - VGint sx, VGint sy, - VGint width, VGint height) +void vegaReadPixels(void * data, VGint dataStride, + VGImageFormat dataFormat, + VGint sx, VGint sy, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); struct pipe_context *pipe = ctx->pipe; @@ -461,9 +462,9 @@ void vgReadPixels(void * data, VGint dataStride, } } -void vgCopyPixels(VGint dx, VGint dy, - VGint sx, VGint sy, - VGint width, VGint height) +void vegaCopyPixels(VGint dx, VGint dy, + VGint sx, VGint sy, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; diff --git a/src/gallium/state_trackers/vega/api_masks.c b/src/gallium/state_trackers/vega/api_masks.c index 7c28ea5c87..94c1ff5375 100644 --- a/src/gallium/state_trackers/vega/api_masks.c +++ b/src/gallium/state_trackers/vega/api_masks.c @@ -28,6 +28,7 @@ #include "mask.h" #include "renderer.h" +#include "api.h" #include "vg_context.h" #include "pipe/p_context.h" @@ -37,7 +38,6 @@ #include "util/u_draw_quad.h" #include "util/u_memory.h" - #define DISABLE_1_1_MASKING 1 /** @@ -151,9 +151,9 @@ clear_with_quad(struct vg_context *st, float x0, float y0, } -void vgMask(VGHandle mask, VGMaskOperation operation, - VGint x, VGint y, - VGint width, VGint height) +void vegaMask(VGHandle mask, VGMaskOperation operation, + VGint x, VGint y, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); @@ -189,8 +189,8 @@ void vgMask(VGHandle mask, VGMaskOperation operation, } } -void vgClear(VGint x, VGint y, - VGint width, VGint height) +void vegaClear(VGint x, VGint y, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); struct pipe_framebuffer_state *fb; @@ -225,9 +225,9 @@ void vgClear(VGint x, VGint y, #ifdef OPENVG_VERSION_1_1 -void vgRenderToMask(VGPath path, - VGbitfield paintModes, - VGMaskOperation operation) +void vegaRenderToMask(VGPath path, + VGbitfield paintModes, + VGMaskOperation operation) { struct vg_context *ctx = vg_current_context(); @@ -258,7 +258,7 @@ void vgRenderToMask(VGPath path, mask_render_to((struct path *)path, paintModes, operation); } -VGMaskLayer vgCreateMaskLayer(VGint width, VGint height) +VGMaskLayer vegaCreateMaskLayer(VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); @@ -272,7 +272,7 @@ VGMaskLayer vgCreateMaskLayer(VGint width, VGint height) return (VGMaskLayer)mask_layer_create(width, height); } -void vgDestroyMaskLayer(VGMaskLayer maskLayer) +void vegaDestroyMaskLayer(VGMaskLayer maskLayer) { struct vg_mask_layer *mask = 0; struct vg_context *ctx = vg_current_context(); @@ -290,10 +290,10 @@ void vgDestroyMaskLayer(VGMaskLayer maskLayer) mask_layer_destroy(mask); } -void vgFillMaskLayer(VGMaskLayer maskLayer, - VGint x, VGint y, - VGint width, VGint height, - VGfloat value) +void vegaFillMaskLayer(VGMaskLayer maskLayer, + VGint x, VGint y, + VGint width, VGint height, + VGfloat value) { struct vg_mask_layer *mask = 0; struct vg_context *ctx = vg_current_context(); @@ -336,10 +336,10 @@ void vgFillMaskLayer(VGMaskLayer maskLayer, mask_layer_fill(mask, x, y, width, height, value); } -void vgCopyMask(VGMaskLayer maskLayer, - VGint sx, VGint sy, - VGint dx, VGint dy, - VGint width, VGint height) +void vegaCopyMask(VGMaskLayer maskLayer, + VGint sx, VGint sy, + VGint dx, VGint dy, + VGint width, VGint height) { struct vg_context *ctx = vg_current_context(); struct vg_mask_layer *mask = 0; diff --git a/src/gallium/state_trackers/vega/api_misc.c b/src/gallium/state_trackers/vega/api_misc.c index 78ba0bc110..e648549745 100644 --- a/src/gallium/state_trackers/vega/api_misc.c +++ b/src/gallium/state_trackers/vega/api_misc.c @@ -27,10 +27,11 @@ #include "VG/openvg.h" #include "vg_context.h" +#include "api.h" /* Hardware Queries */ -VGHardwareQueryResult vgHardwareQuery(VGHardwareQueryType key, - VGint setting) +VGHardwareQueryResult vegaHardwareQuery(VGHardwareQueryType key, + VGint setting) { struct vg_context *ctx = vg_current_context(); @@ -58,7 +59,7 @@ VGHardwareQueryResult vgHardwareQuery(VGHardwareQueryType key, } /* Renderer and Extension Information */ -const VGubyte *vgGetString(VGStringID name) +const VGubyte *vegaGetString(VGStringID name) { struct vg_context *ctx = vg_current_context(); static const VGubyte *vendor = (VGubyte *)"Tungsten Graphics, Inc"; diff --git a/src/gallium/state_trackers/vega/api_paint.c b/src/gallium/state_trackers/vega/api_paint.c index dd3ac5bdb0..d88341b04f 100644 --- a/src/gallium/state_trackers/vega/api_paint.c +++ b/src/gallium/state_trackers/vega/api_paint.c @@ -29,13 +29,14 @@ #include "vg_context.h" #include "paint.h" #include "image.h" +#include "api.h" -VGPaint vgCreatePaint(void) +VGPaint vegaCreatePaint(void) { return (VGPaint) paint_create(vg_current_context()); } -void vgDestroyPaint(VGPaint p) +void vegaDestroyPaint(VGPaint p) { struct vg_context *ctx = vg_current_context(); struct vg_paint *paint; @@ -49,7 +50,7 @@ void vgDestroyPaint(VGPaint p) paint_destroy(paint); } -void vgSetPaint(VGPaint paint, VGbitfield paintModes) +void vegaSetPaint(VGPaint paint, VGbitfield paintModes) { struct vg_context *ctx = vg_current_context(); @@ -74,7 +75,7 @@ void vgSetPaint(VGPaint paint, VGbitfield paintModes) } } -VGPaint vgGetPaint(VGPaintMode paintMode) +VGPaint vegaGetPaint(VGPaintMode paintMode) { struct vg_context *ctx = vg_current_context(); VGPaint paint = VG_INVALID_HANDLE; @@ -95,7 +96,7 @@ VGPaint vgGetPaint(VGPaintMode paintMode) return paint; } -void vgSetColor(VGPaint paint, VGuint rgba) +void vegaSetColor(VGPaint paint, VGuint rgba) { struct vg_context *ctx = vg_current_context(); @@ -114,7 +115,7 @@ void vgSetColor(VGPaint paint, VGuint rgba) } } -VGuint vgGetColor(VGPaint paint) +VGuint vegaGetColor(VGPaint paint) { struct vg_context *ctx = vg_current_context(); struct vg_paint *p; @@ -134,7 +135,7 @@ VGuint vgGetColor(VGPaint paint) return paint_colori(p); } -void vgPaintPattern(VGPaint paint, VGImage pattern) +void vegaPaintPattern(VGPaint paint, VGImage pattern) { struct vg_context *ctx = vg_current_context(); diff --git a/src/gallium/state_trackers/vega/api_params.c b/src/gallium/state_trackers/vega/api_params.c index db77fd9cb0..a10b009e63 100644 --- a/src/gallium/state_trackers/vega/api_params.c +++ b/src/gallium/state_trackers/vega/api_params.c @@ -32,6 +32,7 @@ #include "image.h" #include "matrix.h" #include "api_consts.h" +#include "api.h" #include "pipe/p_compiler.h" #include "util/u_pointer.h" @@ -63,7 +64,7 @@ static INLINE VGboolean count_in_bounds(VGParamType type, VGint count) } } -void vgSetf (VGParamType type, VGfloat value) +void vegaSetf (VGParamType type, VGfloat value) { struct vg_context *ctx = vg_current_context(); struct vg_state *state = current_state(); @@ -123,7 +124,7 @@ void vgSetf (VGParamType type, VGfloat value) vg_set_error(ctx, error); } -void vgSeti (VGParamType type, VGint value) +void vegaSeti (VGParamType type, VGint value) { struct vg_context *ctx = vg_current_context(); struct vg_state *state = current_state(); @@ -254,8 +255,8 @@ void vgSeti (VGParamType type, VGint value) vg_set_error(ctx, error); } -void vgSetfv(VGParamType type, VGint count, - const VGfloat * values) +void vegaSetfv(VGParamType type, VGint count, + const VGfloat * values) { struct vg_context *ctx = vg_current_context(); struct vg_state *state = current_state(); @@ -382,8 +383,8 @@ void vgSetfv(VGParamType type, VGint count, vg_set_error(ctx, error); } -void vgSetiv(VGParamType type, VGint count, - const VGint * values) +void vegaSetiv(VGParamType type, VGint count, + const VGint * values) { struct vg_context *ctx = vg_current_context(); struct vg_state *state = current_state(); @@ -506,7 +507,7 @@ void vgSetiv(VGParamType type, VGint count, } } -VGfloat vgGetf(VGParamType type) +VGfloat vegaGetf(VGParamType type) { struct vg_context *ctx = vg_current_context(); const struct vg_state *state = current_state(); @@ -568,7 +569,7 @@ VGfloat vgGetf(VGParamType type) return value; } -VGint vgGeti(VGParamType type) +VGint vegaGeti(VGParamType type) { const struct vg_state *state = current_state(); struct vg_context *ctx = vg_current_context(); @@ -683,7 +684,7 @@ VGint vgGeti(VGParamType type) return value; } -VGint vgGetVectorSize(VGParamType type) +VGint vegaGetVectorSize(VGParamType type) { struct vg_context *ctx = vg_current_context(); const struct vg_state *state = current_state(); @@ -757,8 +758,8 @@ VGint vgGetVectorSize(VGParamType type) } } -void vgGetfv(VGParamType type, VGint count, - VGfloat * values) +void vegaGetfv(VGParamType type, VGint count, + VGfloat * values) { const struct vg_state *state = current_state(); struct vg_context *ctx = vg_current_context(); @@ -858,8 +859,8 @@ void vgGetfv(VGParamType type, VGint count, } } -void vgGetiv(VGParamType type, VGint count, - VGint * values) +void vegaGetiv(VGParamType type, VGint count, + VGint * values) { const struct vg_state *state = current_state(); struct vg_context *ctx = vg_current_context(); @@ -964,9 +965,9 @@ void vgGetiv(VGParamType type, VGint count, } } -void vgSetParameterf(VGHandle object, - VGint paramType, - VGfloat value) +void vegaSetParameterf(VGHandle object, + VGint paramType, + VGfloat value) { struct vg_context *ctx = vg_current_context(); void *ptr = (void*)object; @@ -1018,9 +1019,9 @@ void vgSetParameterf(VGHandle object, } } -void vgSetParameteri(VGHandle object, - VGint paramType, - VGint value) +void vegaSetParameteri(VGHandle object, + VGint paramType, + VGint value) { struct vg_context *ctx = vg_current_context(); void *ptr = (void*)object; @@ -1093,10 +1094,10 @@ void vgSetParameteri(VGHandle object, } } -void vgSetParameterfv(VGHandle object, - VGint paramType, - VGint count, - const VGfloat * values) +void vegaSetParameterfv(VGHandle object, + VGint paramType, + VGint count, + const VGfloat * values) { struct vg_context *ctx = vg_current_context(); void *ptr = (void*)object; @@ -1206,10 +1207,10 @@ void vgSetParameterfv(VGHandle object, } } -void vgSetParameteriv(VGHandle object, - VGint paramType, - VGint count, - const VGint * values) +void vegaSetParameteriv(VGHandle object, + VGint paramType, + VGint count, + const VGint * values) { struct vg_context *ctx = vg_current_context(); void *ptr = (void*)object; @@ -1311,8 +1312,8 @@ void vgSetParameteriv(VGHandle object, } } -VGint vgGetParameterVectorSize(VGHandle object, - VGint paramType) +VGint vegaGetParameterVectorSize(VGHandle object, + VGint paramType) { struct vg_context *ctx = vg_current_context(); void *ptr = (void*)object; @@ -1367,8 +1368,8 @@ VGint vgGetParameterVectorSize(VGHandle object, } -VGfloat vgGetParameterf(VGHandle object, - VGint paramType) +VGfloat vegaGetParameterf(VGHandle object, + VGint paramType) { struct vg_context *ctx = vg_current_context(); void *ptr = (void*)object; @@ -1424,8 +1425,8 @@ VGfloat vgGetParameterf(VGHandle object, return 0; } -VGint vgGetParameteri(VGHandle object, - VGint paramType) +VGint vegaGetParameteri(VGHandle object, + VGint paramType) { struct vg_context *ctx = vg_current_context(); void *ptr = (void*)object; @@ -1511,10 +1512,10 @@ VGint vgGetParameteri(VGHandle object, return 0; } -void vgGetParameterfv(VGHandle object, - VGint paramType, - VGint count, - VGfloat * values) +void vegaGetParameterfv(VGHandle object, + VGint paramType, + VGint count, + VGfloat * values) { struct vg_context *ctx = vg_current_context(); void *ptr = (void*)object; @@ -1598,10 +1599,10 @@ void vgGetParameterfv(VGHandle object, } } -void vgGetParameteriv(VGHandle object, - VGint paramType, - VGint count, - VGint * values) +void vegaGetParameteriv(VGHandle object, + VGint paramType, + VGint count, + VGint * values) { struct vg_context *ctx = vg_current_context(); void *ptr = (void*)object; diff --git a/src/gallium/state_trackers/vega/api_path.c b/src/gallium/state_trackers/vega/api_path.c index 58ebb3b60e..6c9a2e8d65 100644 --- a/src/gallium/state_trackers/vega/api_path.c +++ b/src/gallium/state_trackers/vega/api_path.c @@ -30,17 +30,18 @@ #include "path.h" #include "polygon.h" #include "paint.h" +#include "api.h" #include "pipe/p_context.h" #include "util/u_inlines.h" #include "util/u_draw_quad.h" -VGPath vgCreatePath(VGint pathFormat, - VGPathDatatype datatype, - VGfloat scale, VGfloat bias, - VGint segmentCapacityHint, - VGint coordCapacityHint, - VGbitfield capabilities) +VGPath vegaCreatePath(VGint pathFormat, + VGPathDatatype datatype, + VGfloat scale, VGfloat bias, + VGint segmentCapacityHint, + VGint coordCapacityHint, + VGbitfield capabilities) { struct vg_context *ctx = vg_current_context(); @@ -63,7 +64,7 @@ VGPath vgCreatePath(VGint pathFormat, capabilities); } -void vgClearPath(VGPath path, VGbitfield capabilities) +void vegaClearPath(VGPath path, VGbitfield capabilities) { struct vg_context *ctx = vg_current_context(); struct path *p = 0; @@ -77,7 +78,7 @@ void vgClearPath(VGPath path, VGbitfield capabilities) path_clear(p, capabilities); } -void vgDestroyPath(VGPath p) +void vegaDestroyPath(VGPath p) { struct path *path = 0; struct vg_context *ctx = vg_current_context(); @@ -91,8 +92,8 @@ void vgDestroyPath(VGPath p) path_destroy(path); } -void vgRemovePathCapabilities(VGPath path, - VGbitfield capabilities) +void vegaRemovePathCapabilities(VGPath path, + VGbitfield capabilities) { struct vg_context *ctx = vg_current_context(); VGbitfield current; @@ -109,7 +110,7 @@ void vgRemovePathCapabilities(VGPath path, (~(capabilities & VG_PATH_CAPABILITY_ALL)))); } -VGbitfield vgGetPathCapabilities(VGPath path) +VGbitfield vegaGetPathCapabilities(VGPath path) { struct vg_context *ctx = vg_current_context(); struct path *p = 0; @@ -122,7 +123,7 @@ VGbitfield vgGetPathCapabilities(VGPath path) return path_capabilities(p); } -void vgAppendPath(VGPath dstPath, VGPath srcPath) +void vegaAppendPath(VGPath dstPath, VGPath srcPath) { struct vg_context *ctx = vg_current_context(); struct path *src, *dst; @@ -142,10 +143,10 @@ void vgAppendPath(VGPath dstPath, VGPath srcPath) path_append_path(dst, src); } -void vgAppendPathData(VGPath dstPath, - VGint numSegments, - const VGubyte * pathSegments, - const void * pathData) +void vegaAppendPathData(VGPath dstPath, + VGint numSegments, + const VGubyte * pathSegments, + const void * pathData) { struct vg_context *ctx = vg_current_context(); struct path *p = 0; @@ -185,10 +186,10 @@ void vgAppendPathData(VGPath dstPath, path_append_data(p, numSegments, pathSegments, pathData); } -void vgModifyPathCoords(VGPath dstPath, - VGint startIndex, - VGint numSegments, - const void * pathData) +void vegaModifyPathCoords(VGPath dstPath, + VGint startIndex, + VGint numSegments, + const void * pathData) { struct vg_context *ctx = vg_current_context(); struct path *p = 0; @@ -220,7 +221,7 @@ void vgModifyPathCoords(VGPath dstPath, path_modify_coords(p, startIndex, numSegments, pathData); } -void vgTransformPath(VGPath dstPath, VGPath srcPath) +void vegaTransformPath(VGPath dstPath, VGPath srcPath) { struct vg_context *ctx = vg_current_context(); struct path *src = 0, *dst = 0; @@ -240,10 +241,10 @@ void vgTransformPath(VGPath dstPath, VGPath srcPath) path_transform(dst, src); } -VGboolean vgInterpolatePath(VGPath dstPath, - VGPath startPath, - VGPath endPath, - VGfloat amount) +VGboolean vegaInterpolatePath(VGPath dstPath, + VGPath startPath, + VGPath endPath, + VGfloat amount) { struct vg_context *ctx = vg_current_context(); struct path *start = 0, *dst = 0, *end = 0; @@ -269,9 +270,9 @@ VGboolean vgInterpolatePath(VGPath dstPath, start, end, amount); } -VGfloat vgPathLength(VGPath path, - VGint startSegment, - VGint numSegments) +VGfloat vegaPathLength(VGPath path, + VGint startSegment, + VGint numSegments) { struct vg_context *ctx = vg_current_context(); struct path *p = 0; @@ -302,13 +303,13 @@ VGfloat vgPathLength(VGPath path, return path_length(p, startSegment, numSegments); } -void vgPointAlongPath(VGPath path, - VGint startSegment, - VGint numSegments, - VGfloat distance, - VGfloat * x, VGfloat * y, - VGfloat * tangentX, - VGfloat * tangentY) +void vegaPointAlongPath(VGPath path, + VGint startSegment, + VGint numSegments, + VGfloat distance, + VGfloat * x, VGfloat * y, + VGfloat * tangentX, + VGfloat * tangentY) { struct vg_context *ctx = vg_current_context(); struct path *p = 0; @@ -362,11 +363,11 @@ void vgPointAlongPath(VGPath path, } } -void vgPathBounds(VGPath path, - VGfloat * minX, - VGfloat * minY, - VGfloat * width, - VGfloat * height) +void vegaPathBounds(VGPath path, + VGfloat * minX, + VGfloat * minY, + VGfloat * width, + VGfloat * height) { struct vg_context *ctx = vg_current_context(); struct path *p = 0; @@ -399,11 +400,11 @@ void vgPathBounds(VGPath path, path_bounding_rect(p, minX, minY, width, height); } -void vgPathTransformedBounds(VGPath path, - VGfloat * minX, - VGfloat * minY, - VGfloat * width, - VGfloat * height) +void vegaPathTransformedBounds(VGPath path, + VGfloat * minX, + VGfloat * minY, + VGfloat * width, + VGfloat * height) { struct vg_context *ctx = vg_current_context(); struct path *p = 0; @@ -466,7 +467,7 @@ void vgPathTransformedBounds(VGPath path, } -void vgDrawPath(VGPath path, VGbitfield paintModes) +void vegaDrawPath(VGPath path, VGbitfield paintModes) { struct vg_context *ctx = vg_current_context(); diff --git a/src/gallium/state_trackers/vega/api_text.c b/src/gallium/state_trackers/vega/api_text.c index d8411cf3e8..b35f3be90a 100644 --- a/src/gallium/state_trackers/vega/api_text.c +++ b/src/gallium/state_trackers/vega/api_text.c @@ -27,6 +27,7 @@ #include "VG/openvg.h" #include "vg_context.h" +#include "api.h" #include "util/u_memory.h" @@ -39,7 +40,7 @@ struct vg_font { VGint num_glyphs; }; -VGFont vgCreateFont(VGint glyphCapacityHint) +VGFont vegaCreateFont(VGint glyphCapacityHint) { struct vg_font *font = 0; struct vg_context *ctx = vg_current_context(); @@ -55,7 +56,7 @@ VGFont vgCreateFont(VGint glyphCapacityHint) return (VGFont)font; } -void vgDestroyFont(VGFont f) +void vegaDestroyFont(VGFont f) { struct vg_font *font = (struct vg_font *)f; struct vg_context *ctx = vg_current_context(); @@ -69,12 +70,12 @@ void vgDestroyFont(VGFont f) /*free(font);*/ } -void vgSetGlyphToPath(VGFont font, - VGuint glyphIndex, - VGPath path, - VGboolean isHinted, - VGfloat glyphOrigin [2], - VGfloat escapement[2]) +void vegaSetGlyphToPath(VGFont font, + VGuint glyphIndex, + VGPath path, + VGboolean isHinted, + VGfloat glyphOrigin [2], + VGfloat escapement[2]) { struct vg_context *ctx = vg_current_context(); struct vg_object *pathObj; @@ -106,11 +107,11 @@ void vgSetGlyphToPath(VGFont font, ++f->num_glyphs; } -void vgSetGlyphToImage(VGFont font, - VGuint glyphIndex, - VGImage image, - VGfloat glyphOrigin [2], - VGfloat escapement[2]) +void vegaSetGlyphToImage(VGFont font, + VGuint glyphIndex, + VGImage image, + VGfloat glyphOrigin [2], + VGfloat escapement[2]) { struct vg_context *ctx = vg_current_context(); struct vg_object *img_obj; @@ -153,8 +154,8 @@ static INLINE VGboolean font_contains_glyph(struct vg_font *font, return VG_FALSE; } -void vgClearGlyph(VGFont font, - VGuint glyphIndex) +void vegaClearGlyph(VGFont font, + VGuint glyphIndex) { struct vg_context *ctx = vg_current_context(); struct vg_font *f; @@ -184,10 +185,10 @@ void vgClearGlyph(VGFont font, } } -void vgDrawGlyph(VGFont font, - VGuint glyphIndex, - VGbitfield paintModes, - VGboolean allowAutoHinting) +void vegaDrawGlyph(VGFont font, + VGuint glyphIndex, + VGbitfield paintModes, + VGboolean allowAutoHinting) { struct vg_context *ctx = vg_current_context(); struct vg_font *f; @@ -211,13 +212,13 @@ void vgDrawGlyph(VGFont font, } } -void vgDrawGlyphs(VGFont font, - VGint glyphCount, - VGuint *glyphIndices, - VGfloat *adjustments_x, - VGfloat *adjustments_y, - VGbitfield paintModes, - VGboolean allowAutoHinting) +void vegaDrawGlyphs(VGFont font, + VGint glyphCount, + VGuint *glyphIndices, + VGfloat *adjustments_x, + VGfloat *adjustments_y, + VGbitfield paintModes, + VGboolean allowAutoHinting) { struct vg_context *ctx = vg_current_context(); VGint i; diff --git a/src/gallium/state_trackers/vega/api_transform.c b/src/gallium/state_trackers/vega/api_transform.c index 763a5ec415..0a40fc69b9 100644 --- a/src/gallium/state_trackers/vega/api_transform.c +++ b/src/gallium/state_trackers/vega/api_transform.c @@ -29,15 +29,16 @@ #include "vg_context.h" #include "matrix.h" +#include "api.h" -void vgLoadIdentity(void) +void vegaLoadIdentity(void) { struct vg_context *ctx = vg_current_context(); struct matrix *mat = vg_state_matrix(&ctx->state.vg); matrix_load_identity(mat); } -void vgLoadMatrix(const VGfloat * m) +void vegaLoadMatrix(const VGfloat * m) { struct vg_context *ctx = vg_current_context(); struct matrix *mat; @@ -59,7 +60,7 @@ void vgLoadMatrix(const VGfloat * m) } } -void vgGetMatrix(VGfloat * m) +void vegaGetMatrix(VGfloat * m) { struct vg_context *ctx = vg_current_context(); struct matrix *mat; @@ -76,7 +77,7 @@ void vgGetMatrix(VGfloat * m) memcpy(m, mat->m, sizeof(VGfloat)*9); } -void vgMultMatrix(const VGfloat * m) +void vegaMultMatrix(const VGfloat * m) { struct vg_context *ctx = vg_current_context(); struct matrix *dst, src; @@ -99,28 +100,28 @@ void vgMultMatrix(const VGfloat * m) } -void vgTranslate(VGfloat tx, VGfloat ty) +void vegaTranslate(VGfloat tx, VGfloat ty) { struct vg_context *ctx = vg_current_context(); struct matrix *dst = vg_state_matrix(&ctx->state.vg); matrix_translate(dst, tx, ty); } -void vgScale(VGfloat sx, VGfloat sy) +void vegaScale(VGfloat sx, VGfloat sy) { struct vg_context *ctx = vg_current_context(); struct matrix *dst = vg_state_matrix(&ctx->state.vg); matrix_scale(dst, sx, sy); } -void vgShear(VGfloat shx, VGfloat shy) +void vegaShear(VGfloat shx, VGfloat shy) { struct vg_context *ctx = vg_current_context(); struct matrix *dst = vg_state_matrix(&ctx->state.vg); matrix_shear(dst, shx, shy); } -void vgRotate(VGfloat angle) +void vegaRotate(VGfloat angle) { struct vg_context *ctx = vg_current_context(); struct matrix *dst = vg_state_matrix(&ctx->state.vg); diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c index 1a8952ce34..f6b07f2109 100644 --- a/src/gallium/state_trackers/vega/vg_context.c +++ b/src/gallium/state_trackers/vega/vg_context.c @@ -33,6 +33,7 @@ #include "asm_util.h" #include "st_inlines.h" #include "vg_manager.h" +#include "api.h" #include "pipe/p_context.h" #include "util/u_inlines.h" @@ -67,6 +68,7 @@ static void init_clear(struct vg_context *st) void vg_set_current_context(struct vg_context *ctx) { _vg_context = ctx; + api_make_dispatch_current((ctx) ? ctx->dispatch : NULL); } struct vg_context * vg_create_context(struct pipe_context *pipe, @@ -80,6 +82,8 @@ struct vg_context * vg_create_context(struct pipe_context *pipe, ctx->pipe = pipe; + ctx->dispatch = api_create_dispatch(); + vg_init_state(&ctx->state.vg); ctx->state.dirty = ALL_DIRTY; @@ -185,6 +189,8 @@ void vg_destroy_context(struct vg_context *ctx) cso_hash_delete(ctx->owned_objects[VG_OBJECT_FONT]); cso_hash_delete(ctx->owned_objects[VG_OBJECT_PATH]); + api_destroy_dispatch(ctx->dispatch); + free(ctx); } diff --git a/src/gallium/state_trackers/vega/vg_context.h b/src/gallium/state_trackers/vega/vg_context.h index dac67192a5..7b59ad512a 100644 --- a/src/gallium/state_trackers/vega/vg_context.h +++ b/src/gallium/state_trackers/vega/vg_context.h @@ -42,6 +42,7 @@ struct renderer; struct shaders_cache; struct shader; struct vg_shader; +struct mapi_table; struct st_renderbuffer { enum pipe_format format; @@ -90,6 +91,7 @@ enum dirty_state { struct vg_context { struct st_context_iface iface; + struct mapi_table *dispatch; struct pipe_context *pipe; diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c index aecac28e7e..9671bbed6c 100644 --- a/src/gallium/state_trackers/vega/vg_manager.c +++ b/src/gallium/state_trackers/vega/vg_manager.c @@ -40,6 +40,7 @@ #include "vg_context.h" #include "image.h" #include "mask.h" +#include "api.h" static struct pipe_resource * create_texture(struct pipe_context *pipe, enum pipe_format format, @@ -536,8 +537,7 @@ vg_api_is_visual_supported(struct st_api *stapi, static st_proc_t vg_api_get_proc_address(struct st_api *stapi, const char *procname) { - /* TODO */ - return (st_proc_t) NULL; + return api_get_proc_address(procname); } static void |