From e5b5d84e8a87a5603a84f8c4625592a278bcf9af Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 31 May 2010 12:38:21 +0800 Subject: [PATCH] st/vega: Use SConscript for Windows build. Fix several portability issues and add SConscript for Windows build. --- src/gallium/SConscript | 1 + src/gallium/state_trackers/vega/SConscript | 51 +++++++++++++++++++ src/gallium/state_trackers/vega/api_filters.c | 11 ++-- src/gallium/state_trackers/vega/arc.c | 3 +- src/gallium/state_trackers/vega/stroker.c | 5 +- 5 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 src/gallium/state_trackers/vega/SConscript diff --git a/src/gallium/SConscript b/src/gallium/SConscript index f47907eed36..c0d48a8268d 100644 --- a/src/gallium/SConscript +++ b/src/gallium/SConscript @@ -16,6 +16,7 @@ if platform != 'embedded': SConscript('state_trackers/dri/SConscript') SConscript('state_trackers/xorg/SConscript') SConscript('state_trackers/egl/SConscript') + SConscript('state_trackers/vega/SConscript') if platform == 'windows': SConscript('state_trackers/wgl/SConscript') 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_filters.c b/src/gallium/state_trackers/vega/api_filters.c index 144fb8f323d..8ace9853368 100644 --- a/src/gallium/state_trackers/vega/api_filters.c +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -42,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" @@ -271,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); @@ -299,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"); 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 +#include "util/u_math.h" #ifndef M_PI #define M_PI 3.14159265358979323846 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) -- 2.30.2