mesa.git
11 years agointel: Make a wrapper for intelEmitCopyBlit using miptrees.
Eric Anholt [Mon, 4 Feb 2013 22:24:09 +0000 (14:24 -0800)]
intel: Make a wrapper for intelEmitCopyBlit using miptrees.

I had previously asserted that it was hard to write a useful, simpler
blit function, but I think this might be it.

This has the side effect of extending the 32k pitch check to a few more
places that were missing it.

v2: Update comment for being moved inside intel_miptree_blit().

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Rename intel_renderbuffer_tile_offsets.
Eric Anholt [Mon, 4 Feb 2013 22:21:24 +0000 (14:21 -0800)]
intel: Rename intel_renderbuffer_tile_offsets.

This makes it more consistent with intel_miptree_get_tile_offsets().

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Reduce intel_renderbuffer_tile_offsets to a thin wrapper.
Eric Anholt [Mon, 4 Feb 2013 18:05:51 +0000 (10:05 -0800)]
intel: Reduce intel_renderbuffer_tile_offsets to a thin wrapper.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Make intel_miptree_get_tile_offsets return a page offset.
Eric Anholt [Mon, 4 Feb 2013 18:00:10 +0000 (10:00 -0800)]
intel: Make intel_miptree_get_tile_offsets return a page offset.

