mesa.git
11 years agor600g/llvm: Add dummy export for vs output
Vincent Lejeune [Fri, 25 Jan 2013 15:27:06 +0000 (16:27 +0100)]
r600g/llvm: Add dummy export for vs output

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=59588
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agor600g: Fix building with --enable-r600-llvm-compiler
Tom Stellard [Sat, 26 Jan 2013 01:50:31 +0000 (20:50 -0500)]
r600g: Fix building with --enable-r600-llvm-compiler

https://bugs.freedesktop.org/show_bug.cgi?id=59877

11 years agor600g: don't emit WAIT_UNTIL on cayman/TN (v2)
Alex Deucher [Mon, 28 Jan 2013 03:13:52 +0000 (22:13 -0500)]
r600g: don't emit WAIT_UNTIL on cayman/TN (v2)

It shouldn't be needed and older kernels don't support
it.

v2: Replace with PS partial flush as before.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=59945

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor600g: add async for staging buffer upload v2
Jerome Glisse [Mon, 7 Jan 2013 22:45:59 +0000 (17:45 -0500)]
r600g: add async for staging buffer upload v2

v2: Add virtual address to dma src/dst offset for cayman

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agor600g: add multi ring support with dma as first second ring v4
Jerome Glisse [Mon, 7 Jan 2013 19:25:11 +0000 (14:25 -0500)]
r600g: add multi ring support with dma as first second ring v4

We keep track of ring emission order in a stack, whenever we need to
flush we empty the stack in a fifo order. There is few helpers function
for bo mapping and other ring activities that will make sure that
the ring stack is properly flush and submitted.

v2: fix st flush path, and other flush path to properly flush all
    rings if necessary
v3: - improve name of ring helpers
    - make sure that each time a cs is gona be written it endup at
      top of the stack to avoid any issue such as :
      STACK[0] = dma (withbo A,B)
      STACK[1] = gfx (withbo C,D)
      Now if code try to emit a dma command relative to bo C or D
      it will start writting cmd stream into the cs and once it
      reach the point where it adds relocation it will flush.
      At that point the cs will have cmd that don't have proper
      relocation into the relocation buffer and kernel will just
      refuse to run.
v4: - Drop the stack idea as it turn out there is no way to use it
      or benefit from it. Any time the driver start command on other
      ring, it always need to flush the previous ring. So make code
      simpler by not using a stack.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agoradeon/winsys: add dma ring support to winsys v3
Jerome Glisse [Mon, 7 Jan 2013 16:49:23 +0000 (11:49 -0500)]
radeon/winsys: add dma ring support to winsys v3

Add ring support, you can create a cs for each ring. DMA ring is
bit special regarding relocation as you must emit as much relocation
as there is use of the buffer.

v2: - Improved comment on relocation changes
    - Use a single thread to queue cs submittion this simplify driver
      code while not impacting performances. Rational for this is that
      you have to wait for all previous submission to have completed
      so there was never a case while we could have 2 different thread
      submitting a command stream at the same time. This code just
      consolidate submission into one single thread per winsys.
v3: - Do not use semaphore for empty queue signaling, instead use
      cond var. This is because it's tricky to maintain an even number
      of call to semaphore wait and semaphore signal (the number of
      cs in the stack would for instance make that number vary).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agogallivm,draw,llvmpipe: mass rename of unit->texture_unit/sampler_unit
Roland Scheidegger [Sat, 26 Jan 2013 00:33:43 +0000 (16:33 -0800)]
gallivm,draw,llvmpipe: mass rename of unit->texture_unit/sampler_unit

Make it obvious what "unit" this is (no change in functionality).
draw still uses "unit" in places where it changes the shader by adding
texture sampling itself - it seems like this can't work with shaders
using dx10-style sample opcodes (can't mix gl-style and dx10-style
sample instructions in a shader).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: split sampler and texture state
Roland Scheidegger [Mon, 28 Jan 2013 14:50:36 +0000 (06:50 -0800)]
gallivm: split sampler and texture state

Split the sampler interface to use separate sampler and texture (sampler_view)
state. This is needed to support dx10-style sampling instructions.
This is not quite complete since both draw/llvmpipe don't really track
textures/samplers independently yet, as well as the gallivm code not quite
using the right sampler or texture index respectively (but it should work
for the sampling codes used by opengl).
We are however losing some optimizations in the process, apply_max_lod will
no longer work, and we potentially could end up with more (unnecessary)
recompiles (if switching textures with/without mipmaps only so it shouldn't
be too bad).

v2: don't use different callback structs for sampler/sampler view functions
(which just complicates things), fix up sampling code to actually use the
right texture or sampler index, and similar for llvmpipe/draw actually
distinguish between samplers and sampler views.

v3: fix more of PIPE_MAX_SAMPLER / PIPE_MAX_SHADER_SAMPLER_VIEWS mismatches
(both in draw and llvmpipe), based on feedback from José get rid of unneeded
static sampler derived state.(which also fixes the only 2 piglit regressions
due to a forgotten assignment), fix comments based on Brian's feedback.

