Commit Graph

47879 Commits

Author SHA1 Message Date
Eric Anholt
05ab8fc134 intel: Remove duplicate test for texture attachment completeness.
We are already testing this if appropriate in
intel_validate_framebuffer (FBO completeness), so no need to avoid
attaching the texture to the renderbuffer here.

This causes MESA_FORMAT_R11_G11_B10_FLOAT to now be renderable as a texture
attachment on i965.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-22 13:58:38 -08:00
Eric Anholt
925356c8c0 i965: Don't require spans (swrast) support to consider a format FBO complete.
We don't want to go writing GetRow/PutRow for every format required by
GL 3.0, when it's very hard to get those functions called, and in
every case we want to make swrast do direct mapping through
MapRenderbuffer anyway.

This causes MESA_FORMAT_R11_G11_B10_FLOAT to be considered complete on gen6.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-22 13:58:38 -08:00
Eric Anholt
ca10b2d449 i965: Use the surface format table to determine render target supportedness.
This moves any chipset-dependent logic we want for render target
format choices to init time as well.  There is still logic left at
state update for SRGB handling, where format choices change based on
GL state.

The brw_render_target_supported() function should now return correct
results, instead of relying on the limited results from
intel_span_supports_format() to avoid lying about FBO completeness.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-22 13:58:38 -08:00
Eric Anholt
6661b7596f intel: Add the context to the render_target_supported() vtbl method.
We're going to want to provide different answers per chipset
generation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-22 13:58:38 -08:00
Eric Anholt
e589ebdf23 i965: Add a table of the surface format information from the PRM.
This will be used to drive chosing formats and determining framebuffer
completeness, instead of the bunch of ad-hoc checks we have had until
now.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
2011-11-22 13:58:38 -08:00
Eric Anholt
755f0a0a02 mesa: Make formats.c "datatype" values match glGetTexLevelParameter return.
The formats.c code's "datatype" value is "what does this value mean",
i.e. unorm or snorm or float, and is the return value from the
GL_TEXTURE_RED_TYPE class of queries.  The depth formats were marked
as GL_UNSIGNED_INT, which is what we use for integer, and not what we
should be returning from the glGetTexLevelParameter.

In texstore, we were inappropriately using it as an argument to
_mesa_unpack_depth_span() that was expecting a value like
GL_UNSIGNED_INT or GL_UNSIGNED_SHORT.  Just hardcode
_mesa_unpack_depth_span()'s arguments for now, though it looks like
the consumers of that interface would be happier with using
MESA_FORMAT.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-22 13:58:37 -08:00
Eric Anholt
250a9c8e7e mesa: Don't report types for 0-sized components of textures.
The GL_TEXTURE_WHATEVER_SIZE entrypoints were checking if the
specified base type of the texture allowed that channel to be present
before reporting the size of the channel, so that GL_RGB didn't end up
with an alpha size if the hardware driver had to store it that way.

The GL_TEXTURE_WHATEVER_TYPE entrypoints weren't checking it, so you
would end up with strange responses from the GL involving 0-bit
floating-point alpha components in GL_RGB32F, even though it says
GL_NONE as expected for other 0-sized channels.

Make _TYPE check _BaseFormat the same as _SIZE, which results in
fixing most of the GL_RGB* testcases of gl-3.0-required-sized-formats
pass on i965.

v2: Add a default case with a warning (suggestion by Brian Paul)

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
2011-11-22 13:58:37 -08:00
Marek Olšák
034e63b9f8 r600g: handle all remaining CAPs 2011-11-22 20:56:51 +01:00
Marek Olšák
4ac250c9d5 r600g: remove default case statements in get_param
This will throw a compile warning if there's an unhandled CAP.
2011-11-22 20:56:51 +01:00
Marek Olšák
650f6a6815 r300g: re-order shaders CAPs 2011-11-22 20:56:51 +01:00
Marek Olšák
410c12352a r300g: handle SHADER_CAP_OUTPUT_READ 2011-11-22 20:56:51 +01:00
Marek Olšák
684d74e000 r300g: remove default case statements in get_param
This will throw a compile warning if there's an unhandled CAP.
2011-11-22 20:56:51 +01:00
Marek Olšák
fba685a099 u_vbuf_mgr: rename to u_vbuf 2011-11-22 20:56:51 +01:00
Marek Olšák
611a8b82e3 u_vbuf_mgr: better way to find a free VB slot + check errors early 2011-11-22 20:56:51 +01:00
Marek Olšák
1146441a2d u_vbuf_mgr: remove a useless variable 2011-11-22 20:56:51 +01:00
Marek Olšák
c4f51b225b u_vbuf_mgr: remove redundant memset 2011-11-22 20:56:51 +01:00
Marek Olšák
498e86e414 u_vbuf_mgr: don't reference non-native vertex buffers as native
also don't mark them as 'user', because they will be uploaded through
the translate fallback anyway.
2011-11-22 20:56:51 +01:00
Marek Olšák
1e53a26b9c u_vbuf_mgr: rename translate_vb_slot -> fallback_vb_slot 2011-11-22 20:56:51 +01:00
Marek Olšák
bb71f9249a gallium: separate out floating-point CAPs into its own enum
The motivation behind this is to add some self-documentation in the code
about how each CAP can be used.

