# mesa/es is required to build es state tracker
CORE_DIRS="$CORE_DIRS mesa/es"
;;
+ vega)
+ CORE_DIRS="$CORE_DIRS mapi/vgapi"
+ ;;
esac
done
GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
### Lists of source files, included by Makefiles
VG_SOURCES = \
+ api.c \
api_context.c \
api_filters.c \
api_images.c \
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
--- /dev/null
+/*
+ * 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);
+}
--- /dev/null
+/*
+ * 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 */
#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;
return error;
}
-void vgFlush(void)
+void vegaFlush(void)
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe;
vg_manager_flush_frontbuffer(ctx);
}
-void vgFinish(void)
+void vegaFinish(void)
{
struct vg_context *ctx = vg_current_context();
struct pipe_fence_handle *fence = NULL;
#include "vg_context.h"
#include "image.h"
+#include "api.h"
#include "renderer.h"
#include "shaders_cache.h"
#include "st_inlines.h"
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;
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;
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;
}
}
-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;
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;
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;
#include "vg_translate.h"
#include "api_consts.h"
#include "image.h"
+#include "api.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
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();
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;
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;
}
-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;
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;
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;
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;
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();
width, height, dither);
}
-void vgDrawImage(VGImage image)
+void vegaDrawImage(VGImage image)
{
struct vg_context *ctx = vg_current_context();
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();
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;
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;
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;
}
}
-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;
#include "mask.h"
#include "renderer.h"
+#include "api.h"
#include "vg_context.h"
#include "pipe/p_context.h"
#include "util/u_draw_quad.h"
#include "util/u_memory.h"
-
#define DISABLE_1_1_MASKING 1
/**
}
-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();
}
}
-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;
#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();
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();
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();
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();
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;
#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();
}
/* 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";
#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;
paint_destroy(paint);
}
-void vgSetPaint(VGPaint paint, VGbitfield paintModes)
+void vegaSetPaint(VGPaint paint, VGbitfield paintModes)
{
struct vg_context *ctx = vg_current_context();
}
}
-VGPaint vgGetPaint(VGPaintMode paintMode)
+VGPaint vegaGetPaint(VGPaintMode paintMode)
{
struct vg_context *ctx = vg_current_context();
VGPaint paint = VG_INVALID_HANDLE;
return paint;
}
-void vgSetColor(VGPaint paint, VGuint rgba)
+void vegaSetColor(VGPaint paint, VGuint rgba)
{
struct vg_context *ctx = vg_current_context();
}
}
-VGuint vgGetColor(VGPaint paint)
+VGuint vegaGetColor(VGPaint paint)
{
struct vg_context *ctx = vg_current_context();
struct vg_paint *p;
return paint_colori(p);
}
-void vgPaintPattern(VGPaint paint, VGImage pattern)
+void vegaPaintPattern(VGPaint paint, VGImage pattern)
{
struct vg_context *ctx = vg_current_context();
#include "image.h"
#include "matrix.h"
#include "api_consts.h"
+#include "api.h"
#include "pipe/p_compiler.h"
#include "util/u_pointer.h"
}
}
-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();
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();
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();
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();
}
}
-VGfloat vgGetf(VGParamType type)
+VGfloat vegaGetf(VGParamType type)
{
struct vg_context *ctx = vg_current_context();
const struct vg_state *state = current_state();
return value;
}
-VGint vgGeti(VGParamType type)
+VGint vegaGeti(VGParamType type)
{
const struct vg_state *state = current_state();
struct vg_context *ctx = vg_current_context();
return value;
}
-VGint vgGetVectorSize(VGParamType type)
+VGint vegaGetVectorSize(VGParamType type)
{
struct vg_context *ctx = vg_current_context();
const struct vg_state *state = current_state();
}
}
-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();
}
}
-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();
}
}
-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;
}
}
-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;
}
}
-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;
}
}
-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;
}
}
-VGint vgGetParameterVectorSize(VGHandle object,
- VGint paramType)
+VGint vegaGetParameterVectorSize(VGHandle object,
+ VGint paramType)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)object;
}
-VGfloat vgGetParameterf(VGHandle object,
- VGint paramType)
+VGfloat vegaGetParameterf(VGHandle object,
+ VGint paramType)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)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;
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;
}
}
-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;
#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();
capabilities);
}
-void vgClearPath(VGPath path, VGbitfield capabilities)
+void vegaClearPath(VGPath path, VGbitfield capabilities)
{
struct vg_context *ctx = vg_current_context();
struct path *p = 0;
path_clear(p, capabilities);
}
-void vgDestroyPath(VGPath p)
+void vegaDestroyPath(VGPath p)
{
struct path *path = 0;
struct vg_context *ctx = vg_current_context();
path_destroy(path);
}
-void vgRemovePathCapabilities(VGPath path,
- VGbitfield capabilities)
+void vegaRemovePathCapabilities(VGPath path,
+ VGbitfield capabilities)
{
struct vg_context *ctx = vg_current_context();
VGbitfield current;
(~(capabilities & VG_PATH_CAPABILITY_ALL))));
}
-VGbitfield vgGetPathCapabilities(VGPath path)
+VGbitfield vegaGetPathCapabilities(VGPath path)
{
struct vg_context *ctx = vg_current_context();
struct path *p = 0;
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;
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;
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;
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;
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;
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;
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;
}
}
-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;
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;
}
-void vgDrawPath(VGPath path, VGbitfield paintModes)
+void vegaDrawPath(VGPath path, VGbitfield paintModes)
{
struct vg_context *ctx = vg_current_context();
#include "VG/openvg.h"
#include "vg_context.h"
+#include "api.h"
#include "util/u_memory.h"
VGint num_glyphs;
};
-VGFont vgCreateFont(VGint glyphCapacityHint)
+VGFont vegaCreateFont(VGint glyphCapacityHint)
{
struct vg_font *font = 0;
struct vg_context *ctx = vg_current_context();
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();
/*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;
++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;
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;
}
}
-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;
}
}
-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;
#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;
}
}
-void vgGetMatrix(VGfloat * m)
+void vegaGetMatrix(VGfloat * m)
{
struct vg_context *ctx = vg_current_context();
struct matrix *mat;
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;
}
-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);
#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"
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,
ctx->pipe = pipe;
+ ctx->dispatch = api_create_dispatch();
+
vg_init_state(&ctx->state.vg);
ctx->state.dirty = ALL_DIRTY;
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);
}
struct shaders_cache;
struct shader;
struct vg_shader;
+struct mapi_table;
struct st_renderbuffer {
enum pipe_format format;
struct vg_context
{
struct st_context_iface iface;
+ struct mapi_table *dispatch;
struct pipe_context *pipe;
#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,
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