v4: remove some accidental unrelated whitespace changes

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/u_upload_mgr: fix a serious memory leak
Marek Olšák [Mon, 28 Jan 2013 01:47:24 +0000 (02:47 +0100)]
gallium/u_upload_mgr: fix a serious memory leak

It can eat all memory and crash in a matter of minutes with r600g.

11 years agonouveau: don't try to use push_data if it's not implemented
Christoph Bumiller [Fri, 25 Jan 2013 18:37:40 +0000 (19:37 +0100)]
nouveau: don't try to use push_data if it's not implemented

11 years agogles3: Update gl3.h
Matt Turner [Sat, 26 Jan 2013 00:07:49 +0000 (16:07 -0800)]
gles3: Update gl3.h

Contains a fix for Khronos bug 9557.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agor600g: add more cases for copying unsupported formats to resource_copy_region
Marek Olšák [Fri, 25 Jan 2013 17:36:19 +0000 (18:36 +0100)]
r600g: add more cases for copying unsupported formats to resource_copy_region

just in case a new format is added to gallium

11 years agor600g: don't use radeon_surface_level::npix_x/y/z
Marek Olšák [Fri, 25 Jan 2013 17:27:05 +0000 (18:27 +0100)]
r600g: don't use radeon_surface_level::npix_x/y/z

npix_x/y/z is wrong with NPOT textures, since it's always aligned to POT
if the level is non-zero, so we can't use that.

This fixes piglit/spec/EXT_texture_shared_exponent/fbo-generatemipmap-formats.

11 years agor600g: fix compile warnings in r600_cp_dma_copy_buffer on 32-bit gcc
Marek Olšák [Sat, 26 Jan 2013 13:50:36 +0000 (14:50 +0100)]
r600g: fix compile warnings in r600_cp_dma_copy_buffer on 32-bit gcc

11 years agor600g: fix up CP DMA for VM on cayman and TN
Alex Deucher [Fri, 25 Jan 2013 23:42:27 +0000 (18:42 -0500)]
r600g: fix up CP DMA for VM on cayman and TN

Need to add the virtual address.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agosvga: use pipe_sampler_view_release() in svga_cleanup_tss_binding()
Brian Paul [Tue, 27 Nov 2012 22:17:27 +0000 (15:17 -0700)]
svga: use pipe_sampler_view_release() in svga_cleanup_tss_binding()

Fixes a crash when the Redway3D Turbine demo exits.  We've made this
change in other places in the past.  The root issue is texture objects
are being shared by multiple contexts and sampler views get shared too.
Sampler views have a context pointer and if that context gets deleted
we may try to reference that context when finally deleting the sampler
view.

pipe_sampler_view_release() avoids this problem because it takes
an explicit context.

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agost/mesa: handle new GLSL IR enumerants in switch statements
Brian Paul [Fri, 25 Jan 2013 17:30:31 +0000 (10:30 -0700)]
st/mesa: handle new GLSL IR enumerants in switch statements

To silence warnings about unhandled cases.

11 years agosvga: add NULL pointer check in svga_create_sampler_state()
Brian Paul [Thu, 24 Jan 2013 23:53:33 +0000 (16:53 -0700)]
svga: add NULL pointer check in svga_create_sampler_state()

Note: This is a candidate for the 9.0 branch.

11 years agovbo: add a null pointer check to handle OOM instead of crashing
Brian Paul [Thu, 24 Jan 2013 23:32:42 +0000 (16:32 -0700)]
vbo: add a null pointer check to handle OOM instead of crashing

Note: This is a candidate for the 9.0 branch.

11 years agoutil: add new error checking code in vbuf helper
Brian Paul [Thu, 24 Jan 2013 23:06:20 +0000 (16:06 -0700)]
util: add new error checking code in vbuf helper

Check the return value of calls to u_upload_alloc() and
u_upload_data() and return early if needed.

Since we don't have a way to propagate errors all the way up to
Mesa through pipe_context::draw_vbo(), call debug_warn_once() so
the user might have some clue about OOM errors.

Note: This is a candidate for the 9.0 branch.

11 years agost/mesa: do proper error checking for u_upload_alloc() calls
Brian Paul [Thu, 24 Jan 2013 21:51:05 +0000 (14:51 -0700)]
st/mesa: do proper error checking for u_upload_alloc() calls

We weren't properly checking the return value of these calls (and
calls to u_upload_data()) to detect OOM errors.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: add some defensive coding in u_upload_alloc()
Brian Paul [Thu, 24 Jan 2013 21:44:09 +0000 (14:44 -0700)]
util: add some defensive coding in u_upload_alloc()

Some callers of this function were checking the 'ptr' result to see if
the function failed.  But the correct way is to check the regular
return value for PIPE_ERROR_x.  Now we initialize all the returned
values at the top of the function in case we do hit an error (like OOM).

