mesa.git
11 years agoglx: Check that swap_buffers_reply is non-NULL before using it
Stéphane Marchesin [Mon, 28 Jan 2013 23:04:00 +0000 (15:04 -0800)]
glx: Check that swap_buffers_reply is non-NULL before using it

Check that the return value from xcb_dri2_swap_buffers_reply is
non-NULL before accessing the struct members.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: fix comment typo: s/formaat/format/
Brian Paul [Tue, 29 Jan 2013 18:52:39 +0000 (11:52 -0700)]
mesa: fix comment typo: s/formaat/format/

11 years agollvmpipe: Don't advertise S8_UNORM (with feeble attempt at supporting it).
José Fonseca [Tue, 29 Jan 2013 13:27:44 +0000 (13:27 +0000)]
llvmpipe: Don't advertise S8_UNORM (with feeble attempt at supporting it).

S8_UNORM was inadvertedly supported together with Z16_UNORM.

I tried to update the code to accomodate stencil-only -- it seemed a simple
thing to do -- but "fbo-stencil clear GL_STENCIL_INDEX8" still fails,
and it's not worth debugging.

Therefore although this change tries to update for S8_UNORM, it also
disables it completely.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agollvmpipe: Fix deferred depth writes for Z16_UNORM.
José Fonseca [Tue, 29 Jan 2013 10:45:01 +0000 (10:45 +0000)]
llvmpipe: Fix deferred depth writes for Z16_UNORM.

This special path hadn't been exercised by my earlier testing, and mask
values weren't being properly truncated to match the values.

This change fixes that.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw: fix draw_llvm_variant_key struct padding to avoid recompiles
Roland Scheidegger [Tue, 29 Jan 2013 16:39:09 +0000 (08:39 -0800)]
draw: fix draw_llvm_variant_key struct padding to avoid recompiles

The struct padding got broken by c789b981b244333cfc903bcd1e2fefc010500013.
This caused serious performance regression because part of the key was
uninitialized and hence the shader always recompiled (at least on release
builds...).
While here also fix key size calculation when the number of samplers
and the number of sampler views are different.

v2: add comment

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs/relnotes-9.1: document new features in radeon drivers
Marek Olšák [Tue, 29 Jan 2013 16:32:14 +0000 (17:32 +0100)]
docs/relnotes-9.1: document new features in radeon drivers

11 years agodocs: more VMware guest driver info, tips
Brian Paul [Tue, 29 Jan 2013 00:44:46 +0000 (17:44 -0700)]
docs: more VMware guest driver info, tips

11 years agost/mesa: only enable GL_EXT_framebuffer_multisample if GL_MAX_SAMPLES >= 2
Brian Paul [Mon, 28 Jan 2013 18:32:13 +0000 (11:32 -0700)]
st/mesa: only enable GL_EXT_framebuffer_multisample if GL_MAX_SAMPLES >= 2

We never really have multisampling with one sample per pixel.
See also http://bugs.freedesktop.org/show_bug.cgi?id=59873

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: don't enable GL_EXT_framebuffer_multisample for software drivers
Brian Paul [Mon, 28 Jan 2013 18:31:33 +0000 (11:31 -0700)]
mesa: don't enable GL_EXT_framebuffer_multisample for software drivers

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoosmesa: use _mesa_generate_mipmap() for mipmap generation, not meta
Brian Paul [Sat, 26 Jan 2013 18:07:35 +0000 (11:07 -0700)]
osmesa: use _mesa_generate_mipmap() for mipmap generation, not meta

See previous commit for more info.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoxlib: use _mesa_generate_mipmap() for mipmap generation, not meta
Brian Paul [Sat, 26 Jan 2013 17:58:37 +0000 (10:58 -0700)]
xlib: use _mesa_generate_mipmap() for mipmap generation, not meta

The swrast fragment program interpreter has trouble computing the
right texture LOD because it doesn't have easy access to input
derivatives.  This causes the GLSL-based meta generate mipmap code
to fetch texels from the wrong mipmap level.

One possible fix would be to set the GL_TEXTURE_MIN/MAX_LOD parameters
to limit sampling from the right level.  But let's just use the
_mesa_generate_mipmap() fallback since it's a lot faster than using
the fragment shader interpreter.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=54240

Note: This is a candidate for the 9.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agost/mesa: set ctx->Const.MaxSamples = 0, not 1
Brian Paul [Sat, 26 Jan 2013 17:09:37 +0000 (10:09 -0700)]
st/mesa: set ctx->Const.MaxSamples = 0, not 1

The gallium docs for pipe_screen::is_format_supported() says that
samples==0 or samples==1 both mean that multisampling is not supported.
Return GL_MAX_SAMPLES==0 instead of 1 for consistency with other drivers.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoxlib: stop use _mesa_enable_extension(), just set the boolean flags
Brian Paul [Mon, 28 Jan 2013 19:58:53 +0000 (12:58 -0700)]
xlib: stop use _mesa_enable_extension(), just set the boolean flags

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoxlib: fix incorrect GL_ANGLE_texture_compression_dxt enable
Brian Paul [Sat, 26 Jan 2013 16:43:07 +0000 (09:43 -0700)]
xlib: fix incorrect GL_ANGLE_texture_compression_dxt enable

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agollvmpipe: Support Z16_UNORM as depth-stencil format.
José Fonseca [Mon, 28 Jan 2013 19:10:22 +0000 (19:10 +0000)]
llvmpipe: Support Z16_UNORM as depth-stencil format.

Simply by adjusting the vector element width after/before
reading/writing the depth-stencil values.

