Commit Graph

45878 Commits

Author SHA1 Message Date
Kenneth Graunke 6c8ea1eed6 glsl: Make ir_validate actually visit ir_if nodes.
There is no ir_hierarchical_visitor::visit(ir_if *) method, since ir_if
is not a leaf node.  Instead, there are visit_enter and visit_leave
methods.  Use visit_enter arbitrarily (either would work fine, though
visit_enter will catch errors sooner).

Found thanks to a warning emitted by Clang.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-08-22 10:30:47 -07:00
Chad Versace 69595283b6 intel: Abort when DRI2 separate stencil handshake fails
When intel_context requires separate stencil but the DRI2 separate stencil
handshake fails, then abort and emit an error instructing the user to
upgrade the DDX to 2.16.0.

CC: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-08-22 07:27:05 -07:00
Kenneth Graunke 7a5d28908c glsl_to_tgsi: Fix a few more struct vs. class warnings.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-08-21 23:07:14 -07:00
Bryan Cain 5379a70d3f glsl_to_tgsi: emit a MAD(b, -a, b) for !a && b
This is a port of commit ff2cfb8989 to glsl_to_tgsi.
2011-08-20 14:43:25 -05:00
Bryan Cain c721d7b7bc glsl_to_tgsi: fix typo 2011-08-20 14:17:52 -05:00
Bryan Cain 9098953ee6 glsl_to_tgsi: implement ir_binop_all_equal using DP4 w/SGE
This is a port of commit ba01df11c4 to glsl_to_tgsi with integer support
added.
2011-08-20 14:15:03 -05:00
Bryan Cain f3dce133f0 glsl_to_tgsi: implement ir_binop_any_nequal using DP4 w/saturate or DP4 w/SLT
Implement the any() part of the operation the same way regular ir_unop_any
is implemented.

This is a port of commit e7bf096e8b to glsl_to_tgsi, with added integer
support.
2011-08-20 14:00:41 -05:00
Bryan Cain a43f68810a glsl_to_tgsi: implement ir_unop_any using DP4 w/saturate or DP4 w/SLT
This is a port of commit 92ca560d68 to glsl_to_tgsi, with integer support
added.
2011-08-20 14:00:41 -05:00
Bryan Cain c15eb5569b glsl_to_tgsi: make glsl_to_tgsi_visitor::emit_dp return the instruction 2011-08-20 14:00:40 -05:00
Bryan Cain 691cc0e3a8 glsl_to_tgsi: implement ir_binop_logic_or using an add w/saturate or add w/SLT
Logical-or is implemented using addition (followed by clamping to [0,1]) on
values of 0.0 and 1.0. Replacing the logical-or operators with addition gives
a + b which has a result on the range [0, 2].

Previously a SNE instruction was used to clamp the resulting logic value to
[0,1]. In a fragment shader, using a saturate on the add has the same effect.
Adding the saturate to the add is free, so (at least) one instruction is
saved. In a vertex shader, using an SLT on the negation of the add result has
the same effect. Many older shader architectures do not support the SNE
instruction. It must be emulated using two SLT instructions and an ADD. On
these architectures, the single SLT saves two instructions.

Note that SNE is still used when integers are used for boolean values, since
there is no such thing as an integer saturate, and older shader architectures
without SNE don't support integers.

This is a port of commit 41f8ffe5e0 to glsl_to_tgsi with integer support
added.
2011-08-20 14:00:40 -05:00
Bryan Cain 8c31bc7048 glsl_to_tgsi: implement ir_unop_logic_not using 1-x
Since our logic values are 0.0 (false) and 1.0 (true), 1.0 - x accurately
implements logical not.

