Commit Graph

54472 Commits

Author SHA1 Message Date
Eric Anholt aa6e35e80d i965/vs: Reference the core GL uniform storage for non-builtin uniforms.
Like in the FS, there's no reason to use an external copy if the
ParameterValues[] relayout of it isn't the layout we need.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-28 10:53:48 -08:00
Eric Anholt c0d1f508d6 i965/fs: Reference the core GL uniform storage for non-builtin uniforms.
There's no reason to use an external copy if the relayout in the
external copy isn't serving us.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-28 10:53:45 -08:00
Eric Anholt bd326623ef glsl: Add a note about a surprising feature of gl_uniform_storage->type.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-28 10:53:42 -08:00
Eric Anholt f189570ccf i965/fs: Remove the param_index/param_offset indirection.
Now that ParameterValues doesn't change across the visitor, we don't
need to go through this.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-28 10:53:39 -08:00
Eric Anholt d5efc14635 i965: Add asserts to check that we don't realloc ParameterValues.
Things are even more restrictive than they used to be, so I've made
mistakes in this area.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-28 10:53:36 -08:00
Eric Anholt ffdfafb06c i965: Add texrect scale parameters before pointers to ParameterValues.
If adding scale parameters during program compile caused a realloc of
ParameterValues, then the driver uniform storage set up by
_mesa_associate_uniform_storage() would point to potentially freed
memory.

Note that this uses TexturesUsed, which may change at runtime for GLSL
when sampler uniforms change.  This is a flaw in our handling of texrect
in general, and not one I'm fixing currently.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-28 10:53:33 -08:00
Eric Anholt 6ccc505fc0 i965: Fix a typo in a comment.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-28 10:53:30 -08:00
Eric Anholt 50a88e2f44 i965: Add a note about a bug from the no-recompile-on-sampler-updates change.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-28 10:53:25 -08:00
Brian Paul 7c35521295 mesa: add missing texel fetch code for sRGB DXT formats
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=58548
2012-12-26 15:23:05 -07:00
Eric Anholt 5791c56811 i965: Fix border color handling for deprecated SNORM formats.
We don't have native hardware support for these, so they get promoted to
RGBA, in which case we don't have hardware dealing with the channel
swizzling for us.

Fixes piglit EXT_texture_snorm/texwrap formats bordercolor (-swizzled).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-26 12:08:33 -08:00
Eric Anholt 5628501e7b i965: Start using HIZ for Z16 textures.
I had left this out for a long time because it regressed some
depthstencil-render-miplevels cases when it was enabled.  Now that the
bugs causing those are fixed, there's nothing stopping us.

Improves glbenchmark 2.1 offscreen performance by 7.3% +/- 2.8% (n=10).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-26 12:03:04 -08:00
Eric Anholt 3e1d8e62e7 intel: Use the parent miptree's format for setting up HiZ miptrees.
This worked out before because the parent was always 4 bytes so it
didn't affect the layout, but now we want to support Z16 too.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-26 12:02:47 -08:00
Eric Anholt cb3b172d19 intel: Remove a couple of dead function prototypes.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2012-12-22 13:46:12 -08:00
Eric Anholt 0d6a722ec4 i965: Add perf debug for depth/stencil alignment workaround.
Fixing these rendering bugs has been implicated in performance
regressions (which may be unfixable), but at least knowing that it's
happening should help diagnose those regressions.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2012-12-22 13:46:04 -08:00
Eric Anholt e454b2d480 i965: Assert that relayout laid out something that won't need it again.
The ETC1 changes failed at this, so let's make sure it will be caught in
testing next time.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2012-12-22 13:46:04 -08:00
Eric Anholt 3b458416e3 i965: Also fix validation of Z32F_S8 textures.
This was caught by the assertion in the next commit.  It fixes the
remaining piglit depthstencil-render-miplevels cases, probably by
avoiding broken stencil copies in the validation path.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2012-12-22 13:46:04 -08:00
Eric Anholt 46386816a7 i965: Fix validation of ETC miptrees.
When comparing to the teximage's format, we have to look at the
format-the-mt-was-created-for not the format-actually-stored-in-the-mt.

Improves glbenchmark 2.1 offscreen test performance 159% +/- 17% (n=3).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54582
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2012-12-22 13:46:04 -08:00
Eric Anholt 3b99d094c9 qi965: Add perf debug for texture relayout.
Relayout is expensive, so it's something developers (both us and others)
should know about when it happens.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2012-12-22 13:45:56 -08:00
Eric Anholt c417d261dd i965: Fix hiz resolves getting stomped by depth offset validation.
Fixes all the remaining non-Z32F_S8 depthstencil-render-miplevels tests
in piglit.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2012-12-22 13:41:22 -08:00
Marek Olšák a58bf9d8f9 r600g: rename GPU_FLUSH -> INVAL_READ_CACHES
because that's what it does.
2012-12-22 19:39:29 +01:00
Marek Olšák 9ef26fc667 r600g: remove redundant parameter alloc_bo from r600_texture_create_object
alloc_bo == !buf
2012-12-22 19:39:29 +01:00
Matt Turner a585b8f3a6 Make IsVertexArray() return false before BindVertexArray()
Rename existing _Used flag to EverBound.