Ran several GL_DEPTH_COMPONENT16 piglit tests without regressions.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoi965: Add chipset limits for Haswell GT1/GT2.
Kenneth Graunke [Sat, 13 Aug 2011 01:27:16 +0000 (18:27 -0700)]
i965: Add chipset limits for Haswell GT1/GT2.

The maximum number of URB entries come from the 3DSTATE_URB_VS and
3DSTATE_URB_GS state packet documentation; the thread count information
comes from the 3DSTATE_VS and 3DSTATE_PS state packet documentation.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
11 years agointel: Un-hardcode lengths from blitter commands.
Kenneth Graunke [Mon, 14 Jan 2013 22:22:38 +0000 (14:22 -0800)]
intel: Un-hardcode lengths from blitter commands.

The packet length may change at some point in the future.  Specifying it
explicitly (rather than hardcoding it in the command #define) allows us
to change it much more easily in the future.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoRemove APIspec.dtd
Matt Turner [Mon, 21 Jan 2013 18:11:52 +0000 (10:11 -0800)]
Remove APIspec.dtd

Left behind by a8ab7e33.

11 years agodocs: List new extensions added in Mesa 9.1
Matt Turner [Fri, 25 Jan 2013 23:06:16 +0000 (15:06 -0800)]
docs: List new extensions added in Mesa 9.1

I did not list the *_get_program_binary extensions since they're not
useful to anyone with their current implementation (that supports 0
binary formats).

11 years agointel: Use a CPU map of the batch on LLC-sharing architectures.
Eric Anholt [Sat, 19 Jan 2013 02:18:57 +0000 (18:18 -0800)]
intel: Use a CPU map of the batch on LLC-sharing architectures.

Before, we were keeping a CPU-only buffer to accumulate the batchbuffer in,
which was an improvement over mapping the batch through the GTT directly
(since any readback or other failure to stream through write combining
correctly would hurt).  However, on LLC-sharing architectures we can do better
by mapping the batch directly, which reduces the cache footprint of the
application since we no longer have this extra copy of a batchbuffer around.

Improves performance of GLBenchmark 2.1 offscreen on IVB by 3.5% +/- 0.4%
(n=21).  Improves Lightsmark performance by 1.1 +/- 0.1% (n=76).  Improves
cairo-gl performance by 1.9% +/- 1.4% (n=57).

No statistically significant difference in GLB2.1 on SNB (n=37).  Improves
cairo-gl performance by 2.1% +/- 0.1% (n=278).

11 years agor600g: use uint64_t instead of unsigned long for proper 32bits cpu support
Jerome Glisse [Tue, 29 Jan 2013 00:07:10 +0000 (19:07 -0500)]
r600g: use uint64_t instead of unsigned long for proper 32bits cpu support

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agor600g: real fix for non 3.8 kernel
Jerome Glisse [Mon, 28 Jan 2013 22:14:09 +0000 (17:14 -0500)]
r600g: real fix for non 3.8 kernel

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agoi965: Fix assignment instead of comparison in asserts.
Vinson Lee [Sat, 26 Jan 2013 07:27:50 +0000 (08:27 +0100)]
i965: Fix assignment instead of comparison in asserts.

Fixes side effect in assertion defects reported by Coverity.

Note: This is a candidate for the 9.1 branch.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoandroid: use gralloc_drm_get_gem_handle api
Tapani Pälli [Thu, 24 Jan 2013 07:56:47 +0000 (09:56 +0200)]
android: use gralloc_drm_get_gem_handle api

Currently a gralloc internal structure is exposed to Mesa,
Use a query function instead to maintain ABI compatibility.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agointel: Typo fix: "pitsh" -> "pitch"
Paul Berry [Mon, 28 Jan 2013 20:30:46 +0000 (12:30 -0800)]
intel: Typo fix: "pitsh" -> "pitch"

Comment change only.

11 years agor600g: fix segfault with old kernel
Jerome Glisse [Mon, 28 Jan 2013 19:48:46 +0000 (14:48 -0500)]
r600g: fix segfault with old kernel

Old kernel do not have dma support, patch pushed were missing some
of the check needed to not use dma.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agoglx: only advertise GLX_INTEL_swap_event if it's supported
Zack Rusin [Fri, 25 Jan 2013 01:48:12 +0000 (17:48 -0800)]
glx: only advertise GLX_INTEL_swap_event if it's supported

Only drivers supporting DRI2 version >=4 support GLX_INTEL_swap_event.
So lets mark it as such otherwise applications which use this extension
(i.e. everything based on Clutter, e.g. gnome-shell) break horribly on
drivers supporting DRI2 versions only up to 3.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor600g: improve inputs/interpolation handling with llvm backend
Vadim Girlin [Wed, 23 Jan 2013 20:30:02 +0000 (21:30 +0100)]
r600g: improve inputs/interpolation handling with llvm backend

Get rid of special handling for reserved regs.
Use one intrinsic for all kinds of interpolation.

v2[Vincent Lejeune]: Rebased against current master

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g: Add ar_chan member to struct r600_bytecode
Tom Stellard [Tue, 22 Jan 2013 20:22:11 +0000 (21:22 +0100)]
r600g: Add ar_chan member to struct r600_bytecode

r600_bytecode::ar_chan stores the register channel for the value that
will be loaded into the AR register.

At the moment, this field is only used by the LLVM backend.  The default
backend always sets ar_chan = 0.

11 years agor600g: More robust checks for MOVA_INT instructions
Tom Stellard [Tue, 22 Jan 2013 20:22:10 +0000 (21:22 +0100)]
r600g: More robust checks for MOVA_INT instructions

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>