The idea is:
- enum pipe_cap is only valid in get_param
- enum pipe_capf is only valid in get_paramf

Which CAPs are floating-point have been determined based on how everybody
except svga implemented the functions. svga have been modified to match all
the other drivers.

Besides that, the floating-point CAPs are now prefixed with PIPE_CAPF_.
2011-11-22 20:56:50 +01:00
Marek Olšák
2a0126932b gallium: remove PIPE_CAP_GLSL and enable GLSL unconditionally
Only i965g does not enable GLSL, but that driver has been unmaintained and
bitrotting for quite a while anyway.
2011-11-22 20:56:50 +01:00
Marek Olšák
a92ee4abfe glsl: convervative_depth is not allowed in the vertex shader
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-11-22 20:56:50 +01:00
Marek Olšák
6b43d6fdda glsl: finish up ARB_conservative_depth (v2)
v2: updated an error message

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-11-22 20:56:50 +01:00
Marek Olšák
bbcb648bc2 mesa: rename the AMD_conservative_depth extension flag to ARB
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-11-22 20:56:50 +01:00
Marek Olšák
e99df05cce st/mesa: quick fix of CopyPixels with GL_DEPTH_STENCIL
This fixes:
- depthstencil-default_fb-copypixels
- fbo-depthstencil-GL_DEPTH24_STENCIL8-copypixels

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-22 20:56:50 +01:00
Ian Romanick
151867b422 linker: Remove erroneous multiply by 4 in uniform usage calculation
The old count_uniform_size::num_shader_uniforms was actually
calculating the number of components used.  Multiplying by 4 when
setting gl_shader::num_uniform_components caused us to count 4x as
many uniform components as were actually used.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42930
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42966
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Vinson Lee <vlee@vmware.com>
Tested-by: Pavel Ondračka <pavel.ondracka@email.cz>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-22 11:50:19 -08:00
Chad Versace
4ce635c871 Merge branch 'hiz' of ssh://people.freedesktop.org/~chadversary/mesa 2011-11-22 10:52:29 -08:00
Chad Versace
e5411d8fdc i965/gen6: Enable HiZ by default
Regresses one Piglit test: bugs/fdo10370.

I'm not enabling HiZ for gen7 yet because it causes a mysterious
performance regression.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:52 -08:00
Chad Versace
b18875d441 intel: Use separate stencil whenever possible
For depthstencil renderbuffers, we were using separate stencil only if the
hardware required it. Since the performance gains from HiZ is so high, we
should always use separate stencil if the hardware supports it.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:52 -08:00
Kenneth Graunke
e7e81714f3 i965: Implement the actual tables for texture alignment units [v2]
I implemented functions for horizontal/vertical alignment units separately
because I find it easier to read that way...especially with all the
corner-cases.

[chad] Corrected the vertical alignment calculation by checking for
depthstencil formats.

v2:
   - Fix typos in intel_horizontal_texture_alignment_unit():
     s/height/width/ and s/VALIGN/HALIGN.
   - Remove special case for compressed formats in
     intel_get_texture_alignment unit(). Compressed formats are already
     handled in the halign and valign functions.
   - Replace check ``_mesa_is_depth_format(...) ||
     _mesa_is_depthstencil_format(...)`` with explcitit checks against
     GL_DEPTH_COMPONENT and GL_DEPTH_STENCIL.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:52 -08:00
Chad Versace
dd0e46c410 i965/gen6: Set vertical alignment in SURFACE_STATE batch
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:52 -08:00
Chad Versace
017c13d55b intel: Store miptree alignment units in the miptree
This allows us to replace all the calls to
intel_get_texture_alignment_unit() with a single call at miptree creation.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:51 -08:00
Chad Versace
293e9a7ccf intel: Enable HiZ for texture renderbuffers
When a depth texture is first attached to framebuffer, allocate a HiZ
miptree for it.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:51 -08:00
Chad Versace
b264698d30 intel: Resolve buffers in intel_map_renderbuffer()
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:51 -08:00
Chad Versace
d2e35a5460 intel: Resolve buffers in intel_map_texture_image()
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:51 -08:00
Chad Versace
3d760664e6 intel: Mark needed resolves when first enabling HiZ on a miptree
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:51 -08:00
Chad Versace
1b2baf3b08 i965: Mark that depth buffer needs depth resolve after drawing
After brw_try_draw_prims() emits a batch, mark that the depth buffer needs
a depth resolve if the buffer was written to and if it has an accompanying
HiZ buffer.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:51 -08:00
Chad Versace
622bae07a5 intel: Resolve buffers in intelSpanRenderStart
Resolve all buffers that will be mapped by intelSpanRenderStart. This
comprises resolving the depth buffer of each enabled texture and of the
read and draw buffers.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:51 -08:00
Chad Versace
1eede4aa87 intel: Refactor intelSpanRenderStart
Factor the mapping loops from intelSpanRenderStart() into
intel_span_map_buffers(). This in preparation for the next commit,
which resolves the buffers before mapping.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:51 -08:00
Chad Versace
3b0d295e12 i965: Resolve buffers before drawing [v2]
Before emitting primitives in brw_try_draw_prims(), resolve the depth
buffer's HiZ buffer and resolve the depth buffer of each enabled depth
texture.