The GL 4.3 and ES 3.0 specs say

   These names are marked as used, for the purposes of GenVertexArrays
   only, but they do not acquire array state until they are first bound.

This also affects Apple VAOs, which is fine since the
APPLE_vertex_array_object spec says

   A vertex array object is created by binding an unused name. This
   binding is accomplished by calling BindVertexArrayAPPLE with id set
   to the name of the new vertex array object.

Fixes arb_vertex_array_object_isvertexarray.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-21 20:03:30 -08:00
Matt Turner fd93d55141 Make IsTransformFeedback() return false before BindTransformFeedback()
The GL 4.3 an ES 3.0 specs say

   A transform feedback object is created by binding a name returned by
   GenTransformFeedbacks with the command
      void BindTransformFeedback( enum target, uint id );

Fixes arb_transform_feedback2-istransformfeedback and part of
es3conform's CoverageES30.test.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-21 20:03:07 -08:00
Dave Airlie 54203ef5ac nouveau: deal with tbo cap for now.
This fixes the printk running apps against master.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-12-22 13:12:30 +10:00
Marek Olšák 9c6410e5c3 r600g: always use a tiled resource as the destination of MSAA resolve
i.e. we have to allocate a temporary tiled resource if dst isn't tiled.

This fixes hardlocks on r6xx-r7xx, though using a linear resource is forbidden
on later asics as well.

NOTE: This is a candidate for the stable branches.
2012-12-21 23:43:34 +01:00
Marek Olšák 9b0b4cf058 winsys/radeon: the env var RADEON_NOOP can be used to skip CS ioctls 2012-12-21 23:42:23 +01:00
Marek Olšák eccc74f5d3 r600g: remove a false comment 2012-12-21 23:42:09 +01:00
Marek Olšák fb45a816eb r600g: don't suspend TIME_ELAPSED queries during flushing
According to the GL spec, the result should be equivalent to comparing
two timestamps.
2012-12-21 23:42:04 +01:00
Marek Olšák 6d49ffde11 gallium/tests: fix build breakage after pipe_surface::usage removal 2012-12-21 23:41:41 +01:00
Frank Henigman 46e3aeb077 mesa: add bounds checking for uniform array access
No piglit regressions and now passes glsl-uniform-out-of-bounds-2.

validate_uniform_parameters now checks that the array index is
valid.  This means if an index is out of bounds, glGetUniform* now
fails with GL_INVALID_OPERATION, as it should.
_mesa_uniform and _mesa_uniform_matrix also call
validate_uniform_parameters so the bounds checks there became
redundant and were removed.

The test in glGetUniformLocation is modified to check array bounds
so it now returns GL_INVALID_INDEX (-1) if you ask for the location
of a non-existent array element, as it should.

Signed-off-by: Frank Henigman <fjhenigman@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2012-12-21 11:23:48 -08:00
José Fonseca 74f0731953 util/u_format: Round when converting depth values from float to z16_unorm.
This makes the z16_unorm -> float -> z16_unorm conversion lossless.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2012-12-21 10:04:51 +00:00
Jerome Glisse e8ca1a53a6 r600g: add cs tracing infrastructure for lockup pin pointing
It's a build time option you need to set R600_TRACE_CS to 1 and it
will print to stderr all cs along as cs trace point value which
gave last offset into a cs process by the GPU.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2012-12-20 18:23:54 -05:00
Jerome Glisse 6532eb17ba r600g: add htile support v16
htile is used for HiZ and HiS support and fast Z/S clears.
This commit just adds the htile setup and Fast Z clear.
We don't take full advantage of HiS with that patch.

v2 really use fast clear, still random issue with some tiles
   need to try more flush combination, fix depth/stencil
   texture decompression
v3 fix random issue on r6xx/r7xx
v4 rebase on top of lastest mesa, disable CB export when clearing
   htile surface to avoid wasting bandwidth
v5 resummarize htile surface when uploading z value. Fix z/stencil
   decompression, the custom blitter with custom dsa is no longer
   needed.
v6 Reorganize render control/override update mecanism, fixing more
   issues in the process.
v7 Add nop after depth surface base update to work around some htile
   flushing issue. For htile to 8x8 on r6xx/r7xx as other combination
   have issue. Do not enable hyperz when flushing/uncompressing
   depth buffer.
