[Mesa-dev] [Bug 47967] gallium driver svga doesn't compile with LIBDRM_LIBS=-L/usr/lib/x86_64-linux-gnu/
https://bugs.freedesktop.org/show_bug.cgi?id=47967 Michel Dänzer mic...@daenzer.net changed: What|Removed |Added Status|NEW |RESOLVED Resolution||NOTABUG --- Comment #2 from Michel Dänzer mic...@daenzer.net 2012-03-28 00:10:53 PDT --- As the name implies, LIBDRM_LIBS should contain any flags necessary for linking libdrm. According to the output of grep LIBDRM_LIBS * in my Mesa tree, you need to add at least -ldrm to it. -- 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 Christian König deathsim...@vodafone.de changed: What|Removed |Added Status|NEW |ASSIGNED CC||deathsim...@vodafone.de --- Comment #2 from Christian König deathsim...@vodafone.de 2012-03-28 02:39:45 PDT --- Going to dig into it, but I don't have much experience with the install targets also so that could take a while. -- 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 Tue, Mar 27, 2012 at 11:34:40PM -0400, Matt Turner wrote: On Tue, Mar 27, 2012 at 10:24 PM, tstel...@gmail.com wrote: 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. Is this only useful for 2.9, and not 3.x? It works with all versions. I tested with 2.9, 3.0 and 3.1-svn. I just added the comment about 2.9, because it's the current stable version provided by my distro of choice (gentoo). -Tom ___ 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 #3 from Fabio Pedretti fabio@libero.it 2012-03-28 07:18:50 PDT --- This is still reproducible also with the custom patches disabled: https://launchpadlibrarian.net/98554602/buildlog_ubuntu-precise-i386.mesa_8.1~git1203271746.7f6af4~gd~p_FAILEDTOBUILD.txt.gz Note: python2 ../../../../../src/mapi/mapi/mapi_abi.py --mode lib --printer shared-glapi ../../../../../src/mapi/glapi/gen/gl_and_es_API.xml glapi_mapi_tmp.h then: ../../../../../src/mapi/mapi/mapi_tmp.h:48:25: fatal error: shared-glapi/glapi_mapi_tmp.h: No such file or directory Maybe glapi_mapi_tmp.h is put in a wrong directory? -- 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] gallivm: Fix method overriding in raw_debug_ostream.
Looks good to me. Thanks. Jose - Original Message - Use matching type qualifers to avoid method hiding. Signed-off-by: Vinson Lee v...@freedesktop.org --- src/gallium/auxiliary/gallivm/lp_bld_debug.cpp |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index 903c878..c5afff0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -83,12 +83,12 @@ class raw_debug_ostream : uint64_t pos; void write_impl(const char *Ptr, size_t Size); - uint64_t current_pos() { return pos; } - uint64_t current_pos() const { return pos; } #if HAVE_LLVM = 0x207 - uint64_t preferred_buffer_size() { return 512; } + uint64_t current_pos() const { return pos; } + size_t preferred_buffer_size() const { return 512; } #else + uint64_t current_pos() { return pos; } size_t preferred_buffer_size() { return 512; } #endif }; -- 1.7.9.1 ___ 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 47878] libXvMC* are not being installed where they should
https://bugs.freedesktop.org/show_bug.cgi?id=47878 --- Comment #3 from Christian König deathsim...@vodafone.de 2012-03-28 07:41:09 PDT --- Created attachment 59161 -- https://bugs.freedesktop.org/attachment.cgi?id=59161 Possible fix. Fixing the bug in the short hand is actually pretty easy, just replace the obvious incorrect combination of $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) with $(DESTDIR)$(INSTALL_LIB_DIR). As an alternative you could also add an --with-xvmc-libdir= option, which then results in setting the XVMC_INSTALL_DIR variable. For an good example how to do this take a look at the --with-vdpau-libdir= option and the resulting VDPAU_LIB_INSTALL_DIR variable in configure.ac. Hope that helps, Christian. -- 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 #4 from Kristian Høgsberg k...@bitplanet.net 2012-03-28 07:50:32 PDT --- (In reply to comment #3) This is still reproducible also with the custom patches disabled: https://launchpadlibrarian.net/98554602/buildlog_ubuntu-precise-i386.mesa_8.1~git1203271746.7f6af4~gd~p_FAILEDTOBUILD.txt.gz Ok, patches or not, there's still some exotic building going on here: mkdir -p /build/buildd/mesa-8.1~git1203271746.7f6af4~gd~p/build/dri find /build/buildd/mesa-8.1~git1203271746.7f6af4~gd~p/* -maxdepth 0 -not -path '/build/buildd/mesa-8.1~git1203271746.7f6af4~gd~p/build*' | \ xargs cp -rlf -t /build/buildd/mesa-8.1~git1203271746.7f6af4~gd~p/build/dri ... cd /build/buildd/mesa-8.1~git1203271746.7f6af4~gd~p/build/dri \ ../../configure --prefix=/usr --mandir=\${prefix}/share/man \ --infodir=\${prefix}/share/info --sysconfdir=/etc \ --libdir=\${prefix}/lib/i386-linux-gnu \ --localstatedir=/var --build=i686-linux-gnu --with-driver=dri --with-dri-drivers= r200 radeon nouveau swrast i915 i965 --with-dri-driverdir=/usr/lib/i386-linux-gnu/dri --enable-glx-tls --enable-shared-dricore --enable-shared-glapi --enable-texture-float --enable-xa --enable-debug --enable-gallium-g3dvl --enable-driglx-direct --with-egl-platforms=x11 drm --enable-gallium-llvm --with-gallium-drivers= nouveau r600 r300 svga i915 swrast --enable-gles1 --enable-gles2 --enable-openvg --enable-gallium-egl --disable-glu CFLAGS=-Wall -g -O2 CXXFLAGS=-Wall -g -O2 which look like a custom out-of-tree build, which we don't really support. But maybe give this patch a try: diff --git a/src/mapi/shared-glapi/Makefile.am b/src/mapi/shared-glapi/Makefile. index 8988d28..25370ad 100644 --- a/src/mapi/shared-glapi/Makefile.am +++ b/src/mapi/shared-glapi/Makefile.am @@ -18,6 +18,7 @@ AM_CPPFLAGS = $(DEFINES) \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/mapi\ + -I$(top_builddir)/src/mapi \ -DMAPI_MODE_GLAPI \ -DMAPI_ABI_HEADER=\shared-glapi/glapi_mapi_tmp.h\ -- 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 1/2] gallium: make get_query_result return union* and not void*
On 03/27/2012 02:51 PM, Marek Olšák wrote: This replaces the cryptic void* parameter with a union. (based on union r600_query_result) Users of this can still pass uint64* in it, but that cannot work for every query type, obviously. Most importantly, the code now documents what should be expected from get_query_result. This also adds pipe_query_data_pipeline_statistics as per the D3D11 docs. In the future, an addition like that should probably go into a separate commit. But it's OK here. --- src/gallium/include/pipe/p_context.h |3 +- src/gallium/include/pipe/p_defines.h | 41 ++ 2 files changed, 43 insertions(+), 1 deletions(-) diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index aaeeb81..8b4a158 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -64,6 +64,7 @@ struct pipe_video_buffer; struct pipe_video_decoder; struct pipe_viewport_state; union pipe_color_union; +union pipe_query_result; /** * Gallium rendering context. Basically: @@ -117,7 +118,7 @@ struct pipe_context { boolean (*get_query_result)(struct pipe_context *pipe, struct pipe_query *q, boolean wait, - void *result); + union pipe_query_result *result); /*@}*/ /** diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 889fc99..a0a0c53 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -528,12 +528,53 @@ struct pipe_query_data_so_statistics uint64_t num_primitives_written; uint64_t primitives_storage_needed; }; + struct pipe_query_data_timestamp_disjoint The existing query-related struct should probably have comments indicating which PIPE_QUERY_x they correspond to. { uint64_t frequency; boolean disjoint; }; +struct pipe_query_data_pipeline_statistics { To be consistent with other structs, the opening brace should be on a new line. + uint64_t ia_vertices;/* Num vertices read by the vertex fetcher. */ + uint64_t ia_primitives; /* Num primitives read by the vertex fetcher. */ + uint64_t vs_invocations; /* Num vertex shader invocations. */ + uint64_t gs_invocations; /* Num geometry shader invocations. */ + uint64_t gs_primitives; /* Num primitives output by a geometry shader. */ + uint64_t c_invocations; /* Num primitives sent to the rasterizer. */ + uint64_t c_primitives; /* Num primitives that were rendered. */ + uint64_t ps_invocations; /* Num pixel shader invocations. */ + uint64_t hs_invocations; /* Num hull shader invocations. */ + uint64_t ds_invocations; /* Num domain shader invocations. */ + uint64_t cs_invocations; /* Num compute shader invocations. */ Other field comments use the doxygen /** comment */ style. +}; + +/** + * Query result (returned by pipe_context::get_query_result). + */ +union pipe_query_result { Brace on next line for consistency. + /* PIPE_QUERY_OCCLUSION_PREDICATE */ + /* PIPE_QUERY_SO_OVERFLOW_PREDICATE */ + /* PIPE_QUERY_GPU_FINISHED */ + boolean b; + + /* PIPE_QUERY_OCCLUSION_COUNTER */ + /* PIPE_QUERY_TIMESTAMP */ + /* PIPE_QUERY_TIME_ELAPSED */ + /* PIPE_QUERY_PRIMITIVES_GENERATED */ + /* PIPE_QUERY_PRIMITIVES_EMITTED */ + uint64_t u64; + + /* PIPE_QUERY_SO_STATISTICS */ + struct pipe_query_data_so_statistics so_statistics; + + /* PIPE_QUERY_TIMESTAMP_DISJOINT */ + struct pipe_query_data_timestamp_disjoint timestamp_disjoint; + + /* PIPE_QUERY_PIPELINE_STATISTICS */ + struct pipe_query_data_pipeline_statistics pipeline_statistics; +}; + union pipe_color_union { float f[4]; For both, Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] mesa: Set the correct initial value of the texture buffer object format.
For both, Reviewed-by: Brian Paul bri...@vmware.com On Mon, Mar 26, 2012 at 1:57 PM, Eric Anholt e...@anholt.net wrote: Fixes piglit GL_ARB_texture_buffer_object/get --- src/mesa/main/texobj.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 97bef35..d7dee4f 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -153,6 +153,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj-Swizzle[3] = GL_ALPHA; obj-_Swizzle = SWIZZLE_NOOP; obj-Sampler.sRGBDecode = GL_DECODE_EXT; + obj-BufferObjectFormat = GL_LUMINANCE8; } -- 1.7.9.1 ___ 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 1/7] ff_fragment_shader: Remove some dead fields.
Reviewed-by: Brian Paul bri...@vmware.com On Mon, Mar 26, 2012 at 1:42 PM, Eric Anholt e...@anholt.net wrote: --- src/mesa/main/ff_fragment_shader.cpp | 11 --- 1 files changed, 0 insertions(+), 11 deletions(-) diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index afc17dc..7b83043 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -511,17 +511,11 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) struct texenv_fragment_program { struct gl_shader_program *shader_program; struct gl_shader *shader; - struct gl_fragment_program *program; exec_list *instructions; exec_list *top_instructions; void *mem_ctx; struct state_key *state; - GLbitfield alu_temps; /** Track texture indirections, see spec. */ - GLbitfield temps_output; /** Track texture indirections, see spec. */ - GLbitfield temp_in_use; /** Tracks temporary regs which are in use. */ - GLboolean error; - ir_variable *src_texture[MAX_TEXTURE_COORD_UNITS]; /* Reg containing each texture unit's sampled texture color, * else undef. @@ -537,8 +531,6 @@ struct texenv_fragment_program { ir_rvalue *src_previous; /** Reg containing color from previous * stage. May need to be decl'd. */ - - GLuint last_tex_stage; /** Number of last enabled texture unit */ }; static ir_rvalue * @@ -1359,7 +1351,6 @@ emit_instructions(struct texenv_fragment_program *p) for (unit = 0; unit key-nr_enabled_units; unit++) if (key-unit[unit].enabled) { load_texunit_sources(p, unit); - p-last_tex_stage = unit; } /* Second pass - emit combine instructions to build final color: @@ -1465,8 +1456,6 @@ create_new_program(struct gl_context *ctx, struct state_key *key) p.src_previous = NULL; - p.last_tex_stage = 0; - ir_function *main_f = new(p.mem_ctx) ir_function(main); p.instructions-push_tail(main_f); state-symbols-add_function(main_f); -- 1.7.9.1 ___ 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 2/7] glsl: Create an ir_builder helper for hand-generating IR.
On 03/26/2012 12:42 PM, Eric Anholt wrote: The C++ constructors with placement new, while functional, are extremely verbose, leading to generation of simple GLSL IR expressions like (a * b + c * d) expanding to many lines of code and using lots of temporary variables. By creating a new ir_builder.h that puts simple generators in our namespace and taking advantage of ralloc_parent(), we can generate much more compact code, at a minor runtime cost. --- src/glsl/Makefile.sources|1 + src/glsl/ir_builder.cpp | 69 ++ src/glsl/ir_builder.h| 36 ++ src/mesa/main/ff_fragment_shader.cpp | 128 -- 4 files changed, 152 insertions(+), 82 deletions(-) create mode 100644 src/glsl/ir_builder.cpp create mode 100644 src/glsl/ir_builder.h diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources index 06728da..4e3b074 100644 --- a/src/glsl/Makefile.sources +++ b/src/glsl/Makefile.sources @@ -26,6 +26,7 @@ LIBGLSL_CXX_FILES := \ glsl_symbol_table.cpp \ hir_field_selection.cpp \ ir_basic_block.cpp \ + ir_builder.cpp \ ir_clone.cpp \ ir_constant_expression.cpp \ ir.cpp \ diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp new file mode 100644 index 000..039ee1b --- /dev/null +++ b/src/glsl/ir_builder.cpp @@ -0,0 +1,69 @@ +/* + * Copyright © 2012 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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 ir_builder.h + +using namespace ir_builder; + +namespace ir_builder { + +ir_expression * +expr(ir_expression_operation op, + ir_instruction *a, ir_instruction *b) +{ + void *mem_ctx = ralloc_parent(a); + + return new(mem_ctx) ir_expression(op, a-as_rvalue(), b-as_rvalue()); +} x.X Please use ir_rvalue everywhere rather than ir_instruction. ir_rvalue is the base class for all expression trees/values, while ir_instruction is the base class for statements. This also would make passing a non-rvalue a compile time error (no matching signature) rather than a run-time crash. Otherwise, this patch looks pretty awesome. I am a fan. :) + +ir_expression *add(ir_instruction *a, ir_instruction *b) +{ + return expr(ir_binop_add, a, b); +} + +ir_expression *sub(ir_instruction *a, ir_instruction *b) +{ + return expr(ir_binop_sub, a, b); +} + +ir_expression *mul(ir_instruction *a, ir_instruction *b) +{ + return expr(ir_binop_mul, a, b); +} + +ir_expression *dot(ir_instruction *a, ir_instruction *b) +{ + return expr(ir_binop_dot, a, b); +} + +ir_expression * +saturate(ir_instruction *a) +{ + void *mem_ctx = ralloc_parent(a); + + return expr(ir_binop_max, + expr(ir_binop_min, a, new(mem_ctx) ir_constant(1.0f)), + new(mem_ctx) ir_constant(0.0f)); +} + +} /* namespace ir_builder */ diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h new file mode 100644 index 000..5a26bb6 --- /dev/null +++ b/src/glsl/ir_builder.h @@ -0,0 +1,36 @@ +/* + * Copyright © 2012 Intel Corporation + * + * 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, sublicense, + * 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
[Mesa-dev] [PATCH 01/14] glapi: Mark TexBuffer as an alias of TexBufferARB.
This is set correctly in gl.spec, but was missed in Mesa. As a result, only one of the two was hooked up in Mesa. --- src/mapi/glapi/gen/GL3x.xml |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mapi/glapi/gen/GL3x.xml b/src/mapi/glapi/gen/GL3x.xml index 86a9a2c..ab4900c 100644 --- a/src/mapi/glapi/gen/GL3x.xml +++ b/src/mapi/glapi/gen/GL3x.xml @@ -521,7 +521,7 @@ param name=primcount type=GLsizei/ /function - function name=TexBuffer offset=assign + function name=TexBuffer offset=assign alias=TexBufferARB param name=target type=GLenum/ param name=internalFormat type=GLenum/ param name=buffer type=GLuint/ -- 1.7.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/14] mesa: Set the correct initial value of the texture buffer object format.
Fixes piglit GL_ARB_texture_buffer_object/get --- src/mesa/main/texobj.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 97bef35..d7dee4f 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -153,6 +153,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj-Swizzle[3] = GL_ALPHA; obj-_Swizzle = SWIZZLE_NOOP; obj-Sampler.sRGBDecode = GL_DECODE_EXT; + obj-BufferObjectFormat = GL_LUMINANCE8; } -- 1.7.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] TBOs: Mesa and i965 sampling support.
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. 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 05/14] glsl: Add support for parsing [iu]samplerBuffer in GLSL 1.40.
The type will be undefined in !glsl 1.40, and the keyword is marked as reserved. --- src/glsl/ast.h |3 +++ src/glsl/ast_type.cpp |3 +++ src/glsl/glsl_parser.yy |6 +- src/glsl/glsl_types.cpp |5 - 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 1f78af8..ab4c210 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -459,18 +459,21 @@ enum ast_types { ast_sampler2darray, ast_sampler1darrayshadow, ast_sampler2darrayshadow, + ast_samplerbuffer, ast_isampler1d, ast_isampler2d, ast_isampler3d, ast_isamplercube, ast_isampler1darray, ast_isampler2darray, + ast_isamplerbuffer, ast_usampler1d, ast_usampler2d, ast_usampler3d, ast_usamplercube, ast_usampler1darray, ast_usampler2darray, + ast_usamplerbuffer, ast_struct, ast_type_name diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 79c43ee..f914f71 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -92,18 +92,21 @@ ast_type_specifier::ast_type_specifier(int specifier) sampler2DArray, sampler1DArrayShadow, sampler2DArrayShadow, + samplerBuffer, isampler1D, isampler2D, isampler3D, isamplerCube, isampler1DArray, isampler2DArray, + isamplerBuffer, usampler1D, usampler2D, usampler3D, usamplerCube, usampler1DArray, usampler2DArray, + usamplerBuffer, NULL, /* ast_struct */ NULL /* ast_type_name */ diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 64506b6..c6b6238 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -103,6 +103,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %token SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE %token ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D %token USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY +%token SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER %token SAMPLEREXTERNALOES %token STRUCT VOID_TOK WHILE %token identifier IDENTIFIER TYPE_IDENTIFIER NEW_IDENTIFIER @@ -135,7 +136,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %token ERROR_TOK -%token COMMON PARTITION ACTIVE SAMPLERBUFFER FILTER +%token COMMON PARTITION ACTIVE FILTER %token IMAGE1D IMAGE2D IMAGE3D IMAGECUBE IMAGE1DARRAY IMAGE2DARRAY %token IIMAGE1D IIMAGE2D IIMAGE3D IIMAGECUBE IIMAGE1DARRAY IIMAGE2DARRAY %token UIMAGE1D UIMAGE2D UIMAGE3D UIMAGECUBE UIMAGE1DARRAY UIMAGE2DARRAY @@ -1405,18 +1406,21 @@ basic_type_specifier_nonarray: | SAMPLER2DARRAY{ $$ = ast_sampler2darray; } | SAMPLER1DARRAYSHADOW { $$ = ast_sampler1darrayshadow; } | SAMPLER2DARRAYSHADOW { $$ = ast_sampler2darrayshadow; } + | SAMPLERBUFFER { $$ = ast_samplerbuffer; } | ISAMPLER1D{ $$ = ast_isampler1d; } | ISAMPLER2D{ $$ = ast_isampler2d; } | ISAMPLER3D{ $$ = ast_isampler3d; } | ISAMPLERCUBE { $$ = ast_isamplercube; } | ISAMPLER1DARRAY { $$ = ast_isampler1darray; } | ISAMPLER2DARRAY { $$ = ast_isampler2darray; } + | ISAMPLERBUFFER{ $$ = ast_isamplerbuffer; } | USAMPLER1D{ $$ = ast_usampler1d; } | USAMPLER2D{ $$ = ast_usampler2d; } | USAMPLER3D{ $$ = ast_usampler3d; } | USAMPLERCUBE { $$ = ast_usamplercube; } | USAMPLER1DARRAY { $$ = ast_usampler1darray; } | USAMPLER2DARRAY { $$ = ast_usampler2darray; } + | USAMPLERBUFFER{ $$ = ast_usamplerbuffer; } ; precision_qualifier: 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); } -- 1.7.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/14] mesa: Set up glTexBuffer{, ARB} for display list compile.
We're supposed to just immediately call it. Fixes piglit GL_ARB_texture_buffer_object/dlist --- src/mesa/main/dlist.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index f113573..8cfb97c 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -10319,6 +10319,9 @@ _mesa_create_save_table(void) SET_FlushMappedBufferRange(table, _mesa_FlushMappedBufferRange); /* no dl */ #endif + /* ARB 51. GL_ARB_texture_buffer_object */ + SET_TexBufferARB(table, _mesa_TexBuffer); /* no dlist save */ + /* ARB 59. GL_ARB_copy_buffer */ SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */ -- 1.7.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/14] mesa: Create the default (name==0) buffer texture.
All that should be needed is that it exists. Fixes segfaults on first _mesa_update_context() with a samplerBuffer-using shader active but without a particular buffer texture enabled. --- src/glsl/builtins/tools/texture_builtins.py |4 +--- src/mesa/main/texobj.c |5 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py index 3a4943a..d0b 100755 --- a/src/glsl/builtins/tools/texture_builtins.py +++ b/src/glsl/builtins/tools/texture_builtins.py @@ -73,9 +73,7 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0): print \n (declare (in) + vec_type(i if tex_inst == txf else , coord_dim + extra_dim) + P), if tex_inst == txl: print \n (declare (in) float lod), -elif (tex_inst == txf and Buffer not in sampler_type): -print \n (declare (in) int lod), -elif (tex_inst == txs and Rect not in sampler_type): +elif ((tex_inst == txf or tex_inst == txs) and Buffer not in sampler_type and Rect not in sampler_type): print \n (declare (in) int lod), elif tex_inst == txd: grad_type = vec_type(, coord_dim) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d7dee4f..88dc3b1 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -756,6 +756,9 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) target = GL_TEXTURE_1D; break; case TEXTURE_BUFFER_INDEX: + dims = 0; + target = GL_TEXTURE_BUFFER; + break; case TEXTURE_EXTERNAL_INDEX: default: /* no-op */ @@ -794,6 +797,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) GL_RGBA, texFormat); switch (dims) { +case 0: + break; case 1: ctx-Driver.TexImage1D(ctx, texImage, GL_RGBA, width, 0, -- 1.7.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/14] glsl: Add texelFetch(*samplerBuffer) entrypoints to GLSL 1.40.
Fix texelFetch(sampler2DRect) and textureSize(samplerBuffer) generation to not reference a LOD at the same time because it's easier than not fixing it. --- src/glsl/builtins/profiles/140.frag |4 src/glsl/builtins/profiles/140.vert |4 src/glsl/builtins/tools/texture_builtins.py | 13 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/glsl/builtins/profiles/140.frag b/src/glsl/builtins/profiles/140.frag index da28473..b534827 100644 --- a/src/glsl/builtins/profiles/140.frag +++ b/src/glsl/builtins/profiles/140.frag @@ -714,6 +714,10 @@ uvec4 texelFetch(usampler1DArray sampler, ivec2 P, int lod); ivec4 texelFetch(isampler2DArray sampler, ivec3 P, int lod); uvec4 texelFetch(usampler2DArray sampler, ivec3 P, int lod); + vec4 texelFetch( samplerBuffer sampler, int P); +ivec4 texelFetch(isamplerBuffer sampler, int P); +uvec4 texelFetch(usamplerBuffer sampler, int P); + /* texelFetchOffset */ vec4 texelFetchOffset( sampler1D sampler, int P, int lod, int offset); ivec4 texelFetchOffset(isampler1D sampler, int P, int lod, int offset); diff --git a/src/glsl/builtins/profiles/140.vert b/src/glsl/builtins/profiles/140.vert index bfef4ed..7aa9240 100644 --- a/src/glsl/builtins/profiles/140.vert +++ b/src/glsl/builtins/profiles/140.vert @@ -635,6 +635,10 @@ uvec4 texelFetch(usampler1DArray sampler, ivec2 P, int lod); ivec4 texelFetch(isampler2DArray sampler, ivec3 P, int lod); uvec4 texelFetch(usampler2DArray sampler, ivec3 P, int lod); + vec4 texelFetch( samplerBuffer sampler, int P); +ivec4 texelFetch(isamplerBuffer sampler, int P); +uvec4 texelFetch(usamplerBuffer sampler, int P); + /* texelFetchOffset */ vec4 texelFetchOffset( sampler1D sampler, int P, int lod, int offset); ivec4 texelFetchOffset(isampler1D sampler, int P, int lod, int offset); diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py index cd15dc4..3a4943a 100755 --- a/src/glsl/builtins/tools/texture_builtins.py +++ b/src/glsl/builtins/tools/texture_builtins.py @@ -25,6 +25,8 @@ def get_sampler_dim(sampler_type): sampler_dim = 3 elif sampler_type == ExternalOES: sampler_dim = 2 +elif sampler_type == Buffer: +sampler_dim = 1 else: assert False (coord_dim: invalid sampler_type: + sampler_type) return sampler_dim @@ -71,7 +73,9 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0): print \n (declare (in) + vec_type(i if tex_inst == txf else , coord_dim + extra_dim) + P), if tex_inst == txl: print \n (declare (in) float lod), -elif tex_inst == txf or (tex_inst == txs and Rect not in sampler_type): +elif (tex_inst == txf and Buffer not in sampler_type): +print \n (declare (in) int lod), +elif (tex_inst == txs and Rect not in sampler_type): print \n (declare (in) int lod), elif tex_inst == txd: grad_type = vec_type(, coord_dim) @@ -115,12 +119,12 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0): # Bias/explicit LOD/gradient: if tex_inst == txb: print (var_ref bias), -elif tex_inst == txs: -if Rect not in sampler_type: +elif tex_inst == txs or tex_inst == txf: +if Rect not in sampler_type and Buffer not in sampler_type: print (var_ref lod), else: print (constant int (0)) -elif tex_inst == txl or tex_inst == txf: +elif tex_inst == txl: print (var_ref lod), elif tex_inst == txd: print ((var_ref dPdx) (var_ref dPdy)), @@ -255,6 +259,7 @@ def generate_texture_functions(fs): generate_fiu_sigs(txf, 3D) generate_fiu_sigs(txf, 1DArray) generate_fiu_sigs(txf, 2DArray) +generate_fiu_sigs(txf, Buffer) end_function(fs, texelFetch) start_function(texelFetchOffset) -- 1.7.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/14] mesa: Handle updating texture state for buffer textures.
We have to skip some work that wants to look at texture images, since buffer textures don't have any of that complexity. --- src/mesa/main/texobj.c |8 src/mesa/main/texstate.c |4 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 88dc3b1..d7e631e 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -449,6 +449,14 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, t-_BaseComplete = GL_TRUE; t-_MipmapComplete = GL_TRUE; + if (t-Target == GL_TEXTURE_BUFFER) { + /* Buffer textures are always considered complete. The obvious case where + * they would be incomplete (no BO attached) is actually specced to be + * undefined rendering results. + */ + return; + } + /* Detect cases where the application set the base level to an invalid * value. */ diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index ee778ff..8ca9092 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -390,6 +390,10 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit) { struct gl_tex_env_combine_state *combine; + /* No combiners will apply to this. */ + if (texUnit-_Current-Target == GL_TEXTURE_BUFFER) + return; + /* Set the texUnit-_CurrentCombine field to point to the user's combiner * state, or the combiner state which is derived from traditional texenv * mode. -- 1.7.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/14] mesa: Add support for the GL 3.1 R/RG formats in texture buffer objects.
--- src/mesa/main/teximage.c | 54 ++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 60b2528..2348646 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3850,6 +3850,49 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) return MESA_FORMAT_RGBA_UINT16; case GL_RGBA32UI_EXT: return MESA_FORMAT_RGBA_UINT32; + + case GL_RG8: + return MESA_FORMAT_GR88; + case GL_RG16: + return MESA_FORMAT_RG1616; + case GL_RG16F: + return MESA_FORMAT_RG_FLOAT16; + case GL_RG32F: + return MESA_FORMAT_RG_FLOAT32; + case GL_RG8I: + return MESA_FORMAT_RG_INT8; + case GL_RG16I: + return MESA_FORMAT_RG_INT16; + case GL_RG32I: + return MESA_FORMAT_RG_INT32; + case GL_RG8UI: + return MESA_FORMAT_RG_UINT8; + case GL_RG16UI: + return MESA_FORMAT_RG_UINT16; + case GL_RG32UI: + return MESA_FORMAT_RG_UINT32; + + case GL_R8: + return MESA_FORMAT_R8; + case GL_R16: + return MESA_FORMAT_R16; + case GL_R16F: + return MESA_FORMAT_R_FLOAT16; + case GL_R32F: + return MESA_FORMAT_R_FLOAT32; + case GL_R8I: + return MESA_FORMAT_R_INT8; + case GL_R16I: + return MESA_FORMAT_R_INT16; + case GL_R32I: + return MESA_FORMAT_R_INT32; + case GL_R8UI: + return MESA_FORMAT_R_UINT8; + case GL_R16UI: + return MESA_FORMAT_R_UINT16; + case GL_R32UI: + return MESA_FORMAT_R_UINT32; + default: return MESA_FORMAT_NONE; } @@ -3871,6 +3914,17 @@ validate_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) if (datatype == GL_HALF_FLOAT !ctx-Extensions.ARB_half_float_pixel) return MESA_FORMAT_NONE; + /* The GL_ARB_texture_rg and GL_ARB_texture_buffer_object specs don't make +* any mention of R/RG formats, but they appear in the GL 3.1 core +* specification. +*/ + if (ctx-VersionMajor 3 || + (ctx-VersionMajor == 3 ctx-VersionMinor == 0)) { + GLenum base_format = _mesa_get_format_base_format(format); + + if (base_format == GL_R || base_format == GL_RG) +return MESA_FORMAT_NONE; + } return format; } -- 1.7.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 11/14] i965/gen7: Fix the /* ignored */ comment on constant surface setup.
It turns out this field *is* used, and it's the stride between samples from the buffer. Discovered during TBO debugging. --- src/mesa/drivers/dri/i965/gen7_wm_surface_state.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c index c52f6aa..57fa540 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c @@ -157,7 +157,7 @@ gen7_create_constant_surface(struct brw_context *brw, surf-ss2.width = w 0x7f;/* bits 6:0 of size or width */ surf-ss2.height = (w 7) 0x1fff; /* bits 19:7 of size or width */ surf-ss3.depth = (w 20) 0x7f;/* bits 26:20 of size or width */ - surf-ss3.pitch = (16 - 1); /* ignored */ + surf-ss3.pitch = (16 - 1); /* stride between samples */ gen7_set_surface_tiling(surf, I915_TILING_NONE); /* tiling now allowed */ /* Emit relocation to surface contents. Section 5.1.1 of the gen4 -- 1.7.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 14/14] i965: Add support for deprecated texture buffer object formats.
GL 3.1 promoted GL_RGBA to core, and added GL_R and GL_RG. It dropped A/I/L/LA formats. Our hardware doesn't support the A/I/L/LA formats, so if we want to support GL_ARB_texture_buffer_object on its own, we have to map them to RG and swizzle their data into place. --- src/mesa/drivers/dri/i965/brw_wm.c| 89 +++-- src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 36 - 2 files changed, 99 insertions(+), 26 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index b358306..18a4bd4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -328,22 +328,64 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx, { const struct gl_texture_unit *unit = ctx-Texture.Unit[i]; - if (unit-_ReallyEnabled unit-_Current-Target != GL_TEXTURE_BUFFER) { - const struct gl_texture_object *t = unit-_Current; - const struct gl_texture_image *img = t-Image[0][t-BaseLevel]; - struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, i); - int swizzles[SWIZZLE_NIL + 1] = { -SWIZZLE_X, -SWIZZLE_Y, -SWIZZLE_Z, -SWIZZLE_W, -SWIZZLE_ZERO, -SWIZZLE_ONE, -SWIZZLE_NIL - }; - - if (img-_BaseFormat == GL_DEPTH_COMPONENT || - img-_BaseFormat == GL_DEPTH_STENCIL) { + if (!unit-_ReallyEnabled) { + key-swizzles[i] = SWIZZLE_NOOP; + return; + } + + const struct gl_texture_object *t = unit-_Current; + const struct gl_texture_image *img; + struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, i); + int swizzles[SWIZZLE_NIL + 1] = { + SWIZZLE_X, + SWIZZLE_Y, + SWIZZLE_Z, + SWIZZLE_W, + SWIZZLE_ZERO, + SWIZZLE_ONE, + SWIZZLE_NIL + }; + + if (t-Target != GL_TEXTURE_BUFFER) + img = t-Image[0][t-BaseLevel]; + else + img = NULL; + + if (t-Target == GL_TEXTURE_BUFFER) { + /* The hardware doesn't have support for the deprecated integer formats, + * so we map them to R/RG in the surface, and swizzle the channels here. + */ + if (_mesa_is_format_integer_color(t-_BufferObjectFormat)) { +switch (_mesa_get_format_base_format(t-_BufferObjectFormat)) { +case GL_ALPHA: + swizzles[0] = SWIZZLE_ZERO; + swizzles[1] = SWIZZLE_ZERO; + swizzles[2] = SWIZZLE_ZERO; + swizzles[3] = SWIZZLE_X; + break; +case GL_LUMINANCE: + swizzles[0] = SWIZZLE_X; + swizzles[1] = SWIZZLE_X; + swizzles[2] = SWIZZLE_X; + swizzles[3] = SWIZZLE_ONE; + break; +case GL_LUMINANCE_ALPHA: + swizzles[0] = SWIZZLE_X; + swizzles[1] = SWIZZLE_X; + swizzles[2] = SWIZZLE_X; + swizzles[3] = SWIZZLE_Y; + break; +case GL_INTENSITY: + swizzles[0] = SWIZZLE_X; + swizzles[1] = SWIZZLE_X; + swizzles[2] = SWIZZLE_X; + swizzles[3] = SWIZZLE_X; + break; +} + } + } else { + if ((img-_BaseFormat == GL_DEPTH_COMPONENT || + img-_BaseFormat == GL_DEPTH_STENCIL)) { if (sampler-CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) key-compare_funcs[i] = sampler-CompareFunc; @@ -385,12 +427,6 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx, key-yuvtex_swap_mask |= 1 i; } - key-swizzles[i] = -MAKE_SWIZZLE4(swizzles[GET_SWZ(t-_Swizzle, 0)], - swizzles[GET_SWZ(t-_Swizzle, 1)], - swizzles[GET_SWZ(t-_Swizzle, 2)], - swizzles[GET_SWZ(t-_Swizzle, 3)]); - if (sampler-MinFilter != GL_NEAREST sampler-MagFilter != GL_NEAREST) { if (sampler-WrapS == GL_CLAMP) @@ -401,9 +437,12 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx, key-gl_clamp_mask[2] |= 1 i; } } - else { - key-swizzles[i] = SWIZZLE_NOOP; - } + + key-swizzles[i] = + MAKE_SWIZZLE4(swizzles[GET_SWZ(t-_Swizzle, 0)], + swizzles[GET_SWZ(t-_Swizzle, 1)], + swizzles[GET_SWZ(t-_Swizzle, 2)], + swizzles[GET_SWZ(t-_Swizzle, 3)]); } static void brw_wm_populate_key( struct brw_context *brw, diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c index 1ebecc7..c093975 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c @@ -54,6 +54,36 @@ gen7_set_surface_tiling(struct gen7_surface_state *surf, uint32_t tiling) } } +const uint32_t buffer_format_overrides[MESA_FORMAT_COUNT] = { + [MESA_FORMAT_ALPHA_INT8] = BRW_SURFACEFORMAT_R8_SINT, + [MESA_FORMAT_ALPHA_INT16] = BRW_SURFACEFORMAT_R16_SINT, + [MESA_FORMAT_ALPHA_INT32] = BRW_SURFACEFORMAT_R32_SINT, + [MESA_FORMAT_ALPHA_UINT8] =
[Mesa-dev] [PATCH 09/14] mesa: Track a gl_format for the texture buffer format.
There was a function full of unused mappings from the GLenum to datatype/comps, but that wasn't all the information a driver would want, which includes the other fields that a gl_format has. Given that all the texture buffer formats were represented in gl_format, just use that as our description. --- src/mesa/main/mtypes.h |2 + src/mesa/main/teximage.c | 241 ++ src/mesa/main/texobj.c |1 + 3 files changed, 76 insertions(+), 168 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a3827d4..8e441c2 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1329,6 +1329,8 @@ struct gl_texture_object /** GL_ARB_texture_buffer_object */ struct gl_buffer_object *BufferObject; GLenum BufferObjectFormat; + /** Equivalent Mesa format for BufferObjectFormat. */ + gl_format _BufferObjectFormat; /** GL_OES_EGL_image_external */ GLint RequiredTextureImageUnits; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index c541182..60b2528 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3746,228 +3746,132 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, width, height, depth, format, imageSize, data); } - -/** - * Helper for glTexBuffer(). Check if internalFormat is legal. If so, - * return the basic data type and number of components for the format. - * \param return GL_TRUE if internalFormat is legal, GL_FALSE otherwise - */ -static GLboolean -get_sized_format_info(const struct gl_context *ctx, GLenum internalFormat, - GLenum *datatype, GLuint *components) +static gl_format +get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) { switch (internalFormat) { case GL_ALPHA8: - *datatype = GL_UNSIGNED_BYTE; - *components = 1; - break; + return MESA_FORMAT_A8; case GL_ALPHA16: - *datatype = GL_UNSIGNED_SHORT; - *components = 1; - break; + return MESA_FORMAT_A16; case GL_ALPHA16F_ARB: - *datatype = GL_HALF_FLOAT; - *components = 1; - break; + return MESA_FORMAT_ALPHA_FLOAT16; case GL_ALPHA32F_ARB: - *datatype = GL_FLOAT; - *components = 1; - break; + return MESA_FORMAT_ALPHA_FLOAT32; case GL_ALPHA8I_EXT: - *datatype = GL_BYTE; - *components = 1; - break; + return MESA_FORMAT_ALPHA_INT8; case GL_ALPHA16I_EXT: - *datatype = GL_SHORT; - *components = 1; - break; + return MESA_FORMAT_ALPHA_INT16; case GL_ALPHA32I_EXT: - *datatype = GL_INT; - *components = 1; - break; + return MESA_FORMAT_ALPHA_INT32; case GL_ALPHA8UI_EXT: - *datatype = GL_UNSIGNED_BYTE; - *components = 1; - break; + return MESA_FORMAT_ALPHA_UINT8; case GL_ALPHA16UI_EXT: - *datatype = GL_UNSIGNED_SHORT; - *components = 1; - break; + return MESA_FORMAT_ALPHA_UINT16; case GL_ALPHA32UI_EXT: - *datatype = GL_UNSIGNED_INT; - *components = 1; - break; + return MESA_FORMAT_ALPHA_UINT32; case GL_LUMINANCE8: - *datatype = GL_UNSIGNED_BYTE; - *components = 1; - break; + return MESA_FORMAT_L8; case GL_LUMINANCE16: - *datatype = GL_UNSIGNED_SHORT; - *components = 1; - break; + return MESA_FORMAT_L16; case GL_LUMINANCE16F_ARB: - *datatype = GL_HALF_FLOAT; - *components = 1; - break; + return MESA_FORMAT_LUMINANCE_FLOAT16; case GL_LUMINANCE32F_ARB: - *datatype = GL_FLOAT; - *components = 1; - break; + return MESA_FORMAT_LUMINANCE_FLOAT32; case GL_LUMINANCE8I_EXT: - *datatype = GL_BYTE; - *components = 1; - break; + return MESA_FORMAT_LUMINANCE_INT8; case GL_LUMINANCE16I_EXT: - *datatype = GL_SHORT; - *components = 1; - break; + return MESA_FORMAT_LUMINANCE_INT16; case GL_LUMINANCE32I_EXT: - *datatype = GL_INT; - *components = 1; - break; + return MESA_FORMAT_LUMINANCE_INT32; case GL_LUMINANCE8UI_EXT: - *datatype = GL_UNSIGNED_BYTE; - *components = 1; - break; + return MESA_FORMAT_LUMINANCE_UINT8; case GL_LUMINANCE16UI_EXT: - *datatype = GL_UNSIGNED_SHORT; - *components = 1; - break; + return MESA_FORMAT_LUMINANCE_UINT16; case GL_LUMINANCE32UI_EXT: - *datatype = GL_UNSIGNED_INT; - *components = 1; - break; + return MESA_FORMAT_LUMINANCE_UINT32; case GL_LUMINANCE8_ALPHA8: - *datatype = GL_UNSIGNED_BYTE; - *components = 2; - break; + return MESA_FORMAT_AL88; case GL_LUMINANCE16_ALPHA16: - *datatype = GL_UNSIGNED_SHORT; - *components = 2; - break; + return MESA_FORMAT_AL1616; case GL_LUMINANCE_ALPHA16F_ARB: - *datatype = GL_HALF_FLOAT; - *components = 2; - break; + return
[Mesa-dev] [PATCH 12/14] i965: Add real support for texturing/rendering with MESA_FORMAT_RGBA8888_REV.
This was hacked in in one place for EGL image stuff, but the right thing to do was just to provide the mapping from the mesa format to the native hardware format, which includes render target support. This turns out to be required for GL_ARB_texture_buffer_object, which sees data in this layout. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c |6 +- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index a3de2e3..1e37ed2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -288,7 +288,7 @@ brw_format_for_mesa_format(gl_format mesa_format) static const uint32_t table[MESA_FORMAT_COUNT] = { [MESA_FORMAT_RGBA] = 0, - [MESA_FORMAT_RGBA_REV] = 0, + [MESA_FORMAT_RGBA_REV] = BRW_SURFACEFORMAT_R8G8B8A8_UNORM, [MESA_FORMAT_ARGB] = BRW_SURFACEFORMAT_B8G8R8A8_UNORM, [MESA_FORMAT_ARGB_REV] = 0, [MESA_FORMAT_XRGB] = BRW_SURFACEFORMAT_B8G8R8X8_UNORM, @@ -606,10 +606,6 @@ translate_tex_format(gl_format mesa_format, else if (srgb_decode == GL_SKIP_DECODE_EXT) return brw_format_for_mesa_format(_mesa_get_srgb_format_linear(mesa_format)); - case MESA_FORMAT_RGBA_REV: - /* This format is not renderable? */ - return BRW_SURFACEFORMAT_R8G8B8A8_UNORM; - case MESA_FORMAT_RGBA_FLOAT32: /* The value of this BRW_SURFACEFORMAT is 0, which tricks the * assertion below. -- 1.7.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/14] i965: Add support for sampling texture buffer objects on gen7+.
--- src/mesa/drivers/dri/i965/brw_wm.c|2 +- src/mesa/drivers/dri/i965/gen7_sampler_state.c|4 + src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 62 + src/mesa/drivers/dri/intel/intel_tex_validate.c |4 + 4 files changed, 71 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index e59ab62..b358306 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -328,7 +328,7 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx, { const struct gl_texture_unit *unit = ctx-Texture.Unit[i]; - if (unit-_ReallyEnabled) { + if (unit-_ReallyEnabled unit-_Current-Target != GL_TEXTURE_BUFFER) { const struct gl_texture_object *t = unit-_Current; const struct gl_texture_image *img = t-Image[0][t-BaseLevel]; struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, i); diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c b/src/mesa/drivers/dri/i965/gen7_sampler_state.c index d2699a1..0cf6229 100644 --- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c @@ -43,6 +43,10 @@ gen7_update_sampler_state(struct brw_context *brw, int unit, struct gl_sampler_object *gl_sampler = _mesa_get_samplerobj(ctx, unit); bool using_nearest = false; + /* These don't use samplers at all. */ + if (texObj-Target == GL_TEXTURE_BUFFER) + return; + switch (gl_sampler-MinFilter) { case GL_NEAREST: sampler-ss0.min_filter = BRW_MAPFILTER_NEAREST; diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c index 57fa540..1ebecc7 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c @@ -28,6 +28,7 @@ #include intel_batchbuffer.h #include intel_tex.h #include intel_fbo.h +#include intel_buffer_objects.h #include brw_context.h #include brw_state.h @@ -54,6 +55,62 @@ gen7_set_surface_tiling(struct gen7_surface_state *surf, uint32_t tiling) } static void +gen7_update_buffer_texture_surface(struct gl_context *ctx, GLuint unit) +{ + struct brw_context *brw = brw_context(ctx); + struct gl_texture_object *tObj = ctx-Texture.Unit[unit]._Current; + const GLuint surf_index = SURF_INDEX_TEXTURE(unit); + struct gen7_surface_state *surf; + struct intel_buffer_object *intel_obj = + intel_buffer_object(tObj-BufferObject); + drm_intel_bo *bo = intel_obj ? intel_obj-buffer : NULL; + gl_format format = tObj-_BufferObjectFormat; + int texel_size = _mesa_get_format_bytes(format); + + surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, + sizeof(*surf), 32, brw-wm.surf_offset[surf_index]); + memset(surf, 0, sizeof(*surf)); + + surf-ss0.surface_type = BRW_SURFACE_BUFFER; + surf-ss0.surface_format = brw_format_for_mesa_format(format); + + surf-ss0.render_cache_read_write = 1; + + if (surf-ss0.surface_format == 0 format != MESA_FORMAT_RGBA_FLOAT32) { + _mesa_problem(NULL, bad format %s for texture buffer\n, + _mesa_get_format_name(format)); + } + + if (bo) { + surf-ss1.base_addr = bo-offset; /* reloc */ + + /* Emit relocation to surface contents. Section 5.1.1 of the gen4 + * bspec (Data Cache) says that the data cache does not exist as + * a separate cache and is just the sampler cache. + */ + drm_intel_bo_emit_reloc(brw-intel.batch.bo, + (brw-wm.surf_offset[surf_index] + + offsetof(struct gen7_surface_state, ss1)), + bo, 0, + I915_GEM_DOMAIN_SAMPLER, 0); + + int w = intel_obj-Base.Size / texel_size; + surf-ss2.width = w 0x7f;/* bits 6:0 of size or width */ + surf-ss2.height = (w 7) 0x1fff; /* bits 19:7 of size or width */ + surf-ss3.depth = (w 20) 0x7f;/* bits 26:20 of size or width */ + surf-ss3.pitch = texel_size - 1; +} else { + surf-ss1.base_addr = 0; + surf-ss2.width = 0; + surf-ss2.height = 0; + surf-ss3.depth = 0; + surf-ss3.pitch = 0; + } + + gen7_set_surface_tiling(surf, I915_TILING_NONE); +} + +static void gen7_update_texture_surface(struct gl_context *ctx, GLuint unit) { struct brw_context *brw = brw_context(ctx); @@ -66,6 +123,11 @@ gen7_update_texture_surface(struct gl_context *ctx, GLuint unit) struct gen7_surface_state *surf; int width, height, depth; + if (tObj-Target == GL_TEXTURE_BUFFER) { + gen7_update_buffer_texture_surface(ctx, unit); + return; + } + intel_miptree_get_dimensions_for_image(firstImage, width, height, depth); surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index
[Mesa-dev] [Bug 47878] libXvMC* are not being installed where they should
https://bugs.freedesktop.org/show_bug.cgi?id=47878 --- Comment #4 from Alexandre Demers alexandre.f.dem...@gmail.com 2012-03-28 11:40:58 PDT --- This seems a good solution. My only concern is about the folder: do we want a specific folder as for other trackers? By the way, thank you for the info about configure.ac (In reply to comment #3) Created attachment 59161 [details] [review] Possible fix. Fixing the bug in the short hand is actually pretty easy, just replace the obvious incorrect combination of $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) with $(DESTDIR)$(INSTALL_LIB_DIR). As an alternative you could also add an --with-xvmc-libdir= option, which then results in setting the XVMC_INSTALL_DIR variable. For an good example how to do this take a look at the --with-vdpau-libdir= option and the resulting VDPAU_LIB_INSTALL_DIR variable in configure.ac. Hope that helps, Christian. -- 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 10/14] mesa: Add support for the GL 3.1 R/RG formats in texture buffer objects.
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 60b2528..2348646 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3850,6 +3850,49 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) return MESA_FORMAT_RGBA_UINT16; case GL_RGBA32UI_EXT: return MESA_FORMAT_RGBA_UINT32; + + case GL_RG8: + return MESA_FORMAT_GR88; Not sure if its worth a comment on why this one is GR vs the rest. Otherwise Reviewed-by: Dave Airlie airl...@redhat.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 47967] gallium driver svga doesn't compile with LIBDRM_LIBS=-L/usr/lib/x86_64-linux-gnu/
https://bugs.freedesktop.org/show_bug.cgi?id=47967 --- Comment #3 from Alexandre Demers alexandre.f.dem...@gmail.com 2012-03-28 11:48:13 PDT --- While I understand the possible need for -Ldrm, why would it be the only driver behaving like that? I mean, shouldn't the use of LIBS_LIBDRM=-L... replace the need for -Ldrm in a way, as it does for other drivers? I'll be testing this solution later at home. -- 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 08/14] mesa: Handle updating texture state for buffer textures.
On Wed, Mar 28, 2012 at 6:58 PM, Eric Anholt e...@anholt.net wrote: We have to skip some work that wants to look at texture images, since buffer textures don't have any of that complexity. Reviewed-by: Dave Airlie airl...@redhat.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] i915: set SPRITE_POINT_ENABLE bit correctly
On Sat, 17 Mar 2012 10:58:27 +0800, Liu Aleaxander aleaxan...@gmail.com wrote: On Sat, Mar 17, 2012 at 1:57 AM, Eric Anholt e...@anholt.net wrote: On Mon, 12 Mar 2012 16:04:00 +0800, Yuanhan Liu yuanhan@linux.intel.com wrote: /**/ /* High level hooks for t_vb_render.c */ @@ -1070,6 +1112,15 @@ intelRunPipeline(struct gl_context * ctx) if (ctx-NewState) _mesa_update_state_locked(ctx); + /* + * Enable POINT_SPRITE_ENABLE bit when needed here + * + * Handle it at _draw_ time so that we can guarantee the CoordReplace + * changes handled well. And we must do it before the tnl pipeline is + * running so that we can fallback when finding something goes wrong. + */ + intel_validate_sprite_point_enable(intel); Other computed state happens in i915InvalidateState. Why does this one go here? A nice point. Yeah, I should do the stuff there. So, how about the following patch (note: I haven't tested the patch yet since I don't have hardware for testing at home, but it should work ;) (send from my gmail account, the format may not good, sorry for that) --- From 34964ef86aad7361cb4f3f5f73ae4e42928a4b31 Mon Sep 17 00:00:00 2001 From: Yuanhan Liu yuanhan@linux.intel.com Date: Sat, 17 Mar 2012 10:48:23 +0800 Subject: [PATCH] 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) 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 | 53 +++--- src/mesa/drivers/dri/i915/intel_tris.c |1 + 4 files changed, 46 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..d7785be 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_POINT) + i915_update_sprite_point_enable(ctx); } +void +i915_update_sprite_point_enable(struct gl_context *ctx) +{ + struct intel_context *intel = intel_context(ctx); In the next two lines, you make use of _NEW_PROGRAM-governed state, but you only call this function based on _NEW_POINT. In the i965 driver, we annotate state usage with /* _NEW_WHATEVER */ so the reader can see what state is being used, and make sure that it's reflected in the caller. + 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++) { + 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); + } + + 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); + } +} This still looks wrong to me. Take a shader reading gl_PointCoord with point sprite enabled, and also a user-defined varying. tex_coord_unit_bits will be 0, coord_replace_bits will be 0, and gl_PointCoord will get
[Mesa-dev] [PATCH] glsl: Don't trust loop analysis in the presence of function calls.
Function calls may have side effects that alter variables used inside the loop. In the fragment shader, they may even terminate the shader. This means our analysis about loop-constant or induction variables may be completely wrong. In general it's impossible to determine whether they actually do or not (due to the halting problem), so we'd need to perform conservative static analysis. For now, it's not worth the complexity: most functions will be inlined, at which point we can unroll them successfully. Fixes Piglit tests: - shaders/glsl-fs-unroll-out-param - shaders/glsl-fs-unroll-side-effect NOTE: This is a candidate for release branches. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/glsl/loop_analysis.cpp | 28 src/glsl/loop_analysis.h |6 ++ 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp index 9bba6a9..6a0e4da 100644 --- a/src/glsl/loop_analysis.cpp +++ b/src/glsl/loop_analysis.cpp @@ -110,6 +110,8 @@ public: virtual ir_visitor_status visit(ir_loop_jump *); virtual ir_visitor_status visit(ir_dereference_variable *); + virtual ir_visitor_status visit_enter(ir_call *); + virtual ir_visitor_status visit_enter(ir_loop *); virtual ir_visitor_status visit_leave(ir_loop *); virtual ir_visitor_status visit_enter(ir_assignment *); @@ -153,6 +155,21 @@ loop_analysis::visit(ir_loop_jump *ir) ir_visitor_status +loop_analysis::visit_enter(ir_call *ir) +{ + /* If we're not somewhere inside a loop, there's nothing to do. */ + if (this-state.is_empty()) + return visit_continue; + + loop_variable_state *const ls = + (loop_variable_state *) this-state.get_head(); + + ls-contains_calls = true; + return visit_continue_with_parent; +} + + +ir_visitor_status loop_analysis::visit(ir_dereference_variable *ir) { /* If we're not somewhere inside a loop, there's nothing to do. @@ -209,6 +226,17 @@ loop_analysis::visit_leave(ir_loop *ir) loop_variable_state *const ls = (loop_variable_state *) this-state.pop_head(); + /* Function calls may contain side effects. These could alter any of our +* variables in ways that cannot be known, and may even terminate shader +* execution (say, calling discard in the fragment shader). So we can't +* rely on any of our analysis about assignments to variables. +* +* We could perform some conservative analysis (prove there's no statically +* possible assignment, etc.) but it isn't worth it for now; function +* inlining will allow us to unroll loops anyway. +*/ + if (ls-contains_calls) + return visit_continue; foreach_list(node, ir-body_instructions) { /* Skip over declarations at the start of a loop. diff --git a/src/glsl/loop_analysis.h b/src/glsl/loop_analysis.h index 2297308..8bed1db 100644 --- a/src/glsl/loop_analysis.h +++ b/src/glsl/loop_analysis.h @@ -122,10 +122,16 @@ public: */ unsigned num_loop_jumps; + /** +* Whether this loop contains any function calls. +*/ + bool contains_calls; + loop_variable_state() { this-max_iterations = -1; this-num_loop_jumps = 0; + this-contains_calls = false; this-var_hash = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); } -- 1.7.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] i915: set SPRITE_POINT_ENABLE bit correctly
On Wed, Mar 28, 2012 at 01:21:18PM -0700, Eric Anholt wrote: On Sat, 17 Mar 2012 10:58:27 +0800, Liu Aleaxander aleaxan...@gmail.com wrote: On Sat, Mar 17, 2012 at 1:57 AM, Eric Anholt e...@anholt.net wrote: On Mon, 12 Mar 2012 16:04:00 +0800, Yuanhan Liu yuanhan@linux.intel.com wrote: /**/ /* High level hooks for t_vb_render.c */ @@ -1070,6 +1112,15 @@ intelRunPipeline(struct gl_context * ctx) if (ctx-NewState) _mesa_update_state_locked(ctx); + /* + * Enable POINT_SPRITE_ENABLE bit when needed here + * + * Handle it at _draw_ time so that we can guarantee the CoordReplace + * changes handled well. And we must do it before the tnl pipeline is + * running so that we can fallback when finding something goes wrong. + */ + intel_validate_sprite_point_enable(intel); Other computed state happens in i915InvalidateState. Why does this one go here? A nice point. Yeah, I should do the stuff there. So, how about the following patch (note: I haven't tested the patch yet since I don't have hardware for testing at home, but it should work ;) (send from my gmail account, the format may not good, sorry for that) --- From 34964ef86aad7361cb4f3f5f73ae4e42928a4b31 Mon Sep 17 00:00:00 2001 From: Yuanhan Liu yuanhan@linux.intel.com Date: Sat, 17 Mar 2012 10:48:23 +0800 Subject: [PATCH] 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) 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 | 53 +++--- src/mesa/drivers/dri/i915/intel_tris.c |1 + 4 files changed, 46 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..d7785be 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_POINT) + i915_update_sprite_point_enable(ctx); } +void +i915_update_sprite_point_enable(struct gl_context *ctx) +{ + struct intel_context *intel = intel_context(ctx); In the next two lines, you make use of _NEW_PROGRAM-governed state, but you only call this function based on _NEW_POINT. In the i965 driver, we annotate state usage with /* _NEW_WHATEVER */ so the reader can see what state is being used, and make sure that it's reflected in the caller. Yes, will do that. + 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++) { + 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); + } + + 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); + } +} This
Re: [Mesa-dev] [PATCH 05/14] glsl: Add support for parsing [iu]samplerBuffer in GLSL 1.40.
On 03/28/2012 10:58 AM, Eric Anholt wrote: The type will be undefined in !glsl 1.40, and the keyword is marked as reserved. --- src/glsl/ast.h |3 +++ src/glsl/ast_type.cpp |3 +++ src/glsl/glsl_parser.yy |6 +- src/glsl/glsl_types.cpp |5 - 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 1f78af8..ab4c210 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -459,18 +459,21 @@ enum ast_types { ast_sampler2darray, ast_sampler1darrayshadow, ast_sampler2darrayshadow, + ast_samplerbuffer, ast_isampler1d, ast_isampler2d, ast_isampler3d, ast_isamplercube, ast_isampler1darray, ast_isampler2darray, + ast_isamplerbuffer, ast_usampler1d, ast_usampler2d, ast_usampler3d, ast_usamplercube, ast_usampler1darray, ast_usampler2darray, + ast_usamplerbuffer, ast_struct, ast_type_name diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 79c43ee..f914f71 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -92,18 +92,21 @@ ast_type_specifier::ast_type_specifier(int specifier) sampler2DArray, sampler1DArrayShadow, sampler2DArrayShadow, + samplerBuffer, isampler1D, isampler2D, isampler3D, isamplerCube, isampler1DArray, isampler2DArray, + isamplerBuffer, usampler1D, usampler2D, usampler3D, usamplerCube, usampler1DArray, usampler2DArray, + usamplerBuffer, NULL, /* ast_struct */ NULL /* ast_type_name */ diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 64506b6..c6b6238 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -103,6 +103,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %token SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE %token ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D %token USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY +%token SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER You need to add these to the lexer. It already has a rule for samplerBuffer, but is missing isamplerBuffer or usamplerBuffer. With that fixed, Reviewed-by: Kenneth Graunke kenn...@whitecape.org %token SAMPLEREXTERNALOES %token STRUCT VOID_TOK WHILE %tokenidentifier IDENTIFIER TYPE_IDENTIFIER NEW_IDENTIFIER @@ -135,7 +136,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %token ERROR_TOK -%token COMMON PARTITION ACTIVE SAMPLERBUFFER FILTER +%token COMMON PARTITION ACTIVE FILTER %token IMAGE1D IMAGE2D IMAGE3D IMAGECUBE IMAGE1DARRAY IMAGE2DARRAY %token IIMAGE1D IIMAGE2D IIMAGE3D IIMAGECUBE IIMAGE1DARRAY IIMAGE2DARRAY %token UIMAGE1D UIMAGE2D UIMAGE3D UIMAGECUBE UIMAGE1DARRAY UIMAGE2DARRAY @@ -1405,18 +1406,21 @@ basic_type_specifier_nonarray: | SAMPLER2DARRAY{ $$ = ast_sampler2darray; } | SAMPLER1DARRAYSHADOW { $$ = ast_sampler1darrayshadow; } | SAMPLER2DARRAYSHADOW { $$ = ast_sampler2darrayshadow; } + | SAMPLERBUFFER { $$ = ast_samplerbuffer; } | ISAMPLER1D{ $$ = ast_isampler1d; } | ISAMPLER2D{ $$ = ast_isampler2d; } | ISAMPLER3D{ $$ = ast_isampler3d; } | ISAMPLERCUBE { $$ = ast_isamplercube; } | ISAMPLER1DARRAY { $$ = ast_isampler1darray; } | ISAMPLER2DARRAY { $$ = ast_isampler2darray; } + | ISAMPLERBUFFER{ $$ = ast_isamplerbuffer; } | USAMPLER1D{ $$ = ast_usampler1d; } | USAMPLER2D{ $$ = ast_usampler2d; } | USAMPLER3D{ $$ = ast_usampler3d; } | USAMPLERCUBE { $$ = ast_usamplercube; } | USAMPLER1DARRAY { $$ = ast_usampler1darray; } | USAMPLER2DARRAY { $$ = ast_usampler2darray; } + | USAMPLERBUFFER{ $$ = ast_usamplerbuffer; } ; precision_qualifier: 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); }
Re: [Mesa-dev] [PATCH 07/14] mesa: Create the default (name==0) buffer texture.
On 03/28/2012 10:58 AM, Eric Anholt wrote: All that should be needed is that it exists. Fixes segfaults on first _mesa_update_context() with a samplerBuffer-using shader active but without a particular buffer texture enabled. --- src/glsl/builtins/tools/texture_builtins.py |4 +--- src/mesa/main/texobj.c |5 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py index 3a4943a..d0b 100755 --- a/src/glsl/builtins/tools/texture_builtins.py +++ b/src/glsl/builtins/tools/texture_builtins.py @@ -73,9 +73,7 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0): print \n (declare (in) + vec_type(i if tex_inst == txf else , coord_dim + extra_dim) + P), if tex_inst == txl: print \n (declare (in) float lod), -elif (tex_inst == txf and Buffer not in sampler_type): -print \n (declare (in) int lod), -elif (tex_inst == txs and Rect not in sampler_type): +elif ((tex_inst == txf or tex_inst == txs) and Buffer not in sampler_type and Rect not in sampler_type): print \n (declare (in) int lod), elif tex_inst == txd: grad_type = vec_type(, coord_dim) You meant to squash this into patch 6, not this one. I'm fine with the change. diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d7dee4f..88dc3b1 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -756,6 +756,9 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) target = GL_TEXTURE_1D; break; case TEXTURE_BUFFER_INDEX: + dims = 0; + target = GL_TEXTURE_BUFFER; + break; case TEXTURE_EXTERNAL_INDEX: default: /* no-op */ @@ -794,6 +797,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) GL_RGBA, texFormat); switch (dims) { +case 0: + break; case 1: ctx-Driver.TexImage1D(ctx, texImage, GL_RGBA, width, 0, ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/9] glsl: Don't trust loop analysis in the presence of function calls.
Function calls may have side effects that alter variables used inside the loop. In the fragment shader, they may even terminate the shader. This means our analysis about loop-constant or induction variables may be completely wrong. In general it's impossible to determine whether they actually do or not (due to the halting problem), so we'd need to perform conservative static analysis. For now, it's not worth the complexity: most functions will be inlined, at which point we can unroll them successfully. Fixes Piglit tests: - shaders/glsl-fs-unroll-out-param - shaders/glsl-fs-unroll-side-effect NOTE: This is a candidate for release branches. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/glsl/loop_analysis.cpp | 28 src/glsl/loop_analysis.h |6 ++ 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp index 9bba6a9..6a0e4da 100644 --- a/src/glsl/loop_analysis.cpp +++ b/src/glsl/loop_analysis.cpp @@ -110,6 +110,8 @@ public: virtual ir_visitor_status visit(ir_loop_jump *); virtual ir_visitor_status visit(ir_dereference_variable *); + virtual ir_visitor_status visit_enter(ir_call *); + virtual ir_visitor_status visit_enter(ir_loop *); virtual ir_visitor_status visit_leave(ir_loop *); virtual ir_visitor_status visit_enter(ir_assignment *); @@ -153,6 +155,21 @@ loop_analysis::visit(ir_loop_jump *ir) ir_visitor_status +loop_analysis::visit_enter(ir_call *ir) +{ + /* If we're not somewhere inside a loop, there's nothing to do. */ + if (this-state.is_empty()) + return visit_continue; + + loop_variable_state *const ls = + (loop_variable_state *) this-state.get_head(); + + ls-contains_calls = true; + return visit_continue_with_parent; +} + + +ir_visitor_status loop_analysis::visit(ir_dereference_variable *ir) { /* If we're not somewhere inside a loop, there's nothing to do. @@ -209,6 +226,17 @@ loop_analysis::visit_leave(ir_loop *ir) loop_variable_state *const ls = (loop_variable_state *) this-state.pop_head(); + /* Function calls may contain side effects. These could alter any of our +* variables in ways that cannot be known, and may even terminate shader +* execution (say, calling discard in the fragment shader). So we can't +* rely on any of our analysis about assignments to variables. +* +* We could perform some conservative analysis (prove there's no statically +* possible assignment, etc.) but it isn't worth it for now; function +* inlining will allow us to unroll loops anyway. +*/ + if (ls-contains_calls) + return visit_continue; foreach_list(node, ir-body_instructions) { /* Skip over declarations at the start of a loop. diff --git a/src/glsl/loop_analysis.h b/src/glsl/loop_analysis.h index 2297308..8bed1db 100644 --- a/src/glsl/loop_analysis.h +++ b/src/glsl/loop_analysis.h @@ -122,10 +122,16 @@ public: */ unsigned num_loop_jumps; + /** +* Whether this loop contains any function calls. +*/ + bool contains_calls; + loop_variable_state() { this-max_iterations = -1; this-num_loop_jumps = 0; + this-contains_calls = false; this-var_hash = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); } -- 1.7.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] GLSL compiler function call cleaning
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. This series changes ir_call from a value (which can be nested inside expression trees) to a statement which can only appear in the instruction stream. This makes expression trees pure (free from side-effects), which ought to make optimization passes easier to write and less error-prone. It also resolves the ugliness where ir_call was the _only_ ir_rvalue that could appear in an instruction stream, which was bizarre. It also includes some AST-IR clean-ups, because...well. It was a mess. 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? I suspect IR-TGSI needs to support real function calls. The code there still compiles, but it probably breaks. I probably need help adapting it. No piglit regressions on i965. Nothing else was tested. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/9] glsl: Split up function matching and call generation a bit more.
We used to have one big function, match_signature_by_name, which found a matching signature, performed out-parameter conversions, and generated the ir_call. As the code for matching against built-in functions became more complicated, I split it internally, creating generate_call(). However, I left the same awkward interface. This patch splits it into three functions: 1. match_signature_by_name() This now takes a name, a list of parameters, the symbol table, and returns an ir_function_signature. Simple and one purpose: matching. 2. no_matching_function_error() Generate the no matching function error and list of prototypes. This was complex enough that I felt it deserved its own function. 3. generate_call() Do the out-parameter conversion and generate the ir_call. This could probably use more splitting. The caller now has a more natural workflow: find a matching signature, then either generate an error or a call. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/glsl/ast_function.cpp | 82 +--- 1 files changed, 47 insertions(+), 35 deletions(-) It's probably easier to apply this and compare rather than reading the raw diff itself. diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 1c2e861..2ad8fba 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -275,10 +275,12 @@ generate_call(exec_list *instructions, ir_function_signature *sig, return deref; } -static ir_rvalue * -match_function_by_name(exec_list *instructions, const char *name, - YYLTYPE *loc, exec_list *actual_parameters, - ir_call **call_ir, +/** + * Given a function name and parameter list, find the matching signature. + */ +static ir_function_signature * +match_function_by_name(const char *name, + exec_list *actual_parameters, struct _mesa_glsl_parse_state *state) { void *ctx = state; @@ -350,43 +352,45 @@ done: } f-add_signature(sig-clone_prototype(f, NULL)); } + } + return sig; +} - /* Finally, generate a call instruction. */ - return generate_call(instructions, sig, loc, actual_parameters, - call_ir, state); - } else { - char *str = prototype_string(NULL, name, actual_parameters); - - _mesa_glsl_error(loc, state, no matching function for call to `%s', - str); - ralloc_free(str); - - const char *prefix = candidates are: ; +/** + * Raise a no matching function error, listing all possible overloads the + * compiler considered so developers can figure out what went wrong. + */ +static void +no_matching_function_error(const char *name, + YYLTYPE *loc, + exec_list *actual_parameters, + _mesa_glsl_parse_state *state) +{ + char *str = prototype_string(NULL, name, actual_parameters); + _mesa_glsl_error(loc, state, no matching function for call to `%s', str); + ralloc_free(str); - for (int i = -1; i (int) state-num_builtins_to_link; i++) { -glsl_symbol_table *syms = i = 0 ? state-builtins_to_link[i]-symbols - : state-symbols; -f = syms-get_function(name); -if (f == NULL) - continue; + const char *prefix = candidates are: ; -foreach_list (node, f-signatures) { - ir_function_signature *sig = (ir_function_signature *) node; + for (int i = -1; i (int) state-num_builtins_to_link; i++) { + glsl_symbol_table *syms = i = 0 ? state-builtins_to_link[i]-symbols + : state-symbols; + ir_function *f = syms-get_function(name); + if (f == NULL) +continue; - str = prototype_string(sig-return_type, f-name, sig-parameters); - _mesa_glsl_error(loc, state, %s%s, prefix, str); - ralloc_free(str); + foreach_list (node, f-signatures) { +ir_function_signature *sig = (ir_function_signature *) node; - prefix = ; -} +str = prototype_string(sig-return_type, f-name, sig-parameters); +_mesa_glsl_error(loc, state, %s%s, prefix, str); +ralloc_free(str); +prefix = ; } - - return ir_call::get_error_instruction(ctx); } } - /** * Perform automatic type conversion of constructor parameters * @@ -1447,17 +1451,25 @@ ast_function_expression::hir(exec_list *instructions, } } else { const ast_expression *id = subexpressions[0]; + const char *func_name = id-primary_expression.identifier; YYLTYPE loc = id-get_location(); exec_list actual_parameters; process_parameters(instructions, actual_parameters, this-expressions, state); + ir_function_signature *sig = +
[Mesa-dev] [PATCH 5/9] glsl: Move constant expression handling from calls to signatures.
When translating a call from AST to HIR, we need to decide whether it can be evaluated to a constant before emitting any code (namely, the temporary declaration, assignment, and call.) Soon, ir_call will become a statement taking a dereference of where to store the return value, rather than an rvalue to be used on the RHS of an assignment. It will be more convenient to try evaluation before creating a call. ir_function_signature seems like a reasonable place. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/glsl/ir.h |6 ++ src/glsl/ir_constant_expression.cpp | 27 +++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 811eac0..bb4f775 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -478,6 +478,12 @@ public: virtual ir_visitor_status accept(ir_hierarchical_visitor *); /** +* Attempt to evaluate this function as a constant expression, given +* a list of the actual parameters. Returns NULL for non-built-ins. +*/ + ir_constant *constant_expression_value(exec_list *actual_parameters); + + /** * Get the name of the function for which this is a signature */ const char *function_name() const; diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 2910b2e..aa47c08 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1027,18 +1027,29 @@ ir_call::constant_expression_value() if (this-type == glsl_type::error_type) return NULL; + return this-callee-constant_expression_value(this-actual_parameters); +} + + +ir_constant * +ir_function_signature::constant_expression_value(exec_list *actual_parameters) +{ + const glsl_type *type = this-return_type; + if (type == glsl_type::void_type) + return NULL; + /* From the GLSL 1.20 spec, page 23: * Function calls to user-defined functions (non-built-in functions) * cannot be used to form constant expressions. */ - if (!this-callee-is_builtin) + if (!this-is_builtin) return NULL; unsigned num_parameters = 0; /* Check if all parameters are constant */ ir_constant *op[3]; - foreach_list(n, this-actual_parameters) { + foreach_list(n, actual_parameters) { ir_constant *constant = ((ir_rvalue *) n)-constant_expression_value(); if (constant == NULL) return NULL; @@ -1060,7 +1071,7 @@ ir_call::constant_expression_value() ir_constant_data data; memset(data, 0, sizeof(data)); - const char *callee = this-callee_name(); + const char *callee = this-function_name(); if (strcmp(callee, abs) == 0) { expr = new(mem_ctx) ir_expression(ir_unop_abs, type, op[0], NULL); } else if (strcmp(callee, all) == 0) { @@ -1108,7 +1119,7 @@ ir_call::constant_expression_value() for (unsigned c = 0; c op[0]-type-components(); c++) data.f[c] = atanhf(op[0]-value.f[c]); } else if (strcmp(callee, dFdx) == 0 || strcmp(callee, dFdy) == 0) { - return ir_constant::zero(mem_ctx, this-type); + return ir_constant::zero(mem_ctx, type); } else if (strcmp(callee, ceil) == 0) { expr = new(mem_ctx) ir_expression(ir_unop_ceil, type, op[0], NULL); } else if (strcmp(callee, clamp) == 0) { @@ -1199,7 +1210,7 @@ ir_call::constant_expression_value() } else if (strcmp(callee, fract) == 0) { expr = new(mem_ctx) ir_expression(ir_unop_fract, type, op[0], NULL); } else if (strcmp(callee, fwidth) == 0) { - return ir_constant::zero(mem_ctx, this-type); + return ir_constant::zero(mem_ctx, type); } else if (strcmp(callee, greaterThan) == 0) { assert(op[0]-type-is_vector() op[1] op[1]-type-is_vector()); for (unsigned c = 0; c op[0]-type-components(); c++) { @@ -1305,7 +1316,7 @@ ir_call::constant_expression_value() float length = sqrtf(dot(op[0], op[0])); if (length == 0) -return ir_constant::zero(mem_ctx, this-type); +return ir_constant::zero(mem_ctx, type); for (unsigned c = 0; c op[0]-type-components(); c++) data.f[c] = op[0]-value.f[c] / length; @@ -1356,7 +1367,7 @@ ir_call::constant_expression_value() const float dot_NI = dot(op[1], op[0]); const float k = 1.0F - eta * eta * (1.0F - dot_NI * dot_NI); if (k 0.0) { -return ir_constant::zero(mem_ctx, this-type); +return ir_constant::zero(mem_ctx, type); } else { for (unsigned c = 0; c type-components(); c++) { data.f[c] = eta * op[0]-value.f[c] - (eta * dot_NI + sqrtf(k)) @@ -1425,5 +1436,5 @@ ir_call::constant_expression_value() if (expr != NULL) return expr-constant_expression_value(); - return new(mem_ctx) ir_constant(this-type, data); + return new(mem_ctx) ir_constant(type, data); } -- 1.7.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org
[Mesa-dev] [PATCH 3/9] glsl: Combine AST-level and IR-level parameter mode checking loops.
generate_call() and ast_function_expression::hir() both tried to verify that 'out' and 'inout' parameters used l-values. Irritatingly, it turned out that this was not redundant; both checks caught -some- cases. This patch combines the two into a single complete function that does all the parameter mode checking. It also adds a comment clarifying why AST-level checking is necessary in the first place. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/glsl/ast_function.cpp | 167 +++-- 1 files changed, 85 insertions(+), 82 deletions(-) Again, sorry the diff is hard to read. It's not hard to compare if you apply it, look at the two old loops, and then the new one. It should be functionally equivalent. diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 2ad8fba..9ffbce6 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -94,76 +94,116 @@ prototype_string(const glsl_type *return_type, const char *name, } /** - * If a function call is generated, \c call_ir will point to it on exit. - * Otherwise \c call_ir will be set to \c NULL. + * Verify that 'out' and 'inout' actual parameters are lvalues. Also, verify + * that 'const_in' formal parameters (an extension in our IR) correspond to + * ir_constant actual parameters. */ -static ir_rvalue * -generate_call(exec_list *instructions, ir_function_signature *sig, - YYLTYPE *loc, exec_list *actual_parameters, - ir_call **call_ir, - struct _mesa_glsl_parse_state *state) +static bool +verify_parameter_modes(_mesa_glsl_parse_state *state, + ir_function_signature *sig, + exec_list actual_ir_parameters, + exec_list actual_ast_parameters) { - void *ctx = state; - exec_list post_call_conversions; + exec_node *actual_ir_node = actual_ir_parameters.head; + exec_node *actual_ast_node = actual_ast_parameters.head; - *call_ir = NULL; + foreach_list(formal_node, sig-parameters) { + /* The lists must be the same length. */ + assert(!actual_ir_node-is_tail_sentinel()); + assert(!actual_ast_node-is_tail_sentinel()); - /* Verify that 'out' and 'inout' actual parameters are lvalues. This -* isn't done in ir_function::matching_signature because that function -* cannot generate the necessary diagnostics. -* -* Also, validate that 'const_in' formal parameters (an extension of our -* IR) correspond to ir_constant actual parameters. -* -* Also, perform implicit conversion of arguments. Note: to implicitly -* convert out parameters, we need to place them in a temporary -* variable, and do the conversion after the call takes place. Since we -* haven't emitted the call yet, we'll place the post-call conversions -* in a temporary exec_list, and emit them later. -*/ - exec_list_iterator actual_iter = actual_parameters-iterator(); - exec_list_iterator formal_iter = sig-parameters.iterator(); - - while (actual_iter.has_next()) { - ir_rvalue *actual = (ir_rvalue *) actual_iter.get(); - ir_variable *formal = (ir_variable *) formal_iter.get(); + const ir_variable *const formal = (ir_variable *) formal_node; + const ir_rvalue *const actual = (ir_rvalue *) actual_ir_node; + const ast_expression *const actual_ast = +exec_node_data(ast_expression, actual_ast_node, link); - assert(actual != NULL); - assert(formal != NULL); + /* FIXME: 'loc' is incorrect (as of 2011-01-21). It is always + * FIXME: 0:0(0). + */ + YYLTYPE loc = actual_ast-get_location(); - if (formal-mode == ir_var_const_in !actual-as_constant()) { -_mesa_glsl_error(loc, state, - parameter `%s' must be a constant expression, + /* Verify that 'const_in' parameters are ir_constants. */ + if (formal-mode == ir_var_const_in + actual-ir_type != ir_type_constant) { +_mesa_glsl_error(loc, state, + parameter `in %s' must be a constant expression, formal-name); -return ir_call::get_error_instruction(ctx); +return false; } - if ((formal-mode == ir_var_out) - || (formal-mode == ir_var_inout)) { + /* Verify that 'out' and 'inout' actual parameters are lvalues. */ + if (formal-mode == ir_var_out || formal-mode == ir_var_inout) { const char *mode = NULL; switch (formal-mode) { case ir_var_out: mode = out; break; case ir_var_inout: mode = inout; break; default: assert(false); break; } -/* FIXME: 'loc' is incorrect (as of 2011-01-21). It is always - * FIXME: 0:0(0). + +/* This AST-based check catches errors like f(i++). The IR-based + * is_lvalue() is insufficient because the actual parameter at the + * IR-level is just a
[Mesa-dev] [PATCH 6/9] glsl: Split out ir_reader's ability to read ir_dereference_variables.
Most of the time, we just want to read an ir_dereference, so there's no need to have these in separate functions. However, the next patch will want to read an ir_dereference_variable directly. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/glsl/ir_reader.cpp | 28 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 6f50cc4..e66ae47 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -61,6 +61,7 @@ private: ir_texture *read_texture(s_expression *); ir_dereference *read_dereference(s_expression *); + ir_dereference_variable *read_var_ref(s_expression *); }; ir_reader::ir_reader(_mesa_glsl_parse_state *state) : state(state) @@ -828,17 +829,11 @@ ir_reader::read_constant(s_expression *expr) return new(mem_ctx) ir_constant(type, data); } -ir_dereference * -ir_reader::read_dereference(s_expression *expr) +ir_dereference_variable * +ir_reader::read_var_ref(s_expression *expr) { s_symbol *s_var; - s_expression *s_subject; - s_expression *s_index; - s_symbol *s_field; - s_pattern var_pat[] = { var_ref, s_var }; - s_pattern array_pat[] = { array_ref, s_subject, s_index }; - s_pattern record_pat[] = { record_ref, s_subject, s_field }; if (MATCH(expr, var_pat)) { ir_variable *var = state-symbols-get_variable(s_var-value()); @@ -847,6 +842,23 @@ ir_reader::read_dereference(s_expression *expr) return NULL; } return new(mem_ctx) ir_dereference_variable(var); + } + return NULL; +} + +ir_dereference * +ir_reader::read_dereference(s_expression *expr) +{ + s_expression *s_subject; + s_expression *s_index; + s_symbol *s_field; + + s_pattern array_pat[] = { array_ref, s_subject, s_index }; + s_pattern record_pat[] = { record_ref, s_subject, s_field }; + + ir_dereference_variable *var_ref = read_var_ref(expr); + if (var_ref != NULL) { + return var_ref; } else if (MATCH(expr, array_pat)) { ir_rvalue *subject = read_rvalue(s_subject); if (subject == NULL) { -- 1.7.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/9] glsl: Use ir_rvalue to represent generic error_type values.
Currently, ir_call can be used as either a statement (for void functions) or a value (for non-void functions). This is rather awkward, as it's the only class that can be used in both forms. A number of places use ir_call::get_error_instruction() to construct a generic value of error_type. If ir_call is to become a statement, it can no longer serve this purpose. Unfortunately, none of our classes are particularly well suited for this, and creating a new one would be rather aggrandizing. So, this patch introduces ir_rvalue::error_value(), a static method that creates an instance of the base class, ir_rvalue. This has the nice property that you can't accidentally try and access uninitialized fields (as it doesn't have any). The downside is that the base class is no longer abstract. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/glsl/ast_function.cpp| 32 +++--- src/glsl/ast_to_hir.cpp |2 +- src/glsl/hir_field_selection.cpp |2 +- src/glsl/ir.cpp | 10 src/glsl/ir.h| 35 +++-- src/glsl/ir_clone.cpp| 10 ++-- src/glsl/ir_constant_expression.cpp |7 ++ src/glsl/ir_hierarchical_visitor.cpp |9 src/glsl/ir_hierarchical_visitor.h |1 + src/glsl/ir_hv_accept.cpp|7 ++ src/glsl/ir_print_visitor.cpp|4 +++ src/glsl/ir_print_visitor.h |1 + src/glsl/ir_visitor.h|1 + 13 files changed, 80 insertions(+), 41 deletions(-) diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 9ffbce6..934bc5e 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -602,7 +602,7 @@ process_array_constructor(exec_list *instructions, parameter%s, (constructor_type-length != 0) ? at least : exactly, min_param, (min_param = 1) ? : s); - return ir_call::get_error_instruction(ctx); + return ir_rvalue::error_value(ctx); } if (constructor_type-length == 0) { @@ -1239,7 +1239,7 @@ ast_function_expression::hir(exec_list *instructions, _mesa_glsl_error( loc, state, unknown type `%s' (structure name may be shadowed by a variable with the same name), type-type_name); -return ir_call::get_error_instruction(ctx); +return ir_rvalue::error_value(ctx); } @@ -1248,14 +1248,14 @@ ast_function_expression::hir(exec_list *instructions, if (constructor_type-is_sampler()) { _mesa_glsl_error( loc, state, cannot construct sampler type `%s', constructor_type-name); -return ir_call::get_error_instruction(ctx); +return ir_rvalue::error_value(ctx); } if (constructor_type-is_array()) { if (state-language_version = 110) { _mesa_glsl_error( loc, state, array constructors forbidden in GLSL 1.10); - return ir_call::get_error_instruction(ctx); + return ir_rvalue::error_value(ctx); } return process_array_constructor(instructions, constructor_type, @@ -1286,7 +1286,7 @@ ast_function_expression::hir(exec_list *instructions, insufficient parameters to constructor for `%s', constructor_type-name); - return ir_call::get_error_instruction(ctx); + return ir_rvalue::error_value(ctx); } if (apply_implicit_conversion(constructor_type-fields.structure[i].type, @@ -1300,7 +1300,7 @@ ast_function_expression::hir(exec_list *instructions, constructor_type-fields.structure[i].name, ir-type-name, constructor_type-fields.structure[i].type-name); - return ir_call::get_error_instruction(ctx);; + return ir_rvalue::error_value(ctx);; } node = node-next; @@ -1309,7 +1309,7 @@ ast_function_expression::hir(exec_list *instructions, if (!node-is_tail_sentinel()) { _mesa_glsl_error(loc, state, too many parameters in constructor for `%s', constructor_type-name); - return ir_call::get_error_instruction(ctx); + return ir_rvalue::error_value(ctx); } ir_rvalue *const constant = @@ -1323,7 +1323,7 @@ ast_function_expression::hir(exec_list *instructions, } if (!constructor_type-is_numeric() !constructor_type-is_boolean()) -return ir_call::get_error_instruction(ctx); +return ir_rvalue::error_value(ctx); /* Total number of components of the type being constructed. */ const unsigned type_components =
[Mesa-dev] [PATCH 7/9] glsl: Convert ir_call to be a statement rather than a value.
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) Unfortunately, ir_call confused all this: - For void functions, we placed ir_call directly in the instruction stream, treating it as an untyped statement. Yet, it was a subclass of ir_rvalue, and no other ir_rvalue could be used in this way. - For functions with a return value, ir_call could be placed in arbitrary expression trees. While this fit naturally with the source language, it meant that expressions might not be pure, making it difficult to transform and optimize them. To combat this, we always emitted ir_call directly in the RHS of an ir_assignment, only using a temporary variable in expression trees. Many passes relied on this assumption; the acos and atan built-ins violated it. This patch makes ir_call a statement (ir_instruction) rather than a value (ir_rvalue). Non-void calls now take a ir_dereference of a variable, and store the return value there---effectively a call and assignment rolled into one. They cannot be embedded in expressions. All expression trees are now pure, without exception. Signed-off-by: Kenneth Graunke kenn...@whitecape.org Reviewed-by: Eric Anholt e...@anholt.net [v1/mostly optimization] --- src/glsl/ast_function.cpp | 46 +++ src/glsl/builtins/ir/acos.ir | 23 ++--- src/glsl/builtins/ir/atan.ir | 80 ++--- src/glsl/ir.cpp |2 - src/glsl/ir.h | 22 ++--- src/glsl/ir_basic_block.cpp | 46 +-- src/glsl/ir_clone.cpp |6 ++- src/glsl/ir_constant_expression.cpp |3 - src/glsl/ir_expression_flattening.cpp |5 -- src/glsl/ir_hv_accept.cpp |8 +++ src/glsl/ir_print_visitor.cpp |5 ++- src/glsl/ir_reader.cpp| 32 ++--- src/glsl/ir_validate.cpp | 17 +++ src/glsl/linker.cpp | 10 src/glsl/opt_constant_folding.cpp | 10 src/glsl/opt_constant_variable.cpp| 12 + src/glsl/opt_dead_code.cpp|3 +- src/glsl/opt_dead_code_local.cpp |7 +--- src/glsl/opt_function_inlining.cpp| 62 ++--- src/glsl/opt_tree_grafting.cpp|3 + 20 files changed, 194 insertions(+), 208 deletions(-) I suggest ignoring the built-ins when reading this patch. diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 934bc5e..dfdbc55 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -269,29 +269,21 @@ generate_call(exec_list *instructions, ir_function_signature *sig, formal_iter.next(); } - /* Always insert the call in the instruction stream, and return a deref -* of its return val if it returns a value, since we don't know if -* the rvalue is going to be assigned to anything or not. + /* If the function call is a constant expression, don't generate any +* instructions; just generate an ir_constant. * -* Also insert any out parameter conversions after the call. +* Function calls were first allowed to be constant expressions in GLSL 1.20. */ - ir_call *call = new(ctx) ir_call(sig, actual_parameters); - ir_dereference_variable *deref; - if (!sig-return_type-is_void()) { - /* If the function call is a constant expression, don't - * generate the instructions to call it; just generate an - * ir_constant representing the constant value. - * - * Function calls can only be constant expressions starting - * in GLSL 1.20. - */ - if (state-language_version = 120) { -ir_constant *const_val = call-constant_expression_value(); -if (const_val) { - return const_val; -} + if (state-language_version = 120) { + ir_constant *value = sig-constant_expression_value(actual_parameters); + if (value != NULL) { +return value; } + } + ir_dereference_variable *deref = NULL; + if (!sig-return_type-is_void()) { + /* Create a new temporary to hold the return value. */ ir_variable *var; var = new(ctx) ir_variable(sig-return_type, @@ -301,18 +293,14 @@ generate_call(exec_list *instructions, ir_function_signature *sig, instructions-push_tail(var); deref = new(ctx) ir_dereference_variable(var); - ir_assignment *assign = new(ctx) ir_assignment(deref, call, NULL); - instructions-push_tail(assign); - *call_ir = call; - - deref = new(ctx) ir_dereference_variable(var); - } else { - instructions-push_tail(call); - *call_ir = call; - deref = NULL; } + ir_call *call = new(ctx) ir_call(sig, deref, actual_parameters); + instructions-push_tail(call); + + /* Also emit any necessary out-parameter
[Mesa-dev] [PATCH 8/9] glsl: Remove ir_call::get_callee() and set_callee().
Previously, set_callee() performed some assertions about the type of the ir_call; protecting the bare pointer ensured these checks would be run. However, ir_call no longer has a type, so the getter and setter methods don't actually do anything useful. Remove them in favor of accessing callee directly, as is done with most other fields in our IR. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/glsl/ir.cpp|5 - src/glsl/ir.h | 21 + src/glsl/ir_clone.cpp |4 ++-- src/glsl/ir_function_can_inline.cpp|2 +- src/glsl/ir_function_detect_recursion.cpp |2 +- src/glsl/ir_validate.cpp |2 +- src/glsl/link_functions.cpp|6 +++--- src/glsl/linker.cpp|2 +- src/glsl/lower_clip_distance.cpp |2 +- src/glsl/opt_constant_folding.cpp |2 +- src/glsl/opt_constant_propagation.cpp |2 +- src/glsl/opt_constant_variable.cpp |2 +- src/glsl/opt_copy_propagation.cpp |2 +- src/glsl/opt_copy_propagation_elements.cpp |2 +- src/glsl/opt_dead_functions.cpp|2 +- src/glsl/opt_tree_grafting.cpp |2 +- src/mesa/program/ir_to_mesa.cpp|2 +- src/mesa/state_tracker/st_glsl_to_tgsi.cpp |2 +- 18 files changed, 24 insertions(+), 40 deletions(-) diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 3595e74..1ba8751 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1467,11 +1467,6 @@ ir_rvalue::error_value(void *mem_ctx) return v; } -void -ir_call::set_callee(ir_function_signature *sig) -{ - this-callee = sig; -} void visit_exec_list(exec_list *list, ir_visitor *visitor) diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 054e2ac..6adfaa3 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1072,19 +1072,6 @@ public: } /** -* Get the function signature bound to this function call -*/ - ir_function_signature *get_callee() - { - return callee; - } - - /** -* Set the function call target -*/ - void set_callee(ir_function_signature *sig); - - /** * Generates an inline version of the function before @ir, * storing the return value in return_deref. */ @@ -1096,14 +1083,16 @@ public: */ ir_dereference_variable *return_deref; + /** +* The specific function signature being called. +*/ + ir_function_signature *callee; + /* List of ir_rvalue of paramaters passed in this call. */ exec_list actual_parameters; /** Should this call only bind to a built-in function? */ bool use_builtin; - -private: - ir_function_signature *callee; }; diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 8a9701c..26b0d8f 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -398,9 +398,9 @@ public: * table. If it is found, replace it with the value from the table. */ ir_function_signature *sig = -(ir_function_signature *) hash_table_find(this-ht, ir-get_callee()); +(ir_function_signature *) hash_table_find(this-ht, ir-callee); if (sig != NULL) -ir-set_callee(sig); +ir-callee = sig; /* Since this may be used before function call parameters are flattened, * the children also need to be processed. diff --git a/src/glsl/ir_function_can_inline.cpp b/src/glsl/ir_function_can_inline.cpp index c367c30..7b15d5d 100644 --- a/src/glsl/ir_function_can_inline.cpp +++ b/src/glsl/ir_function_can_inline.cpp @@ -59,7 +59,7 @@ bool can_inline(ir_call *call) { ir_function_can_inline_visitor v; - const ir_function_signature *callee = call-get_callee(); + const ir_function_signature *callee = call-callee; if (!callee-is_defined) return false; diff --git a/src/glsl/ir_function_detect_recursion.cpp b/src/glsl/ir_function_detect_recursion.cpp index 890bc45..0a5e647 100644 --- a/src/glsl/ir_function_detect_recursion.cpp +++ b/src/glsl/ir_function_detect_recursion.cpp @@ -217,7 +217,7 @@ public: if (this-current == NULL) return visit_continue; - function *const target = this-get_function(call-get_callee()); + function *const target = this-get_function(call-callee); /* Create a link from the caller to the callee. */ diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 385ef12..0803851 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -541,7 +541,7 @@ ir_validate::visit_enter(ir_assignment *ir) ir_visitor_status ir_validate::visit_enter(ir_call *ir) { - ir_function_signature *const callee = ir-get_callee(); + ir_function_signature *const callee = ir-callee; if (callee-ir_type != ir_type_function_signature) { printf(IR called by ir_call is not ir_function_signature!\n); diff --git a/src/glsl/link_functions.cpp
[Mesa-dev] [PATCH 9/9] glsl: Demote 'type' from ir_instruction to ir_rvalue and ir_variable.
Variables have types, expression trees have types, but statements don't. Rather than have a nonsensical field that stays NULL in the base class, just move it to where it makes sense. Fix up a few places that lazily used ir_instruction even though they actually knew the particular subclass. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/glsl/ast_function.cpp|2 +- src/glsl/ir.h|9 +++-- src/glsl/ir_function.cpp |2 +- src/glsl/ir_validate.cpp |4 +++- src/glsl/lower_variable_index_to_cond_assign.cpp |2 +- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |2 +- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index dfdbc55..3940101 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -83,7 +83,7 @@ prototype_string(const glsl_type *return_type, const char *name, const char *comma = ; foreach_list(node, parameters) { - const ir_instruction *const param = (ir_instruction *) node; + const ir_variable *const param = (ir_variable *) node; ralloc_asprintf_append(str, %s%s, comma, param-type-name); comma = , ; diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 6adfaa3..b1ae6db 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -88,7 +88,6 @@ enum ir_node_type { class ir_instruction : public exec_node { public: enum ir_node_type ir_type; - const struct glsl_type *type; /** ir_print_visitor helper for debugging. */ void print(void) const; @@ -127,7 +126,6 @@ protected: ir_instruction() { ir_type = ir_type_unset; - type = NULL; } }; @@ -137,6 +135,8 @@ protected: */ class ir_rvalue : public ir_instruction { public: + const struct glsl_type *type; + virtual ir_rvalue *clone(void *mem_ctx, struct hash_table *) const; virtual void accept(ir_visitor *v) @@ -321,6 +321,11 @@ public: glsl_interp_qualifier determine_interpolation_mode(bool flat_shade); /** +* Declared type of the variable +*/ + const struct glsl_type *type; + + /** * Delcared name of the variable */ const char *name; diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index b34a500..a525693 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -59,7 +59,7 @@ parameter_lists_match(const exec_list *list_a, const exec_list *list_b) const ir_variable *const param = (ir_variable *) node_a; - const ir_instruction *const actual = (ir_instruction *) node_b; + const ir_rvalue *const actual = (ir_rvalue *) node_b; if (param-type == actual-type) continue; diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 0803851..618c111 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -628,7 +628,9 @@ check_node_type(ir_instruction *ir, void *data) printf(Instruction node with unset type\n); ir-print(); printf(\n); } - assert(ir-type != glsl_type::error_type); + ir_rvalue *value = ir-as_rvalue(); + if (value != NULL) + assert(value-type != glsl_type::error_type); } void diff --git a/src/glsl/lower_variable_index_to_cond_assign.cpp b/src/glsl/lower_variable_index_to_cond_assign.cpp index f8e4a1d..5777107 100644 --- a/src/glsl/lower_variable_index_to_cond_assign.cpp +++ b/src/glsl/lower_variable_index_to_cond_assign.cpp @@ -117,7 +117,7 @@ compare_index_block(exec_list *instructions, ir_variable *index, } static inline bool -is_array_or_matrix(const ir_instruction *ir) +is_array_or_matrix(const ir_rvalue *ir) { return (ir-type-is_array() || ir-type-is_matrix()); } diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index b4ef80b..186cd0b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -1412,7 +1412,7 @@ fs_visitor::visit(ir_constant *ir) } } else if (ir-type-is_record()) { foreach_list(node, ir-components) { -ir_instruction *const field = (ir_instruction *) node; +ir_constant *const field = (ir_constant *) node; const unsigned size = type_size(field-type); field-accept(this); -- 1.7.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 11/14] i965/gen7: Fix the /* ignored */ comment on constant surface setup.
On 03/28/2012 10:58 AM, Eric Anholt wrote: It turns out this field *is* used, and it's the stride between samples from the buffer. Discovered during TBO debugging. --- src/mesa/drivers/dri/i965/gen7_wm_surface_state.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Oh, right. It's ignored by the OWORD_DUAL_BLOCK_READ message that we use, but *is* used by the sampler messages. I discovered this when cherry-picking my change to use LD/samplers for constants on Gen7...but forgot to update the comment. Sorry about that! Reviewed-by: Kenneth Graunke kenn...@whitecape.org diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c index c52f6aa..57fa540 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c @@ -157,7 +157,7 @@ gen7_create_constant_surface(struct brw_context *brw, surf-ss2.width = w 0x7f;/* bits 6:0 of size or width */ surf-ss2.height = (w 7) 0x1fff; /* bits 19:7 of size or width */ surf-ss3.depth = (w 20) 0x7f;/* bits 26:20 of size or width */ - surf-ss3.pitch = (16 - 1); /* ignored */ + surf-ss3.pitch = (16 - 1); /* stride between samples */ gen7_set_surface_tiling(surf, I915_TILING_NONE); /* tiling now allowed */ /* Emit relocation to surface contents. Section 5.1.1 of the gen4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 47967] gallium driver svga doesn't compile with LIBDRM_LIBS=-L/usr/lib/x86_64-linux-gnu/
https://bugs.freedesktop.org/show_bug.cgi?id=47967 --- Comment #4 from Alexandre Demers alexandre.f.dem...@gmail.com 2012-03-28 20:57:26 PDT --- Confirmed, I understood what you meant (have both -L... and -ldrm exported). 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 47873] [PATCH] Building libxatracker.o is broken when using --enable-32-bit on a 64bit OS
https://bugs.freedesktop.org/show_bug.cgi?id=47873 Alexandre Demers alexandre.f.dem...@gmail.com changed: What|Removed |Added AssignedTo|mesa-dev@lists.freedesktop. |alexandre.f.dem...@gmail.co |org |m -- 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
See also this bug report and mail thread: https://bugs.freedesktop.org/show_bug.cgi?id=36792 http://lists.freedesktop.org/archives/mesa-dev/2011-August/011099.html Current Ubuntu mesa package also include updated patches. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev