From 28cf5e1191077e063fe2a81d9d35934b71d001e2 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 29 Mar 2010 17:30:09 +0100 Subject: r300: UTIL_FORMAT_LAYOUT_COMPRESSED -> UTIL_FORMAT_LAYOUT_S3TC. --- src/gallium/drivers/r300/r300_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 7c86bdb4bd..22ccadfe3d 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -159,7 +159,7 @@ static uint32_t r300_translate_texformat(enum pipe_format format) } /* Compressed formats. */ - if (desc->layout == UTIL_FORMAT_LAYOUT_COMPRESSED) { + if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) { switch (format) { case PIPE_FORMAT_DXT1_RGB: case PIPE_FORMAT_DXT1_RGBA: -- cgit v1.2.3 From bade76191a3a429176694b3d7fd4f68409359735 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 29 Mar 2010 17:30:35 +0100 Subject: svga: util_format_is_compressed() -> util_format_is_s3tc(). --- src/gallium/drivers/svga/svga_screen_texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index 4a058eda88..70d3a8a46a 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -330,7 +330,7 @@ svga_texture_create(struct pipe_screen *screen, */ #if 0 if((templat->tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) && - !util_format_is_compressed(templat->format)) + !util_format_is_s3tc(templat->format)) tex->key.flags |= SVGA3D_SURFACE_HINT_RENDERTARGET; #endif @@ -969,7 +969,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, if (min_lod == 0 && max_lod >= pt->last_level) view = FALSE; - if (util_format_is_compressed(pt->format) && view) { + if (util_format_is_s3tc(pt->format) && view) { format = svga_translate_format_render(pt->format); } -- cgit v1.2.3 From f3cb08f3dd81bc6479e8aa926fb74e73bb83cb6f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 29 Mar 2010 17:31:16 +0100 Subject: i965g: util_format_is_compressed() -> util_format_is_s3tc(). --- src/gallium/drivers/i965/brw_screen_texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_screen_texture.c index cadcb7cee2..f9f17bdaba 100644 --- a/src/gallium/drivers/i965/brw_screen_texture.c +++ b/src/gallium/drivers/i965/brw_screen_texture.c @@ -206,7 +206,7 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen, /* XXX: compressed textures need special treatment here */ tex->cpp = util_format_get_blocksize(tex->base.format); - tex->compressed = util_format_is_compressed(tex->base.format); + tex->compressed = util_format_is_s3tc(tex->base.format); make_empty_list(&tex->views[0]); make_empty_list(&tex->views[1]); @@ -321,7 +321,7 @@ brw_texture_from_handle(struct pipe_screen *screen, templ->depth0 != 1) return NULL; - if (util_format_is_compressed(templ->format)) + if (util_format_is_s3tc(templ->format)) return NULL; tex = CALLOC_STRUCT(brw_texture); -- cgit v1.2.3 From 5fa09846618ed702493f054a1d4b0ec2a28fbbd0 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Fri, 26 Mar 2010 10:24:34 -0700 Subject: Add test case for lp_bld_printf() --- src/gallium/drivers/llvmpipe/Makefile | 3 +- src/gallium/drivers/llvmpipe/lp_test_printf.c | 162 ++++++++++++++++++++++++++ 2 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 src/gallium/drivers/llvmpipe/lp_test_printf.c (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index 74d728ddb3..b37c6754c0 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -44,7 +44,8 @@ CPP_SOURCES = \ PROGS := lp_test_format \ lp_test_blend \ - lp_test_conv + lp_test_conv \ + lp_test_printf include ../../Makefile.template diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c new file mode 100644 index 0000000000..e5e5925012 --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -0,0 +1,162 @@ +/************************************************************************** + * + * Copyright 2010 VMware, Inc. + * All Rights Reserved. + * + * 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, sub license, 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 (including the + * next paragraph) 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 NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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. + * + **************************************************************************/ + + +#include +#include + +#include "gallivm/lp_bld.h" +#include "gallivm/lp_bld_printf.h" + +#include +#include +#include +#include + +#include "lp_test.h" + + +struct printf_test_case { +}; + +void +write_tsv_header(FILE *fp) +{ + fprintf(fp, + "result\t" + "format\n"); + + fflush(fp); +} + + + +typedef void (*test_printf_t)(int i); + +static LLVMValueRef +add_printf_test(LLVMModuleRef module) +{ + LLVMTypeRef args[1] = { LLVMIntType(32) }; + LLVMValueRef func = LLVMAddFunction(module, "test_printf", LLVMFunctionType(LLVMVoidType(), args, 1, 0)); + LLVMBuilderRef builder = LLVMCreateBuilder(); + LLVMBasicBlockRef block = LLVMAppendBasicBlock(func, "entry"); + + LLVMSetFunctionCallConv(func, LLVMCCallConv); + + LLVMPositionBuilderAtEnd(builder, block); + lp_build_printf(builder, "hello, world\n"); + lp_build_printf(builder, "print 5 6: %d %d\n", LLVMConstInt(LLVMInt32Type(), 5, 0), + LLVMConstInt(LLVMInt32Type(), 6, 0)); + LLVMBuildRetVoid(builder); + LLVMDisposeBuilder(builder); + return func; +} + + +PIPE_ALIGN_STACK +static boolean +test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase) +{ + LLVMModuleRef module = NULL; + LLVMValueRef test = NULL; + LLVMExecutionEngineRef engine = NULL; + LLVMModuleProviderRef provider = NULL; + LLVMPassManagerRef pass = NULL; + char *error = NULL; + test_printf_t test_printf; + float unpacked[4]; + unsigned packed; + boolean success = TRUE; + + module = LLVMModuleCreateWithName("test"); + + test = add_printf_test(module); + + if(LLVMVerifyModule(module, LLVMPrintMessageAction, &error)) { + LLVMDumpModule(module); + abort(); + } + LLVMDisposeMessage(error); + + provider = LLVMCreateModuleProviderForExistingModule(module); + if (LLVMCreateJITCompiler(&engine, provider, 1, &error)) { + fprintf(stderr, "%s\n", error); + LLVMDisposeMessage(error); + abort(); + } + +#if 0 + pass = LLVMCreatePassManager(); + LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass); + /* These are the passes currently listed in llvm-c/Transforms/Scalar.h, + * but there are more on SVN. */ + LLVMAddConstantPropagationPass(pass); + LLVMAddInstructionCombiningPass(pass); + LLVMAddPromoteMemoryToRegisterPass(pass); + LLVMAddGVNPass(pass); + LLVMAddCFGSimplificationPass(pass); + LLVMRunPassManager(pass, module); +#else + (void)pass; +#endif + + test_printf = (test_printf_t)LLVMGetPointerToGlobal(engine, test); + + memset(unpacked, 0, sizeof unpacked); + packed = 0; + + + // LLVMDumpModule(module); + + test_printf(0); + + LLVMFreeMachineCodeForFunction(engine, test); + + LLVMDisposeExecutionEngine(engine); + if(pass) + LLVMDisposePassManager(pass); + + return success; +} + + +boolean +test_all(unsigned verbose, FILE *fp) +{ + bool success = TRUE; + + test_printf(verbose, fp, NULL); + + return success; +} + + +boolean +test_some(unsigned verbose, FILE *fp, unsigned long n) +{ + return test_all(verbose, fp); +} -- cgit v1.2.3