Callers are more likely to detect OOM conditions now.  But there
are some callers which don't do any error checking...

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoglsl: use glsl_strtof() instead of glsl_strtod()
Brian Paul [Wed, 23 Jan 2013 00:50:53 +0000 (17:50 -0700)]
glsl: use glsl_strtof() instead of glsl_strtod()

Since the result of those calls is always assigned to a float.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglsl: add new glsl_strtof() function
Brian Paul [Wed, 23 Jan 2013 16:05:30 +0000 (09:05 -0700)]
glsl: add new glsl_strtof() function

Note, we could alternately implement this in terms of glsl_strtod()
with a (float) cast.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agosoftpipe: add casts to silence MSVC warnings
Brian Paul [Wed, 23 Jan 2013 00:46:40 +0000 (17:46 -0700)]
softpipe: add casts to silence MSVC warnings

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoutil: silence MSVC signed/unsigned comparison warnings
Brian Paul [Wed, 23 Jan 2013 00:46:13 +0000 (17:46 -0700)]
util: silence MSVC signed/unsigned comparison warnings

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoutil: silence MSVC double->float conversion warnings
Brian Paul [Wed, 23 Jan 2013 00:45:57 +0000 (17:45 -0700)]
util: silence MSVC double->float conversion warnings

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoutil: silence MSVC signed/unsigned warnings in debug_get_flags_option()
Brian Paul [Wed, 23 Jan 2013 00:45:25 +0000 (17:45 -0700)]
util: silence MSVC signed/unsigned warnings in debug_get_flags_option()

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agost/mesa: silence assorted MSVC warnings in DrawPixels code
Brian Paul [Wed, 23 Jan 2013 00:44:59 +0000 (17:44 -0700)]
st/mesa: silence assorted MSVC warnings in DrawPixels code

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoswrast: silence a bunch of MSVC warnings
Brian Paul [Wed, 23 Jan 2013 00:44:41 +0000 (17:44 -0700)]
swrast: silence a bunch of MSVC warnings

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agomesa: use GLbitfield64 when copying program inputs
Brian Paul [Wed, 23 Jan 2013 00:44:02 +0000 (17:44 -0700)]
mesa: use GLbitfield64 when copying program inputs

Note: This is a candidate for the 9.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agomesa: add some casts to silence MSVC warnings
Brian Paul [Wed, 23 Jan 2013 00:19:30 +0000 (17:19 -0700)]
mesa: add some casts to silence MSVC warnings

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agomesa: add casts in _mesa_GetTexParameterfv() to silence warnings
Brian Paul [Wed, 23 Jan 2013 00:17:24 +0000 (17:17 -0700)]
mesa: add casts in _mesa_GetTexParameterfv() to silence warnings

There are other similar int->float casts elsewhere in the function.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoi965: Enable ARB_shading_language_packing
Matt Turner [Wed, 23 Jan 2013 05:06:12 +0000 (21:06 -0800)]
i965: Enable ARB_shading_language_packing

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Assert that the 4x8 pack/unpack operations have been lowered
Matt Turner [Tue, 22 Jan 2013 01:50:41 +0000 (17:50 -0800)]
i965: Assert that the 4x8 pack/unpack operations have been lowered

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Lower the 4x8 pack/unpack operations
Matt Turner [Tue, 22 Jan 2013 01:46:01 +0000 (17:46 -0800)]
i965: Lower the 4x8 pack/unpack operations

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Add support for lowering 4x8 pack/unpack operations
Matt Turner [Mon, 21 Jan 2013 23:31:00 +0000 (15:31 -0800)]
glsl: Add support for lowering 4x8 pack/unpack operations

Lower them to arithmetic and bit manipulation expressions.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Evaluate constant pack/unpack 4x8 expressions
Matt Turner [Mon, 21 Jan 2013 22:53:26 +0000 (14:53 -0800)]
glsl: Evaluate constant pack/unpack 4x8 expressions

That is, evaluate constant expressions for the following functions:
  packSnorm4x8, unpackSnorm4x8
  packUnorm4x8, unpackUnorm4x8

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Extend ir_expression_operation for ARB_shading_language_packing
Matt Turner [Mon, 21 Jan 2013 22:12:37 +0000 (14:12 -0800)]
glsl: Extend ir_expression_operation for ARB_shading_language_packing

For each function {pack,unpack}{Snorm,Unorm}4x8, add a corresponding
opcode to enum ir_expression_operation. Validate the new opcodes in
ir_validate.cpp.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Add IR lisp for ARB_shading_language_packing
Matt Turner [Mon, 21 Jan 2013 22:00:41 +0000 (14:00 -0800)]
glsl: Add IR lisp for ARB_shading_language_packing

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Add infrastructure for ARB_shading_language_packing
Matt Turner [Tue, 22 Jan 2013 01:09:53 +0000 (17:09 -0800)]
glsl: Add infrastructure for ARB_shading_language_packing

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoconfigure.ac: Don't set LLVM_LIBS when llvm is disabled
Tom Stellard [Fri, 25 Jan 2013 17:46:55 +0000 (12:46 -0500)]
configure.ac: Don't set LLVM_LIBS when llvm is disabled

11 years agor600g: Don't build llvm_wrapper.cpp when we aren't using LLVM
Tom Stellard [Fri, 25 Jan 2013 15:01:47 +0000 (15:01 +0000)]
r600g: Don't build llvm_wrapper.cpp when we aren't using LLVM

We were using the NEED_RADEON_GALLIUM conditional to decide whether or not
to build llvm_wrapper.cpp, which is required for using the LLVM backend.
llvm_wrapper.cpp needs to be linked against the LLVM IPO libary
and this library is only added to LLVM_LIBS if either opencl or the
r600-llvm-compiler is enabled.

The NEED_RADEON_GALLIUM conditional is set to true when enabling the
radeonsi driver, so if the radeonsi and r600 drivers are enabled without
also enabling opencl or r600-llvm-compiler, llvm_wrapper.cpp will be
built, but the IPO library won't be added to LLVM_LIBS.  This was
causing unresolved symbol errors when buiding with this configuration.

https://bugs.freedesktop.org/show_bug.cgi?id=59831

Tested-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoi965: Pass in the glarray to get_surface_type.
Eric Anholt [Wed, 23 Jan 2013 02:08:37 +0000 (18:08 -0800)]
i965: Pass in the glarray to get_surface_type.

Dereffing all the values in the two callers was just pointless, and
the function isn't inlined so there was actual code impact.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Remove nonsense comment.
Eric Anholt [Wed, 23 Jan 2013 01:55:41 +0000 (17:55 -0800)]
i965: Remove nonsense comment.

vb.inputs_read has never been a thing, even in the initial import.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Remove NDEBUG undef that was snuck in.
Eric Anholt [Wed, 23 Jan 2013 01:42:11 +0000 (17:42 -0800)]
i965: Remove NDEBUG undef that was snuck in.

If you want debug, set --enable-debug in your config flags.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: reuse _mesa_sizeof_type for index buffer types.
Eric Anholt [Wed, 23 Jan 2013 01:39:36 +0000 (17:39 -0800)]
i965: reuse _mesa_sizeof_type for index buffer types.

The core Mesa code has just one more case than this (GL_BITMAP), so I
don't see any cause to special-case it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Reuse precalculated ib_type_size value.
Eric Anholt [Wed, 23 Jan 2013 01:38:37 +0000 (17:38 -0800)]
i965: Reuse precalculated ib_type_size value.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Drop debug check for knowing the size of a type.
Eric Anholt [Wed, 23 Jan 2013 01:36:53 +0000 (17:36 -0800)]
i965: Drop debug check for knowing the size of a type.

This was added in b93684f5f311f89c965960ab42bfea71a397b180, but there's
no need for it -- get_size has to succeed, and it has an assert for us
in debug builds.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Stop worrying about alignment of vertex data.
Eric Anholt [Wed, 23 Jan 2013 01:27:14 +0000 (17:27 -0800)]
i965: Stop worrying about alignment of vertex data.

For our current types, the required alignment is actually just 1 byte.
When we get doubles, we have to worry (those have to be aligned to the
natural size), but we don't have doubles yet and they'll just be a
special case.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Use the glarray _ElementSize that Mesa tracks for us.
Eric Anholt [Wed, 23 Jan 2013 01:14:15 +0000 (17:14 -0800)]
i965: Use the glarray _ElementSize that Mesa tracks for us.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Print more informative debug for _mesa_do_init_remap_table().
Eric Anholt [Wed, 9 Jan 2013 23:33:19 +0000 (15:33 -0800)]
mesa: Print more informative debug for _mesa_do_init_remap_table().

This is the same logic from _mesa_map_function_array().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Remove ir_variable::uniform_block
Ian Romanick [Tue, 22 Jan 2013 06:14:36 +0000 (01:14 -0500)]
glsl: Remove ir_variable::uniform_block

v2: A previous patch contained a spurious hunk that removed an
assignment to ir_variable::uniform_block.  That hunk was moved to this
patch.  Suggested by Carl Worth.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Allow dereferencing fields of an interface instance
Ian Romanick [Tue, 22 Jan 2013 04:19:25 +0000 (23:19 -0500)]
glsl: Allow dereferencing fields of an interface instance

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglsl: Allow elimination of uniform block members
Ian Romanick [Sat, 15 Dec 2012 22:49:53 +0000 (14:49 -0800)]
glsl: Allow elimination of uniform block members

glGetActiveUniform is not supposed to report block members that are not
active even if they are included in the layout of the block.  The block
layout is determined from the GLSL_TYPE_INTERFACE that defines the
block, so eliminating the ir_variables that correspond to the individual
fields is safe.

Fixes gles3conform test
uniform_buffer_object_getuniformindices_for_for_nonexistent_or_not_active_uniform_names.

