st/vega: Use SConscript for Windows build.
authorChia-I Wu <olv@lunarg.com>
Mon, 31 May 2010 04:38:21 +0000 (12:38 +0800)
committerChia-I Wu <olv@lunarg.com>
Mon, 31 May 2010 05:28:01 +0000 (13:28 +0800)
Fix several portability issues and add SConscript for Windows build.

src/gallium/SConscript
src/gallium/state_trackers/vega/SConscript [new file with mode: 0644]
src/gallium/state_trackers/vega/api_filters.c
src/gallium/state_trackers/vega/arc.c
src/gallium/state_trackers/vega/stroker.c

index f47907e..c0d48a8 100644 (file)
@@ -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 (file)
index 0000000..548053e
--- /dev/null
@@ -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')
index 144fb8f..8ace985 100644 (file)
@@ -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");
index 2d12340..65a985f 100644 (file)
@@ -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
index 68a5202..d89b6cf 100644 (file)
@@ -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)