v2: [anholt] The driver no longer validates drm bo's, so update a comment
    to reflect that.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:50 -08:00
Chad Versace
b95986729e i965: Prevent recursive calls to FLUSH_VERTICES [v2]
To do so, we must resolve all buffers on entering a glBegin/glEnd block.
For the detailed explanation, see the Doxygen comments in this patch.

v2:
   - Fix typo: s/enusure/ensure/.
   - In brwPrepareExecBegin(), do the same resolves as done by
     brw_predraw_resolve_buffers().

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:50 -08:00
Chad Versace
1249855346 i965/gen6: Manipulate state batches for HiZ meta-ops [v4]
A lot of the state manipulation is handled by the meta-op state setup.
However, some batches need manual intervention.

v2:
   Do not special-case the 3DSTATE_DEPTH_STENCIL.Depth_Test_Enable bit
   for HiZ in gen6_upload_depth_stencil(). The HiZ meta-op sets
   ctx->Depth.Test, just read the value from that.

v3:
   Add a new dirty flag, BRW_STATE_HIZ, for brw_tracked_state. Flag it
   immediately before and after executing the HiZ operation in
   gen6_resolve_slice(). Add the flag to the the dirty bits for the
   following state packets:
      gen6_clip_state
      gen6_depth_stencil_state
      gen6_sf_state
      gen6_wm_state

v4:
   - Add BRW_NEW_STATE_HIZ to the dirty bit table in brw_state_upload.c.
     This is needed for INTEL_DEBUG=state.
   - Align brw dirty bit for gen6_depth_stencil_state.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:50 -08:00
Chad Versace
d1f1d348d8 i965/gen6: Complete stubs for HiZ buffer resolves
Some state batches also need to be manipulated. That's done in the next
commit.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:50 -08:00
Chad Versace
77a18428ff i965: Add HiZ operation state to brw_context
brw_context::hiz contains state needed to perform HiZ meta-ops and
indicates if a HiZ operation is currently in progress.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:50 -08:00
Chad Versace
1383e56bd9 intel: Add resolve functions for renderbuffers
Add the following functions:
   intel_renderbuffer_resolve_hiz
   intel_renderbuffer_resolve_depth

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:50 -08:00
Chad Versace
2945abea33 intel: Add resolve functions for miptrees
Add functions that
   - set a miptree slice as needing a resolve
   - resolve a single slice of a miptree
   - resolve all slices of a miptree

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:49 -08:00
Chad Versace
cf5e08c8e4 intel: Add field intel_mipmap_tree::hiz_map
This is a map of miptree slices to needed resolves.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:49 -08:00
Chad Versace
8d3aa14e89 intel: Define struct intel_resolve_map [v2]
This is a map of miptree slices to needed resolves, implemented as
a linked list. A future commit will embed such a list in
intel_mipmap_tree.

If you think I'm crazy to put a list in a miptree, read the Doxygen in
this patch for intel_resolve_map.

v2: [anholt] Move Doxygen from functin prototypes to definitions.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:49 -08:00
Chad Versace
f17b12278d intel: Change signature of HiZ resolve functions
Now that intel_renderbuffer::region has been replaced with a miptree, the
HiZ functions region parameter must be replaced with a miptree parameter.

Change the return type from bool to void.

Rename the 'depth' parameter to 'layer', because it will correspond to
irb->mt_layer.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:49 -08:00
Chad Versace
c015183947 intel: Remove unused HiZ functions
Remove the following functions:
   i830_hiz_resolve_noop
   i915_hiz_resolve_noop
   brw_hiz_resolve_noop

My original strategy for how intel->vtbl.resolve_*buffer was used has
substantially changed. The above functions are no longer called in the
current strategy.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:49 -08:00
Chad Versace
a2e44b0813 intel: Replace intel_mipmap_tree::hiz_region with a miptree [v2]
This is required to correctly implement HiZ for mipmapped and
multi-layered textures.

v2: Accomodate refcount fixes in intel_process_dri2_buffer_*() that were
    introduced in v2 of commit
        intel: Replace intel_renderbuffer::region with a miptree [v2]

Reviewed-by: Eric Anholt <eric@anholt>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-22 10:50:49 -08:00