diff options
Diffstat (limited to 'lib/mesa/src/gallium/tests')
-rw-r--r-- | lib/mesa/src/gallium/tests/graw/clear.c | 6 | ||||
-rw-r--r-- | lib/mesa/src/gallium/tests/graw/graw_util.h | 19 | ||||
-rw-r--r-- | lib/mesa/src/gallium/tests/graw/meson.build | 2 | ||||
-rw-r--r-- | lib/mesa/src/gallium/tests/trivial/meson.build | 2 | ||||
-rw-r--r-- | lib/mesa/src/gallium/tests/unit/meson.build | 2 | ||||
-rw-r--r-- | lib/mesa/src/gallium/tests/unit/translate_test.c | 31 | ||||
-rw-r--r-- | lib/mesa/src/gallium/tests/unit/u_half_test.c | 32 |
7 files changed, 60 insertions, 34 deletions
diff --git a/lib/mesa/src/gallium/tests/graw/clear.c b/lib/mesa/src/gallium/tests/graw/clear.c index 2a08ae154..d46b9c90c 100644 --- a/lib/mesa/src/gallium/tests/graw/clear.c +++ b/lib/mesa/src/gallium/tests/graw/clear.c @@ -3,7 +3,7 @@ */ #include <stdio.h> -#include "state_tracker/graw.h" +#include "frontend/graw.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" #include "pipe/p_state.h" @@ -28,12 +28,12 @@ static void draw( void ) { union pipe_color_union clear_color = { {1, 0, 1, 1} }; - ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0); + ctx->clear(ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0); ctx->flush(ctx, NULL, 0); graw_save_surface_to_file(ctx, surf, NULL); - screen->flush_frontbuffer(screen, tex, 0, 0, window, NULL); + screen->flush_frontbuffer(screen, ctx, tex, 0, 0, window, NULL); } static void init( void ) diff --git a/lib/mesa/src/gallium/tests/graw/graw_util.h b/lib/mesa/src/gallium/tests/graw/graw_util.h index 7cd22416a..ca813b6b8 100644 --- a/lib/mesa/src/gallium/tests/graw/graw_util.h +++ b/lib/mesa/src/gallium/tests/graw/graw_util.h @@ -1,5 +1,5 @@ -#include "state_tracker/graw.h" +#include "frontend/graw.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -160,9 +160,9 @@ graw_util_default_state(struct graw_info *info, boolean depth_test) struct pipe_depth_stencil_alpha_state depthStencilAlpha; void *handle; memset(&depthStencilAlpha, 0, sizeof depthStencilAlpha); - depthStencilAlpha.depth.enabled = depth_test; - depthStencilAlpha.depth.writemask = 1; - depthStencilAlpha.depth.func = PIPE_FUNC_LESS; + depthStencilAlpha.depth_enabled = depth_test; + depthStencilAlpha.depth_writemask = 1; + depthStencilAlpha.depth_func = PIPE_FUNC_LESS; handle = info->ctx->create_depth_stencil_alpha_state(info->ctx, &depthStencilAlpha); info->ctx->bind_depth_stencil_alpha_state(info->ctx, handle); @@ -201,6 +201,11 @@ graw_util_viewport(struct graw_info *info, vp.translate[1] = half_height + y; vp.translate[2] = half_depth + z; + vp.swizzle_x = PIPE_VIEWPORT_SWIZZLE_POSITIVE_X; + vp.swizzle_y = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y; + vp.swizzle_z = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z; + vp.swizzle_w = PIPE_VIEWPORT_SWIZZLE_POSITIVE_W; + info->ctx->set_viewport_states(info->ctx, 0, 1, &vp); } @@ -208,7 +213,7 @@ graw_util_viewport(struct graw_info *info, static inline void graw_util_flush_front(const struct graw_info *info) { - info->screen->flush_frontbuffer(info->screen, info->color_buf[0], + info->screen->flush_frontbuffer(info->screen, info->ctx, info->color_buf[0], 0, 0, info->window, NULL); } @@ -244,7 +249,7 @@ graw_util_create_tex2d(const struct graw_info *info, info->ctx->texture_subdata(info->ctx, tex, 0, - PIPE_TRANSFER_WRITE, + PIPE_MAP_WRITE, &box, data, row_stride, @@ -258,7 +263,7 @@ graw_util_create_tex2d(const struct graw_info *info, uint32_t *ptr; t = pipe_transfer_map(info->ctx, samptex, 0, 0, /* level, layer */ - PIPE_TRANSFER_READ, + PIPE_MAP_READ, 0, 0, SIZE, SIZE); /* x, y, width, height */ ptr = info->ctx->transfer_map(info->ctx, t); diff --git a/lib/mesa/src/gallium/tests/graw/meson.build b/lib/mesa/src/gallium/tests/graw/meson.build index 9a1f4e7db..6d6840eb1 100644 --- a/lib/mesa/src/gallium/tests/graw/meson.build +++ b/lib/mesa/src/gallium/tests/graw/meson.build @@ -29,7 +29,7 @@ foreach t : progs executable( 'graw-' + t, t + '.c', - include_directories : inc_common, + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], link_with : [libgraw, libgraw_util, libgallium], dependencies : [dep_m, idep_mesautil], ) diff --git a/lib/mesa/src/gallium/tests/trivial/meson.build b/lib/mesa/src/gallium/tests/trivial/meson.build index bc6fbac47..a54e71d72 100644 --- a/lib/mesa/src/gallium/tests/trivial/meson.build +++ b/lib/mesa/src/gallium/tests/trivial/meson.build @@ -22,7 +22,7 @@ foreach t : ['compute', 'tri', 'quad-tex'] executable( t, '@0@.c'.format(t), - include_directories : inc_common, + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], link_with : [libgallium, libpipe_loader_dynamic], dependencies : idep_mesautil, install : false, diff --git a/lib/mesa/src/gallium/tests/unit/meson.build b/lib/mesa/src/gallium/tests/unit/meson.build index 3a6badace..f94e1058d 100644 --- a/lib/mesa/src/gallium/tests/unit/meson.build +++ b/lib/mesa/src/gallium/tests/unit/meson.build @@ -23,7 +23,7 @@ foreach t : ['pipe_barrier_test', 'u_cache_test', 'u_half_test', exe = executable( t, '@0@.c'.format(t), - include_directories : inc_common, + include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], link_with : libgallium, dependencies : idep_mesautil, install : false, diff --git a/lib/mesa/src/gallium/tests/unit/translate_test.c b/lib/mesa/src/gallium/tests/unit/translate_test.c index 8e96b7b7b..782f16e7f 100644 --- a/lib/mesa/src/gallium/tests/unit/translate_test.c +++ b/lib/mesa/src/gallium/tests/unit/translate_test.c @@ -27,7 +27,7 @@ #include "translate/translate.h" #include "util/u_memory.h" #include "util/format/u_format.h" -#include "util/u_half.h" +#include "util/half_float.h" #include "util/u_cpu_detect.h" #include "rtasm/rtasm_cpu.h" @@ -50,6 +50,7 @@ int main(int argc, char** argv) { struct translate *(*create_fn)(const struct translate_key *key) = 0; + extern struct util_cpu_caps_t util_cpu_caps; struct translate_key key; unsigned output_format; unsigned input_format; @@ -87,7 +88,7 @@ int main(int argc, char** argv) } else if (!strcmp(argv[1], "sse")) { - if(!util_cpu_caps.has_sse || !rtasm_cpu_has_sse()) + if(!util_get_cpu_caps()->has_sse || !rtasm_cpu_has_sse()) { printf("Error: CPU doesn't support SSE (test with qemu)\n"); return 2; @@ -99,7 +100,7 @@ int main(int argc, char** argv) } else if (!strcmp(argv[1], "sse2")) { - if(!util_cpu_caps.has_sse2 || !rtasm_cpu_has_sse()) + if(!util_get_cpu_caps()->has_sse2 || !rtasm_cpu_has_sse()) { printf("Error: CPU doesn't support SSE2 (test with qemu)\n"); return 2; @@ -110,7 +111,7 @@ int main(int argc, char** argv) } else if (!strcmp(argv[1], "sse3")) { - if(!util_cpu_caps.has_sse3 || !rtasm_cpu_has_sse()) + if(!util_get_cpu_caps()->has_sse3 || !rtasm_cpu_has_sse()) { printf("Error: CPU doesn't support SSE3 (test with qemu)\n"); return 2; @@ -120,7 +121,7 @@ int main(int argc, char** argv) } else if (!strcmp(argv[1], "sse4.1")) { - if(!util_cpu_caps.has_sse4_1 || !rtasm_cpu_has_sse()) + if(!util_get_cpu_caps()->has_sse4_1 || !rtasm_cpu_has_sse()) { printf("Error: CPU doesn't support SSE4.1 (test with qemu)\n"); return 2; @@ -164,7 +165,7 @@ int main(int argc, char** argv) double_buffer[i] = rand_double(); for (i = 0; i < buffer_size / sizeof(double); ++i) - half_buffer[i] = util_float_to_half((float) rand_double()); + half_buffer[i] = _mesa_float_to_half((float) rand_double()); for (i = 0; i < count; ++i) elts[i] = i; @@ -172,12 +173,15 @@ int main(int argc, char** argv) for (output_format = 1; output_format < PIPE_FORMAT_COUNT; ++output_format) { const struct util_format_description* output_format_desc = util_format_description(output_format); + const struct util_format_pack_description* output_format_pack = util_format_pack_description(output_format); + util_format_fetch_rgba_func_ptr fetch_rgba = + util_format_fetch_rgba_func(output_format); unsigned output_format_size; unsigned output_normalized = 0; if (!output_format_desc - || !output_format_desc->fetch_rgba_float - || !output_format_desc->pack_rgba_float + || !fetch_rgba + || !output_format_pack->pack_rgba_float || output_format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB || output_format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN || !translate_is_output_format_supported(output_format)) @@ -194,6 +198,9 @@ int main(int argc, char** argv) for (input_format = 1; input_format < PIPE_FORMAT_COUNT; ++input_format) { const struct util_format_description* input_format_desc = util_format_description(input_format); + const struct util_format_pack_description* input_format_pack = util_format_pack_description(input_format); + util_format_fetch_rgba_func_ptr fetch_rgba = + util_format_fetch_rgba_func(input_format); unsigned input_format_size; struct translate* translate[2]; unsigned fail = 0; @@ -202,8 +209,8 @@ int main(int argc, char** argv) boolean input_is_float = FALSE; if (!input_format_desc - || !input_format_desc->fetch_rgba_float - || !input_format_desc->pack_rgba_float + || !fetch_rgba + || !input_format_pack->pack_rgba_float || input_format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB || input_format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN || !translate_is_output_format_supported(input_format)) @@ -273,8 +280,8 @@ int main(int argc, char** argv) { float a[4]; float b[4]; - input_format_desc->fetch_rgba_float(a, buffer[2] + i * input_format_size, 0, 0); - input_format_desc->fetch_rgba_float(b, buffer[4] + i * input_format_size, 0, 0); + fetch_rgba(a, buffer[2] + i * input_format_size, 0, 0); + fetch_rgba(b, buffer[4] + i * input_format_size, 0, 0); for (j = 0; j < count; ++j) { diff --git a/lib/mesa/src/gallium/tests/unit/u_half_test.c b/lib/mesa/src/gallium/tests/unit/u_half_test.c index 48a9a2d53..4474cfb82 100644 --- a/lib/mesa/src/gallium/tests/unit/u_half_test.c +++ b/lib/mesa/src/gallium/tests/unit/u_half_test.c @@ -3,10 +3,11 @@ #include <float.h> #include "util/u_math.h" -#include "util/u_half.h" +#include "util/half_float.h" +#include "util/u_cpu_detect.h" -int -main(int argc, char **argv) +static void +test(void) { unsigned i; unsigned roundtrip_fails = 0; @@ -17,8 +18,8 @@ main(int argc, char **argv) union fi f; uint16_t rh; - f.f = util_half_to_float(h); - rh = util_float_to_half(f.f); + f.f = _mesa_half_to_float(h); + rh = _mesa_float_to_half(f.f); if (h != rh && !(util_is_half_nan(h) && util_is_half_nan(rh))) { printf("Roundtrip failed: %x -> %x = %f -> %x\n", h, f.ui, f.f, rh); @@ -28,9 +29,22 @@ main(int argc, char **argv) if(roundtrip_fails) { printf("Failure! %u/65536 half floats failed a conversion to float and back.\n", roundtrip_fails); - return 1; - } else { - printf("Success!\n"); - return 0; + exit(1); + } +} + +int +main(int argc, char **argv) +{ + util_cpu_detect(); + test(); + + /* Test non-f16c. */ + if (util_get_cpu_caps()->has_f16c) { + ((struct util_cpu_caps_t *)util_get_cpu_caps())->has_f16c = false; + test(); } + + printf("Success!\n"); + return 0; } |