This also fixes the assertion failures (added in the previous commit) in
gles3conform uniform_buffer_object_index_of_not_active_block,
uniform_buffer_object_inherit_and_override_layouts, and
uniform_buffer_object_repeat_global_scope_layouts.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglsl: Calculate UBO data at link-time
Ian Romanick [Tue, 22 Jan 2013 06:09:16 +0000 (01:09 -0500)]
glsl: Calculate UBO data at link-time

Use the function added in the previous commit.

This temporarily causes gles3conform
uniform_buffer_object_index_of_not_active_block,
uniform_buffer_object_inherit_and_override_layouts, and
uniform_buffer_object_repeat_global_scope_layouts to assertion fail.
This is fixed in the next commit.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglsl: Add link_uniform_blocks to calculate all UBO data at link-time
Ian Romanick [Tue, 22 Jan 2013 05:59:56 +0000 (00:59 -0500)]
glsl: Add link_uniform_blocks to calculate all UBO data at link-time

Calculate all of the block member offsets, the IndexNames, and
everything else to do with every UBO.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglsl: Add a visitor to determine whether a uniform block is ever used
Ian Romanick [Mon, 21 Jan 2013 22:33:47 +0000 (17:33 -0500)]
glsl: Add a visitor to determine whether a uniform block is ever used

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglsl: Lower UBO references using link-time data instead of compile-time data
Ian Romanick [Tue, 22 Jan 2013 05:44:58 +0000 (00:44 -0500)]
glsl: Lower UBO references using link-time data instead of compile-time data

Pretty much all of the compile-time, per-compilation unit block data is
about to get the axe.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglsl: Add gl_uniform_buffer_variable::IndexName field
Ian Romanick [Tue, 22 Jan 2013 05:23:24 +0000 (00:23 -0500)]
glsl: Add gl_uniform_buffer_variable::IndexName field

glGetUniformIndices requires that the block instance index not be
present in the name of queried uniforms.  However,
gl_uniform_buffer_variable::Name will include the instance index.  The
IndexName field is added to handle this difference.

Note that currently IndexName will always point to the same string as
Name.  This will change soon.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Make the align function available elsewhere in the linker
Ian Romanick [Tue, 22 Jan 2013 05:06:10 +0000 (00:06 -0500)]
glsl: Make the align function available elsewhere in the linker

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
11 years agoglsl: Calculate link-time uniform block data without using compile-time block data
Ian Romanick [Tue, 22 Jan 2013 04:57:45 +0000 (23:57 -0500)]
glsl: Calculate link-time uniform block data without using compile-time block data

Pretty much all of the compile-time, per-compilation unit block data is
about to get the axe.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglsl: Assert that interfaces, like structures, are not seen as leaf types
Ian Romanick [Tue, 22 Jan 2013 04:43:25 +0000 (23:43 -0500)]
glsl: Assert that interfaces, like structures, are not seen as leaf types

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add new uniform_field_visitor::process variant
Ian Romanick [Tue, 22 Jan 2013 04:42:19 +0000 (23:42 -0500)]
glsl: Add new uniform_field_visitor::process variant

This flavor takes a type and a base name.  It will be used to handle
cases where the block name (instead of the instance name) is used for an
interface block.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Recurse into uniform blocks just like uniform structures
Ian Romanick [Tue, 22 Jan 2013 04:27:30 +0000 (23:27 -0500)]
glsl: Recurse into uniform blocks just like uniform structures

v2: Inspite of the spell checker, spell recurse correctly.  Suggested by
Carl Worth.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Handle instance array declarations
Ian Romanick [Tue, 22 Jan 2013 04:06:45 +0000 (23:06 -0500)]
glsl: Handle instance array declarations

v2: Add a comment and an assertion about the array size in the
non-instance name case.  Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Track blocks in the symbol table using the glsl_type instead of the gl_uniform_...
Ian Romanick [Tue, 22 Jan 2013 04:01:33 +0000 (23:01 -0500)]
glsl: Track blocks in the symbol table using the glsl_type instead of the gl_uniform_block

Eventually the gl_uniform_block information won't be calculated until
linking.  Block names need to be checked for name clashes during
compiling, so we have to track it differently.

v2: Update the commit message.  Suggested by Carl Worth.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add new uniform_field_visitor::visit_field variant
Ian Romanick [Tue, 22 Jan 2013 03:49:39 +0000 (22:49 -0500)]
glsl: Add new uniform_field_visitor::visit_field variant

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Modify uniform_field_visitor::visit_field to take a row_major parameter
Ian Romanick [Tue, 22 Jan 2013 03:41:13 +0000 (22:41 -0500)]
glsl: Modify uniform_field_visitor::visit_field to take a row_major parameter

Not used yet, but the UBO layout visitor will use this.

