[Mesa-dev] [PATCH] linker: Fix memory leak in count_uniform_size::visit_field.
Fixes a Coverity resource leak defect. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Vinson Lee v...@freedesktop.org --- src/glsl/link_uniforms.cpp |1 + 1 file changed, 1 insertion(+) diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index 613c9b7..86717f9 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -175,6 +175,7 @@ private: char *key = strdup(name); this-map-put(this-num_active_uniforms, key); + free(key); /* Each leaf uniform occupies one entry in the list of active * uniforms. -- 1.7.9.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure: Add --with-llvm-shared-libs
Looks good to me. It's disabled by default, which is important because upstream doesn't really support shared llvm libs -- it's something that distros are doing on their initiative. Also note that this will saves disk at the expense of runtime memory -- as the shared LLVM library will contain the _whole_ LLVM, and not just the components targets needed, and given that there is usually only xxx_dri.so module on a system at a time, that means a net increase. libLLMVM-3.0 is 22MB on my system, which means 22MB - 13MB = +9MB of increased memory usage. Linux kernel may page out some portions to disk though. Jose - Original Message - From: Tom Stellard tstel...@gmail.com This option allows targets to link against the LLVM shared library instead of the static libs. With LLVM 2.9, his saves ~13 MB for each of the r300 target libraries. --- configure.ac | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ac7d49f..4ff02e4 100644 --- a/configure.ac +++ b/configure.ac @@ -1779,6 +1779,13 @@ AC_ARG_ENABLE([gallium-llvm], [build gallium LLVM support @:@default=enabled on x86/x86_64@:@])], [enable_gallium_llvm=$enableval], [enable_gallium_llvm=auto]) + +AC_ARG_WITH([llvm-shared-libs], +[AS_HELP_STRING([--with-llvm-shared-libs], +[link with LLVM shared libraries @:@default=disabled@:@])], +[with_llvm_shared_libs=yes], +[with_llvm_shared_libs=no]) + if test x$with_gallium_drivers = x; then enable_gallium_llvm=no fi @@ -1793,8 +1800,12 @@ if test x$enable_gallium_llvm = xyes; then if test x$LLVM_CONFIG != xno; then LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'` LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\//g' -e 's/-pedantic//g'` - LLVM_LIBS=`$LLVM_CONFIG --libs engine bitwriter` - + if test x$with_llvm_shared_libs = xyes; then + dnl We can't use $LLVM_VERSION because it has 'svn' stripped out, + LLVM_LIBS=-lLLVM-`$LLVM_CONFIG --version` + else + LLVM_LIBS=`$LLVM_CONFIG --libs engine bitwriter` + fi LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags` DEFINES=$DEFINES -D__STDC_CONSTANT_MACROS MESA_LLVM=1 -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure: Add --with-llvm-shared-libs
On Don, 2012-03-29 at 00:07 -0700, Jose Fonseca wrote: Also note that this will saves disk at the expense of runtime memory -- as the shared LLVM library will contain the _whole_ LLVM, and not just the components targets needed, and given that there is usually only xxx_dri.so module on a system at a time, that means a net increase. libLLMVM-3.0 is 22MB on my system, which means 22MB - 13MB = +9MB of increased memory usage. Linux kernel may page out some portions to disk though. Or never page in the unused parts in the first place. :) And as soon as a second *_dri.so comes into play (e.g. swrast_dri.so for testing something with software rendering), it's a win either way. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 47878] libXvMC* are not being installed where they should
https://bugs.freedesktop.org/show_bug.cgi?id=47878 --- Comment #5 from Christian König deathsim...@vodafone.de 2012-03-29 01:00:43 PDT --- It at least sounds like a good idea if vdpau and va have a separate installation-dir parameter to give xvmc one also. I just doesn't want to do the patch myself, so if you want to hack it together just leave me a note here and then send the patch to the list for review. Otherwise I'm going to commit the simpler version and close this bugreport. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 47649] fatal error: shared-glapi/glapi_mapi_tmp.h: No such file or directory
https://bugs.freedesktop.org/show_bug.cgi?id=47649 --- Comment #5 from Fabio Pedretti fabio@libero.it 2012-03-29 03:53:13 PDT --- But maybe give this patch a try: The patch fixes the issue indeed, thanks. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 47878] libXvMC* are not being installed where they should
https://bugs.freedesktop.org/show_bug.cgi?id=47878 --- Comment #6 from Alexandre Demers alexandre.f.dem...@gmail.com 2012-03-29 05:22:03 PDT --- (In reply to comment #5) It at least sounds like a good idea if vdpau and va have a separate installation-dir parameter to give xvmc one also. I just doesn't want to do the patch myself, so if you want to hack it together just leave me a note here and then send the patch to the list for review. Otherwise I'm going to commit the simpler version and close this bugreport. I'll do it in the next couple of days with the help of your explanations. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure: Add --with-llvm-shared-libs
On Thu, Mar 29, 2012 at 12:07:46AM -0700, Jose Fonseca wrote: Looks good to me. It's disabled by default, which is important because upstream doesn't really support shared llvm libs -- it's something that distros are doing on their initiative. Also note that this will saves disk at the expense of runtime memory -- as the shared LLVM library will contain the _whole_ LLVM, and not just the components targets needed, and given that there is usually only xxx_dri.so module on a system at a time, that means a net increase. libLLMVM-3.0 is 22MB on my system, which means 22MB - 13MB = +9MB of increased memory usage. Linux kernel may page out some portions to disk though. libLLVM-2.9.so is much smaller at only 12.4 MB (though it probably depends on how many backends were built). I checked again, and I miscalculated the space savings of the r300 targets, they're really only 11.1 MB smaller. Anyway you're right for the single xxx_dri.so use case it will increase memory usage. LLVM shared libs should help a lot with the clover state tracker, because libOpenCL.so depends on LLVM as do some of the pipe drivers it loads, like r600_pipe.so. It is also very useful for development purposes, because with shared libraries, I don't need to rebuild mesa every time I make a change to LLVM. -Tom Jose - Original Message - From: Tom Stellard tstel...@gmail.com This option allows targets to link against the LLVM shared library instead of the static libs. With LLVM 2.9, his saves ~13 MB for each of the r300 target libraries. --- configure.ac | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ac7d49f..4ff02e4 100644 --- a/configure.ac +++ b/configure.ac @@ -1779,6 +1779,13 @@ AC_ARG_ENABLE([gallium-llvm], [build gallium LLVM support @:@default=enabled on x86/x86_64@:@])], [enable_gallium_llvm=$enableval], [enable_gallium_llvm=auto]) + +AC_ARG_WITH([llvm-shared-libs], +[AS_HELP_STRING([--with-llvm-shared-libs], +[link with LLVM shared libraries @:@default=disabled@:@])], +[with_llvm_shared_libs=yes], +[with_llvm_shared_libs=no]) + if test x$with_gallium_drivers = x; then enable_gallium_llvm=no fi @@ -1793,8 +1800,12 @@ if test x$enable_gallium_llvm = xyes; then if test x$LLVM_CONFIG != xno; then LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'` LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\//g' -e 's/-pedantic//g'` - LLVM_LIBS=`$LLVM_CONFIG --libs engine bitwriter` - + if test x$with_llvm_shared_libs = xyes; then + dnl We can't use $LLVM_VERSION because it has 'svn' stripped out, + LLVM_LIBS=-lLLVM-`$LLVM_CONFIG --version` + else + LLVM_LIBS=`$LLVM_CONFIG --libs engine bitwriter` + fi LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags` DEFINES=$DEFINES -D__STDC_CONSTANT_MACROS MESA_LLVM=1 -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 47649] fatal error: shared-glapi/glapi_mapi_tmp.h: No such file or directory
https://bugs.freedesktop.org/show_bug.cgi?id=47649 Kristian Høgsberg k...@bitplanet.net changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Comment #6 from Kristian Høgsberg k...@bitplanet.net 2012-03-29 06:25:54 PDT --- Thanks for testing! commit 2402ce04ae06f909e361782f5063fa3070091bf1 Author: Kristian Høgsberg k...@bitplanet.net Date: Thu Mar 29 09:20:53 2012 -0400 shared-glapi: Include from builddir Fixes out-of-tree builds. https://bugs.freedesktop.org/show_bug.cgi?id=47649 -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] XDC2012 - Announcement
Now that we have everything in place we can finally make it official and announce it: XDC2012 will take place from September 19th to September 21th in Nuernberg, Germany at the SUSE headquarter buidling. Matthias Hopf, Luc Verhaegen and I will be orgainzing this event. The initial wiki page for this event has been put in place at: http://wiki.x.org/wiki/Events/XDC2012 This page will get updated regularly. Also we will keep you up-to-date on the X.Org events mailing list http://lists.x.org/mailman/listinfo/events so if you plan to come and are not subscribed there already, please consider doing so! q For registration please add yourself to the attendees page http://wiki.x.org/wiki/Events/XDC2012/Attendees. If you would like to give a talk during the event, please add it to the program page http://wiki.x.org/wiki/Events/XDC2012/Program. We are looking forward to seeing you in Nuernberg. So if you are corporate please talk to your managers about funding your trip. If you aren't but you have something to present, please contact the XOrg Foundation Board of Directors at bo...@foundation.x.org for travel funding. We are negotiating a special conference rate at a hotel nearby (5 minute walking) please check the Wiki page for more information. This year is something special as it marks the 25th anniversary of the first release of X11. How can we celebrate this better than with Frankonian Beer? We therefore have a beer hiking trip planned for Saturday, Sept. 22, where we will walk thru the Frankonian countryside visiting several brewery beergardens along the way. So if you can spare the weekend, please stick around and join us for this exciting event! If you still have time left on Sunday Luc would like to show you around Nuernberg's recent history. Cheers, Egbert. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 48052] New: [softpipe] depth-cube-map fails
https://bugs.freedesktop.org/show_bug.cgi?id=48052 Bug #: 48052 Summary: [softpipe] depth-cube-map fails Classification: Unclassified Product: Mesa Version: git Platform: Other OS/Version: All Status: NEW Severity: normal Priority: medium Component: Other AssignedTo: mesa-dev@lists.freedesktop.org ReportedBy: morgan.de...@gmail.com I took some time to look after this bug. The problem seems to come from the sample_cube function in sp_tex_sample.c, when the face of the cube map is determined using the four pixel's texcoords average. At the edges of the current rasterized primitive, some pixels may not be part of the primitive (ie. masked), leading to an incorrect average and therefore an incorrect face selection. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 7/9] glsl: Convert ir_call to be a statement rather than a value.
On Wed, 28 Mar 2012 20:33:06 -0700, Kenneth Graunke kenn...@whitecape.org wrote: Aside from ir_call, our IR is cleanly split into two classes: - Statements (typeless; used for side effects, control flow) - Values (deeply nestable, pure, typed expression trees) diff --git a/src/glsl/ir_basic_block.cpp b/src/glsl/ir_basic_block.cpp index a833825..5ebbf6f 100644 --- a/src/glsl/ir_basic_block.cpp +++ b/src/glsl/ir_basic_block.cpp @@ -122,24 +97,9 @@ void call_for_basic_blocks(exec_list *instructions, call_for_basic_blocks(ir_sig-body, callback, data); } - } else if (ir-as_assignment()) { - /* If there's a call in the expression tree being assigned, - * then that ends the BB too. - * - * The assumption is that any consumer of the basic block - * walker is fine with the fact that the call is somewhere in - * the tree even if portions of the tree may be evaluated - * after the call. - * - * A consumer that has an issue with this could not process - * the last instruction of the basic block. If doing so, - * expression flattener may be useful before using the basic - * block finder to get more maximal basic blocks out. - */ - if (ir_has_call(ir)) { - callback(leader, ir, data); - leader = NULL; - } + } else if (ir-as_call()) { + callback(leader, ir, data); + leader = NULL; There was already a block checking for ir-as_call() above, so this can just be dropped. diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 101d999..385ef12 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -548,6 +548,23 @@ ir_validate::visit_enter(ir_call *ir) abort(); } + if (callee-return_type == glsl_type::void_type) { + if (ir-return_deref != NULL) { + printf(ir_call to void function has storage for a return value\n); + abort(); + } + } else { + if (ir-return_deref == NULL) { + printf(ir_call has non-void callee but no return storage\n); + abort(); + } + if (callee-return_type != ir-return_deref-type) { + printf(callee type %s does not match return storage type %s\n, + callee-return_type-name, ir-return_deref-type-name); + abort(); + } + } I think this could be slightly simplified: if (ir-return_deref) { if (ir-return_deref-type != callee-return_type) { printf(callee type %s does not match return storage type %s\n, callee-return_type-name, ir-return_deref-type-name); abort(); } } else if (callee-return_type != glsl_type::void_type) { printf(ir_call has non-void callee but no return storage\n); abort(); } but either way. diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 09ffdff..d56eb97 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -117,6 +117,15 @@ public: sig_iter.next(); } + if (ir-return_deref != NULL) { + ir_variable *const var = ir-return_deref-variable_referenced(); = ir-return_deref-var; Every time I see variable_referenced(), I think about what kind of rvalue tree it is and the possibility of a NULL return. Actually, I think there's a later patch opportunity to simplify this visitor a bunch of the optimization passes by setting in_assignee during function out/inout parameter visiting, and then dropping a bunch of ir_call special cases in favor of the ir_dereference_variable() visit function with an in_assignee check. You can bump my Reviewed-by up to the current version. pgp8XWDy60kzI.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] GLSL compiler function call cleaning
On Wed, 28 Mar 2012 20:32:59 -0700, Kenneth Graunke kenn...@whitecape.org wrote: I finally resurrected this work I started back in September. I think I've included most of the old feedback, and done a bunch more cleaning. Patches 2,4,5,6,8,9 are also: Reviewed-by: Eric Anholt e...@anholt.net The one outstanding concern I have is IR-Mesa and IR-TGSI: both seem to support function calls, but I'm not sure how that all works. IMHO Mesa IR really shouldn't support them---we should just rely on the GLSL compiler's inliner. I'm incredibly skeptical that the code in IR-Mesa actually works, since it has a comment that functions other than main() should never been seen. Maybe that's just old. Can we delete this? There may exist code in ir_to_mesa, but I don't think that code has been run, nor do I expect the Mesa optimization passes to do anything good to programs using the CAL opcode. pgpPcsBQycz2z.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] linker: Fix memory leak in count_uniform_size::visit_field.
On Wed, 28 Mar 2012 23:43:30 -0700, Vinson Lee v...@freedesktop.org wrote: Fixes a Coverity resource leak defect. I'm betting coverity is pointing out a case where this is sometimes leaked, but not every time, while you're freeing it every time. pgpmiJpUky7fj.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 7/9] glsl: Convert ir_call to be a statement rather than a value.
On 03/29/2012 09:58 AM, Eric Anholt wrote: On Wed, 28 Mar 2012 20:33:06 -0700, Kenneth Graunkekenn...@whitecape.org wrote: Aside from ir_call, our IR is cleanly split into two classes: - Statements (typeless; used for side effects, control flow) - Values (deeply nestable, pure, typed expression trees) diff --git a/src/glsl/ir_basic_block.cpp b/src/glsl/ir_basic_block.cpp index a833825..5ebbf6f 100644 --- a/src/glsl/ir_basic_block.cpp +++ b/src/glsl/ir_basic_block.cpp @@ -122,24 +97,9 @@ void call_for_basic_blocks(exec_list *instructions, call_for_basic_blocks(ir_sig-body, callback, data); } - } else if (ir-as_assignment()) { -/* If there's a call in the expression tree being assigned, - * then that ends the BB too. - * - * The assumption is that any consumer of the basic block - * walker is fine with the fact that the call is somewhere in - * the tree even if portions of the tree may be evaluated - * after the call. - * - * A consumer that has an issue with this could not process - * the last instruction of the basic block. If doing so, - * expression flattener may be useful before using the basic - * block finder to get more maximal basic blocks out. - */ -if (ir_has_call(ir)) { - callback(leader, ir, data); - leader = NULL; -} + } else if (ir-as_call()) { +callback(leader, ir, data); +leader = NULL; There was already a block checking for ir-as_call() above, so this can just be dropped. Oops. Fixed, thanks. diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 101d999..385ef12 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -548,6 +548,23 @@ ir_validate::visit_enter(ir_call *ir) abort(); } + if (callee-return_type == glsl_type::void_type) { + if (ir-return_deref != NULL) { +printf(ir_call to void function has storage for a return value\n); +abort(); + } + } else { + if (ir-return_deref == NULL) { +printf(ir_call has non-void callee but no return storage\n); +abort(); + } + if (callee-return_type != ir-return_deref-type) { +printf(callee type %s does not match return storage type %s\n, + callee-return_type-name, ir-return_deref-type-name); +abort(); + } + } I think this could be slightly simplified: if (ir-return_deref) { if (ir-return_deref-type != callee-return_type) { printf(callee type %s does not match return storage type %s\n, callee-return_type-name, ir-return_deref-type-name); abort(); } } else if (callee-return_type != glsl_type::void_type) { printf(ir_call has non-void callee but no return storage\n); abort(); } but either way. Agreed. Changed to your version. diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 09ffdff..d56eb97 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -117,6 +117,15 @@ public: sig_iter.next(); } + if (ir-return_deref != NULL) { +ir_variable *const var = ir-return_deref-variable_referenced(); = ir-return_deref-var; Every time I see variable_referenced(), I think about what kind of rvalue tree it is and the possibility of a NULL return. Actually, I think there's a later patch opportunity to simplify this visitor a bunch of the optimization passes by setting in_assignee during function out/inout parameter visiting, and then dropping a bunch of ir_call special cases in favor of the ir_dereference_variable() visit function with an in_assignee check. Yeah, worth looking into. You can bump my Reviewed-by up to the current version. Awesome, thanks! ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] linker: Fix memory leak in count_uniform_size::visit_field.
On 03/28/2012 11:43 PM, Vinson Lee wrote: Fixes a Coverity resource leak defect. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Vinson Leev...@freedesktop.org --- src/glsl/link_uniforms.cpp |1 + 1 file changed, 1 insertion(+) diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index 613c9b7..86717f9 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -175,6 +175,7 @@ private: char *key = strdup(name); this-map-put(this-num_active_uniforms, key); + free(key); /* Each leaf uniform occupies one entry in the list of active * uniforms. It looks like string_to_uint_map::put (hash_table.h:247) already calls strdup() on the key. So I think we should just do: this-map-put(this-num_active_uniforms, name); and not bother duplicating it twice. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 48057] New: use of uninitialized variables by read_builtins()
https://bugs.freedesktop.org/show_bug.cgi?id=48057 Bug #: 48057 Summary: use of uninitialized variables by read_builtins() Classification: Unclassified Product: Mesa Version: 8.0 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: medium Component: Mesa core AssignedTo: mesa-dev@lists.freedesktop.org ReportedBy: jstrother9...@gmail.com With 8.0.2 I receive the following using valgrind: ==15511== Conditional jump or move depends on uninitialised value(s) ==15511==at 0x52AC1CA: _mesa_glsl_parse_state::_mesa_glsl_parse_state(gl_context*, unsigned int, void*) (glsl_parser_extras.cpp:118) ==15511==by 0x52DC68F: read_builtins(unsigned int, char const*, char const**, unsigned int) (builtin_function.cpp:44) ==15511==by 0x52DC90F: _mesa_read_profile(_mesa_glsl_parse_state*, int, char const*, char const**, int) (builtin_function.cpp:16205) ==15511==by 0x52DCABE: _mesa_glsl_initialize_functions(_mesa_glsl_parse_state*) (builtin_function.cpp:16251) ==15511==by 0x529C2C3: match_function_by_name(exec_list*, char const*, YYLTYPE*, exec_list*, ir_call**, _mesa_glsl_parse_state*) (ast_function.cpp:314) ==15511==by 0x529F9FC: ast_function_expression::hir(exec_list*, _mesa_glsl_parse_state*) (ast_function.cpp:1460) ==15511==by 0x52A1CAC: ast_expression::hir(exec_list*, _mesa_glsl_parse_state*) (ast_to_hir.cpp:1033) ==15511==by 0x52A4C8D: ast_expression_statement::hir(exec_list*, _mesa_glsl_parse_state*) (ast_to_hir.cpp:1813) ==15511==by 0x52A4CFD: ast_compound_statement::hir(exec_list*, _mesa_glsl_parse_state*) (ast_to_hir.cpp:1829) ==15511==by 0x52A7F00: ast_function_definition::hir(exec_list*, _mesa_glsl_parse_state*) (ast_to_hir.cpp:3312) ==15511==by 0x529FF9E: _mesa_ast_to_hir(exec_list*, _mesa_glsl_parse_state*) (ast_to_hir.cpp:87) ==15511==by 0x527CF58: _mesa_glsl_compile_shader (ir_to_mesa.cpp:3342) ==15511== Uninitialised value was created by a stack allocation ==15511==at 0x52DC5F1: read_builtins(unsigned int, char const*, char const**, unsigned int) (builtin_function.cpp:37) The problem is fairly clear. When fakeCtx is instantiated in read_builtins() it is left uninitialized except for a few select members. The constructor for _mesa_glsl_parse_state does not seem to have anticipated fake contexts and uses a number of other members. I would suggest a patch, but it looks like a non-trivial fix. Seems like glsl_compiler wants to be standalone, even though all of the structures it uses have dependencies in mesa/main. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 48057] use of uninitialized variables by read_builtins()
https://bugs.freedesktop.org/show_bug.cgi?id=48057 --- Comment #1 from Dave Airlie airl...@freedesktop.org 2012-03-29 11:27:13 PDT --- http://cgit.freedesktop.org/mesa/mesa/commit/?id=b78a77f979b21a84aecb6fa4f19a2ed51a48c306 is the fix in master needs to be picked -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] linker: Fix memory leak in count_uniform_size::visit_field.
On 03/29/2012 10:41 AM, Kenneth Graunke wrote: On 03/28/2012 11:43 PM, Vinson Lee wrote: Fixes a Coverity resource leak defect. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Vinson Leev...@freedesktop.org --- src/glsl/link_uniforms.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index 613c9b7..86717f9 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -175,6 +175,7 @@ private: char *key = strdup(name); this-map-put(this-num_active_uniforms, key); + free(key); /* Each leaf uniform occupies one entry in the list of active * uniforms. It looks like string_to_uint_map::put (hash_table.h:247) already calls strdup() on the key. So I think we should just do: this-map-put(this-num_active_uniforms, name); and not bother duplicating it twice. I think that's correct. I seem to recall a similar case being fixed a few months ago. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl: Drop the round-trip through ast_type_specifier for many builtin types.
We have lexer recognition of a bunch of our types based on the handling. This code was mapping those recognized tokens to an enum and then to a string of their name. Just drop the enums and provide the string directly in the parser. --- src/glsl/ast.h | 66 + src/glsl/ast_to_hir.cpp |4 +- src/glsl/ast_type.cpp | 68 +- src/glsl/glsl_parser.yy | 106 +++ 4 files changed, 58 insertions(+), 186 deletions(-) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 1f78af8..e6707ac 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -418,72 +418,12 @@ public: }; -enum ast_types { - ast_void, - ast_float, - ast_int, - ast_uint, - ast_bool, - ast_vec2, - ast_vec3, - ast_vec4, - ast_bvec2, - ast_bvec3, - ast_bvec4, - ast_ivec2, - ast_ivec3, - ast_ivec4, - ast_uvec2, - ast_uvec3, - ast_uvec4, - ast_mat2, - ast_mat2x3, - ast_mat2x4, - ast_mat3x2, - ast_mat3, - ast_mat3x4, - ast_mat4x2, - ast_mat4x3, - ast_mat4, - ast_sampler1d, - ast_sampler2d, - ast_sampler2drect, - ast_sampler3d, - ast_samplercube, - ast_samplerexternaloes, - ast_sampler1dshadow, - ast_sampler2dshadow, - ast_sampler2drectshadow, - ast_samplercubeshadow, - ast_sampler1darray, - ast_sampler2darray, - ast_sampler1darrayshadow, - ast_sampler2darrayshadow, - ast_isampler1d, - ast_isampler2d, - ast_isampler3d, - ast_isamplercube, - ast_isampler1darray, - ast_isampler2darray, - ast_usampler1d, - ast_usampler2d, - ast_usampler3d, - ast_usamplercube, - ast_usampler1darray, - ast_usampler2darray, - - ast_struct, - ast_type_name -}; - class ast_type_specifier : public ast_node { public: - ast_type_specifier(int specifier); - /** Construct a type specifier from a type name */ ast_type_specifier(const char *name) - : type_specifier(ast_type_name), type_name(name), structure(NULL), + : type_name(name), structure(NULL), is_array(false), array_size(NULL), precision(ast_precision_none), is_precision_statement(false) { @@ -492,7 +432,7 @@ public: /** Construct a type specifier from a structure definition */ ast_type_specifier(ast_struct_specifier *s) - : type_specifier(ast_struct), type_name(s-name), structure(s), + : type_name(s-name), structure(s), is_array(false), array_size(NULL), precision(ast_precision_none), is_precision_statement(false) { @@ -507,8 +447,6 @@ public: ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *); - enum ast_types type_specifier; - const char *type_name; ast_struct_specifier *structure; diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index ff56e33..dd02301 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -3904,8 +3904,8 @@ ast_type_specifier::hir(exec_list *instructions, arrays); return NULL; } - if (this-type_specifier != ast_float - this-type_specifier != ast_int) { + if (strcmp(this-type_name, float) != 0 + strcmp(this-type_name, int) != 0) { _mesa_glsl_error(loc, state, default precision statements apply only to types float and int); diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 79c43ee..6c44f8c 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -29,7 +29,7 @@ extern C { void ast_type_specifier::print(void) const { - if (type_specifier == ast_struct) { + if (structure) { structure-print(); } else { printf(%s , type_name); @@ -46,72 +46,6 @@ ast_type_specifier::print(void) const } } -ast_type_specifier::ast_type_specifier(int specifier) - : type_specifier(ast_types(specifier)), type_name(NULL), structure(NULL), - is_array(false), array_size(NULL), precision(ast_precision_none), - is_precision_statement(false) -{ - static const char *const names[] = { - void, - float, - int, - uint, - bool, - vec2, - vec3, - vec4, - bvec2, - bvec3, - bvec4, - ivec2, - ivec3, - ivec4, - uvec2, - uvec3, - uvec4, - mat2, - mat2x3, - mat2x4, - mat3x2, - mat3, - mat3x4, - mat4x2, - mat4x3, - mat4, - sampler1D, - sampler2D, - sampler2DRect, - sampler3D, - samplerCube, - samplerExternalOES, - sampler1DShadow, - sampler2DShadow, - sampler2DRectShadow, - samplerCubeShadow, - sampler1DArray, - sampler2DArray, - sampler1DArrayShadow, - sampler2DArrayShadow, - isampler1D, - isampler2D, - isampler3D, - isamplerCube, - isampler1DArray, - isampler2DArray, - usampler1D, - usampler2D, - usampler3D, - usamplerCube, -
Re: [Mesa-dev] [PATCH] glsl: Drop the round-trip through ast_type_specifier for many builtin types.
On 03/29/2012 02:59 PM, Matt Turner wrote: On Thu, Mar 29, 2012 at 5:37 PM, Eric Anholte...@anholt.net wrote: We have lexer recognition of a bunch of our types based on the handling. This code was mapping those recognized tokens to an enum and then to a string of their name. Just drop the enums and provide the string directly in the parser. --- src/glsl/ast.h | 66 + src/glsl/ast_to_hir.cpp |4 +- src/glsl/ast_type.cpp | 68 +- src/glsl/glsl_parser.yy | 106 +++ 4 files changed, 58 insertions(+), 186 deletions(-) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 1f78af8..e6707ac 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -418,72 +418,12 @@ public: }; -enum ast_types { - ast_void, - ast_float, - ast_int, - ast_uint, - ast_bool, - ast_vec2, - ast_vec3, - ast_vec4, - ast_bvec2, - ast_bvec3, - ast_bvec4, - ast_ivec2, - ast_ivec3, - ast_ivec4, - ast_uvec2, - ast_uvec3, - ast_uvec4, - ast_mat2, - ast_mat2x3, - ast_mat2x4, - ast_mat3x2, - ast_mat3, - ast_mat3x4, - ast_mat4x2, - ast_mat4x3, - ast_mat4, - ast_sampler1d, - ast_sampler2d, - ast_sampler2drect, - ast_sampler3d, - ast_samplercube, - ast_samplerexternaloes, - ast_sampler1dshadow, - ast_sampler2dshadow, - ast_sampler2drectshadow, - ast_samplercubeshadow, - ast_sampler1darray, - ast_sampler2darray, - ast_sampler1darrayshadow, - ast_sampler2darrayshadow, - ast_isampler1d, - ast_isampler2d, - ast_isampler3d, - ast_isamplercube, - ast_isampler1darray, - ast_isampler2darray, - ast_usampler1d, - ast_usampler2d, - ast_usampler3d, - ast_usamplercube, - ast_usampler1darray, - ast_usampler2darray, - - ast_struct, - ast_type_name -}; - class ast_type_specifier : public ast_node { public: - ast_type_specifier(int specifier); - /** Construct a type specifier from a type name */ ast_type_specifier(const char *name) - : type_specifier(ast_type_name), type_name(name), structure(NULL), + : type_name(name), structure(NULL), is_array(false), array_size(NULL), precision(ast_precision_none), is_precision_statement(false) { @@ -492,7 +432,7 @@ public: /** Construct a type specifier from a structure definition */ ast_type_specifier(ast_struct_specifier *s) - : type_specifier(ast_struct), type_name(s-name), structure(s), + : type_name(s-name), structure(s), is_array(false), array_size(NULL), precision(ast_precision_none), is_precision_statement(false) { @@ -507,8 +447,6 @@ public: ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *); - enum ast_types type_specifier; - const char *type_name; ast_struct_specifier *structure; diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index ff56e33..dd02301 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -3904,8 +3904,8 @@ ast_type_specifier::hir(exec_list *instructions, arrays); return NULL; } - if (this-type_specifier != ast_float - this-type_specifier != ast_int) { + if (strcmp(this-type_name, float) != 0 + strcmp(this-type_name, int) != 0) { _mesa_glsl_error(loc, state, default precision statements apply only to types float and int); diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 79c43ee..6c44f8c 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -29,7 +29,7 @@ extern C { void ast_type_specifier::print(void) const { - if (type_specifier == ast_struct) { + if (structure) { structure-print(); } else { printf(%s , type_name); @@ -46,72 +46,6 @@ ast_type_specifier::print(void) const } } -ast_type_specifier::ast_type_specifier(int specifier) - : type_specifier(ast_types(specifier)), type_name(NULL), structure(NULL), - is_array(false), array_size(NULL), precision(ast_precision_none), - is_precision_statement(false) -{ - static const char *const names[] = { - void, - float, - int, - uint, - bool, - vec2, - vec3, - vec4, - bvec2, - bvec3, - bvec4, - ivec2, - ivec3, - ivec4, - uvec2, - uvec3, - uvec4, - mat2, - mat2x3, - mat2x4, - mat3x2, - mat3, - mat3x4, - mat4x2, - mat4x3, - mat4, - sampler1D, - sampler2D, - sampler2DRect, - sampler3D, - samplerCube, - samplerExternalOES, - sampler1DShadow, - sampler2DShadow, - sampler2DRectShadow, - samplerCubeShadow, - sampler1DArray, - sampler2DArray, - sampler1DArrayShadow, - sampler2DArrayShadow, - isampler1D, - isampler2D, - isampler3D, - isamplerCube, - isampler1DArray, -
Re: [Mesa-dev] [PATCH] glsl: Drop the round-trip through ast_type_specifier for many builtin types.
On 03/29/2012 02:37 PM, Eric Anholt wrote: We have lexer recognition of a bunch of our types based on the handling. This code was mapping those recognized tokens to an enum and then to a string of their name. Just drop the enums and provide the string directly in the parser. I like this. Assuming it passes a full piglit run, Reviewed-by: Ian Romanick ian.d.roman...@intel.com --- src/glsl/ast.h | 66 + src/glsl/ast_to_hir.cpp |4 +- src/glsl/ast_type.cpp | 68 +- src/glsl/glsl_parser.yy | 106 +++ 4 files changed, 58 insertions(+), 186 deletions(-) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 1f78af8..e6707ac 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -418,72 +418,12 @@ public: }; -enum ast_types { - ast_void, - ast_float, - ast_int, - ast_uint, - ast_bool, - ast_vec2, - ast_vec3, - ast_vec4, - ast_bvec2, - ast_bvec3, - ast_bvec4, - ast_ivec2, - ast_ivec3, - ast_ivec4, - ast_uvec2, - ast_uvec3, - ast_uvec4, - ast_mat2, - ast_mat2x3, - ast_mat2x4, - ast_mat3x2, - ast_mat3, - ast_mat3x4, - ast_mat4x2, - ast_mat4x3, - ast_mat4, - ast_sampler1d, - ast_sampler2d, - ast_sampler2drect, - ast_sampler3d, - ast_samplercube, - ast_samplerexternaloes, - ast_sampler1dshadow, - ast_sampler2dshadow, - ast_sampler2drectshadow, - ast_samplercubeshadow, - ast_sampler1darray, - ast_sampler2darray, - ast_sampler1darrayshadow, - ast_sampler2darrayshadow, - ast_isampler1d, - ast_isampler2d, - ast_isampler3d, - ast_isamplercube, - ast_isampler1darray, - ast_isampler2darray, - ast_usampler1d, - ast_usampler2d, - ast_usampler3d, - ast_usamplercube, - ast_usampler1darray, - ast_usampler2darray, - - ast_struct, - ast_type_name -}; - class ast_type_specifier : public ast_node { public: - ast_type_specifier(int specifier); - /** Construct a type specifier from a type name */ ast_type_specifier(const char *name) - : type_specifier(ast_type_name), type_name(name), structure(NULL), + : type_name(name), structure(NULL), is_array(false), array_size(NULL), precision(ast_precision_none), is_precision_statement(false) { @@ -492,7 +432,7 @@ public: /** Construct a type specifier from a structure definition */ ast_type_specifier(ast_struct_specifier *s) - : type_specifier(ast_struct), type_name(s-name), structure(s), + : type_name(s-name), structure(s), is_array(false), array_size(NULL), precision(ast_precision_none), is_precision_statement(false) { @@ -507,8 +447,6 @@ public: ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *); - enum ast_types type_specifier; - const char *type_name; ast_struct_specifier *structure; diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index ff56e33..dd02301 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -3904,8 +3904,8 @@ ast_type_specifier::hir(exec_list *instructions, arrays); return NULL; } - if (this-type_specifier != ast_float - this-type_specifier != ast_int) { + if (strcmp(this-type_name, float) != 0 + strcmp(this-type_name, int) != 0) { _mesa_glsl_error(loc, state, default precision statements apply only to types float and int); diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 79c43ee..6c44f8c 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -29,7 +29,7 @@ extern C { void ast_type_specifier::print(void) const { - if (type_specifier == ast_struct) { + if (structure) { structure-print(); } else { printf(%s , type_name); @@ -46,72 +46,6 @@ ast_type_specifier::print(void) const } } -ast_type_specifier::ast_type_specifier(int specifier) - : type_specifier(ast_types(specifier)), type_name(NULL), structure(NULL), - is_array(false), array_size(NULL), precision(ast_precision_none), - is_precision_statement(false) -{ - static const char *const names[] = { - void, - float, - int, - uint, - bool, - vec2, - vec3, - vec4, - bvec2, - bvec3, - bvec4, - ivec2, - ivec3, - ivec4, - uvec2, - uvec3, - uvec4, - mat2, - mat2x3, - mat2x4, - mat3x2, - mat3, - mat3x4, - mat4x2, - mat4x3, - mat4, - sampler1D, - sampler2D, - sampler2DRect, - sampler3D, - samplerCube, - samplerExternalOES, - sampler1DShadow, - sampler2DShadow, - sampler2DRectShadow, - samplerCubeShadow, - sampler1DArray, - sampler2DArray, - sampler1DArrayShadow, - sampler2DArrayShadow, - isampler1D, - isampler2D, -
Re: [Mesa-dev] [PATCH] glsl: Add support for parsing [iu]samplerBuffer types in GLSL 1.40.
On 03/29/2012 02:59 PM, Eric Anholt wrote: The samplerBuffer type will be undefined in !glsl 1.40, and the keyword is marked as reserved. The [iu]samplerBuffer types are not marked as reserved pre-1.40, so they don't have separate tokens and fall through to normal type handling. My recollection of GLSL namespace rules is failing. If these are only caught by the symbol table, will that allow things like int isamplerBufer; --- Good catch on my silly addition of tokens that never got lexed. But it turns out we didn't need to add those tokens, since [iu]samplerBuffer are defined types in the symbol table, and obviously we can find existing types during parsing. src/glsl/glsl_parser.yy |1 + src/glsl/glsl_types.cpp | 5 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 5ce69b6..dc1ef98 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -1405,6 +1405,7 @@ basic_type_specifier_nonarray: | SAMPLER2DARRAY{ $$ = (char *)sampler2DArray; } | SAMPLER1DARRAYSHADOW { $$ = (char *)sampler1DArrayShadow; } | SAMPLER2DARRAYSHADOW { $$ = (char *)sampler2DArrayShadow; } + | SAMPLERBUFFER { $$ = (char *)samplerBuffer; } | ISAMPLER1D{ $$ = (char *)isampler1D; } | ISAMPLER2D{ $$ = (char *)isampler2D; } | ISAMPLER3D{ $$ = (char *)isampler3D; } diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 069ebd1..8a34b8e 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -146,7 +146,6 @@ glsl_type::sampler_index() const case GLSL_SAMPLER_DIM_RECT: return TEXTURE_RECT_INDEX; case GLSL_SAMPLER_DIM_BUF: - assert(!FINISHME: Implement ARB_texture_buffer_object); return TEXTURE_BUFFER_INDEX; case GLSL_SAMPLER_DIM_EXTERNAL: return TEXTURE_EXTERNAL_INDEX; @@ -213,6 +212,10 @@ glsl_type::generate_140_types(glsl_symbol_table *symtab) add_types_to_symbol_table(symtab, builtin_140_types, Elements(builtin_140_types), false); + + add_types_to_symbol_table(symtab, builtin_EXT_texture_buffer_object_types, +Elements(builtin_EXT_texture_buffer_object_types), +false); } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] TBOs: Mesa and i965 sampling support.
On 03/28/2012 10:58 AM, Eric Anholt wrote: This gets the texture buffer object support to the point of running and passing the piglit core tests other than deprecated formats on i965. Patch 2 is the glapi regen (I want the time back I've lost to regen failure this week). Patch 13 we may want to extend to gen6 before landing. Patch 14 I'm not sure if we want to land at all -- it gets the deprecated formats almost working, but we may want to just not do TBOs pre-3.1, and drop all that ugly code. TBOs (and UBOs) have a bit of fail in their specification. The each require either GLSL 1.40 (by virtue of being in OpenGL 3.1) or GL_EXT_gpu_shader4. I think we decided to not bother with GLSL 1.40 pre-3.1. I'm not super excited about GL_EXT_gpu_shader4. Do we know of any applications that use that EXT and don't use either GLSL 1.30 or GLSL 1.40? If we're not going to expose any version (or extension) of GLSL that adds the required support on pre-3.1, I don't see any reason to support the deprecated formats. I haven't actually turned on the extension, pending resolution on patch 14. So far I'm testing with GL 3.1 override, GLSL 1.40 override, and +GL_ARB_tbo extension override. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4] i915: set SPRITE_POINT_ENABLE bit correctly
When SPRITE_POINT_ENABLE bit is set, the texture coord would be replaced, and this is only needed when we called something like glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE). And more, we currently handle varying inputs as texture coord, we would be careful when setting this bit and set it just when needed, or you will find the value of varying input is not right and changed. Thus we do set SPRITE_POINT_ENABLE bit only when all enabled tex coord units need do CoordReplace. Or fallback is needed to make sure the rendering is right. With handling the bit setup at i915_update_sprite_point_enable(), we don't need the relative code at i915Enable then. This patch would _really_ fix the webglc point-size.html test case and of course, not regress piglit point-sprite and glean-pointSprite testcase. NOTE: This is a candidate for stable release branches. v2: fallback just when all enabled tex coord units need do CoordReplace (Eric) v3: move the sprite point validate code at I915InvalidateState (Eric) v4: sprite point enable bit update based on _NEW_PROGRAM, too add relative _NEW-state comments to show what state is being used(Eric) Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com --- src/mesa/drivers/dri/i915/i915_context.c |2 + src/mesa/drivers/dri/i915/i915_context.h |2 + src/mesa/drivers/dri/i915/i915_state.c | 55 +++-- src/mesa/drivers/dri/i915/intel_tris.c |1 + 4 files changed, 48 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 36563ef..dc32292 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -76,6 +76,8 @@ i915InvalidateState(struct gl_context * ctx, GLuint new_state) i915_update_provoking_vertex(ctx); if (new_state (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS)) i915_update_program(ctx); + if (new_state (_NEW_PROGRAM | _NEW_POINT)) + i915_update_sprite_point_enable(ctx); } diff --git a/src/mesa/drivers/dri/i915/i915_context.h b/src/mesa/drivers/dri/i915/i915_context.h index 8167137..7037465 100644 --- a/src/mesa/drivers/dri/i915/i915_context.h +++ b/src/mesa/drivers/dri/i915/i915_context.h @@ -40,6 +40,7 @@ #define I915_FALLBACK_POINT_SMOOTH 0x8 #define I915_FALLBACK_POINT_SPRITE_COORD_ORIGIN 0x10 #define I915_FALLBACK_DRAW_OFFSET 0x20 +#define I915_FALLBACK_COORD_REPLACE 0x40 #define I915_UPLOAD_CTX 0x1 #define I915_UPLOAD_BUFFERS 0x2 @@ -338,6 +339,7 @@ extern void i915InitStateFunctions(struct dd_function_table *functions); extern void i915InitState(struct i915_context *i915); extern void i915_update_stencil(struct gl_context * ctx); extern void i915_update_provoking_vertex(struct gl_context *ctx); +extern void i915_update_sprite_point_enable(struct gl_context *ctx); /*== diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 756001f..94c7327 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -652,6 +652,48 @@ i915PointParameterfv(struct gl_context * ctx, GLenum pname, const GLfloat *param } } +void +i915_update_sprite_point_enable(struct gl_context *ctx) +{ + struct intel_context *intel = intel_context(ctx); + /* _NEW_PROGRAM */ + struct i915_fragment_program *p = + (struct i915_fragment_program *) ctx-FragmentProgram._Current; + const GLbitfield64 inputsRead = p-FragProg.Base.InputsRead; + struct i915_context *i915 = i915_context(ctx); + GLuint s4 = i915-state.Ctx[I915_CTXREG_LIS4] ~S4_VFMT_MASK; + int i; + GLuint coord_replace_bits = 0x0; + GLuint tex_coord_unit_bits = 0x0; + + for (i = 0; i ctx-Const.MaxTextureCoordUnits; i++) { + /* _NEW_POINT */ + if (ctx-Point.CoordReplace[i] ctx-Point.PointSprite) + coord_replace_bits |= (1 i); + if (inputsRead FRAG_BIT_TEX(i)) + tex_coord_unit_bits |= (1 i); + } + + /* +* Here we can't enable the SPRITE_POINT_ENABLE bit when the mis-match +* of tex_coord_unit_bits and coord_replace_bits, or this will make all +* the other non-point-sprite coords(like varying inputs, as we now use +* tex coord to implement varying inputs) be replaced to value (0, 0)-(1, 1). +* +* Thus, do fallback when needed. +*/ + FALLBACK(intel, I915_FALLBACK_COORD_REPLACE, +coord_replace_bits coord_replace_bits != tex_coord_unit_bits); + + s4 = ~S4_SPRITE_POINT_ENABLE; + s4 |= (coord_replace_bits coord_replace_bits == tex_coord_unit_bits) ? + S4_SPRITE_POINT_ENABLE : 0; + if (s4 != i915-state.Ctx[I915_CTXREG_LIS4]) { + i915-state.Ctx[I915_CTXREG_LIS4] = s4; + I915_STATECHANGE(i915, I915_UPLOAD_CTX); + } +} + /*
[Mesa-dev] Threading issues with LLVM pipeline
Hi, last time I was wondering about thread safety in Mesa 8.0 build with llvm=no - this configuration seems to be working with the lock patch. Now I am testing 8.0 branch with LLVM 3.0 (with scons script fix a1482b21cb438c271cf20e7d52cb9e4e0537344c - stop me if it is not supposed to work) I have very simple GL code: HGLRC glContext = wglCreateContext(hDC); wglMakeCurrent(hDC, glContext); glViewport(0, 0, 1024, 600); void *buffer = malloc(1024*600*3); for (int i=0; i 100; i++) { glClearColor(0.0, 0.0, 1.0, 0); glClear(GL_COLOR_BUFFER_BIT); glReadPixels(0, 0, 1024, 600, GL_RGB, GL_UNSIGNED_BYTE, buffer); SwapBuffers(hDC); Sleep(20); } free (buffer); which I run in 2 or more threads. The first problem occurs during wglMakeCurrent: thread 1: opengl32.dll!pipe_semaphore_wait(pipe_semaphore * sema) Line 432 + 0x17 bytes opengl32.dll!lp_rast_finish(lp_rasterizer * rast) Line 782 + 0x16 bytes opengl32.dll!lp_setup_rasterize_scene(lp_setup_context * setup) Line 160 + 0xc bytes opengl32.dll!set_scene_state(lp_setup_context * setup, setup_state new_state, const char * reason) Line 313 + 0x9 bytes opengl32.dll!lp_setup_flush(lp_setup_context * setup, pipe_fence_handle * * fence, const char * reason) Line 342 + 0xf bytes opengl32.dll!llvmpipe_flush(pipe_context * pipe, pipe_fence_handle * * fence, const char * reason) Line 55 + 0x17 bytes opengl32.dll!llvmpipe_finish(pipe_context * pipe, const char * reason) Line 89 + 0x11 bytes opengl32.dll!llvmpipe_flush_resource(pipe_context * pipe, pipe_resource * resource, unsigned int level, int layer, unsigned char read_only, unsigned char cpu_access, unsigned char do_not_block, const char * reason) Line 128 + 0xd bytes opengl32.dll!llvmpipe_get_transfer(pipe_context * pipe, pipe_resource * resource, unsigned int level, unsigned int usage, const pipe_box * box) Line 607 + 0x41 bytes opengl32.dll!pipe_get_transfer(pipe_context * context, pipe_resource * resource, unsigned int level, unsigned int layer, pipe_transfer_usage usage, unsigned int x, unsigned int y, unsigned int w, unsigned int h) Line 393 + 0x1f bytes opengl32.dll!st_MapRenderbuffer(gl_context * ctx, gl_renderbuffer * rb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int mode, unsigned char * * mapOut, int * rowStrideOut) Line 683 + 0x38 bytes opengl32.dll!slow_read_rgba_pixels(gl_context * ctx, int x, int y, int width, int height, unsigned int format, unsigned int type, void * pixels, const gl_pixelstore_attrib * packing, unsigned int transferOps) Line 274 + 0x2d bytes opengl32.dll!read_rgba_pixels(gl_context * ctx, int x, int y, int width, int height, unsigned int format, unsigned int type, void * pixels, const gl_pixelstore_attrib * packing) Line 338 + 0x2d bytes opengl32.dll!_mesa_readpixels(gl_context * ctx, int x, int y, int width, int height, unsigned int format, unsigned int type, const gl_pixelstore_attrib * packing, void * pixels) Line 586 + 0x29 bytes opengl32.dll!st_readpixels(gl_context * ctx, int x, int y, int width, int height, unsigned int format, unsigned int type, const gl_pixelstore_attrib * pack, void * dest) Line 54 + 0x29 bytes opengl32.dll!_mesa_ReadnPixelsARB(int x, int y, int width, int height, unsigned int format, unsigned int type, int bufSize, void * pixels) Line 831 + 0x35 bytes opengl32.dll!_mesa_ReadPixels(int x, int y, int width, int height, unsigned int format, unsigned int type, void * pixels) Line 839 opengl32.dll!glReadPixels(int x, int y, int width, int height, unsigned int format, unsigned int type, void * pixels) Line 1618 multithreads.exe!display_gl_window(int id) Line 103 + 0x24 bytes multithreads.exe!thread_1_main(void * lpParameter) Line 126 + 0x9 bytes thread 2: opengl32.dll!_debug_assert_fail(const char * expr, const char * file, unsigned int line, const char * function) Line 278 opengl32.dll!begin_binning(lp_setup_context * setup) Line 180 + 0x24 bytes opengl32.dll!execute_clears(lp_setup_context * setup) Line 262 + 0x9 bytes opengl32.dll!set_scene_state(lp_setup_context * setup, setup_state new_state, const char * reason) Line 310 + 0x9 bytes opengl32.dll!lp_setup_flush(lp_setup_context * setup, pipe_fence_handle * * fence, const char * reason) Line 342 + 0xf bytes opengl32.dll!llvmpipe_flush(pipe_context * pipe, pipe_fence_handle * * fence, const char * reason) Line 55 + 0x17 bytes opengl32.dll!do_flush(pipe_context * pipe, pipe_fence_handle * * fence) Line 141 + 0x12 bytes opengl32.dll!st_flush(st_context * st, pipe_fence_handle * * fence) Line 92 + 0x19 bytes opengl32.dll!st_context_flush(st_context_iface * stctxi, unsigned int flags, pipe_fence_handle * * fence) Line 462 + 0xd bytes opengl32.dll!stw_make_current(HDC__ * hdc, unsigned long dhglrc) Line 327 + 0x14 bytes opengl32.dll!DrvSetContext(HDC__ * hdc, unsigned long dhglrc, void (_GLCLTPROCTABLE *)* pfnSetProcTable) Line 768 + 0xd bytes opengl32.dll!wglMakeCurrent(HDC__ * hdc, HGLRC__ * hglrc) Line 88 + 0xf
Re: [Mesa-dev] [PATCH] glsl: Drop the round-trip through ast_type_specifier for many builtin types.
On 03/29/2012 02:37 PM, Eric Anholt wrote: We have lexer recognition of a bunch of our types based on the handling. This code was mapping those recognized tokens to an enum and then to a string of their name. Just drop the enums and provide the string directly in the parser. --- src/glsl/ast.h | 66 + src/glsl/ast_to_hir.cpp |4 +- src/glsl/ast_type.cpp | 68 +- src/glsl/glsl_parser.yy | 106 +++ 4 files changed, 58 insertions(+), 186 deletions(-) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 1f78af8..e6707ac 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -418,72 +418,12 @@ public: }; -enum ast_types { - ast_void, - ast_float, - ast_int, - ast_uint, - ast_bool, - ast_vec2, - ast_vec3, - ast_vec4, - ast_bvec2, - ast_bvec3, - ast_bvec4, - ast_ivec2, - ast_ivec3, - ast_ivec4, - ast_uvec2, - ast_uvec3, - ast_uvec4, - ast_mat2, - ast_mat2x3, - ast_mat2x4, - ast_mat3x2, - ast_mat3, - ast_mat3x4, - ast_mat4x2, - ast_mat4x3, - ast_mat4, - ast_sampler1d, - ast_sampler2d, - ast_sampler2drect, - ast_sampler3d, - ast_samplercube, - ast_samplerexternaloes, - ast_sampler1dshadow, - ast_sampler2dshadow, - ast_sampler2drectshadow, - ast_samplercubeshadow, - ast_sampler1darray, - ast_sampler2darray, - ast_sampler1darrayshadow, - ast_sampler2darrayshadow, - ast_isampler1d, - ast_isampler2d, - ast_isampler3d, - ast_isamplercube, - ast_isampler1darray, - ast_isampler2darray, - ast_usampler1d, - ast_usampler2d, - ast_usampler3d, - ast_usamplercube, - ast_usampler1darray, - ast_usampler2darray, - - ast_struct, - ast_type_name -}; - class ast_type_specifier : public ast_node { public: - ast_type_specifier(int specifier); - /** Construct a type specifier from a type name */ ast_type_specifier(const char *name) - : type_specifier(ast_type_name), type_name(name), structure(NULL), + : type_name(name), structure(NULL), is_array(false), array_size(NULL), precision(ast_precision_none), is_precision_statement(false) { @@ -492,7 +432,7 @@ public: /** Construct a type specifier from a structure definition */ ast_type_specifier(ast_struct_specifier *s) - : type_specifier(ast_struct), type_name(s-name), structure(s), + : type_name(s-name), structure(s), is_array(false), array_size(NULL), precision(ast_precision_none), is_precision_statement(false) { @@ -507,8 +447,6 @@ public: ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *); - enum ast_types type_specifier; - const char *type_name; ast_struct_specifier *structure; diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index ff56e33..dd02301 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -3904,8 +3904,8 @@ ast_type_specifier::hir(exec_list *instructions, arrays); return NULL; } - if (this-type_specifier != ast_float - this-type_specifier != ast_int) { + if (strcmp(this-type_name, float) != 0 + strcmp(this-type_name, int) != 0) { _mesa_glsl_error(loc, state, default precision statements apply only to types float and int); diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 79c43ee..6c44f8c 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -29,7 +29,7 @@ extern C { void ast_type_specifier::print(void) const { - if (type_specifier == ast_struct) { + if (structure) { structure-print(); } else { printf(%s , type_name); @@ -46,72 +46,6 @@ ast_type_specifier::print(void) const } } -ast_type_specifier::ast_type_specifier(int specifier) - : type_specifier(ast_types(specifier)), type_name(NULL), structure(NULL), - is_array(false), array_size(NULL), precision(ast_precision_none), - is_precision_statement(false) -{ - static const char *const names[] = { - void, - float, - int, - uint, - bool, - vec2, - vec3, - vec4, - bvec2, - bvec3, - bvec4, - ivec2, - ivec3, - ivec4, - uvec2, - uvec3, - uvec4, - mat2, - mat2x3, - mat2x4, - mat3x2, - mat3, - mat3x4, - mat4x2, - mat4x3, - mat4, - sampler1D, - sampler2D, - sampler2DRect, - sampler3D, - samplerCube, - samplerExternalOES, - sampler1DShadow, - sampler2DShadow, - sampler2DRectShadow, - samplerCubeShadow, - sampler1DArray, - sampler2DArray, - sampler1DArrayShadow, - sampler2DArrayShadow, - isampler1D, - isampler2D, - isampler3D, - isamplerCube, - isampler1DArray, - isampler2DArray, - usampler1D, -