Right now, the callers in i965 don't expect a nonzero page offset to
actually occur (since that's being handled elsewhere), but it seems
like a trap to leave it this way.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Fix MSVC build.
José Fonseca [Tue, 28 May 2013 12:56:18 +0000 (13:56 +0100)]
glsl: Fix MSVC build.

It appears that `sizeof(Class::member)` is either non-standard or
merely unsupported in MSVC.

So use `sizeof(instance->member)` instead, which is guaranteed to work
everywhere.

Also promote the assert to a static assert.

Trivial.

11 years agomesa: fix GLSL program objects with more than 16 samplers combined
Marek Olšák [Mon, 13 May 2013 13:46:49 +0000 (15:46 +0200)]
mesa: fix GLSL program objects with more than 16 samplers combined

The problem is the sampler units are allocated from the same pool for all
shader stages, so if a vertex shader uses 12 samplers (0..11), the fragment
shader samplers start at index 12, leaving only 4 sampler units
for the fragment shader. The main cause is probably the fact that samplers
(texture unit -> sampler unit mapping, etc.) are tracked globally
for an entire program object.

This commit adapts the GLSL linker and core Mesa such that the sampler units
are assigned to sampler uniforms for each shader stage separately
(if a sampler uniform is used in all shader stages, it may occupy a different
sampler unit in each, and vice versa, an i-th sampler unit may refer to
a different sampler uniform in each shader stage), and the sampler-specific
variables are moved from gl_shader_program to gl_shader.

This doesn't require any driver changes, and it fixes piglit/max-samplers
for gallium and classic swrast. It also works with any number of shader
stages.

v2: - converted tabs to spaces
    - added an assertion to _mesa_get_sampler_uniform_value

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoswrast: increase array size of TextureSample
Marek Olšák [Mon, 13 May 2013 14:24:57 +0000 (16:24 +0200)]
swrast: increase array size of TextureSample

to match the size of ctx->Texture.Unit, and it will also fix
piglit/max-samplers with the following commit.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: declare UniformBufferBindings as an array with a static size
Marek Olšák [Tue, 14 May 2013 15:58:32 +0000 (17:58 +0200)]
mesa: declare UniformBufferBindings as an array with a static size

Some Gallium drivers were crashing, because the array was not large enough.

v2: clamp the per-shader maximum in st/mesa, then sum them all up

NOTE: This is a candidate for the stable branches.

11 years agoradeonsi: Enable GLSL 1.30
Michel Dänzer [Fri, 24 May 2013 14:49:42 +0000 (16:49 +0200)]
radeonsi: Enable GLSL 1.30

11 years agoradeonsi: Handle TGSI TXQ opcode
Michel Dänzer [Mon, 6 May 2013 10:45:14 +0000 (12:45 +0200)]
radeonsi: Handle TGSI TXQ opcode

11 years agoradeonsi: Add support for TGSI TXF opcode
Michel Dänzer [Thu, 2 May 2013 07:44:45 +0000 (09:44 +0200)]
radeonsi: Add support for TGSI TXF opcode

11 years agoradeonsi: Use tgsi_util_get_texture_coord_dim()
Michel Dänzer [Fri, 24 May 2013 12:23:26 +0000 (13:23 +0100)]
radeonsi: Use tgsi_util_get_texture_coord_dim()

11 years agoradeonsi: Handle TGSI_SEMANTIC_CLIPDIST
Michel Dänzer [Thu, 2 May 2013 12:53:17 +0000 (14:53 +0200)]
radeonsi: Handle TGSI_SEMANTIC_CLIPDIST

11 years agoradeonsi: Make border colour state handling safe for integer textures
Michel Dänzer [Wed, 1 May 2013 16:15:36 +0000 (18:15 +0200)]
radeonsi: Make border colour state handling safe for integer textures

11 years agoradeonsi: Fix hardware state for dual source blending
Michel Dänzer [Tue, 30 Apr 2013 14:34:10 +0000 (16:34 +0200)]
radeonsi: Fix hardware state for dual source blending

Set up CB_SHADER_MASK register according to pixel shader exports, and enable
some minimal state for colour buffer 1 in case dual source blending is used.

11 years agor600g/sb: handle more cases for folding in gvn pass
Vadim Girlin [Tue, 28 May 2013 01:24:53 +0000 (05:24 +0400)]
r600g/sb: handle more cases for folding in gvn pass

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agost/vdpau: destroy handle table only when it's empty
Christian König [Thu, 23 May 2013 17:31:08 +0000 (19:31 +0200)]
st/vdpau: destroy handle table only when it's empty

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agost/vdpau: remove vlCreateHTAB from surface functions
Christian König [Thu, 23 May 2013 17:28:57 +0000 (19:28 +0200)]
st/vdpau: remove vlCreateHTAB from surface functions

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agost/vdpau: invalidate the handles on destruction
Christian König [Thu, 23 May 2013 17:17:19 +0000 (19:17 +0200)]
st/vdpau: invalidate the handles on destruction

Fixes a problem with xbmc when switching channels.

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agor600g/sb: improve folding for SETcc
Vadim Girlin [Mon, 27 May 2013 10:23:47 +0000 (14:23 +0400)]
r600g/sb: improve folding for SETcc

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: optimize CNDcc instructions
Vadim Girlin [Mon, 27 May 2013 11:29:56 +0000 (15:29 +0400)]
r600g/sb: optimize CNDcc instructions

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: improve optimization of conditional instructions
Vadim Girlin [Mon, 27 May 2013 00:00:03 +0000 (04:00 +0400)]
r600g/sb: improve optimization of conditional instructions

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agoilo: enable multiple constant buffers
Chia-I Wu [Mon, 27 May 2013 04:31:01 +0000 (12:31 +0800)]
ilo: enable multiple constant buffers

This effectively enables uniform buffer object support.

11 years agoilo: add support for indirect access of CONST in FS
Chia-I Wu [Mon, 27 May 2013 04:09:33 +0000 (12:09 +0800)]
ilo: add support for indirect access of CONST in FS

Unlike other register files, CONST is read with a message and indirect access
is easier to implement.

11 years agoilo: add support for TBOs on GEN6
Chia-I Wu [Mon, 27 May 2013 04:29:51 +0000 (12:29 +0800)]
ilo: add support for TBOs on GEN6

This hunk was missing in the last commit.

11 years agoilo: advertise supports for pure integer formats
Chia-I Wu [Thu, 23 May 2013 06:02:36 +0000 (14:02 +0800)]
ilo: advertise supports for pure integer formats

For pure integer formats, no filtering nor blending is needed.

11 years agoilo: add support for texture buffer objects
Chia-I Wu [Thu, 23 May 2013 04:50:14 +0000 (12:50 +0800)]
ilo: add support for texture buffer objects

Take care of sampler views that have buffers as the underlying resources.
Update caps related to TBOs.

11 years agotgsi: add buffer texture to tgsi_util_get_texture_coord_dim()
Chia-I Wu [Thu, 23 May 2013 05:24:55 +0000 (13:24 +0800)]
tgsi: add buffer texture to tgsi_util_get_texture_coord_dim()

TGSI_TEXTURE_BUFFER is one-dimensional.  Assert that exec_tex() is never
called with TGSI_TEXTURE_BUFFER.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor600g/sb: improve handling of KILL instructions
Vadim Girlin [Sun, 26 May 2013 21:37:54 +0000 (01:37 +0400)]
r600g/sb: improve handling of KILL instructions

This patch improves handling of unconditional KILL instructions inside
the conditional blocks, uncovering more opportunities for if-conversion.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix peephole optimization for PRED_SETE
Vadim Girlin [Sun, 26 May 2013 21:41:11 +0000 (01:41 +0400)]
r600g/sb: fix peephole optimization for PRED_SETE

Fixes incorrect condition that prevented optimization for
PRED_SETE/PRED_SETE_INT.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix scheduling of PRED_SET instructions
Vadim Girlin [Sun, 26 May 2013 21:39:54 +0000 (01:39 +0400)]
r600g/sb: fix scheduling of PRED_SET instructions

PRED_SET instructions that update exec mask should be scheduled immediately
prior to the "if-then-else" block, because any instruction that is
inserted after alu clause with PRED_SET and before conditional block is
also conditionally executed by hw (exec mask is already updated at that
moment).

Propbably it's better to make PRED_SET a part of conditional
"if-then-else" block in the IR to handle this more cleanly,
but for now this temporary solution should prevent the problem.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix handling of preloaded inputs for compute shaders
Vadim Girlin [Sat, 25 May 2013 18:56:53 +0000 (22:56 +0400)]
r600g/sb: fix handling of preloaded inputs for compute shaders

For compute shaders we need to let the backend know that
GPRs 0 and 1 are preloaded with some compute-specific input
values, otherwise any use of these regs without previous
definition is considered as undefined value and usually
is simply replaced with 0.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agoxlib: add null ctx check in glXDestroyContext()
Brian Paul [Fri, 24 May 2013 14:06:19 +0000 (08:06 -0600)]
xlib: add null ctx check in glXDestroyContext()

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64934
NOTE: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agost/glx: add null ctx check in glXDestroyContext()
Brian Paul [Fri, 24 May 2013 14:06:04 +0000 (08:06 -0600)]
st/glx: add null ctx check in glXDestroyContext()

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64934
NOTE: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agost/mesa: add switch cases for new IR enums to silence warnings
Brian Paul [Thu, 23 May 2013 15:33:19 +0000 (09:33 -0600)]
st/mesa: add switch cases for new IR enums to silence warnings

11 years agost/glx/xlib: assorted whitespace, comment fixes
Brian Paul [Tue, 21 May 2013 20:11:42 +0000 (14:11 -0600)]
st/glx/xlib: assorted whitespace, comment fixes

11 years agor600g/sb: fix incorrect assert
Vadim Girlin [Fri, 24 May 2013 15:07:27 +0000 (19:07 +0400)]
r600g/sb: fix incorrect assert

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: relax some restrictions for FETCH instructions
Vadim Girlin [Fri, 24 May 2013 14:15:57 +0000 (18:15 +0400)]
r600g/sb: relax some restrictions for FETCH instructions

This allows GVN rewrite pass to propagate non-const (register)
values to FETCH source operands, helping to eliminate unnecessary
copies in some cases.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: relax register allocation for compute shaders
Vadim Girlin [Fri, 24 May 2013 14:07:55 +0000 (18:07 +0400)]
r600g/sb: relax register allocation for compute shaders

We have to assume that all GPRs in compute shader can be indirectly
addressed because LLVM backend doesn't provide any indirect array info.
That's why for compute shaders GPR array is created that covers all used
GPRs (0..r600_bytecode::ngpr-1), but this seriously restricts register
allocation in sb.

This patch checks for actual use of indirect access in the shader and
if it's not used then GPR array is not created, so that regalloc is not
unnecessarily restricted.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix gpr array handling for compute shaders
Vadim Girlin [Fri, 24 May 2013 12:45:58 +0000 (16:45 +0400)]
r600g/sb: fix gpr array handling for compute shaders

Fixes segfault with bfgminer and R600_DEBUG=sbcl.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix buffer overflow in sb_ostream
Vadim Girlin [Fri, 24 May 2013 12:24:09 +0000 (16:24 +0400)]
r600g/sb: fix buffer overflow in sb_ostream

Fixes segfault during bytecode dump with bfgminer kernel

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/compute: Use common transfer_{map,unmap} functions for global resources
Tom Stellard [Tue, 14 May 2013 15:56:25 +0000 (08:56 -0700)]
r600g/compute: Use common transfer_{map,unmap} functions for global resources

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor600g/compute: Use common transfer_{map,unmap} functions for kernel inputs
Tom Stellard [Tue, 14 May 2013 15:56:25 +0000 (08:56 -0700)]
r600g/compute: Use common transfer_{map,unmap} functions for kernel inputs

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoi965: Go back to using the kernel SOL reset feature.
Kenneth Graunke [Fri, 24 May 2013 03:19:19 +0000 (20:19 -0700)]
i965: Go back to using the kernel SOL reset feature.

It turns out the MI_LOAD_REGISTER_IMM approach doesn't work on Haswell,
and regressed essentially all the transform feedback Piglit tests.

This morally reverts eaa6fbe6d54dc99efac4ab8e800edef65ce8220d.  However,
the code is still simpler than it was.  On BeginTransformFeedback, we
simply flush the batch and set the SOL reset flag so that the next batch
will start with zeroed offsets.  There's still no software counting.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64887
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agofreedreno: scissor fix
Rob Clark [Wed, 15 May 2013 00:05:55 +0000 (20:05 -0400)]
freedreno: scissor fix

Don't assume the state-tracker will set the scissor after the
framebuffer state is changed.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno: implement pipe->resource_copy_region()
Rob Clark [Tue, 14 May 2013 17:57:06 +0000 (13:57 -0400)]
freedreno: implement pipe->resource_copy_region()

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agoglsl linker: compare interface blocks during interstage linking
Kenneth Graunke [Tue, 21 May 2013 06:46:16 +0000 (23:46 -0700)]
glsl linker: compare interface blocks during interstage linking

Verify that interface blocks match when linking separate shader
stages into a program.

Fixes piglit glsl-1.50 tests:
* linker/interface-blocks-vs-fs-member-count-mismatch.shader_test
* linker/interface-blocks-vs-fs-member-order-mismatch.shader_test

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglsl linker: compare interface blocks during intrastage linking
Jordan Justen [Tue, 21 May 2013 06:42:49 +0000 (23:42 -0700)]
glsl linker: compare interface blocks during intrastage linking

Verify that interface blocks match when combining compilation
units at the same stage. (For example, when merging all vertex
shaders.)

Fixes piglit glsl-1.50 test:
* linker/interface-blocks-multiple-vs-member-count-mismatch.shader_test

v5 (Ken): Rename to link_interface_blocks.cpp and drop the separate .h
file for consistency with other linker code.  Remove "ok" variable.
Fold cross_validate_interface_blocks into its caller.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl linker: support arrays of interface block instances
Jordan Justen [Sun, 17 Mar 2013 09:04:56 +0000 (02:04 -0700)]
glsl linker: support arrays of interface block instances

With this change we now support interface block arrays.
For example, cases like this:

out block_name {
    float f;
} block_instance[2];

This allows Mesa to pass the piglit glsl-1.50 test:
* execution/interface-blocks-complex-vs-fs.shader_test

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl link_varyings: link interface blocks using the block name
Jordan Justen [Sun, 10 Mar 2013 10:48:53 +0000 (03:48 -0700)]
glsl link_varyings: link interface blocks using the block name

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl linker: remove interface block instance names
Jordan Justen [Sun, 10 Mar 2013 10:20:03 +0000 (03:20 -0700)]
glsl linker: remove interface block instance names

Convert interface blocks with instance names into flat
interface blocks without an instance name.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl ast_to_hir: support in/out for interface blocks
Jordan Justen [Sun, 10 Mar 2013 00:34:55 +0000 (16:34 -0800)]
glsl ast_to_hir: support in/out for interface blocks

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl ast_to_hir: reject row/column_major for in/out interface blocks
Jordan Justen [Sun, 24 Mar 2013 00:16:28 +0000 (17:16 -0700)]
glsl ast_to_hir: reject row/column_major for in/out interface blocks

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl ast_to_hir: move uniform block symbols to interface blocks namespace
Jordan Justen [Thu, 21 Mar 2013 18:10:04 +0000 (11:10 -0700)]
glsl ast_to_hir: move uniform block symbols to interface blocks namespace

Uniform/interface blocks are a separate namespace from types.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl_symbol_table: add interface block namespaces
Jordan Justen [Thu, 21 Mar 2013 16:57:20 +0000 (09:57 -0700)]
glsl_symbol_table: add interface block namespaces

For interface blocks, there are three separate namespaces for
uniform, input and output blocks.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl parser: allow in & out for interface block members
Jordan Justen [Sat, 9 Mar 2013 22:52:14 +0000 (14:52 -0800)]
glsl parser: allow in & out for interface block members

Previously uniform blocks allowed for the 'uniform' keyword
to be used with members of a uniform blocks. With interface
blocks 'in' can be used on 'in' interface block members and
'out' can be used on 'out' interface block members.

The basic_interface_block rule will verify that the same
qualifier type is used with the block and each member.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl ast_to_hir: reject interpolation qualifiers for uniform blocks
Jordan Justen [Sun, 24 Mar 2013 00:14:37 +0000 (17:14 -0700)]
glsl ast_to_hir: reject interpolation qualifiers for uniform blocks

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl parser: handle interface block member qualifier
Jordan Justen [Thu, 21 Mar 2013 17:52:19 +0000 (10:52 -0700)]
glsl parser: handle interface block member qualifier

An interface block member may specify the type:
in {
    in vec4 in_var_with_qualifier;
};

When specified with the member, it must match the same
type as interface block type.

It can also omit the qualifier:
uniform {
    vec4 uniform_var_without_qualifier;
};

When the type is not specified with the member,
it will adopt the same type as the interface block.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl parser: on desktop GL require GLSL 150 for instance names
Jordan Justen [Sat, 9 Mar 2013 22:09:30 +0000 (14:09 -0800)]
glsl parser: on desktop GL require GLSL 150 for instance names

Interface blocks in GLSL 150 allow an instance name to be used.

v2:
 * use state->check_version

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl parser: reject VS+in & FS+out interface blocks
Jordan Justen [Sat, 9 Mar 2013 21:01:13 +0000 (13:01 -0800)]
glsl parser: reject VS+in & FS+out interface blocks

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: parse in/out types for interface blocks
Jordan Justen [Sat, 9 Mar 2013 19:36:11 +0000 (11:36 -0800)]
glsl: parse in/out types for interface blocks

Previously only 'uniform' was allowed for uniform blocks.

Now, in/out can be parsed, but it will only be allowed for
GLSL >= 150.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl parser: rename uniform block to interface block
Jordan Justen [Sat, 9 Mar 2013 19:00:59 +0000 (11:00 -0800)]
glsl parser: rename uniform block to interface block

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: rename ast_uniform_block to ast_interface_block
Jordan Justen [Sat, 9 Mar 2013 18:40:41 +0000 (10:40 -0800)]
glsl: rename ast_uniform_block to ast_interface_block

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Enable guardband clipping on Gen4/5.
Chris Forbes [Sun, 19 May 2013 08:44:29 +0000 (20:44 +1200)]
i965: Enable guardband clipping on Gen4/5.

Enables guardband clipping when the viewport covers the entire render
target.

No piglit regressions on Ironlake.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoARB_fp: accept duplicate precision options
Chris Forbes [Thu, 16 May 2013 09:21:05 +0000 (21:21 +1200)]
ARB_fp: accept duplicate precision options

Relaxes the validation of

   OPTION ARB_precision_hint_{nicest,fastest};

to allow duplicate options. The spec says that both /nicest/ and
/fastest/ cannot be specified together, but could be interpreted
either way for respecification of the same option.

Other drivers (NVIDIA etc) accept this, and at least one Unity3D game
expects it to succeed (Kerbal Space Program).

V2: Add spec quote.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoilo: Initialize need_flush in draw_vbo.
Vinson Lee [Thu, 23 May 2013 06:24:35 +0000 (23:24 -0700)]
ilo: Initialize need_flush in draw_vbo.

need_flush was uninitialized if hw3d->new_batch was true.

Fixes "Uninitialized scalar variable" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
11 years agoradeon: Initialize variables in radeon_llvm_context_init.
Vinson Lee [Sat, 18 May 2013 07:21:52 +0000 (00:21 -0700)]
radeon: Initialize variables in radeon_llvm_context_init.

'type' was not fully initialized when calling lp_build_context_init.

Fixes "Uninitialized scalar variable" defect reported by Coverity.

NOTE: This is a candidate for the stable branches.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agointel: Count fragments in our blitter-based glBitmap() path.
Eric Anholt [Tue, 21 May 2013 23:20:18 +0000 (16:20 -0700)]
intel: Count fragments in our blitter-based glBitmap() path.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59440
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Shut up more compiler warnings from vector insert/extract changes.
Eric Anholt [Wed, 22 May 2013 00:39:58 +0000 (17:39 -0700)]
i965: Shut up more compiler warnings from vector insert/extract changes.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agosoftpipe: change TEX_TILE_SIZE and NUM_TEX_TILE_ENTRIES
Roland Scheidegger [Wed, 22 May 2013 20:55:21 +0000 (22:55 +0200)]
softpipe: change TEX_TILE_SIZE and NUM_TEX_TILE_ENTRIES

Initially we had NUM_TEX_TILE_ENTRIES of 50, however this was using too much
memory (mostly because the tile cache is operating on fixed max current
sampler views which could be fixed but that's another topic). So it was
decreased to 4. However this is a ridiculously low number which can't
actually really work (the number of tiles needed for as little as
a single quad with linear_mipmap_linear is 2 to 8 for a 2d texture, and
4 to 16 for a 3d texture), as it just about guarantees there will be
cache thrashing sometimes (just about always for 3d textures in fact, since
while there are 4 entries the cache is direct mapped).
So increase that number to 16 (which is still on the low side for direct
mapped cache though I guess using something like 4-way associativity would
be more effective than increasing this further) which has at least some good
chance to avoid thrashing. Since we don't want to increase memory requirements
however in turn decrease the tile size accordingly from 64 to 32 (as a bonus
point this also decreases the cost of texture thrashing which might still
happen sometimes).
I've seen performance improvement in the order of factor ~200 (specifically,
drawing the first frame from the replay from bug 41787 needs "only" ~10s
instead of ~30min, meaning I can actually compare the output with other
drivers...) with this.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosoftpipe: disambiguate TILE_SIZE / TEX_TILE_SIZE
Roland Scheidegger [Wed, 22 May 2013 00:13:02 +0000 (02:13 +0200)]
softpipe: disambiguate TILE_SIZE / TEX_TILE_SIZE

These can be different (just like NUM_TEX_TILE_ENTRIES / NUM_ENTRIES),
though currently they aren't.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: disable simple_shader optimization
Roland Scheidegger [Wed, 22 May 2013 20:47:59 +0000 (22:47 +0200)]
llvmpipe: disable simple_shader optimization

This optimization disabled mask checks if the shader is simple enough.
While this should work correctly, the problem is that it can hide real issues
because shaders in practice are usually complex enough (8 instructions or 1
texture is already enough) so this doesn't get used, whereas dumbed-down
tests which should hit all the same code paths suddenly do something quite
different. This was the reason that bug 41787 could not be easily tracked as
stencil test not working correctly (piglit would in fact have failed some
tests without that optimization).
So disable it for now, it's unclear if it's much of a win in any case.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: fix early depth test / late depth write stencil issues
Roland Scheidegger [Tue, 21 May 2013 21:57:33 +0000 (23:57 +0200)]
llvmpipe: fix early depth test / late depth write stencil issues

We actually did early depth/stencil test and late depth/stencil write even
when the shader could kill the fragment (alpha test or discard). Since it
matters for the new stencil value if the fragment is killed by depth/stencil
test or by the shader (in which case it will not reach the depth/stencil
test) this simply cannot work (we also would possibly skip writing the new
stencil value due to mask checks but this is a secondary issue).
So use late depth test / late depth write instead in this case.
(No piglit changes as it doesn't seem to hit such bogus early depth test
/ late depth write path.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: fix issue with not writing new stencil values
Roland Scheidegger [Wed, 22 May 2013 20:42:11 +0000 (22:42 +0200)]
llvmpipe: fix issue with not writing new stencil values

We did mask checks between depth/stencil testing and depth/stencil write.
This meant that if the depth/stencil test killed off all fragments we never
actually wrote the new stencil value. This issue affected all early/late
test/write combinations.
So move the mask check after depth/stencil write (for early depth test,
could do the same for late depth test but might not be worth it at that
point so just skip it there).
This addresses https://bugs.freedesktop.org/show_bug.cgi?id=41787.
Piglit does not hit this issue because of the simple_shader optimization
in generate_fs_loop() which means we're skipping the mask checks.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: (trivial) remove confusing code in stencil test
Roland Scheidegger [Tue, 21 May 2013 21:10:53 +0000 (23:10 +0200)]
llvmpipe: (trivial) remove confusing code in stencil test

This was meant to disable some code which isn't needed when depth/stencil
isn't written. However, there's more code which wouldn't be needed in that
case so having the condition there was just odd (llvm will drop all the code
anyway).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: fix bug in early depth test / late depth write handling
Roland Scheidegger [Tue, 21 May 2013 20:51:15 +0000 (22:51 +0200)]
llvmpipe: fix bug in early depth test / late depth write handling

Using wrong type if the format was less than 32bits.
No piglit changes as it doesn't hit that path.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoHaiku: Add Gallium winsys and target code
Alexander von Gluck IV [Tue, 21 May 2013 20:55:24 +0000 (15:55 -0500)]
Haiku: Add Gallium winsys and target code

* We generate a static library for Haiku
  Gallium targets as our port system combines
  the compiled rendering code into a modular
  ar for each module (for example, our port
  system combines llvm libsoftpipe.a libllvmpipe.a
  into a single ar for the Haiku build system.
  I'd like the Gallium hgl target scons build
  system to do this some day, however how is
  beyond me at the moment. This is a first step.

11 years agoilo: set more fields of 3DSTATE_DEPTH_BUFFER
Chia-I Wu [Wed, 22 May 2013 04:19:13 +0000 (12:19 +0800)]
ilo: set more fields of 3DSTATE_DEPTH_BUFFER

Set lod/layer related fields of 3DSTATE_DEPTH_BUFFER.  Since we always point
to a single level/layer, those fields are always zero and this commit
effectively makes no change.

While at it, make it easier to disable manual slice offset calculation.

11 years agoilo: correctly set view extent in SURFACE_STATE
Chia-I Wu [Wed, 22 May 2013 05:00:30 +0000 (13:00 +0800)]
ilo: correctly set view extent in SURFACE_STATE

The view extent was set to be the same as the depth while it should be set to
the number of layers.  It makes a difference for 3D textures.

Also use this as a chance to clean up the code.

11 years agoilo: avoid unnecessary emission of SO states
Chia-I Wu [Wed, 22 May 2013 07:33:15 +0000 (15:33 +0800)]
ilo: avoid unnecessary emission of SO states

No need to emit 3DSTATE_SO_BUFFER and 3DSTATE_SO_DECL_LIST when SO is
disabled.  As the implicit flush done by the commands is also gone, emit an
explicit flush.

11 years agoi965: Skip etc-to-rgb transcode on BayTrail.
Eric Anholt [Tue, 21 May 2013 21:55:31 +0000 (14:55 -0700)]
i965: Skip etc-to-rgb transcode on BayTrail.

The hardware does it, so no need for this workaround.

Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Remove extension checking from ChooseTexFormat.
Eric Anholt [Thu, 21 Mar 2013 16:50:45 +0000 (09:50 -0700)]
mesa: Remove extension checking from ChooseTexFormat.

This should already be handled by _mesa_base_tex_format() calls in
TexImage*.

11 years agomesa: Add ChooseTexFormat support for the new XBGR formats.
Eric Anholt [Thu, 21 Mar 2013 16:45:20 +0000 (09:45 -0700)]
mesa: Add ChooseTexFormat support for the new XBGR formats.

11 years agoi965: Split BeginTransformFeedback hook into Gen6 and Gen7+ variants.
Kenneth Graunke [Mon, 20 May 2013 22:25:28 +0000 (15:25 -0700)]
i965: Split BeginTransformFeedback hook into Gen6 and Gen7+ variants.

Most of the work in BeginTransformFeedback is only necessary on Gen6.
We may as well just skip it on Gen7+.

v2: Add an intel->gen == 6 assert.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Kill software primitive counting entirely.
Kenneth Graunke [Fri, 17 May 2013 18:53:53 +0000 (11:53 -0700)]
i965: Kill software primitive counting entirely.

Now that we have hardware contexts, we don't need to continually
reprogram the GS_SVBI_INDEX registers.  They're automatically saved and
restored with the context, so they can just increment over time.  We
only need to reset them when starting transform feedback.

There's also no reason to delay until the next drawing operation; we can
just emit the packet immediately.  However, this means we must drop the
initialization in brw_invariant_state, as BeginTransformFeedback may
occur before the first drawing in a context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Remove software geometry query code.
Kenneth Graunke [Fri, 17 May 2013 18:46:16 +0000 (11:46 -0700)]
i965: Remove software geometry query code.

EXT_transform_feedback isn't yet supported on Gen4-5, so none of this
query code is actually used.  This also means we can remove some of the
surrounding support code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Delete unused brw->sol.offset_0_batch_start field.
Kenneth Graunke [Fri, 17 May 2013 18:00:01 +0000 (11:00 -0700)]
i965: Delete unused brw->sol.offset_0_batch_start field.

This was only used for the the non-hardware context code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Stop using the kernel SOL reset feature.
Kenneth Graunke [Fri, 17 May 2013 17:55:35 +0000 (10:55 -0700)]
i965: Stop using the kernel SOL reset feature.

We can just do it ourselves with MI_LOAD_REGISTER_IMM.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Remove dead code for Gen7 SOL without hardware contexts.
Kenneth Graunke [Fri, 17 May 2013 17:51:34 +0000 (10:51 -0700)]
i965: Remove dead code for Gen7 SOL without hardware contexts.

Failing to get a hardware context now means failing to load the driver,
so this code will never get hit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Add a macro for accessing the SO_WRITE_OFFSET[0-3] registers.
Kenneth Graunke [Sun, 21 Apr 2013 05:35:46 +0000 (22:35 -0700)]
i965: Add a macro for accessing the SO_WRITE_OFFSET[0-3] registers.

Using a function-like macro makes it easy to loop over all four streams.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agodocs: Import 9.1.3 release notes, add news item.
Ian Romanick [Tue, 21 May 2013 20:16:35 +0000 (13:16 -0700)]
docs: Import 9.1.3 release notes, add news item.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoradeonsi: Fix user clip planes
Michel Dänzer [Thu, 2 May 2013 13:39:15 +0000 (15:39 +0200)]
radeonsi: Fix user clip planes

4 more little piglits.

NOTE: This is a candidate for the 9.1 branch.

11 years agoradeonsi: Handle TGSI_SEMANTIC_CLIPVERTEX
Michel Dänzer [Wed, 15 May 2013 16:09:50 +0000 (18:09 +0200)]
radeonsi: Handle TGSI_SEMANTIC_CLIPVERTEX

17 more little piglits.

NOTE: This is a candidate for the 9.1 branch.

11 years agoradeonsi: Initial support for multiple constant buffers
Michel Dänzer [Thu, 16 May 2013 09:50:00 +0000 (11:50 +0200)]
radeonsi: Initial support for multiple constant buffers

Just enough to support an additional internal constant buffer for the user
clip planes.

NOTE: This is a candidate for the 9.1 branch.

11 years agoradeonsi: Fix handling of TGSI_SEMANTIC_PSIZE
Michel Dänzer [Fri, 3 May 2013 15:59:34 +0000 (17:59 +0200)]
radeonsi: Fix handling of TGSI_SEMANTIC_PSIZE

Two more little piglits.

NOTE: This is a candidate for the 9.1 branch.

11 years agoradeonsi: increase array size for shader inputs and outputs
Marek Olšák [Tue, 14 May 2013 17:37:17 +0000 (19:37 +0200)]
radeonsi: increase array size for shader inputs and outputs

and add assertions to prevent buffer overflow. This fixes corruption
of the si_shader struct.

NOTE: This is a candidate for the 9.1 branch.

[ Cherry-pick of r600g commit da33f9b919039442e9ab51f9b1d1c83a73607133 ]

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoxlib: check for null ctx pointer in glXIsDirect()
Brian Paul [Mon, 20 May 2013 22:15:24 +0000 (16:15 -0600)]
xlib: check for null ctx pointer in glXIsDirect()

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64745
Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agost/glx/xlib: check for null ctx pointer in glXIsDirect()
Brian Paul [Mon, 20 May 2013 22:13:53 +0000 (16:13 -0600)]
st/glx/xlib: check for null ctx pointer in glXIsDirect()

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64745
Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoscons: Don't force stabs debug format for Mingw.
José Fonseca [Fri, 17 May 2013 12:23:04 +0000 (13:23 +0100)]
scons: Don't force stabs debug format for Mingw.

- recent gdb handles DWARF fine (tested both with version
  7.1.90.20100730 from mingw-w64 project, and 7.5-1 from mingw project)

- http://people.freedesktop.org/~jrfonseca/bfdhelp/ was updated to
  handle DWARF

- stabs requires ugly hacks to prevent compilation failures

- mixing stabs/dwarf prevents proper backtraces (which is inevitable,
  given that the MinGW C runtime is pre-built with DWARF)

For example, without this change I get:

  (gdb) bt
  #0  _wassert (_Message=0xf925060 L"Num < NumOperands && \"Invalid child # of SDNode!\"",
      _File=0xf60b488 L"llvm/include/llvm/CodeGen/SelectionDAGNodes.h", _Line=534)
      at ../../../../mingw-w64-crt/misc/wassert.c:51
  #1  0x0368996b in _assert (_Message=0x39d7ee4 "Num < NumOperands && \"Invalid child # of SDNode!\"",
      _File=0x39d7e94 "llvm/include/llvm/CodeGen/SelectionDAGNodes.h", _Line=534)
      at ../../../../mingw-w64-crt/misc/wassert.c:44
  #2  0x00000004 in ?? ()
  #3  0x00000004 in ?? ()
  #4  0x0f60b488 in ?? ()
  #5  0x00000000 in ?? ()

While with this change I get:

  (gdb) bt
  #0  _wassert (_Message=0xfb982e8 L"Num < NumOperands && \"Invalid child # of SDNode!\"",
      _File=0xefbcb40 L"llvm/include/llvm/CodeGen/SelectionDAGNodes.h", _Line=534)
      at ../../../../mingw-w64-crt/misc/wassert.c:51
  #1  0x039c996b in _assert (_Message=0x3d17f24 "Num < NumOperands && \"Invalid child # of SDNode!\"",
      _File=0x3d17ed4 "llvm/include/llvm/CodeGen/SelectionDAGNodes.h", _Line=534)
      at ../../../../mingw-w64-crt/misc/wassert.c:44
  #2  0x033111cc in getOperand (Num=4, this=<optimized out>)
      at llvm/include/llvm/CodeGen/SelectionDAGNodes.h:534
  #3  getOperand (i=4, this=<optimized out>)
      at llvm/include/llvm/CodeGen/SelectionDAGNodes.h:779
  #4  llvm::SelectionDAG::getNode (this=0xf00cb08, Opcode=79, DL=..., VT=..., N1=..., N2=...)
      at llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2859
  #5  0x03377b20 in llvm::SelectionDAGBuilder::visitExtractElement (this=0xfb45028, I=...)
      at llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2803
  [...]

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoilo: use BLT engine to copy between textures
Chia-I Wu [Fri, 17 May 2013 08:20:52 +0000 (16:20 +0800)]
ilo: use BLT engine to copy between textures

Emit XY_SRC_COPY_BLT to do the job.  Since ETC1 textures cannot be mapped for
reading, as is required by util_copy_resource_region, this fixes copying of
ETC1 textures.