v2: Remove a spruious hunk.  This is moved to the patch "glsl: Remove
ir_variable::uniform_block".  Suggested by Carl Worth.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Modify uniform_field_visitor::recursion to take a row_major parameter
Ian Romanick [Tue, 22 Jan 2013 03:32:07 +0000 (22:32 -0500)]
glsl: Modify uniform_field_visitor::recursion to take a row_major parameter

Not used yet, but the UBO layout visitor will use this.

v2: Add some commentary as to why row_major is always set to false in
process.  Suggesed by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add a predicate to determine whether a variable is an interface block
Ian Romanick [Tue, 22 Jan 2013 03:18:16 +0000 (22:18 -0500)]
glsl: Add a predicate to determine whether a variable is an interface block

For the first declaration below, there will be an ir_variable named
"instance" whose type and whose instance_type will be the same
glsl_type.  For the second declaration, there will be an ir_variable
named "f" whose type is float and whose instance_type is B2.

"instance" is an interface instance variable, but "f" is not.

uniform B1 {
    float f;
} instance;

uniform B2 {
    float f;
};

v2: Copy the comment message documentation into the code.  Suggested by
Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Require that indices into uniform block arrays be constants
Ian Romanick [Tue, 22 Jan 2013 03:07:34 +0000 (22:07 -0500)]
glsl: Require that indices into uniform block arrays be constants

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add ir_variable::interface_type field
Ian Romanick [Tue, 22 Jan 2013 02:51:15 +0000 (21:51 -0500)]
glsl: Add ir_variable::interface_type field

For variables that are in an interface block or are an instance of an
interface block, this is the GLSL_TYPE_INTERFACE type for that block.

Convert the ir_variable::is_in_uniform_block method added in the
previous commit to use this field instead of ir_variable::uniform_block.

v2: Fix the place-holder comment on ir_variable::interface_type.
Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add ir_variable::is_in_uniform_block predicate
Ian Romanick [Fri, 14 Dec 2012 20:00:14 +0000 (12:00 -0800)]
glsl: Add ir_variable::is_in_uniform_block predicate

The way a variable is tested for this property is about to change, and
this makes the code easier to modify.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Generate an interface type for uniform blocks
Ian Romanick [Tue, 11 Dec 2012 20:14:03 +0000 (12:14 -0800)]
glsl: Generate an interface type for uniform blocks

If the block has an instance name, add the instance name to the symbol
table instead of the individual fields.

Fixes the piglit test interface-name-access-without-interface-name.vert
for real.

v2: Update the comment before the assertion that interface block
definitions won't generate instructions.  Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Add GLSL_TYPE_INTERFACE
Ian Romanick [Tue, 11 Dec 2012 20:11:16 +0000 (12:11 -0800)]
glsl: Add GLSL_TYPE_INTERFACE

Interfaces are structurally identical to structures from the compiler's
point of view.  They have some additional restrictions, and generally
GPUs use different instructions to access them.  Using a different base
type should make this a bit easier.

This commit also adds the glsl_type::interface_packing fields.  For
GLSL_TYPE_INTERFACE types, this will track the specified packing mode.
It is analogous to gl_uniform_buffer::_Packing.

v2: Add serveral missing GLSL_TYPE_INTERFACE cases in switch-statements.

v3: Add information about glsl_type::interface_packing.  Move row_major
checking in glsl_type::record_key_compare from this patch to the
previous patch.  Both suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add row_major field to glsl_struct_field
Ian Romanick [Tue, 11 Dec 2012 20:09:32 +0000 (12:09 -0800)]
glsl: Add row_major field to glsl_struct_field

For now, this will always be false.  In the near future, an "interface"
type will be added that shares a lot of infrastructure with structures.

v2: Move row_major checking in glsl_type::record_key_compare from the
next patch to this patch.  Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Refactor out processing of structure fields
Ian Romanick [Sun, 9 Dec 2012 01:38:30 +0000 (17:38 -0800)]
glsl: Refactor out processing of structure fields

This will soon also be used for processing interface block fields.

v2: Add a comment explaining the interface of
ast_process_structure_or_interface_block.  Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Parse interface array size
Ian Romanick [Tue, 11 Dec 2012 20:13:30 +0000 (12:13 -0800)]
glsl: Parse interface array size

The size is parsed and stored in the AST, but it is not used yet.
Processing of the array size is added in the patch "glsl: Handle
instance array declarations"

v2: Update the commit message (suggested by Carl Worth).  Add a comment
to ast_uniform_block::array_size (suggested by Paul Berry).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Parse non-array uniform block instance names in GLSL ES 3.00.
Kenneth Graunke [Wed, 28 Nov 2012 07:45:17 +0000 (23:45 -0800)]
glsl: Parse non-array uniform block instance names in GLSL ES 3.00.

In GLSL ES 3.00 (and GLSL 1.50), uniform blocks can have an associated
"instance name", which essentially namespaces the variables inside.

This patch adds basic parsing for this new feature, but doesn't yet hook
it up to actually do anything yet.

It does not support for arrays of interface blocks; a later commit will
take care of that.