This is a port of commit 6ad08989d7 to glsl_to_tgsi.
2011-08-20 14:00:40 -05:00
Chia-I Wu 112e68c503 st/egl: add a missing include
Reported by cwhuang.
2011-08-21 02:01:50 +08:00
Chia-I Wu b71a7a2f37 st/egl: improve error logging
This helps diagnose problems in EGL initialization.
2011-08-21 02:01:50 +08:00
Chia-I Wu 5ce2dc692f st/egl: add buffer preserving support to Android
Use a staging color buffer when buffer preserving is enabled.
2011-08-21 02:01:50 +08:00
Chia-I Wu 4c222ff4fe st/egl: improve buffer cache for Android
There may be more than two back buffers.  Clean up and prepare the
buffer cache for that.
2011-08-21 02:01:50 +08:00
Chia-I Wu 62c7c2fca4 st/egl: swapping without a buffer is not an error
This fixes Kwaak3.
2011-08-21 02:01:49 +08:00
Chia-I Wu 8ccafbbbcc st/egl: use HAL formats for Android backend
Native buffers use HAL formats, not UI formats.
2011-08-21 02:01:49 +08:00
Chia-I Wu 9650483acd winsys/sw/android: use HAL formats
Native buffers use HAL formats, not UI formats.
2011-08-21 02:01:49 +08:00
Chia-I Wu f496d8b86d winsys/sw/android: set bo usage correctly
Since this is the software path, set GRALLOC_USAGE_SW_WRITE_OFTEN when
PIPE_BIND_RENDER_TARGET, and set GRALLOC_USAGE_SW_READ_OFTEN when
PIPE_BIND_SAMPLER_VIEW.
2011-08-21 02:01:49 +08:00
Chia-I Wu 327de226ae android: make libGLES_mesa real
libGLES_mesa with swrast should link in these libraries

  libmesa_egl
  libmesa_egl_gallium
  libmesa_st_egl
  libmesa_st_mesa
  libmesa_glsl
  libmesa_glsl_utils
  libmesa_pipe_softpipe
  libmesa_winsys_sw_android
  libmesa_gallium

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:49 +08:00
Chia-I Wu ee41fc898d android: build shared glapi
This builds the shared library libglapi from shared glapi.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:49 +08:00
Chia-I Wu b81b82df95 android: build glsl
This builds the static library libmesa_glsl and executable glsl_compiler
from glsl.  glsl_compiler is only installed for engineering build.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:49 +08:00
Chia-I Wu ee40f18054 android: build core mesa
This builds the static library libmesa_st_mesa from core mesa.

Acked-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:49 +08:00
Chia-I Wu 2a77dc0c0d android: build core EGL
This builds the static library libmesa_egl from core EGL.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:49 +08:00
Chia-I Wu faf9d580f5 android: build softpipe
This builds the static library libmesa_pipe_softpipe from softpipe.
2011-08-21 02:01:49 +08:00
Chia-I Wu 15576344f7 android: build android sw winsys
This builds the static library libmesa_winsys_sw_android from winsys/sw.
2011-08-21 02:01:49 +08:00
Chia-I Wu b38da5f0a1 android: build targets/egl-static
This builds the static library libmesa_egl_gallium from
targets/egl-static.
2011-08-21 02:01:49 +08:00
Chia-I Wu 98345cf1b5 android: build st/egl with android backend
This builds the static library libmesa_st_egl from st/egl.
2011-08-21 02:01:48 +08:00
Chia-I Wu 688db6e8dc android: build gallium auxiliaries
This builds the static library libmesa_gallium from gallium auxiliaries.
2011-08-21 02:01:48 +08:00
Chia-I Wu c9b21d986e android: build libGLES_mesa
This is the first step to integrate Mesa into Android(-x86) build
system.  You can git clone mesa under the external/ directory of Android
source tree and build Android with

 $ make BOARD_GPU_DRIVERS=swrast

It will build libGLES_mesa that will be loaded by Android runtime.

libGLES_mesa is still a stub in this commit.
2011-08-21 02:01:48 +08:00
Chia-I Wu 4b2b0b9fb8 targets/egl-static: do not rely on libudev on Android
There is no libudev on Android.  Use DRM to get the PCI ID directly.

Reviewed-by: Benjamin Franzke <benjaminfranzke@googlemail.com>
2011-08-21 02:01:48 +08:00
Chia-I Wu 15418a8505 st/egl: add android backend
Both HW and SW rendering are supported for Android.  For SW rendering,
we use the generic gralloc lock/unlock for mapping and unmapping color
buffers (in winsys/android).