v8 Fix htile surface, preload and prefetch setup. Only set preload
   and prefetch on htile surface clear like fglrx. Record depth
   clear value per level. Support several level for the htile
   surface. First depth clear can't be a fast clear.
v9 Fix comments, properly account new register in emit function,
   disable fast zclear if clearing different layer of texture
   array to different value
v10 Disable hyperz for texture array making test simpler. Force
    db_misc_state update when no depth buffer is bound. Remove
    unused variable, rename depth_clearstencil to depth_clear.
    Don't allocate htile surface for flushed depth. Something
    broken the cliprect change, this need to be investigated.
v11 Rebase on top of newer mesa
v12 Rebase on top of newer mesa
v13 Rebase on top of newer mesa, htile surface need to be initialized
    to zero, somehow special casing first clear to not use fast clear
    and thus initialize the htile surface with proper value does not
    work in all case.
v14 Use resource not texture for htile buffer make the htile buffer
    size computation easier and simpler. Disable preload on evergreen
    as its still troublesome in some case
v15 Cleanup some comment and remove some left over
v16 Define name for bit 20 of CP_COHER_CNTL

Signed-off-by: Pierre-Eric Pelloux-Prayer <pelloux@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2012-12-20 18:23:51 -05:00
Jerome Glisse 24b1206ab2 r600g: rework flusing and synchronization pattern v7
This bring r600g allmost inline with closed source driver when
it comes to flushing and synchronization pattern.

v2-v4: history lost somewhere in outer space
v5: Fix compute size of flushing, use define for flags, update
    worst case cs size requirement for flush, treat rs780 and
    newer as r7xx when it comes to streamout.
v6: Fix num dw computation for framebuffer state, remove dead
    code, use define instead of hardcoded value.
v7: Remove dead code

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2012-12-20 18:23:31 -05:00
Paul Berry cf5632094b mesa: Allow glReadBuffer(GL_NONE) for winsys framebuffers.
Previously, Mesa code assumed that glReadBuffer(GL_NONE) was only
valid for user-created framebuffer objects.  However, the spec is
quite clear that is should also be valid for the default framebuffer.
From section 18.2.1 ("Obtaining Pixels from the Framebuffer") of the
GL 4.3 spec:

    "When READ_FRAMEBUFFER_BINDING is zero, i.e. the default
    framebuffer, src must be one of the values listed in table 17.4,
    including NONE."

Similar language exists in the GLES 3.0 spec, and in desktop GL all
the way back to ARB_framebuffer_object.

Partially fixes GLES3 conformance test "CoverageES30.test".

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2012-12-20 10:03:30 -08:00
José Fonseca ab2f573634 llvmpipe: Drop PIPE_QUERY_TIME_ELAPSED support.
It was slightly wrong: we were computing the longest duration of
the query among all the rasterizer tasks.

Regardless, for tile-based implementations such as llvmpipe, time differences
will never be very useful, because rendering before/during/after the query
is all interleaved.  And this is expected, see ARB_timer_query spec, issue 10.

In particular, piglit ext_timer_query-time-elapsed still fails, because
it makes assumptions that don't hold true in in tiled architectures. Not
sure how to fix that though.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2012-12-20 16:33:49 +00:00
José Fonseca 3160b0b9fc mesa/st: Implement GL_TIME_ELAPSED w/ PIPE_QUERY_TIMESTAMP.
ARB/EXT_timer_query's definition of GL_TIME_ELAPSED match precisely the
subtraction of two GL_TIMESTAMP queries.

And for a lot of drivers, that's precisely how they have to implement
internally -- by emitting two hardware timestamp queries.

So, to simplify driver implementation, simply allow doing so in the state
tracker.

Eventually if no driver implements PIPE_QUERY_TIME_ELAPSED then we could
retire it.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2012-12-20 16:33:49 +00:00
José Fonseca 9976216bf6 gallium: s/PIPE_CAP_TIMER_QUERY/PIPE_CAP_QUERY_TIME_ELAPSED/
To better reflect what it is being advertised.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2012-12-20 16:33:49 +00:00
Marek Olšák ef11ed61a0 r600g: add assertions to prevent creation of invalid surfaces 2012-12-20 17:13:18 +01:00
Marek Olšák fefa2112bf r600g: refactor and make streamout dumping more informative
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-12-20 17:13:15 +01:00
Marek Olšák 6a2ec765bd r600g: try to fix streamout for the cases where BURST_COUNT > 0
The burst was incorrectly used, because ELEM_SIZE was always 0.
I don't know if the burst works, because I don't know of any test
which uses it.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-12-20 17:13:12 +01:00
Marek Olšák 72362ebefb r600g: lower stream outputs with dst_offset < start_component
This fixes streamout breakage caused by the varying packing.

Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-12-20 17:13:09 +01:00
Marek Olšák d0e40bd3ed r600g: use r600_get_temp to get temporaries for CLIPDIST shader outputs
I need this to be able to use r600_get_temp in the function later.

Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-12-20 17:13:06 +01:00
Brian Paul fddcc67f5c softpipe: fix up FS variant unbinding / deletion
The old call to tgsi_exec_machine_bind_shader() in
softpipe_delete_fs_state() was never called since the shader's original
tokens are never passed to the tgsi interpreter (only shader _variant_
tokens are).  Now, unbind the variant's tokens from the tgsi interpreter
when we free the variant.

This doesn't fix any known bugs but it's the right thing to do.

Note: This is a candidate for the stable branches.
2012-12-19 09:02:08 -07:00
Brian Paul 18ef8f83b2 softpipe: fix unreliable FS variant binding bug
In exec_prepare() we were comparing pointers to see if the fragment
shader variant had changed before calling tgsi_exec_machine_bind_shader().
This didn't work reliably when there was a lot of shader token malloc/
freeing going on because the memory might get reused.
Instead, bind the shader variant during regular state validation.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=40404
(fixes a couple of piglit's glsl-max-varyings test)

Note: This is a candidate for the stable branches.
2012-12-19 09:02:08 -07:00
Jerome Glisse 50880314e3 Revert "r600g: work around ddx over alignment"
This reverts commit d8287bac1f.

Cause more issue than it fix. Need to think of a proper solution.
2012-12-19 09:56:17 -05:00
Jerome Glisse d8287bac1f r600g: work around ddx over alignment
This force surface allocated from ddx to be consider as height
aligned on 8 and fix 1D->2D tiling transition that result from
this.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
2012-12-18 16:10:54 -05:00
Paul Berry 1b37fc40fc i965: Fix gl_VertexID when there are no other vertex inputs.
brw_emit_vertices contains special case logic to handle the case where
a vertex shader doesn't read any inputs.  This special case logic was
incorrectly activating in the case were the only vertex input is
gl_VertexID.  As a result, if a shader used gl_VertexID but used no
other inputs, then all vertices got a gl_VertexID of zero.

Fixes oglconform test "ubo-usage advanced.transform_feedback".

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-12-18 09:02:53 -08:00
Paul Berry 5b7099c74d mesa: Make a function is_transform_feedback_active_and_unpaused.
The rather unweildy logic for determining this condition was repeated
in a large number of places.  This patch consolidates it to a single
inline function.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2012-12-18 09:02:53 -08:00
Paul Berry 1ad516207d mesa: Fix corner cases of BindBufferBase with transform feedback.
This patch implements the following behaviours, which are mandated by
the GL 4.3 and GLES3 specs.

1. Regarding the GL_TRANSFORM_FEEDBACK_BUFFER_SIZE query: "If the
   ... size was not specified when the buffer object was bound
   (e.g. if it was bound with BindBufferBase), ... zero is returned."
   (GL 4.3 section 6.7.1 "Indexed Buffer Object Limits and Binding
   Queries").

2. "BindBufferBase binds the entire buffer, even when the size of the
   buffer is changed after the binding is established. It is
   equivalent to calling BindBufferRange with offset zero, while size
   is determined by the size of the bound buffer at the time the
   binding is used."  (GL 4.3 section 6.1.1 "Binding Buffer Objects to
   Indexed Targets").  I interpret "at the time the binding is used"
   to mean "at the time of the call to glBeginTransformFeedback".

3. "Regardless of the size specified with BindBufferRange, or
   indirectly with BindBufferBase, the GL will never read or write
   beyond the end of a bound buffer. In some cases this constraint may
   result in visibly different behavior when a buffer overflow would
   otherwise result, such as described for transform feedback
   operations in section 13.2.2."  (GL 4.3 section 6.1.1 "Binding
   Buffer Objects to Indexed Targets").

Item 1 has been part of the spec all the way back to the inception of
the EXT_transform_feedback extension.  Items 2 and 3 were added in GL
4.2 and GLES 3.

Prior to GL 4.2, in place of items 2 and 3, the spec simply said
"BindBufferBase is equivalent to calling BindBufferRange with offset
zero and size equal to the size of buffer."  For transform feedback,
Mesa behaved as though this meant "...equal to the size of buffer at
the time of the call to BindBufferBase".  However, this was
problematic because it left it ambiguous what to do if the buffer is
shrunk between the call to BindBuffer{Base,Range} and the call to
BeginTransformFeedback.  Prior to this patch, Mesa's behaviour was to
try to write beyond the end of the buffer, likely resulting in memory
corruption.  In light of this, I'm interpreting the spec change as a
clarification, not an intended behavioural change, so I'm making the
change apply regardless of API version.

Fixes GLES3 conformance test transform_feedback2_pause_resume.test.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2012-12-18 09:02:49 -08:00