This change temporarily regresses the piglit test
interface-name-access-without-interface-name.vert.  This shader failed
to compile before (the expected result), but it failed to compile for
the wrong reason.  This is not a real regression.

v2: Add some comments to ast_uniform_block::instance_name.  Suggested by
Paul Berry.

Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Refactor uniform block parser rules.
Kenneth Graunke [Wed, 28 Nov 2012 07:21:56 +0000 (23:21 -0800)]
glsl: Refactor uniform block parser rules.

The existing code has a lot of duplication; the only difference between
the two cases is whether we merge in an additional layout qualifier.

Apparently creating a layout_qualifieropt rule that can be empty causes
a lot of conflicts and confusion.  However, refactoring out the guts of
the ast_uniform_block creation works fine.

Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agolinker: Refactor intra-stage block compatabililty testing
Ian Romanick [Thu, 13 Dec 2012 10:25:34 +0000 (02:25 -0800)]
linker: Refactor intra-stage block compatabililty testing

Also slightly change the compatibility test.  Instead of comparing the
offsets of the block variables, compare the packing mode of the blocks.
Ideally we don't want to assign the offsets until a later stage of
linking.

This is put in a new file called link_uniform_blocks.cpp.  Some new
functions related to uniform blocks are going to live in that file as
well.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Track the packing mode of a UBO in gl_uniform_buffer
Ian Romanick [Thu, 13 Dec 2012 10:13:30 +0000 (02:13 -0800)]
mesa: Track the packing mode of a UBO in gl_uniform_buffer

This allows the next patch to verify that two uniform blocks match
without first calculating the locations of the fields.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Replace most default cases in switches on GLSL type
Ian Romanick [Tue, 11 Dec 2012 20:56:03 +0000 (12:56 -0800)]
glsl: Replace most default cases in switches on GLSL type

This makes it easier to find switch-statements that need to be updated
after a new GLSL_TYPE_* is added because the compiler will generate a
warning.

Switch-statements that only had a small number of cases (e.g.,
everything in ir_constant_expression.cpp) were not modified.  I may
regret that decision when we eventually add support for doubles.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Correct gen6+ guardband calculation.
Eric Anholt [Wed, 23 Jan 2013 22:30:05 +0000 (14:30 -0800)]
i965: Correct gen6+ guardband calculation.

Too much attention was paid to the first paragraphs, and not enough to
the last little note that "oh, by the way, the rendered things
themselves still have to be clipped to just 8192 wide/high".

Fixes GTF's clip.c test with 4096 or higher width on ivb, where one of
the triangles got the upper half of its pixels dropped.

Tested-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Use GL_RED for DEPTH_TEXTURE_MODE in ES 3.0 for unsized formats.
Kenneth Graunke [Wed, 23 Jan 2013 23:27:39 +0000 (15:27 -0800)]
i965: Use GL_RED for DEPTH_TEXTURE_MODE in ES 3.0 for unsized formats.

Khronos has apparently decided that depth textures with sized formats
(allowed with ARB_internalformat_query or ES 3.0) should be treated as
GL_RED, while unsized formats (an existing feature) should be treated
as GL_INTENSITY for compatibility with ES 2.0.

Ian is proposing changes to ARB_internalformat_query which will make
this actually legal and consistent.

A similar problem exists with GL 4.2, but we're going to ignore that
for the time being.

Tested on Ivybridge: no Piglit regressions; fixes 4 es3conform tests:
- depth_texture_fbo
- depth_texture_fbo_clear
- depth_texture_teximage
- depth_texture_texsubimage

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Bump maximum supported ES2 context version to 3.0
Chad Versace [Wed, 21 Nov 2012 17:28:36 +0000 (09:28 -0800)]
i965: Bump maximum supported ES2 context version to 3.0

Since patch "i965: Validate requested GLES context version in
brwCreateContext", we have been able to create ES 3.0 contexts due to the
max version check.  So...bump the max version.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965/Gen6+: Enable ARB_ES3_compatibility extension
Paul Berry [Tue, 7 Aug 2012 19:39:30 +0000 (12:39 -0700)]
i965/Gen6+: Enable ARB_ES3_compatibility extension

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa/es3: Enable ES 3.0 API and shading language version
Ian Romanick [Wed, 8 Aug 2012 22:25:00 +0000 (15:25 -0700)]
mesa/es3: Enable ES 3.0 API and shading language version

v2: Add ARB_internalformat_query to the list of required extensions.

v3: Add OES_depth_texture_cube_map to the list of required extensions.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoscons: Add imports.c to builtin_compiler build.
Vinson Lee [Fri, 25 Jan 2013 06:36:27 +0000 (22:36 -0800)]
scons: Add imports.c to builtin_compiler build.

Fixes build regression introduced by commit
eac030e38e3cdd4ed4534516e3d3a50c8a372719.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59835