For HW rendering, we need to know the real type of color buffers.  This
backend works with drm_gralloc, where a color buffer is backed by a GEM
object.
2011-08-21 02:01:48 +08:00
Chia-I Wu 8e54c47a61 winsys/android: new SW winsys for Android
On Android, color buffers are passed between server and clients as
opaque buffer_handle_t.  This winsys makes use of gralloc, which
provides a generic way to map and unmap buffer_handle_t for CPU access.
2011-08-21 02:01:48 +08:00
Chia-I Wu 00b365bc78 egl: add Android-specific extensions
Add EGL_ANDROID_image_native_buffer and EGL_ANDROID_swap_rectangle.
There is no spec for them though.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:48 +08:00
Chia-I Wu b0945c14df egl: add _EGL_PLATFORM_ANDROID
This is Android Gingerbread platform.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:48 +08:00
Chia-I Wu 504f92c739 mesa: android has no log2f nor ffs
Define log2f(v) to be logf(v) / M_LN2 and ffs to __builtin_ffs.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:48 +08:00
Chia-I Wu b34770d834 ralloc: include limits.h for SIZE_MAX on Android
Android does not define SIZE_MAX in stdint.h.  We have to include
limits.h for it.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:48 +08:00
Chia-I Wu cd893ccba9 gallium: add PIPE_OS_ANDROID support
Android uses Linux kernel and its own C runtime.  It resembles
PIPE_OS_LINUX a lot with some minor exceptions.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-08-21 02:01:48 +08:00
Chia-I Wu 31753b50f3 glsl: remove an unnecessary header include
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:47 +08:00
Chia-I Wu a40008ac64 mesa: fix !FEATURE_GL build
Move vbo_exec_FlushVertices_internal out of FEATURE_beginend.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-21 02:01:47 +08:00
Kenneth Graunke f7d2dcae3b i965/gen7: Use align1 mode to set URB_WRITE_HWORD channel enables.
Makes the new vertex shader backend work on Ivybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-08-20 00:17:55 -07:00
Kenneth Graunke e98ee06776 i965/fs: Don't double-convert integer/boolean uniforms.
When ctx->Const.NativeIntegers is set, Core Mesa loads integer/boolean
uniforms directly, rather than loading the floating point equivalent.
So, when that's set, we don't need to perform any conversions.

Unfortunately, we can't properly support native integers with the old
vertex shader backend, so this patch leaves them disabled for now.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-08-19 23:32:50 -07:00
Kenneth Graunke 01d81dedc7 mesa, glsl_to_tgsi: Add new gl_context::NativeIntegers flag.
Previously, native integer support was based on whether the driver
advertised GLSL 1.30 or not.  However, drivers that natively support
integers may wish to do so for older GLSL versions as well.  Adding this
new opt-in flag allows them to do so.

Currently disabled by default on all drivers, which was the existing
behavior (no drivers currently implement GLSL 1.30).

Fixes piglit tests on i965 with INTEL_GLSL_VERSION=130 set:
- spec/glsl-1.10/fs-uniform-int-110.shader_test
- spec/glsl-1.30/fs-uniform-int-130.shader_test
(it was doubly converting the data)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-08-19 23:30:45 -07:00
Kenneth Graunke 07e9b9049f ir_to_mesa: Remove incorrect usage of the 'struct' keyword on classes.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-08-19 23:29:24 -07:00
Kenneth Graunke eb86bb55f5 i965/fs: Change incorrect use of 'struct fs_reg' to simply 'fs_reg'.
It's actually a class.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-08-19 23:29:24 -07:00
Kenneth Graunke 64f11db558 glsl: Remove unused variable. 2011-08-19 23:29:23 -07:00
Eric Anholt f4db75547f i965/vs: Implement proper register allocation instead of 1:1 mapping.
Fixes vs-atan-* and several others.  This is not the real solution we
eventually want, which will pack floats, vec2s, and vec3s into vec4
registers, but this code should provide the framework for that.
2011-08-19 17:06:29 -07:00
Eric Anholt 8174945d33 i965/vs: Add simple dead code elimination.
This is copied right from the fragment shader.  It is needed for real
register allocation to work correctly.
2011-08-19 17:06:29 -07:00
Eric Anholt 3dadc1e3cc i965/vs: Copy the live intervals calculation over from the FS.
This is a rather pessimistic calculation, since it doesn't distinguish
individual channels of a vec4, or elements of an array, but should be
a minimum start for register allocation.
2011-08-19 16:55:02 -07:00
Eric Anholt eb5454f20a i965/vs: Remove stale comment about compressed instructions.
This was copy'n'paste from the fragment shader, and didn't make sense
here.
2011-08-19 16:55:02 -07:00