diff options
Diffstat (limited to 'src/gallium/state_trackers/vega')
29 files changed, 605 insertions, 403 deletions
diff --git a/src/gallium/state_trackers/vega/Makefile b/src/gallium/state_trackers/vega/Makefile index b871990cd9a..e0a87151c43 100644 --- a/src/gallium/state_trackers/vega/Makefile +++ b/src/gallium/state_trackers/vega/Makefile @@ -3,16 +3,14 @@ TOP = ../../../.. include $(TOP)/configs/current -VG_LIB = OpenVG -VG_LIB_NAME = lib$(VG_LIB).so +LIBNAME = vega -VG_MAJOR = 1 -VG_MINOR = 0 -VG_TINY = 0 - -### Lists of source files, included by Makefiles +LIBRARY_INCLUDES = \ + -I$(TOP)/include \ + -I$(TOP)/src/mapi -VG_SOURCES = \ +C_SOURCES = \ + api.c \ api_context.c \ api_filters.c \ api_images.c \ @@ -40,55 +38,4 @@ VG_SOURCES = \ shader.c \ shaders_cache.c -VG_OBJECTS = $(VG_SOURCES:.c=.o) - -VG_LIBS = $(GALLIUM_AUXILIARIES) -VG_LIB_DEPS = $(EXTRA_LIB_PATH) -lm - -### Include directories - -INCLUDE_DIRS = \ - -I$(TOP)/include \ - -I$(TOP)/src/gallium/include \ - -I$(TOP)/src/gallium/auxiliary - - -.c.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ - -default: depend $(TOP)/$(LIB_DIR)/$(VG_LIB_NAME) - -# Make the OpenVG library -$(TOP)/$(LIB_DIR)/$(VG_LIB_NAME): $(VG_OBJECTS) $(VG_LIBS) - $(MKLIB) -o $(VG_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major $(VG_MAJOR) \ - -minor $(VG_MINOR) \ - -patch $(VG_TINY) \ - -install $(TOP)/$(LIB_DIR) \ - $(VG_OBJECTS) $(VG_LIBS) $(VG_LIB_DEPS) - -###################################################################### -# Generic stuff - -depend: $(VG_SOURCES) - @ echo "running $(MKDEP)" - @ rm -f depend # workaround oops on gutsy?!? - @ touch depend - @ $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(VG_SOURCES) \ - > /dev/null 2>/dev/null - -install: default - $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/VG - $(INSTALL) -m 644 $(TOP)/include/VG/*.h $(DESTDIR)$(INSTALL_DIR)/include/VG - $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) - $(MINSTALL) $(TOP)/$(LIB_DIR)/libOpenVG* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) - -# Emacs tags -tags: - etags `find . -name \*.[ch]` $(TOP)/include/VG/*.h - -clean: - rm -f $(VG_OBJECTS) - rm -f depend depend.bak - -sinclude depend +include ../../Makefile.template diff --git a/src/gallium/state_trackers/vega/SConscript b/src/gallium/state_trackers/vega/SConscript new file mode 100644 index 00000000000..548053eb646 --- /dev/null +++ b/src/gallium/state_trackers/vega/SConscript @@ -0,0 +1,51 @@ +####################################################################### +# SConscript for vega state_tracker + +Import('*') + +if 'egl' in env['statetrackers']: + + env = env.Clone() + + env.Append(CPPPATH = [ + '#/src/mapi', + ]) + + vega_sources = [ + 'api.c', + 'api_context.c', + 'api_filters.c', + 'api_images.c', + 'api_masks.c', + 'api_misc.c', + 'api_paint.c', + 'api_params.c', + 'api_path.c', + 'api_text.c', + 'api_transform.c', + 'vgu.c', + 'vg_context.c', + 'vg_manager.c', + 'vg_state.c', + 'vg_translate.c', + 'polygon.c', + 'bezier.c', + 'path.c', + 'paint.c', + 'arc.c', + 'image.c', + 'renderer.c', + 'stroker.c', + 'mask.c', + 'shader.c', + 'shaders_cache.c', + ] + + # vgapi_header must be generated first + env.Depends(vega_sources, vgapi_header) + + st_vega = env.ConvenienceLibrary( + target = 'st_vega', + source = vega_sources, + ) + Export('st_vega') diff --git a/src/gallium/state_trackers/vega/api.c b/src/gallium/state_trackers/vega/api.c new file mode 100644 index 00000000000..bf1d37493af --- /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 <[email protected]> + */ + +#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 00000000000..955508dae9a --- /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 <[email protected]> + */ + +#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 eb2fbe26e7f..0d04d8e8718 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 b1c08af9382..8ace9853368 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" @@ -41,6 +42,7 @@ #include "util/u_format.h" #include "util/u_memory.h" #include "util/u_sampler.h" +#include "util/u_string.h" #include "asm_filters.h" @@ -270,7 +272,7 @@ static struct vg_shader * setup_convolution(struct vg_context *ctx, void *user_d VGint num_consts = (VGint)(long)(user_data); struct vg_shader *shader; - snprintf(buffer, 1023, convolution_asm, num_consts, num_consts / 2 + 1); + util_snprintf(buffer, 1023, convolution_asm, num_consts, num_consts / 2 + 1); shader = shader_create_from_text(ctx->pipe, buffer, 200, PIPE_SHADER_FRAGMENT); @@ -298,16 +300,16 @@ static struct vg_shader * setup_lookup_single(struct vg_context *ctx, void *user switch(channel) { case VG_RED: - snprintf(buffer, 1023, lookup_single_asm, "xxxx"); + util_snprintf(buffer, 1023, lookup_single_asm, "xxxx"); break; case VG_GREEN: - snprintf(buffer, 1023, lookup_single_asm, "yyyy"); + util_snprintf(buffer, 1023, lookup_single_asm, "yyyy"); break; case VG_BLUE: - snprintf(buffer, 1023, lookup_single_asm, "zzzz"); + util_snprintf(buffer, 1023, lookup_single_asm, "zzzz"); break; case VG_ALPHA: - snprintf(buffer, 1023, lookup_single_asm, "wwww"); + util_snprintf(buffer, 1023, lookup_single_asm, "wwww"); break; default: debug_assert(!"Unknown color channel"); @@ -361,8 +363,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 +405,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 +510,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 +602,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 +701,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 +760,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 6c7fd3b346c..c36b3d2f3c8 100644 --- a/src/gallium/state_trackers/vega/api_images.c +++ b/src/gallium/state_trackers/vega/api_images.c @@ -31,7 +31,7 @@ #include "vg_context.h" #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 +92,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 +126,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 +142,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 +167,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 +195,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 +222,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 +252,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 +269,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 +291,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 +307,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 +327,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 +349,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 +390,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 +461,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 7c28ea5c872..94c1ff5375f 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 78ba0bc1103..e648549745b 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 dd3ac5bdb09..d88341b04ff 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 db77fd9cb05..a10b009e631 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 58ebb3b60ea..6c9a2e8d658 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 d8411cf3e87..b35f3be90ab 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 763a5ec415c..0a40fc69b95 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/arc.c b/src/gallium/state_trackers/vega/arc.c index 2d123408702..65a985fbbbf 100644 --- a/src/gallium/state_trackers/vega/arc.c +++ b/src/gallium/state_trackers/vega/arc.c @@ -33,8 +33,7 @@ #include "path.h" #include "util/u_debug.h" - -#include <math.h> +#include "util/u_math.h" #ifndef M_PI #define M_PI 3.14159265358979323846 diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c index 9c323b1809c..c12dc71b860 100644 --- a/src/gallium/state_trackers/vega/image.c +++ b/src/gallium/state_trackers/vega/image.c @@ -270,7 +270,7 @@ struct vg_image * image_create(VGImageFormat format, image->sampler.normalized_coords = 1; assert(screen->is_format_supported(screen, pformat, PIPE_TEXTURE_2D, - PIPE_BIND_SAMPLER_VIEW, 0)); + 0, PIPE_BIND_SAMPLER_VIEW, 0)); memset(&pt, 0, sizeof(pt)); pt.target = PIPE_TEXTURE_2D; @@ -355,7 +355,7 @@ void image_destroy(struct vg_image *img) } pipe_sampler_view_reference(&img->sampler_view, NULL); - free(img); + FREE(img); } void image_clear(struct vg_image *img, @@ -576,7 +576,7 @@ void image_set_pixels(VGint dx, VGint dy, pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); surf = screen->get_tex_surface(screen, image_texture(src), 0, 0, 0, - PIPE_BIND_BLIT_SOURCE); + 0 /* no bind flags as surf isn't actually used??? */); vg_copy_surface(ctx, strb->surface, dx, dy, surf, sx+src->x, sy+src->y, width, height); @@ -601,7 +601,7 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy, pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); surf = screen->get_tex_surface(screen, image_texture(dst), 0, 0, 0, - PIPE_BIND_BLIT_SOURCE); + 0 /* no bind flags as surf isn't actually used??? */); vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy, strb->surface, sx, sy, width, height); diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c index 6d627b0e8da..ef28ebd740c 100644 --- a/src/gallium/state_trackers/vega/mask.c +++ b/src/gallium/state_trackers/vega/mask.c @@ -520,7 +520,7 @@ void mask_layer_destroy(struct vg_mask_layer *layer) vg_context_remove_object(ctx, VG_OBJECT_MASK, layer); pipe_resource_release(&layer->texture); - free(layer); + FREE(layer); } void mask_layer_fill(struct vg_mask_layer *layer, diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c index 05540e82752..2c0eb6b23d2 100644 --- a/src/gallium/state_trackers/vega/paint.c +++ b/src/gallium/state_trackers/vega/paint.c @@ -236,7 +236,7 @@ void paint_destroy(struct vg_paint *paint) free(paint->gradient.ramp_stopsi); free(paint->gradient.ramp_stops); - free(paint); + FREE(paint); } void paint_set_color(struct vg_paint *paint, diff --git a/src/gallium/state_trackers/vega/path.c b/src/gallium/state_trackers/vega/path.c index 4fc23a7a278..05f8b0d9979 100644 --- a/src/gallium/state_trackers/vega/path.c +++ b/src/gallium/state_trackers/vega/path.c @@ -218,7 +218,7 @@ void path_destroy(struct path *p) if (p->stroked.path) path_destroy(p->stroked.path); - free(p); + FREE(p); } VGbitfield path_capabilities(struct path *p) diff --git a/src/gallium/state_trackers/vega/polygon.c b/src/gallium/state_trackers/vega/polygon.c index d2b7e489124..bc94170eb96 100644 --- a/src/gallium/state_trackers/vega/polygon.c +++ b/src/gallium/state_trackers/vega/polygon.c @@ -301,8 +301,7 @@ static void draw_polygon(struct vg_context *ctx, cso_set_vertex_elements(ctx->cso_context, 1, &velement); /* draw */ - pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLE_FAN, - 0, poly->num_verts); + util_draw_arrays(pipe, PIPE_PRIM_TRIANGLE_FAN, 0, (uint) poly->num_verts); } void polygon_fill(struct polygon *poly, struct vg_context *ctx) @@ -379,7 +378,7 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx) dsa.stencil[0].func = PIPE_FUNC_ALWAYS; dsa.stencil[0].valuemask = ~0; - raster.cull_mode = raster.front_winding ^ PIPE_WINDING_BOTH; + raster.cull_face = PIPE_FACE_BACK; dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP; @@ -389,7 +388,7 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx) cso_set_rasterizer(ctx->cso_context, &raster); draw_polygon(ctx, poly); - raster.cull_mode = raster.front_winding; + raster.cull_face = PIPE_FACE_FRONT; dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_DECR_WRAP; @@ -501,7 +500,7 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx) dsa.stencil[0].func = PIPE_FUNC_ALWAYS; dsa.stencil[0].valuemask = ~0; - raster.cull_mode = raster.front_winding ^ PIPE_WINDING_BOTH; + raster.cull_face = PIPE_FACE_BACK; dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP; @@ -514,7 +513,7 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx) draw_polygon(ctx, poly); } - raster.cull_mode = raster.front_winding; + raster.cull_face = PIPE_FACE_FRONT; dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP; dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP; dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_DECR_WRAP; diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c index 48fbc3b330e..8c023044c45 100644 --- a/src/gallium/state_trackers/vega/renderer.c +++ b/src/gallium/state_trackers/vega/renderer.c @@ -40,6 +40,7 @@ #include "util/u_memory.h" #include "util/u_rect.h" #include "util/u_sampler.h" +#include "util/u_surface.h" #include "cso_cache/cso_context.h" @@ -58,7 +59,8 @@ static void setup_shaders(struct renderer *ctx) { struct pipe_context *pipe = ctx->pipe; /* fragment shader */ - ctx->fs = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_2D); + ctx->fs = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_2D, + TGSI_INTERPOLATE_LINEAR); } static struct pipe_resource * @@ -201,7 +203,7 @@ void renderer_destroy(struct renderer *ctx) ctx->fs = NULL; } #endif - free(ctx); + FREE(ctx); } void renderer_draw_quad(struct renderer *r, @@ -307,7 +309,7 @@ void renderer_copy_texture(struct renderer *ctx, #endif assert(screen->is_format_supported(screen, dst_surf->format, PIPE_TEXTURE_2D, - PIPE_BIND_RENDER_TARGET, 0)); + 0, PIPE_BIND_RENDER_TARGET, 0)); /* save state (restored below) */ cso_save_blend(ctx->cso); @@ -414,7 +416,7 @@ void renderer_copy_surface(struct renderer *ctx, struct pipe_sampler_view view_templ; struct pipe_sampler_view *view; struct pipe_resource texTemp, *tex; - struct pipe_surface *texSurf; + struct pipe_subresource subsrc, subdst; struct pipe_framebuffer_state fb; struct st_framebuffer *stfb = ctx->owner->draw_buffer; const int srcW = abs(srcX1 - srcX0); @@ -440,11 +442,11 @@ void renderer_copy_surface(struct renderer *ctx, } assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D, - PIPE_BIND_SAMPLER_VIEW, 0)); + 0, PIPE_BIND_SAMPLER_VIEW, 0)); assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, - PIPE_BIND_SAMPLER_VIEW, 0)); + 0, PIPE_BIND_SAMPLER_VIEW, 0)); assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, - PIPE_BIND_RENDER_TARGET, 0)); + 0, PIPE_BIND_RENDER_TARGET, 0)); /* * XXX for now we're always creating a temporary texture. @@ -459,6 +461,7 @@ void renderer_copy_surface(struct renderer *ctx, texTemp.width0 = srcW; texTemp.height0 = srcH; texTemp.depth0 = 1; + texTemp.bind = PIPE_BIND_SAMPLER_VIEW; tex = screen->resource_create(screen, &texTemp); if (!tex) @@ -470,24 +473,15 @@ void renderer_copy_surface(struct renderer *ctx, if (!view) return; - texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0, - PIPE_BIND_RENDER_TARGET); - - /* load temp texture */ - if (pipe->surface_copy) { - pipe->surface_copy(pipe, - texSurf, 0, 0, /* dest */ - src, srcLeft, srcTop, /* src */ - srcW, srcH); /* size */ - } else { - util_surface_copy(pipe, FALSE, - texSurf, 0, 0, /* dest */ - src, srcLeft, srcTop, /* src */ - srcW, srcH); /* size */ - } + subdst.face = 0; + subdst.level = 0; + subsrc.face = src->face; + subsrc.level = src->level; - /* free the surface, update the texture if necessary.*/ - screen->tex_surface_destroy(texSurf); + pipe->resource_copy_region(pipe, + tex, subdst, 0, 0, 0, /* dest */ + src->texture, subsrc, srcLeft, srcTop, src->zslice, /* src */ + srcW, srcH); /* size */ /* save state (restored below) */ cso_save_blend(ctx->cso); diff --git a/src/gallium/state_trackers/vega/shader.c b/src/gallium/state_trackers/vega/shader.c index 6eef94ce767..eab1349639c 100644 --- a/src/gallium/state_trackers/vega/shader.c +++ b/src/gallium/state_trackers/vega/shader.c @@ -68,7 +68,7 @@ struct shader * shader_create(struct vg_context *ctx) void shader_destroy(struct shader *shader) { - free(shader); + FREE(shader); } void shader_set_masking(struct shader *shader, VGboolean set) diff --git a/src/gallium/state_trackers/vega/shaders_cache.c b/src/gallium/state_trackers/vega/shaders_cache.c index f43fe6ee4cb..53e6bfcf16b 100644 --- a/src/gallium/state_trackers/vega/shaders_cache.c +++ b/src/gallium/state_trackers/vega/shaders_cache.c @@ -381,7 +381,7 @@ void shaders_cache_destroy(struct shaders_cache *sc) } cso_hash_delete(sc->hash); - free(sc); + FREE(sc); } void * shaders_cache_fill(struct shaders_cache *sc, @@ -410,7 +410,7 @@ struct vg_shader * shader_create_from_text(struct pipe_context *pipe, const char *txt, int num_tokens, int type) { - struct vg_shader *shader = (struct vg_shader *)malloc( + struct vg_shader *shader = (struct vg_shader *)MALLOC( sizeof(struct vg_shader)); struct tgsi_token *tokens = tokens_from_assembly(txt, num_tokens); struct pipe_shader_state state; @@ -435,6 +435,6 @@ void vg_shader_destroy(struct vg_context *ctx, struct vg_shader *shader) cso_delete_fragment_shader(ctx->cso_context, shader->driver); else cso_delete_vertex_shader(ctx->cso_context, shader->driver); - free(shader->tokens); - free(shader); + FREE(shader->tokens); + FREE(shader); } diff --git a/src/gallium/state_trackers/vega/stroker.c b/src/gallium/state_trackers/vega/stroker.c index 68a52029db0..d89b6cf25cb 100644 --- a/src/gallium/state_trackers/vega/stroker.c +++ b/src/gallium/state_trackers/vega/stroker.c @@ -35,7 +35,7 @@ #include "path_utils.h" #include "polygon.h" -#include "math.h" +#include "util/u_math.h" #ifndef M_2PI #define M_2PI 6.28318530717958647692528676655900576 @@ -870,7 +870,7 @@ static VGboolean vg_stroke_outline(struct stroke_iterator *it, VGboolean cap_first, VGfloat *start_tangent) { - const int MAX_OFFSET = 16; +#define MAX_OFFSET 16 struct bezier offset_curves[MAX_OFFSET]; VGPathCommand first_element; VGfloat start[2], prev[2]; @@ -1017,6 +1017,7 @@ static VGboolean vg_stroke_outline(struct stroke_iterator *it, #endif return VG_FALSE; } +#undef MAX_OFFSET } static void stroker_process_subpath(struct stroker *stroker) diff --git a/src/gallium/state_trackers/vega/util_array.h b/src/gallium/state_trackers/vega/util_array.h index 4343dfe36e2..b2d22f476ee 100644 --- a/src/gallium/state_trackers/vega/util_array.h +++ b/src/gallium/state_trackers/vega/util_array.h @@ -65,7 +65,7 @@ static INLINE void array_destroy(struct array *array) { if (array) free(array->data); - free(array); + FREE(array); } static INLINE void array_resize(struct array *array, int num) diff --git a/src/gallium/state_trackers/vega/vg_api.h b/src/gallium/state_trackers/vega/vg_api.h new file mode 100644 index 00000000000..ce2a0d6bb47 --- /dev/null +++ b/src/gallium/state_trackers/vega/vg_api.h @@ -0,0 +1,37 @@ +/* + * 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 <[email protected]> + */ + +#ifndef VG_API_H +#define VG_API_H + +struct st_api; + +const struct st_api * +vg_api_get(void); + +#endif /* VG_API_H */ diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c index 1a8952ce34a..5cb25906027 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" @@ -64,9 +65,36 @@ static void init_clear(struct vg_context *st) st->clear.fs = util_make_fragment_passthrough_shader(pipe); } + +/** + * A depth/stencil rb will be needed regardless of what the visual says. + */ +static boolean +choose_depth_stencil_format(struct vg_context *ctx) +{ + struct pipe_screen *screen = ctx->pipe->screen; + enum pipe_format formats[] = { + PIPE_FORMAT_Z24_UNORM_S8_USCALED, + PIPE_FORMAT_S8_USCALED_Z24_UNORM, + PIPE_FORMAT_NONE + }; + enum pipe_format *fmt; + + for (fmt = formats; *fmt != PIPE_FORMAT_NONE; fmt++) { + if (screen->is_format_supported(screen, *fmt, + PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0)) + break; + } + + ctx->ds_format = *fmt; + + return (ctx->ds_format != PIPE_FORMAT_NONE); +} + 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, @@ -79,6 +107,12 @@ struct vg_context * vg_create_context(struct pipe_context *pipe, ctx = CALLOC_STRUCT(vg_context); ctx->pipe = pipe; + if (!choose_depth_stencil_format(ctx)) { + FREE(ctx); + return NULL; + } + + ctx->dispatch = api_create_dispatch(); vg_init_state(&ctx->state.vg); ctx->state.dirty = ALL_DIRTY; @@ -185,7 +219,9 @@ 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]); - free(ctx); + api_destroy_dispatch(ctx->dispatch); + + FREE(ctx); } void vg_init_object(struct vg_object *obj, struct vg_context *ctx, enum vg_object_type type) @@ -451,8 +487,7 @@ void vg_prepare_blend_surface(struct vg_context *ctx) dest_surface = pipe->screen->get_tex_surface(pipe->screen, stfb->blend_texture_view->texture, 0, 0, 0, - PIPE_BIND_BLIT_DESTINATION | - PIPE_BIND_RENDER_TARGET); + PIPE_BIND_RENDER_TARGET); /* flip it, because we want to use it as a sampler */ util_blit_pixels_tex(ctx->blit, view, @@ -488,8 +523,7 @@ void vg_prepare_blend_surface_from_mask(struct vg_context *ctx) dest_surface = pipe->screen->get_tex_surface(pipe->screen, stfb->blend_texture_view->texture, 0, 0, 0, - PIPE_BIND_BLIT_DESTINATION | - PIPE_BIND_RENDER_TARGET); + PIPE_BIND_RENDER_TARGET); /* flip it, because we want to use it as a sampler */ util_blit_pixels_tex(ctx->blit, diff --git a/src/gallium/state_trackers/vega/vg_context.h b/src/gallium/state_trackers/vega/vg_context.h index dac67192a54..80a6c07c693 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,8 +91,10 @@ enum dirty_state { struct vg_context { struct st_context_iface iface; + struct mapi_table *dispatch; struct pipe_context *pipe; + enum pipe_format ds_format; struct { struct vg_state vg; diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c index aecac28e7ee..e7996741d14 100644 --- a/src/gallium/state_trackers/vega/vg_manager.c +++ b/src/gallium/state_trackers/vega/vg_manager.c @@ -36,10 +36,12 @@ #include "util/u_format.h" #include "util/u_sampler.h" +#include "vg_api.h" #include "vg_manager.h" #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, @@ -122,28 +124,22 @@ setup_new_alpha_mask(struct vg_context *ctx, struct st_framebuffer *stfb) /* if we had an old surface copy it over */ if (old_sampler_view) { - struct pipe_surface *surface = pipe->screen->get_tex_surface( - pipe->screen, - stfb->alpha_mask_view->texture, - 0, 0, 0, - PIPE_BIND_RENDER_TARGET | - PIPE_BIND_BLIT_DESTINATION); - struct pipe_surface *old_surface = pipe->screen->get_tex_surface( - pipe->screen, - old_sampler_view->texture, - 0, 0, 0, - PIPE_BIND_BLIT_SOURCE); - pipe->surface_copy(pipe, - surface, - 0, 0, - old_surface, - 0, 0, - MIN2(old_surface->width, surface->width), - MIN2(old_surface->height, surface->height)); - if (surface) - pipe_surface_reference(&surface, NULL); - if (old_surface) - pipe_surface_reference(&old_surface, NULL); + struct pipe_subresource subsurf, subold_surf; + subsurf.face = 0; + subsurf.level = 0; + subold_surf.face = 0; + subold_surf.level = 0; + pipe->resource_copy_region(pipe, + stfb->alpha_mask_view->texture, + subsurf, + 0, 0, 0, + old_sampler_view->texture, + subold_surf, + 0, 0, 0, + MIN2(old_sampler_view->texture->width0, + stfb->alpha_mask_view->texture->width0), + MIN2(old_sampler_view->texture->height0, + stfb->alpha_mask_view->texture->height0)); } /* Free the old texture @@ -170,9 +166,7 @@ vg_context_update_depth_stencil_rb(struct vg_context * ctx, /* Probably need dedicated flags for surface usage too: */ - surface_usage = (PIPE_BIND_RENDER_TARGET | - PIPE_BIND_BLIT_SOURCE | - PIPE_BIND_BLIT_DESTINATION); + surface_usage = PIPE_BIND_DEPTH_STENCIL; /* XXX: was: RENDER_TARGET */ dsrb->texture = create_texture(pipe, dsrb->format, width, height); if (!dsrb->texture) @@ -214,9 +208,7 @@ vg_context_update_color_rb(struct vg_context *ctx, struct pipe_resource *pt) strb->texture = pt; strb->surface = screen->get_tex_surface(screen, strb->texture, 0, 0, 0, - PIPE_BIND_RENDER_TARGET | - PIPE_BIND_BLIT_SOURCE | - PIPE_BIND_BLIT_DESTINATION); + PIPE_BIND_RENDER_TARGET); if (!strb->surface) { pipe_resource_reference(&strb->texture, NULL); return TRUE; @@ -349,13 +341,20 @@ vg_context_destroy(struct st_context_iface *stctxi) static struct st_context_iface * vg_api_create_context(struct st_api *stapi, struct st_manager *smapi, - const struct st_visual *visual, + const struct st_context_attribs *attribs, struct st_context_iface *shared_stctxi) { struct vg_context *shared_ctx = (struct vg_context *) shared_stctxi; struct vg_context *ctx; struct pipe_context *pipe; + if (!(stapi->profile_mask & (1 << attribs->profile))) + return NULL; + + /* only 1.0 is supported */ + if (attribs->major != 1 || attribs->minor > 0) + return NULL; + pipe = smapi->screen->context_create(smapi->screen, NULL); if (!pipe) return NULL; @@ -396,7 +395,7 @@ destroy_renderbuffer(struct st_renderbuffer *strb) { pipe_surface_reference(&strb->surface, NULL); pipe_resource_reference(&strb->texture, NULL); - free(strb); + FREE(strb); } /** @@ -456,11 +455,10 @@ vg_context_bind_framebuffers(struct st_context_iface *stctxi, /* free the existing fb */ if (!stdrawi || stfb->strb_att != strb_att || - stfb->strb->format != stdrawi->visual->color_format || - stfb->dsrb->format != stdrawi->visual->depth_stencil_format) { + stfb->strb->format != stdrawi->visual->color_format) { destroy_renderbuffer(stfb->strb); destroy_renderbuffer(stfb->dsrb); - free(stfb); + FREE(stfb); ctx->draw_buffer = NULL; } @@ -480,14 +478,14 @@ vg_context_bind_framebuffers(struct st_context_iface *stctxi, stfb->strb = create_renderbuffer(stdrawi->visual->color_format); if (!stfb->strb) { - free(stfb); + FREE(stfb); return FALSE; } - stfb->dsrb = create_renderbuffer(stdrawi->visual->depth_stencil_format); + stfb->dsrb = create_renderbuffer(ctx->ds_format); if (!stfb->dsrb) { - free(stfb->strb); - free(stfb); + FREE(stfb->strb); + FREE(stfb); return FALSE; } @@ -525,38 +523,29 @@ vg_api_get_current(struct st_api *stapi) return (ctx) ? &ctx->iface : NULL; } -static boolean -vg_api_is_visual_supported(struct st_api *stapi, - const struct st_visual *visual) -{ - /* the impl requires a depth/stencil buffer */ - return util_format_is_depth_and_stencil(visual->depth_stencil_format); -} - 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 vg_api_destroy(struct st_api *stapi) { - free(stapi); } -struct st_api st_vg_api = { +static const struct st_api vg_api = { + ST_API_OPENVG, + ST_PROFILE_DEFAULT_MASK, vg_api_destroy, vg_api_get_proc_address, - vg_api_is_visual_supported, vg_api_create_context, vg_api_make_current, vg_api_get_current, }; -struct st_api * -st_api_create_OpenVG(void) +const struct st_api * +vg_api_get(void) { - return &st_vg_api; + return &vg_api; } |