11 years agoi965/fs/gen7: Fix fatal typo in unpackHalf2x16
Chad Versace [Fri, 25 Jan 2013 05:48:40 +0000 (21:48 -0800)]
i965/fs/gen7: Fix fatal typo in unpackHalf2x16

s/src/src_w/

That little typo, which sneaked into v4 of the previous patch, generates
incorrect fs code.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965/fs/gen7: Emit code for GLSL 3.00 pack/unpack operations (v4)
Chad Versace [Wed, 9 Jan 2013 19:46:42 +0000 (11:46 -0800)]
i965/fs/gen7: Emit code for GLSL 3.00 pack/unpack operations (v4)

v2: Remove lewd comment. [for idr]
v3: - Optimize away tmp register for packHalf2x16. [for anholt, paul]
    - Improve comments. [for anholt, paul]
    - Reduce near-duplicate code by removing vec4_visitor emit_pack/unpack
      methods. [for chadv]
v4: Factor our UD/W register conversion into helper function. [for anholt]

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v2)
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965/vs/gen7: Emit code for GLSL ES 3.00 pack/unpack operations (v3)
Chad Versace [Wed, 9 Jan 2013 19:44:31 +0000 (11:44 -0800)]
i965/vs/gen7: Emit code for GLSL ES 3.00 pack/unpack operations (v3)

FIXME: This patch emits VS code that violates documented hardware
restrictions and then relies on undocumented behavior that results from
that violation.  This patch passes all tests, but should be fixed ASAP to
conform to the hardware documentation.

v2: Explain undocumented hardware behavior. Improve comments.
v3: Use ALU1 helper methods F32TO16() and F16TO32(). [for anholt]

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965: Quote the PRM on a HorzStride subtlety
Chad Versace [Wed, 9 Jan 2013 19:40:29 +0000 (11:40 -0800)]
i965: Quote the PRM on a HorzStride subtlety

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965: Add opcodes for F32TO16 and F16TO32
Chad Versace [Wed, 9 Jan 2013 19:35:47 +0000 (11:35 -0800)]
i965: Add opcodes for F32TO16 and F16TO32

The GLSL ES 3.00 operations packHalf2x16 and unpackHalf2x16 will emit
these opcodes.

- Define the opcodes BRW_OPCODE_{F32TO16,F16TO32}.
- Add the opcodes to the brw_disasm table.
- Define convenience functions brw_{F32TO16,F16TO32}.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965: Lower the GLSL ES 3.00 pack/unpack operations (v2)
Chad Versace [Sat, 1 Dec 2012 00:49:21 +0000 (16:49 -0800)]
i965: Lower the GLSL ES 3.00 pack/unpack operations (v2)

On gen < 7, we fully lower all operations to arithmetic and bitwise
operations.

On gen >= 7, we fully lower the Snorm2x16 and Unorm2x16 operations, and
partially lower the Half2x16 operations.

v2:
  - Comment that scalarization is needed only for SOA code [for idr].
  - Replace switch-statement with if-statement [for idr].
  - Remove misplaced hunk from previous patch [found by idr].

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Tuner <mattst88@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoglsl: Add lowering pass for GLSL ES 3.00 pack/unpack operations (v4)
Chad Versace [Mon, 19 Nov 2012 23:15:32 +0000 (15:15 -0800)]
glsl: Add lowering pass for GLSL ES 3.00 pack/unpack operations (v4)

Lower them to arithmetic and bit manipulation expressions.

v2: Rewrite using ir_builder [for idr].
v3: Comment typos. [for mattst88]
v4: Fix arithmetic error in comments.
    Factor out a shift instruction.
    Don't heap allocate factory.instructions.
    [for paul]

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v2)
Reviewed-by: Matt Tuner <mattst88@gmail.com> (v3)
Reviewed-by: Paul Berry <stereotype441@gmail.com> (v4)
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoglsl: Fix type-deduction for and/or/xor expressions
Chad Versace [Tue, 15 Jan 2013 20:16:12 +0000 (12:16 -0800)]
glsl: Fix type-deduction for and/or/xor expressions

In ir_expression's constructor, the cases for {bit,logic}_{and,or,xor}
failed to handle the case when both operands were vectors.

Note: This is a candidate for the stable branches.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoglsl: Reformat and/or/xor cases in ir_expression ctor
Chad Versace [Tue, 15 Jan 2013 20:11:37 +0000 (12:11 -0800)]
glsl: Reformat and/or/xor cases in ir_expression ctor

Replace tabs with spaces. According to docs/devinfo.html, Mesa's
indetation style is:
  indent -br -i3 -npcs --no-tabs infile.c -o outfile.c

This patch prevents whitespace weirdness in the next patch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoglsl/ir_builder: Add helpers for making if-statements
Chad Versace [Fri, 11 Jan 2013 23:53:11 +0000 (15:53 -0800)]
glsl/ir_builder: Add helpers for making if-statements

Add two overloaded variants of
    ir_if *if_tree()

The new functions allow one to chain together if-trees within a single C++
expression that resembles a real if-statement.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>