Compare commits

..

80 Commits

Author SHA1 Message Date
Ian Romanick
61653b488d mesa: set version string to 7.9-rc1 2010-09-27 10:17:11 -07:00
Marek Olšák
7e62335f35 r300g: fix macrotiling on R350
MACRO_SWITCH on R350 appears to use the RV350 mode by default. Who knew?

NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 311ab3d468)

https://bugs.freedesktop.org/show_bug.cgi?id=30313
2010-09-26 23:00:16 +02:00
Joakim Sindholt
b8a60c84aa radeong: fix leaks
(cherry picked from commit 16baa465a2)
2010-09-26 19:59:11 +02:00
Joakim Sindholt
9f221e738d util/u_blitter: fix leak
(cherry picked from commit b51f6e7c23)
2010-09-26 19:53:47 +02:00
Tom Stellard
5c78e931c2 r300/compiler: Fix two mistakes in the presubtract optimization pass.
1. We can't turn an instruction into a presubtract operation if it
writes to one of the registers it reads from.
2. If we turn an instruction into a presubtract operation, we can't
remove that intruction unless all readers can use the presubtract
operation.

This fixes fdo bug 30337.
This is a candidate for the 7.9 branch.
(cherry picked from commit 522e994a22)
2010-09-25 15:53:20 -07:00
Marek Olšák
361084ac4b util: fix util_pack_color for B4G4R4A4
NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 8619495790)
2010-09-25 01:54:12 +02:00
Marek Olšák
9409b544cc Build r300g by default
NOTE: This will go to 7.9 as well.
(cherry picked from commit 85a45dcd5d)
2010-09-25 01:54:12 +02:00
Marek Olšák
7261c3973d r300g: fix the border color for every format other than PIPE_FORMAT_B8G8R8A8
TX_BORDER_COLOR should be formatted according to the texture format.
Also the interaction with ARB_texture_swizzle should be fixed too.

NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 9f35dcd24c)
2010-09-25 01:54:12 +02:00
Marek Olšák
bb4c9e0969 r300g: make accessing map_list and buffer_handles thread-safe
NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit a333485386)
2010-09-25 01:54:12 +02:00
Marek Olšák
aa05753059 r300g: fixup long-lived BO maps being incorrectly unmapped when flushing
Based on commit 3ddc714b20 by Dave Airlie.

NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 206d92912c)
2010-09-25 01:54:12 +02:00
Marek Olšák
09085ada5d util: make calling remove_from_list multiple times in a row safe
This commit fixes an infinite loop in foreach_s if remove_from_list is used
more than once on the same item with other list operations in between.

NOTE: This is a candidate for the 7.9 branch because the commit
"r300g: fixup long-lived BO maps being incorrectly unmapped when flushing"
depends on it.
(cherry picked from commit 68afbe89c7)
2010-09-25 01:54:11 +02:00
Alex Deucher
77cc2a4e17 r600c: fix mipmap stride on evergreen
taken from Dave's r600g fix
2010-09-24 13:27:21 -04:00
Brian Paul
96085dc41a st/mesa: use the wrapped renderbuffer in CopyPixels()
Fixes assertion failures when copying stencil pixels.

NOTE: this is a candidate for the 7.9 branch.
(cherry picked from commit f5c810c42f)
2010-09-24 10:18:12 -06:00
Brian Paul
a128b62a35 st/mesa: add missing MESA_FORMAT_S8 case in st_mesa_format_to_pipe_format()
NOTE: this is a candidate for the 7.9 branch.
(cherry picked from commit 10dcc989ab)
2010-09-24 10:17:40 -06:00
Brian Paul
b756100892 mesa: fix assertions to handle srgb formats
http://bugs.freedesktop.org/show_bug.cgi?id=30333

NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 9f7c8053e0)
2010-09-24 10:16:52 -06:00
Tom Stellard
3ad0279344 r300g: Always try to build libr300compiler.a
Make libr300compiler.a a PHONY target so that this library will always be
built.  This fixes the problem of libr300compiler.a not being updated
when r300g is being built and r300c is not.

(cherry picked from commit 92762842a0)
2010-09-23 15:42:40 -07:00
Kristian Høgsberg
97cfa1240c intel: Fix GL_ARB_shading_language_120 commit
Fix commit e7087175f8.  Move the reference to
GL_VERSION_2_1_functions to intel_extensions.c where it's available,
don't try to enable a non-existing extension and advertise 1.20 for all
intel chipsets, not just GEN4 and up.
(cherry picked from commit b91dba49e0)
2010-09-23 08:47:01 -07:00
Brian Paul
6b0c280660 mesa: don't advertise bogus GL_ARB_shading_language_120 extension
Instead of using the invalid GL_ARB_shading_language_120 extension to
determine the GLSL version, use a new ctx->Const.GLSLVersion field.
Updated the intel and r600 drivers, but untested.

See fd.o bug 29910

NOTE: This is a candidate for the 7.9 branch (but let's wait and see if
there's any regressions).
(cherry picked from commit e7087175f8)
2010-09-23 08:47:01 -07:00
Eric Anholt
b437c9102f i965: Share the KIL_NV implementation between glsl and non-glsl.
(cherry picked from commit 23c507f135)
2010-09-23 08:47:01 -07:00
Kenneth Graunke
4ec818ea4a glsl: Fix broken handling of ir_binop_equal and ir_binop_nequal.
When ir_binop_all_equal and ir_binop_any_nequal were introduced, the
meaning of these two opcodes changed to return vectors rather than a
single scalar, but the constant expression handling code was incorrectly
written and only worked for scalars.  As a result, only the first
component of the returned vector would be properly initialized.
(cherry picked from commit 6ea16b6c51)
2010-09-23 08:47:01 -07:00
Kenneth Graunke
80a6cbfea3 glsl: Add comments to clarify the types of comparison binops.
(cherry picked from commit 14eea26828)
2010-09-23 08:47:01 -07:00
Brian Paul
ec2031563a glsl2: silence compiler warnings in printf() calls
Such as: "ir_validate.cpp:143: warning: format ‘%p’ expects type ‘void*’,
but argument 2 has type ‘ir_variable*’"
(cherry picked from commit 1739124159)
2010-09-23 08:47:01 -07:00
Ian Romanick
b7d4f08f4e glsl: Add doxygen comments
(cherry picked from commit e053d62aa5)
2010-09-23 08:47:01 -07:00
Kenneth Graunke
2fc2b89680 glsl/builtins: Switch comparison functions to just return an expression.
(cherry picked from commit dbd2480507)
2010-09-23 08:47:01 -07:00
Kenneth Graunke
b29289a61c glsl/builtins: Fix equal and notEqual builtins.
Commit 309cd4115b incorrectly converted
these to all_equal and any_nequal, which is the wrong operation.
(cherry picked from commit 52f9156e88)
2010-09-23 08:47:01 -07:00
Kenneth Graunke
728829ab63 glsl: Properly handle nested structure types.
Fixes piglit test CorrectFull.frag.
(cherry picked from commit ca92ae2699)
2010-09-23 08:47:01 -07:00
Tilman Sauerbeck
9753ee3f3e glsl2: Fixed cloning of ir_call error instructions.
Those have the callee field set to the null pointer, so
calling the public constructor will segfault.

Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
(cherry picked from commit 3894fddccc)
2010-09-23 08:47:01 -07:00
Vinson Lee
2db5398449 glsl: Fix 'control reaches end of non-void function' warning.
Fixes this GCC warning.

lower_variable_index_to_cond_assign.cpp:
In member function
'bool variable_index_to_cond_assign_visitor::needs_lowering(ir_dereference_array*) const':

lower_variable_index_to_cond_assign.cpp:261:
warning: control reaches end of non-void function
(cherry picked from commit a822ae3f1a)
2010-09-23 08:47:01 -07:00
Vinson Lee
ee8a96707a ir_to_mesa: Remove unused member array_indexed from struct statevar_element.
Fixes this GCC warning.
warning: missing initializer for member 'statevar_element::array_indexed'
(cherry picked from commit ff78d6dcc0)
2010-09-23 08:47:01 -07:00
Tilman Sauerbeck
22dcee8da2 glsl2: Empty functions can be inlined.
Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 19f8f32a96)
2010-09-23 08:47:00 -07:00
Ian Romanick
1b622bfbee glsl2: Add flags to enable variable index lowering
(cherry picked from commit a6ecd1c372)
2010-09-23 08:47:00 -07:00
Ian Romanick
2bb2efd7b2 glsl2: Refactor testing for whether a deref is of a matrix or array
(cherry picked from commit 6e4fe39da2)
2010-09-23 08:47:00 -07:00
Luca Barbieri
a19f0fb50b glsl: add pass to lower variable array indexing to conditional assignments
Currenly GLSL happily generates indirect addressing of any kind of
arrays.

Unfortunately DirectX 9 GPUs are not guaranteed to support any of them in
general.

This pass fixes that by lowering such constructs to a binary search on the
values, followed at the end by vectorized generation of equality masks, and
4 conditional assignments for each mask generation.

Note that this requires the ir_binop_equal change so that we can emit SEQ
to generate the boolean masks.

Unfortunately, ir_structure_splitting is too dumb to turn the resulting
constant array references to individual variables, so this will need to
be added too before this pass can actually be effective for temps.

Several patches in the glsl2-lower-variable-indexing were squashed
into this commit.  These patches fix bugs in Luca's original
implementation, and the individual patches can be seen in that branch.
This was done to aid bisecting in the future.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit a47539c7a1)
2010-09-23 08:47:00 -07:00
Kenneth Graunke
8df8bb43c7 glsl: Don't print blank (function ...) headers for built-ins.
Fixes a regression caused when I added my GLSL ES support.
(cherry picked from commit 8fbe968a62)
2010-09-23 08:47:00 -07:00
Kenneth Graunke
d2b6502c93 glsl: Change from has_builtin_signature to has_user_signature.
The print visitor needs this, and the only existing user can work with
has_user_signature just as well.
(cherry picked from commit 81f0339398)
2010-09-23 08:47:00 -07:00
Brian Paul
e68ec2212f glsl2: fix signed/unsigned comparison warning
(cherry picked from commit 7545514fb6)
2010-09-23 08:47:00 -07:00
Vinson Lee
c0f82e619c glsl: Fix 'format not a string literal and no format arguments' warning.
Fix the following GCC warning.
loop_controls.cpp: In function 'int calculate_iterations(ir_rvalue*, ir_rvalue*, ir_rvalue*, ir_expression_operation)':
loop_controls.cpp:88: warning: format not a string literal and no format arguments
(cherry picked from commit f20f2cc330)
2010-09-23 08:47:00 -07:00
José Fonseca
7f95c59509 draw: Prevent clipped vertices overflow.
Some pathological triangles cause a theoritically impossible number of
clipped vertices.

The clipper will still assert, but at least release builds will not
crash, while this problem is further investigated.
2010-09-23 16:48:59 +01:00
Keith Whitwell
6f310f379b draw: don't apply flatshading to clipped tris with <3 verts
If a triangle was completely culled by clipping, we would still try to
fix up its provoking vertex.
2010-09-23 16:28:27 +01:00
Dave Airlie
f279480df2 egl: fix build since 17eace581d
looks like mesa st didn't get updated.
2010-09-23 07:41:05 -04:00
Kristian Høgsberg
d382c51a23 dri: Pass the __DRIscreen and the __DRIscreen private back to image lookup
We will typically have a current context when we need to lookup the image,
but the lookup implementation don't need it so drop it.
2010-09-23 07:40:59 -04:00
Kristian Høgsberg
cdb3f23d8a glx: Hold on to drawables if we're just switching to another context
https://bugs.freedesktop.org/show_bug.cgi?id=30234
2010-09-23 07:40:27 -04:00
Eric Anholt
8f4c99a9af i965: Also enable CC statistics when doing OQs.
This is required by the spec, so respect that.

(oh, and it was required to actually fix occlusion-query-discard,
though I didn't know at the time of the commit since o-q-discard was
hanging the GPU)

(cherry picked from commit 4a0bc4716d)
2010-09-22 13:45:50 -07:00
Eric Anholt
5285100502 ir_to_mesa: Only compare vector_elements present for any_nequal/all_equal
Fixes: glsl-mat-from-int-ctor-03
(cherry picked from commit eaa6bf59db)
2010-09-22 13:43:10 -07:00
Eric Anholt
56dc7ca916 i965: Track the windowizer's dispatch for kill pixel, promoted, and OQ
Looks like the problem was we weren't passing the depth to the render
target as expected, so the chip would wedge.  Fixes GPU hang in
occlusion-query-discard.

Bug #30097
(cherry picked from commit dd9a88f4dd)
2010-09-22 13:15:59 -07:00
Eric Anholt
902dfdaa86 glsl: Add definition of gl_TextureMatrix inverse/transpose builtins.
Fixes glsl2/builtin-texturematrix.
Bug #30196.
(cherry picked from commit b5bb215629)
2010-09-22 13:15:59 -07:00
Kristian Høgsberg
c98ce41de3 dri2: Make createImageFromName() take a __DRIscreen instead of __DRIcontext
We can't expect to have a context when this is called, and we don't need one
so just require a __DRIscreen instead.

Reported by Yu Dai <yu.dai@intel.com>
2010-09-22 15:27:04 -04:00
Brian Paul
3cdfc62523 llvmpipe: use draw module to draw sprites
For the 7.9 branch, this is simpler than merging the sprite-coord branch
and less likely to break other drivers.

Fixes fd.o bug 29849.
2010-09-22 08:22:36 -06:00
Brian Paul
2606105cc5 glsl2: fix typo in error msg
(cherry picked from commit 2b95525429)
2010-09-21 14:58:24 -06:00
Keith Whitwell
141dbbfc78 llvmpipe: fix flatshading in new line code
Calculate interpolants before rearranging the vertices.
2010-09-21 14:40:22 +01:00
Brian Paul
e678c3f4e1 docs: mark as obsolete, remove dead links
(cherry picked from commit 0bc3e1f4f4)
2010-09-20 10:56:53 -06:00
Brian Paul
1b90889eb4 docs: remove old broken link
(cherry picked from commit a8fde1ba4d)
2010-09-20 10:56:41 -06:00
Brian Paul
a9fceb6979 llvmpipe: fix query bug when no there's no scene
(cherry picked from commit 7888a2f822)
2010-09-20 10:56:10 -06:00
Brian Paul
febd353bcd gallivm: fix incorrect vector shuffle datatype
The permutation vector must always be a vector of int32 values.

(cherry picked from commit 3c9f4c7b75)
2010-09-20 10:55:35 -06:00
Marek Olšák
0f1faa9c7b st/mesa: fix assertion failure in GetTexImage for cubemaps
Can be reproduced with mesa/demos/src/tests/blitfb.

NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 168554904b)
2010-09-20 18:21:24 +02:00
Jakob Bornecrantz
b247620854 i915g: Link with wrapper sw winsys with scons
cherry picked from commit 208f1f3810
2010-09-20 15:45:35 +02:00
Michal Krol
d36344f900 svga: Integer constant register file has a separate namespace.
Count int and float constants independently. Since there are only
few i# constants available and hundreds of c# constants, it would
be too easy to end up with an i# declaration out of its range.
2010-09-20 09:29:26 +01:00
Michal Krol
202c1279c6 svga: Fix relative addressing translation for pixel shaders.
Pixel shaders do not have address registers a#, only one
loop register aL. Our only hope is to assume the address
register is in fact a loop counter and replace it with aL.

Do not translate ARL instruction for pixel shaders -- MOVA
instruction is only valid for vertex saders.

Make it more explicit relative addressing of inputs is only valid
for pixel shaders and constants for vertex shaders.
2010-09-20 09:29:24 +01:00
Jakob Bornecrantz
f6e811a7d0 scons: Link against talloc in the Gallium DRI drivers
cherry picked from commit b83156d42f
2010-09-20 00:08:06 +02:00
Luca Barbieri
bd009df1cc auxiliary: fix depth-only and stencil-only clears
Depth-only and stencil-only clears should mask out depth/stencil from the
output, mask out stencil/input from input, and OR or ADD them together.

However, due to a typo they were being ANDed, resulting in zeroing the buffer.
2010-09-19 21:51:25 +02:00
Chia-I Wu
d6df0cdcca egl: Enable drm platform by default.
This enables EGL_MESA_drm_display for st/egl in the default setup.
(cherry picked from commit 2a910b3396)
2010-09-19 17:37:00 +08:00
Chia-I Wu
52f6be0688 st/egl: s/kms/drm/ on the drm backend.
s/kms/drm/, s/kdpy/drmdpy/, and so forth.
(cherry picked from commit e4513e7fb9)
2010-09-19 17:30:00 +08:00
Chia-I Wu
b73cfde5ce st/egl: Rename kms backend to drm.
The main use of the backend is to support EGL_MESA_drm_display.  drm
should be a better name.
(cherry picked from commit e7424d7240)
2010-09-19 17:29:55 +08:00
Chia-I Wu
d7500ac4df st/egl: Split modeset code support to modeset.c.
The modeset code supports now obsolete EGL_MESA_screen_surface.  Move it
to a file of its own.
(cherry picked from commit c7c2e7d0ce)
2010-09-19 17:29:50 +08:00
Brian Paul
83917660f1 tgsi/sse: fix aos_to_soa() loop to handle num_inputs==0
Basically, change the loop from:
  do {...} while (--num_inputs != 0)
into:
  while (num_inputs != 0) { ... --num_inputs; }

Fixes fd.o bug 29987.
(cherry picked from commit 4b27c614cf)
2010-09-17 10:51:50 -07:00
Chia-I Wu
69f67f5ded libgl-xlib: Remove unused st_api_create_OpenGL.
st/egl no longer relies on libGL for OpenGL support.
2010-09-17 12:57:15 +08:00
Chia-I Wu
a42527be33 targets/egl: Use C++ compiler to link GL/ES state trackers.
Otherwise, applications compiled with C compiler might have trouble
using them.
2010-09-17 12:57:06 +08:00
Brian Paul
d169a67ad1 mesa: include mfeatures.h in formats.c
Otherwise, FEATURE_EXT_texture_sRGB was undefined.
This is (part of?) the fix for fd.o bug 30177.

(cherry picked from commit 3a6f9d0f47)
2010-09-16 12:42:53 -06:00
Marek Olšák
be16a35438 r300g/swtcl: fix CS overrun
https://bugs.freedesktop.org/show_bug.cgi?id=29901
(cherry picked from commit d4b2de13bc)
2010-09-16 20:35:39 +02:00
Brian Paul
d46b7c9f6f glx: add const qualifiers to __indirect_glMultiDrawArraysEXT()
(cherry picked from commit 4cd751bcc4)
2010-09-16 14:34:06 +08:00
Chia-I Wu
5d02503467 st/xlib: Notify the context when the front/back buffers are swapped.
The current context should be notified when the the front/back buffers
of the current drawable are swapped.  The notification was skipped when
xmesa_strict_invalidate is false (the default).

This fixes fdo bug #29774.
(cherry picked from commit 03224f492d)
2010-09-16 14:24:46 +08:00
Chia-I Wu
e3b89388ff mesa: Update ES APIspec.xml.
Enable some extensions now that the needed tokens are defined in
GLES/glext.h and GLES2/glext.h.  Update the prototype of MultiDrawArrays
now that the prototype of _mesa_MultiDrawArraysEXT has been updated.
(cherry picked from commit 9ca59b2427)
2010-09-16 14:24:45 +08:00
Chia-I Wu
d6538baa3b glapi: Fix ES build errors again.
This fixes an error in GLAPI ES.  My build is ok with or without this
patch, and the error affects others' setups.

[Patch from Francesco Marella]
(cherry picked from commit e3c46cf586)
2010-09-16 14:24:45 +08:00
Chia-I Wu
16a023ad7d glapi: Fix build errors for ES.
The latest glext.h defines GL_FIXED.  Test GL_OES_fixed_point instead to
decide whether to define GLfixed and GLclampx.

This fixes fdo bug #30205.
(cherry picked from commit cad87ebc3a)
2010-09-16 14:24:45 +08:00
Andre Maasikas
029eb8e764 r600c: fix buffer height setting in dri2 case
fbHeight is 0 in this case

uncovered by changes in b0bc026c and should fix kernel rejecting command
streams after that commit
2010-09-16 09:09:43 +03:00
Brian Paul
71b4054a6c tgsi: fix incorrect usage_mask for shadow tex instructions
The shadow versions of the texture targets use an extra component
(Z) to express distance from light source to the fragment.
Fixes the shadowtex demo with llvmpipe.

(cherry picked from commit 95254bbd2d)
2010-09-15 13:57:50 -06:00
Keith Whitwell
8e8a42ffc5 llvmpipe: return zero from floor_pot(zero) 2010-09-15 16:41:59 +01:00
Dave Airlie
fd4c6bd135 r300g: fix buffer reuse issue caused by previous commit
caused by 0b9eb5c9bb

test run glxgears, resize.
(cherry picked from commit 09ef8e9283)
2010-09-15 13:32:29 +02:00
Marek Olšák
5d4409e0e5 r300g: prevent creating multiple winsys BOs for the same handle
This fixes a DRM deadlock in the cubestorm xscreensaver, because somehow
there must not be 2 different BOs relocated in one CS if both BOs back
the same handle. I was told it is impossible to happen, but apparently
it is not, or there is something else wrong.
(cherry picked from commit 0b9eb5c9bb)
2010-09-15 04:34:36 +02:00
Luca Barbieri
26e63a431d auxiliary: fix unintended fallthrough 2010-09-14 23:22:16 +02:00
2002 changed files with 92350 additions and 149845 deletions

View File

@@ -180,7 +180,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.10
VERSION=7.9-rc1
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
GLUT_NAME = MesaGLUT-$(VERSION)
@@ -329,8 +329,6 @@ GALLIUM_FILES = \
$(DIRECTORY)/src/gallium/Makefile.template \
$(DIRECTORY)/src/gallium/SConscript \
$(DIRECTORY)/src/gallium/targets/Makefile.dri \
$(DIRECTORY)/src/gallium/targets/Makefile.xorg \
$(DIRECTORY)/src/gallium/targets/SConscript.dri \
$(DIRECTORY)/src/gallium/*/Makefile \
$(DIRECTORY)/src/gallium/*/SConscript \
$(DIRECTORY)/src/gallium/*/*/Makefile \
@@ -347,19 +345,22 @@ GALLIUM_FILES = \
DRI_FILES = \
$(DIRECTORY)/include/GL/internal/dri_interface.h \
$(DIRECTORY)/include/GL/internal/glcore.h \
$(DIRECTORY)/include/GL/internal/sarea.h \
$(DIRECTORY)/src/glx/Makefile \
$(DIRECTORY)/src/glx/Makefile \
$(DIRECTORY)/src/glx/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/Makefile \
$(DIRECTORY)/src/mesa/drivers/dri/Makefile.template \
$(DIRECTORY)/src/mesa/drivers/dri/dri.pc.in \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \
$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/dri/*/*.cpp \
$(DIRECTORY)/src/mesa/drivers/dri/*/*/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/dri/*/Makefile \
$(DIRECTORY)/src/mesa/drivers/dri/*/*/Makefile \
$(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile
$(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile \
$(DIRECTORY)/src/mesa/drivers/dri/*/server/*.[ch]
SGI_GLU_FILES = \
$(DIRECTORY)/src/glu/Makefile \

View File

@@ -3,14 +3,14 @@
#
# For example, invoke scons as
#
# scons build=debug llvm=yes machine=x86
# scons debug=1 dri=0 machine=x86
#
# to set configuration variables. Or you can write those options to a file
# named config.py:
#
# # config.py
# build='debug'
# llvm=True
# debug=1
# dri=0
# machine='x86'
#
# Invoke
@@ -30,8 +30,55 @@ import common
#######################################################################
# Configuration options
default_statetrackers = 'mesa'
default_targets = 'graw-null'
if common.default_platform in ('linux', 'freebsd', 'darwin'):
default_drivers = 'softpipe,galahad,failover,svga,i915,i965,trace,identity,llvmpipe'
default_winsys = 'xlib'
elif common.default_platform in ('winddk',):
default_drivers = 'softpipe,svga,i915,i965,trace,identity'
default_winsys = 'all'
elif common.default_platform in ('embedded',):
default_drivers = 'softpipe,llvmpipe'
default_winsys = 'xlib'
else:
default_drivers = 'all'
default_winsys = 'all'
opts = Variables('config.py')
common.AddOptions(opts)
opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
['mesa', 'python', 'xorg', 'egl']))
opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
['softpipe', 'galahad', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'r600', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon', 'r600', 'graw-xlib']))
opts.Add(ListVariable('targets', 'driver targets to build', default_targets,
['dri-i915',
'dri-i965',
'dri-nouveau',
'dri-radeong',
'dri-swrast',
'dri-vmwgfx',
'egl-i915',
'egl-i965',
'egl-nouveau',
'egl-radeon',
'egl-swrast',
'egl-vmwgfx',
'graw-xlib',
'graw-null',
'libgl-gdi',
'libgl-xlib',
'xorg-i915',
'xorg-i965',
'xorg-nouveau',
'xorg-radeon',
'xorg-vmwgfx']))
opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
env = Environment(
options = opts,
@@ -40,26 +87,61 @@ env = Environment(
ENV = os.environ,
)
# Backwards compatability with old target configuration variable
try:
targets = ARGUMENTS['targets']
except KeyError:
pass
else:
targets = targets.split(',')
print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
print
print ' scons %s' % ' '.join(targets)
print
COMMAND_LINE_TARGETS.append(targets)
if os.environ.has_key('CC'):
env['CC'] = os.environ['CC']
if os.environ.has_key('CFLAGS'):
env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
if os.environ.has_key('CXX'):
env['CXX'] = os.environ['CXX']
if os.environ.has_key('CXXFLAGS'):
env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
if os.environ.has_key('LDFLAGS'):
env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
Help(opts.GenerateHelpText(env))
# replicate options values in local variables
debug = env['debug']
dri = env['dri']
machine = env['machine']
platform = env['platform']
# derived options
x86 = machine == 'x86'
ppc = machine == 'ppc'
gcc = platform in ('linux', 'freebsd', 'darwin', 'embedded')
msvc = platform in ('windows', 'winddk')
Export([
'debug',
'x86',
'ppc',
'dri',
'platform',
'gcc',
'msvc',
])
#######################################################################
# Environment setup
# Always build trace, rbug, identity, softpipe, and llvmpipe (where possible)
if 'trace' not in env['drivers']:
env['drivers'].append('trace')
if 'rbug' not in env['drivers']:
env['drivers'].append('rbug')
if 'galahad' not in env['drivers']:
env['drivers'].append('galahad')
if 'identity' not in env['drivers']:
env['drivers'].append('identity')
if 'softpipe' not in env['drivers']:
env['drivers'].append('softpipe')
if env['llvm'] and 'llvmpipe' not in env['drivers']:
env['drivers'].append('llvmpipe')
if 'sw' not in env['drivers']:
env['drivers'].append('sw')
# Includes
env.Prepend(CPPPATH = [
'#/include',
@@ -75,7 +157,7 @@ if env['msvc']:
env.Append(CPPPATH = ['#include/c99'])
# Embedded
if env['platform'] == 'embedded':
if platform == 'embedded':
env.Append(CPPDEFINES = [
'_POSIX_SOURCE',
('_POSIX_C_SOURCE', '199309L'),
@@ -92,7 +174,7 @@ if env['platform'] == 'embedded':
])
# Posix
if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
if platform in ('posix', 'linux', 'freebsd', 'darwin'):
env.Append(CPPDEFINES = [
'_POSIX_SOURCE',
('_POSIX_C_SOURCE', '199309L'),
@@ -102,9 +184,9 @@ if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
'PTHREADS',
'HAVE_POSIX_MEMALIGN',
])
if env['gcc']:
if gcc:
env.Append(CFLAGS = ['-fvisibility=hidden'])
if env['platform'] == 'darwin':
if platform == 'darwin':
env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
env.Append(LIBS = [
'm',
@@ -126,7 +208,9 @@ Export('env')
SConscript(
'src/SConscript',
variant_dir = env['build_dir'],
variant_dir = env['build'],
duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
)
env.Default('src')

View File

@@ -8,8 +8,6 @@ import subprocess
import sys
import platform as _platform
import SCons.Script.SConscript
#######################################################################
# Defaults
@@ -22,15 +20,6 @@ _platform_map = {
default_platform = sys.platform
default_platform = _platform_map.get(default_platform, default_platform)
# Search sys.argv[] for a "platform=foo" argument since we don't have
# an 'env' variable at this point.
if 'platform' in SCons.Script.ARGUMENTS:
selected_platform = SCons.Script.ARGUMENTS['platform']
else:
selected_platform = default_platform
cross_compiling = selected_platform != default_platform
_machine_map = {
'x86': 'x86',
'i386': 'x86',
@@ -48,26 +37,38 @@ if 'PROCESSOR_ARCHITECTURE' in os.environ:
else:
default_machine = _platform.machine()
default_machine = _machine_map.get(default_machine, 'generic')
default_toolchain = 'default'
if selected_platform == 'windows' and cross_compiling:
default_machine = 'x86'
default_toolchain = 'crossmingw'
# find default_llvm value
if 'LLVM' in os.environ:
default_llvm = 'yes'
else:
# Search sys.argv[] for a "platform=foo" argument since we don't have
# an 'env' variable at this point.
platform = default_platform
pattern = re.compile("(platform=)(.*)")
for arg in sys.argv:
m = pattern.match(arg)
if m:
platform = m.group(2)
default_llvm = 'no'
try:
if selected_platform != 'windows' and \
subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
if platform != 'windows' and subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
default_llvm = 'yes'
except:
pass
# find default_dri value
if default_platform in ('linux', 'freebsd'):
default_dri = 'yes'
elif default_platform in ('winddk', 'windows', 'wince', 'darwin'):
default_dri = 'no'
else:
default_dri = 'no'
#######################################################################
# Common options
@@ -80,15 +81,13 @@ def AddOptions(opts):
from SCons.Variables.EnumVariable import EnumVariable as EnumOption
except ImportError:
from SCons.Options.EnumOption import EnumOption
opts.Add(EnumOption('build', 'build type', 'debug',
allowed_values=('debug', 'checked', 'profile', 'release')))
opts.Add(BoolOption('debug', 'debug build', 'yes'))
opts.Add(BoolOption('profile', 'profile build', 'no'))
opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', default_platform,
allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded', 'cygwin', 'sunos5', 'freebsd8')))
opts.Add('toolchain', 'compiler toolchain', default_toolchain)
opts.Add('toolchain', 'compiler toolchain', 'default')
opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))

View File

@@ -53,7 +53,7 @@ MKDEP_OPTIONS = @MKDEP_OPTIONS@
INSTALL = @INSTALL@
# Python and flags (generally only needed by the developers)
PYTHON2 = @PYTHON2@
PYTHON2 = python
PYTHON_FLAGS = -t -O -O
# Library names (base name)

View File

@@ -9,7 +9,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
MESA_MINOR=10
MESA_MINOR=9
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)

View File

@@ -58,7 +58,7 @@ EGL_DRIVERS_DIRS = glx
DRIVER_DIRS = dri
GALLIUM_WINSYS_DIRS = sw sw/xlib drm/vmware drm/intel drm/i965
GALLIUM_TARGET_DIRS =
GALLIUM_TARGET_DIRS = egl-swrast
GALLIUM_STATE_TRACKERS_DIRS = egl
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon \

View File

@@ -15,7 +15,7 @@ ARCH_FLAGS = -mmmx -msse -msse2 -mstackrealign
DEFINES += -DNDEBUG -DGALLIUM_LLVMPIPE -DHAVE_UDIS86
# override -std=c99
CFLAGS += -std=gnu99
CFLAGS += -std=gnu99 -D__STDC_CONSTANT_MACROS
LLVM_VERSION := $(shell llvm-config --version)
@@ -30,7 +30,7 @@ else
endif
ifeq ($(MESA_LLVM),1)
LLVM_CFLAGS=`llvm-config --cppflags`
# LLVM_CFLAGS=`llvm-config --cflags`
LLVM_CXXFLAGS=`llvm-config --cxxflags backend bitreader engine ipo interpreter instrumentation` -Wno-long-long
LLVM_LDFLAGS = $(shell llvm-config --ldflags backend bitreader engine ipo interpreter instrumentation)
LLVM_LIBS = $(shell llvm-config --libs backend bitwriter bitreader engine ipo interpreter instrumentation)

View File

@@ -30,14 +30,9 @@ AC_PROG_CPP
AC_PROG_CC
AC_PROG_CXX
AC_CHECK_PROGS([MAKE], [gmake make])
AC_CHECK_PROGS([PYTHON2], [python2 python])
AC_PATH_PROG([MKDEP], [makedepend])
AC_PATH_PROG([SED], [sed])
if test "x$MKDEP" = "x"; then
AC_MSG_ERROR([makedepend is required to build Mesa])
fi
dnl Our fallback install-sh is a symlink to minstall. Use the existing
dnl configuration in that case.
AC_PROG_INSTALL
@@ -465,71 +460,6 @@ if test "x$enable_selinux" = "xyes"; then
DEFINES="$DEFINES -DMESA_SELINUX"
fi
dnl Determine which APIs to support
AC_ARG_ENABLE([opengl],
[AS_HELP_STRING([--disable-opengl],
[disable support for standard OpenGL API @<:@default=no@:>@])],
[enable_opengl="$enableval"],
[enable_opengl=yes])
AC_ARG_ENABLE([gles1],
[AS_HELP_STRING([--enable-gles1],
[enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
[enable_gles1="$enableval"],
[enable_gles1=no])
AC_ARG_ENABLE([gles2],
[AS_HELP_STRING([--enable-gles2],
[enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
[enable_gles2="$enableval"],
[enable_gles2=no])
AC_ARG_ENABLE([gles-overlay],
[AS_HELP_STRING([--enable-gles-overlay],
[build separate OpenGL ES only libraries @<:@default=no@:>@])],
[enable_gles_overlay="$enableval"],
[enable_gles_overlay=no])
AC_ARG_ENABLE([openvg],
[AS_HELP_STRING([--enable-openvg],
[enable support for OpenVG API @<:@default=no@:>@])],
[enable_openvg="$enableval"],
[enable_openvg=no])
dnl smooth the transition; should be removed eventually
if test "x$enable_openvg" = xno; then
case "x$with_state_trackers" in
x*vega*)
AC_MSG_WARN([vega state tracker is enabled without --enable-openvg])
enable_openvg=yes
;;
esac
fi
if test "x$enable_opengl" = xno -a \
"x$enable_gles1" = xno -a \
"x$enable_gles2" = xno -a \
"x$enable_gles_overlay" = xno -a \
"x$enable_openvg" = xno; then
AC_MSG_ERROR([at least one API should be enabled])
fi
API_DEFINES=""
GLES_OVERLAY=0
if test "x$enable_opengl" = xno; then
API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
else
API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
fi
if test "x$enable_gles1" = xyes; then
API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
fi
if test "x$enable_gles2" = xyes; then
API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
fi
if test "x$enable_gles_overlay" = xyes; then
GLES_OVERLAY=1
fi
AC_SUBST([API_DEFINES])
AC_SUBST([GLES_OVERLAY])
dnl
dnl Driver configuration. Options are xlib, dri and osmesa right now.
dnl More later: fbdev, ...
@@ -549,10 +479,6 @@ linux*)
;;
esac
if test "x$enable_opengl" = xno; then
default_driver="no"
fi
AC_ARG_WITH([driver],
[AS_HELP_STRING([--with-driver=DRIVER],
[driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
@@ -561,11 +487,6 @@ AC_ARG_WITH([driver],
dnl Check for valid option
case "x$mesa_driver" in
xxlib|xdri|xosmesa)
if test "x$enable_opengl" = xno; then
AC_MSG_ERROR([Driver '$mesa_driver' requires OpenGL enabled])
fi
;;
xno)
;;
*)
AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
@@ -581,7 +502,7 @@ dnl Driver specific build directories
dnl
dnl this variable will be prepended to SRC_DIRS and is not exported
CORE_DIRS=""
CORE_DIRS="mapi/glapi glsl mesa"
SRC_DIRS=""
GLU_DIRS="sgi"
@@ -591,30 +512,6 @@ GALLIUM_WINSYS_DIRS="sw"
GALLIUM_DRIVERS_DIRS="softpipe failover galahad trace rbug identity"
GALLIUM_STATE_TRACKERS_DIRS=""
# build glapi if OpenGL is enabled
if test "x$enable_opengl" = xyes; then
CORE_DIRS="$CORE_DIRS mapi/glapi"
fi
# build es1api and es2api if OpenGL ES is enabled
case "x$enable_gles1$enable_gles2$enable_gles_overlay" in
x*yes*)
CORE_DIRS="$CORE_DIRS mapi/es1api mapi/es2api"
;;
esac
# build vgapi if OpenVG is enabled
if test "x$enable_openvg" = xyes; then
CORE_DIRS="$CORE_DIRS mapi/vgapi"
fi
# build glsl and mesa if OpenGL or OpenGL ES is enabled
case "x$enable_opengl$enable_gles1$enable_gles2$enable_gles_overlay" in
x*yes*)
CORE_DIRS="$CORE_DIRS glsl mesa"
;;
esac
case "$mesa_driver" in
xlib)
DRIVER_DIRS="x11"
@@ -629,9 +526,6 @@ dri)
osmesa)
DRIVER_DIRS="osmesa"
;;
no)
DRIVER_DRIS=""
;;
esac
AC_SUBST([SRC_DIRS])
AC_SUBST([GLU_DIRS])
@@ -724,7 +618,7 @@ xlib)
GL_LIB_DEPS=""
fi
;;
dri|no) # these checks are still desired when there is no mesa_driver
dri)
# DRI must be shared, I think
if test "$enable_static" = yes; then
AC_MSG_ERROR([Can't use static libraries for DRI drivers])
@@ -798,11 +692,6 @@ AC_SUBST([GLESv2_PC_LIB_PRIV])
AC_SUBST([HAVE_XF86VIDMODE])
PKG_CHECK_MODULES([LIBDRM_RADEON],
[libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
HAVE_LIBDRM_RADEON=yes,
HAVE_LIBDRM_RADEON=no)
dnl
dnl More X11 setup
dnl
@@ -849,6 +738,51 @@ if test "x$with_dri_drivers" = x; then
with_dri_drivers=no
fi
dnl Determine which APIs to support
AC_ARG_ENABLE([opengl],
[AS_HELP_STRING([--disable-opengl],
[disable support for standard OpenGL API @<:@default=no@:>@])],
[enable_opengl="$enableval"],
[enable_opengl=yes])
AC_ARG_ENABLE([gles1],
[AS_HELP_STRING([--enable-gles1],
[enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
[enable_gles1="$enableval"],
[enable_gles1=no])
AC_ARG_ENABLE([gles2],
[AS_HELP_STRING([--enable-gles2],
[enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
[enable_gles2="$enableval"],
[enable_gles2=no])
AC_ARG_ENABLE([gles-overlay],
[AS_HELP_STRING([--enable-gles-overlay],
[build separate OpenGL ES only libraries @<:@default=no@:>@])],
[enable_gles_overlay="$enableval"],
[enable_gles_overlay=no])
API_DEFINES=""
GLES_OVERLAY=0
if test "x$enable_opengl" = xno; then
API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
else
API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
fi
if test "x$enable_gles1" = xyes; then
API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
fi
if test "x$enable_gles2" = xyes; then
API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
fi
if test "x$enable_gles_overlay" = xyes -o \
"x$enable_gles1" = xyes -o "x$enable_gles2" = xyes; then
CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
if test "x$enable_gles_overlay" = xyes; then
GLES_OVERLAY=1
fi
fi
AC_SUBST([API_DEFINES])
AC_SUBST([GLES_OVERLAY])
dnl If $with_dri_drivers is yes, directories will be added through
dnl platform checks
DRI_DIRS=""
@@ -869,7 +803,7 @@ yes)
esac
dnl Set DRI_DIRS, DEFINES and LIB_DEPS
if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
if test "$mesa_driver" = dri; then
# Use TLS in GLX?
if test "x$GLX_USE_TLS" = xyes; then
DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
@@ -947,21 +881,19 @@ if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
# Check for expat
if test "$mesa_driver" = dri; then
EXPAT_INCLUDES=""
EXPAT_LIB=-lexpat
AC_ARG_WITH([expat],
[AS_HELP_STRING([--with-expat=DIR],
[expat install directory])],[
EXPAT_INCLUDES="-I$withval/include"
CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
])
AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
AC_CHECK_LIB([expat],[XML_ParserCreate],[],
[AC_MSG_ERROR([Expat required for DRI.])])
fi
EXPAT_INCLUDES=""
EXPAT_LIB=-lexpat
AC_ARG_WITH([expat],
[AS_HELP_STRING([--with-expat=DIR],
[expat install directory])],[
EXPAT_INCLUDES="-I$withval/include"
CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
])
AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
AC_CHECK_LIB([expat],[XML_ParserCreate],[],
[AC_MSG_ERROR([Expat required for DRI.])])
# put all the necessary libs together
DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS"
@@ -978,7 +910,12 @@ esac
case $DRI_DIRS in
*radeon*|*r200*|*r300*|*r600*)
if test "x$HAVE_LIBDRM_RADEON" = xyes; then
PKG_CHECK_MODULES([LIBDRM_RADEON],
[libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
HAVE_LIBDRM_RADEON=yes,
HAVE_LIBDRM_RADEON=no)
if test "$HAVE_LIBDRM_RADEON" = yes; then
RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
fi
@@ -1002,9 +939,6 @@ AC_ARG_ENABLE([gl-osmesa],
[gl_osmesa="$enableval"],
[gl_osmesa="$default_gl_osmesa"])
if test "x$gl_osmesa" = xyes; then
if test "x$enable_opengl" = xno; then
AC_MSG_ERROR([OpenGL is not available for OSMesa driver])
fi
if test "$mesa_driver" = osmesa; then
AC_MSG_ERROR([libGL is not available for OSMesa driver])
else
@@ -1061,21 +995,13 @@ AC_ARG_ENABLE([egl],
[disable EGL library @<:@default=enabled@:>@])],
[enable_egl="$enableval"],
[enable_egl=yes])
if test "x$enable_egl" = xno; then
if test "x$mesa_driver" = xno; then
AC_MSG_ERROR([cannot disable EGL when there is no mesa driver])
fi
if test "x$enable_openvg" = xyes; then
AC_MSG_ERROR([cannot enable OpenVG without EGL])
fi
fi
if test "x$enable_egl" = xyes; then
SRC_DIRS="$SRC_DIRS egl"
EGL_LIB_DEPS="$DLOPEN_LIBS -lpthread"
EGL_DRIVERS_DIRS=""
if test "$enable_static" != yes; then
# build egl_glx when libGL is built
if test "$mesa_driver" = xlib -o "$mesa_driver" = dri; then
if test "$mesa_driver" != osmesa; then
EGL_DRIVERS_DIRS="glx"
fi
@@ -1109,12 +1035,6 @@ AC_ARG_ENABLE([glu],
[enable OpenGL Utility library @<:@default=enabled@:>@])],
[enable_glu="$enableval"],
[enable_glu=yes])
if test "x$enable_glu" = xyes -a "x$mesa_driver" = xno; then
AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
enable_glu=no
fi
if test "x$enable_glu" = xyes; then
SRC_DIRS="$SRC_DIRS glu"
@@ -1164,13 +1084,9 @@ AC_ARG_ENABLE([glw],
[enable_glw="$enableval"],
[enable_glw=yes])
dnl Don't build GLw on osmesa
if test "x$enable_glw" = xyes; then
case "$mesa_driver" in
osmesa|no)
AC_MSG_NOTICE([Disabling GLw since there is no OpenGL driver])
enable_glw=no
;;
esac
if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
enable_glw=no
fi
AC_ARG_ENABLE([motif],
[AS_HELP_STRING([--enable-motif],
@@ -1244,20 +1160,16 @@ AC_ARG_ENABLE([glut],
[enable_glut="$enableval"],
[enable_glut="$default_glut"])
dnl Don't build glut on osmesa
if test "x$enable_glut" = xyes; then
case "$mesa_driver" in
osmesa|no)
AC_MSG_NOTICE([Disabling glut since there is no OpenGL driver])
enable_glut=no
;;
esac
fi
dnl Can't build glut if GLU not available
if test "x$enable_glu$enable_glut" = xnoyes; then
AC_MSG_WARN([Disabling glut since GLU is disabled])
enable_glut=no
fi
dnl Don't build glut on osmesa
if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
AC_MSG_WARN([Disabling glut since the driver is OSMesa])
enable_glut=no
fi
if test "x$enable_glut" = xyes; then
SRC_DIRS="$SRC_DIRS glut/glx"
@@ -1322,9 +1234,6 @@ AC_ARG_ENABLE([gallium],
[build gallium @<:@default=enabled@:>@])],
[enable_gallium="$enableval"],
[enable_gallium=yes])
if test "x$enable_gallium" = xno -a "x$enable_openvg" = xyes; then
AC_MSG_ERROR([cannot enable OpenVG without Gallium])
fi
if test "x$enable_gallium" = xyes; then
SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
@@ -1337,30 +1246,15 @@ AC_SUBST([LLVM_LIBS])
AC_SUBST([LLVM_LDFLAGS])
AC_SUBST([LLVM_VERSION])
VG_LIB_DEPS=""
EGL_CLIENT_APIS='$(GL_LIB)'
if test "x$enable_gles_overlay" = xyes; then
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
fi
dnl
dnl Gallium state trackers configuration
dnl
AC_ARG_ENABLE([gallium-egl],
[AS_HELP_STRING([--enable-gallium-egl],
[enable gallium EGL state tracker @<:@default=auto@:>@])],
[enable_gallium_egl="$enableval"],
[enable_gallium_egl=auto])
if test "x$enable_gallium_egl" = xauto; then
case "$mesa_driver" in
dri|no)
enable_gallium_egl=$enable_egl
;;
*)
enable_gallium_egl=$enable_openvg
;;
esac
fi
case "x$enable_egl$enable_gallium_egl" in
xnoyes)
AC_MSG_ERROR([cannot build Gallium EGL state tracker without EGL])
esac
AC_ARG_WITH([state-trackers],
[AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
[comma delimited state_trackers list, e.g.
@@ -1381,24 +1275,16 @@ yes)
dri)
GALLIUM_STATE_TRACKERS_DIRS="dri"
HAVE_ST_DRI="yes"
if test "x$enable_egl" = xyes; then
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
HAVE_ST_EGL="yes"
fi
# Have only tested st/xorg on 1.6.0 servers
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
HAVE_ST_XORG="no")
;;
esac
if test "x$enable_egl" = xyes; then
if test "$enable_openvg" = yes; then
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vega"
st_egl="yes"
fi
if test "$enable_gallium_egl" = yes; then
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
HAVE_ST_EGL="yes"
fi
fi
;;
*)
# verify the requested state tracker exist
@@ -1424,10 +1310,22 @@ yes)
PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
HAVE_ST_XORG="yes"
;;
vega)
if test "x$enable_openvg" != xyes; then
AC_MSG_ERROR([cannot build vega state tracker without --enable-openvg])
es)
AC_MSG_WARN([state tracker 'es' has been replaced by --enable-gles-overlay])
if test "x$enable_gles_overlay" != xyes; then
if test "x$enable_gles1" != xyes -a "x$enable_gles2" != xyes; then
CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
fi
GLES_OVERLAY=1
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
fi
tracker=""
;;
vega)
CORE_DIRS="$CORE_DIRS mapi/vgapi"
VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
;;
esac
@@ -1445,28 +1343,15 @@ yes)
;;
esac
EGL_CLIENT_APIS=""
VG_LIB_DEPS=""
case "x$enable_opengl$enable_gles1$enable_gles2" in
x*yes*)
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
;;
esac
if test "x$enable_gles_overlay" = xyes; then
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
fi
if test "x$enable_openvg" = xyes; then
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
fi
AC_SUBST([VG_LIB_DEPS])
AC_SUBST([EGL_CLIENT_APIS])
if test "x$HAVE_ST_EGL" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl"
# define GLX_DIRECT_RENDERING even when the driver is not dri
if test "x$mesa_driver" != xdri -a "x$driglx_direct" = xyes; then
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
fi
fi
if test "x$HAVE_ST_XORG" = xyes; then
@@ -1554,7 +1439,7 @@ AC_ARG_ENABLE([gallium-llvm],
if test "x$enable_gallium_llvm" = xyes; then
if test "x$LLVM_CONFIG" != xno; then
LLVM_VERSION=`$LLVM_CONFIG --version`
LLVM_CFLAGS=`$LLVM_CONFIG --cppflags`
LLVM_CFLAGS=`$LLVM_CONFIG --cflags`
LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
if test "x$HAS_UDIS86" != xno; then
@@ -1643,21 +1528,9 @@ AC_ARG_ENABLE([gallium-radeon],
[build gallium radeon @<:@default=disabled@:>@])],
[enable_gallium_radeon="$enableval"],
[enable_gallium_radeon=auto])
if test "x$enable_gallium_radeon" = xauto; then
if test "x$HAVE_LIBDRM_RADEON" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "dri-r300"
else
AC_MSG_WARN([libdrm_radeon is missing, not building gallium-radeon (r300)])
fi
fi
if test "x$enable_gallium_radeon" = xyes; then
if test "x$HAVE_LIBDRM_RADEON" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
else
AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-radeon (r300)])
fi
if test "x$enable_gallium_radeon" = xyes || test "x$enable_gallium_radeon" = xauto; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
fi
dnl
@@ -1669,12 +1542,8 @@ AC_ARG_ENABLE([gallium-r600],
[enable_gallium_r600="$enableval"],
[enable_gallium_r600=auto])
if test "x$enable_gallium_r600" = xyes; then
if test "x$HAVE_LIBDRM_RADEON" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
gallium_check_st "r600/drm" "dri-r600"
else
AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-r600])
fi
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
gallium_check_st "r600/drm" "dri-r600"
fi
dnl
@@ -1704,19 +1573,6 @@ if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xau
fi
fi
dnl
dnl Gallium noop configuration
dnl
AC_ARG_ENABLE([gallium-noop],
[AS_HELP_STRING([--enable-gallium-noop],
[build gallium radeon @<:@default=disabled@:>@])],
[enable_gallium_noop="$enableval"],
[enable_gallium_noop=auto])
if test "x$enable_gallium_noop" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS noop"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-noop"
fi
dnl prepend CORE_DIRS to SRC_DIRS
SRC_DIRS="$CORE_DIRS $SRC_DIRS"
@@ -1746,56 +1602,25 @@ echo " exec_prefix: $exec_prefix"
echo " libdir: $libdir"
echo " includedir: $includedir"
dnl API info
echo ""
echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
echo " GLES overlay: $enable_gles_overlay"
echo " OpenVG: $enable_openvg"
dnl Driver info
echo ""
echo " Driver: $mesa_driver"
if test "$mesa_driver" != no; then
if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
echo " OSMesa: lib$OSMESA_LIB"
else
echo " OSMesa: no"
fi
if test "$mesa_driver" = dri; then
# cleanup the drivers var
dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
if test "x$DRI_DIRS" = x; then
echo " DRI drivers: no"
else
echo " DRI drivers: $dri_dirs"
fi
echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
echo " Use XCB: $enable_xcb"
fi
if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
echo " OSMesa: lib$OSMESA_LIB"
else
echo " OSMesa: no"
fi
echo ""
echo " GLU: $enable_glu"
echo " GLw: $enable_glw (Motif: $enable_motif)"
echo " glut: $enable_glut"
dnl EGL
echo ""
echo " EGL: $enable_egl"
if test "$enable_egl" = yes; then
echo " EGL platforms: $EGL_PLATFORMS"
egl_drivers=""
for d in $EGL_DRIVERS_DIRS; do
egl_drivers="$egl_drivers egl_$d"
done
if test "$enable_gallium" = yes -a "$HAVE_ST_EGL" = yes; then
echo " EGL drivers: ${egl_drivers} egl_gallium"
echo " EGL Gallium STs:$EGL_CLIENT_APIS"
else
echo " EGL drivers: $egl_drivers"
fi
if test "$mesa_driver" = dri; then
# cleanup the drivers var
dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
if test "x$DRI_DIRS" = x; then
echo " DRI drivers: no"
else
echo " DRI drivers: $dri_dirs"
fi
echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
fi
echo " Use XCB: $enable_xcb"
echo ""
if test "x$MESA_LLVM" = x1; then
@@ -1814,6 +1639,9 @@ if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
if test "x$HAVE_ST_EGL" = xyes; then
echo " EGL client APIs: $EGL_CLIENT_APIS"
fi
else
echo " Gallium: no"
fi
@@ -1822,6 +1650,15 @@ dnl Libraries
echo ""
echo " Shared libs: $enable_shared"
echo " Static libs: $enable_static"
if test "$enable_egl" = yes; then
echo " EGL: $EGL_DRIVERS_DIRS"
echo " EGL platforms: $EGL_PLATFORMS"
else
echo " EGL: no"
fi
echo " GLU: $enable_glu"
echo " GLw: $enable_glw (Motif: $enable_motif)"
echo " glut: $enable_glut"
dnl Compiler options
# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
@@ -1834,8 +1671,6 @@ echo ""
echo " CFLAGS: $cflags"
echo " CXXFLAGS: $cxxflags"
echo " Macros: $defines"
echo ""
echo " PYTHON2: $PYTHON2"
echo ""
echo " Run '${MAKE-make}' to build Mesa"

View File

@@ -20,22 +20,21 @@ Float textures, renderbuffers some infrastructure done
Framebuffer objects (GL_EXT_framebuffer_object) DONE
Half-float some infrastructure done
Multisample blit DONE
Non-normalized Integer texture/framebuffer formats ~50% done
Non-normalized Integer texture/framebuffer formats not started
1D/2D Texture arrays core Mesa, swrast done
Packed depth/stencil formats DONE
Per-buffer blend and masks (GL_EXT_draw_buffers2) DONE
GL_EXT_texture_compression_rgtc not started
Red and red/green texture formats DONE (swrast, i965, gallium)
Red and red/green texture formats Ian?
Transform feedback (GL_EXT_transform_feedback) ~50% done
glBindFragDataLocation, glGetFragDataLocation,
glBindBufferRange, glBindBufferBase commands
Vertex array objects (GL_APPLE_vertex_array_object) DONE
sRGB framebuffer format (GL_EXT_framebuffer_sRGB) not started
glClearBuffer commands DONE
glGetStringi command DONE
glTexParameterI, glGetTexParameterI commands DONE
glVertexAttribI commands DONE (but converts int
values to floats)
glClearBuffer commands DONE, except for dispatch
glGetStringi command DONE, except for dispatch
glTexParameterI, glGetTexParameterI commands DONE, except for dispatch
glVertexAttribI commands not started
GL 3.1:
@@ -43,9 +42,9 @@ GL 3.1:
GLSL 1.30 and 1.40 not started
Instanced drawing (GL_ARB_draw_instanced) ~50% done
Buffer copying (GL_ARB_copy_buffer) DONE
Primitive restart (GL_NV_primitive_restart) DONE (gallium)
Primitive restart (GL_NV_primitive_restart) not started
16 vertex texture image units not started
Texture buffer objs (GL_ARB_texture_buffer_object) not started
Texture buffer objs (GL_ARB_textur_buffer_object) not started
Rectangular textures (GL_ARB_texture_rectangle) DONE
Uniform buffer objs (GL_ARB_uniform_buffer_object) not started
Signed normalized texture formats ~50% done
@@ -70,7 +69,7 @@ GL 3.3:
GLSL 3.30 not started
GL_ARB_blend_func_extended not started
GL_ARB_explicit_attrib_location DONE (swrast, i915, i965)
GL_ARB_explicit_attrib_location not started
GL_ARB_occlusion_query2 not started
GL_ARB_sampler_objects not started
GL_ARB_texture_rgb10_a2ui not started
@@ -94,18 +93,6 @@ GL_ARB_texture_buffer_object_rgb32 not started
GL_ARB_texture_cube_map_array not started
GL_ARB_texture_gather not started
GL_ARB_transform_feedback2 not started
GL_ARB_transform_feedback3 not started
GL 4.1:
GLSL 4.1 not started
GL_ARB_ES2_compatibility not started
GL_ARB_get_program_binary not started
GL_ARB_separate_shader_objects some infrastructure done
GL_ARB_shader_precision not started
GL_ARB_vertex_attrib_64bit not started
GL_ARB_viewport_array not started

View File

@@ -83,7 +83,7 @@ Additions to the EGL 1.4 Specification:
EGLImageKHR eglCreateDRMImageMESA(EGLDisplay dpy,
const EGLint *attrib_list);
In the attribute list, pass EGL_WIDTH, EGL_HEIGHT and format and
In the attribute list, pass EGL_WIDTH, EGL_EIGHT and format and
use in the attrib list using EGL_DRM_BUFFER_FORMAT_MESA and
EGL_DRM_BUFFER_USE_MESA. The only format specified by this
extension is EGL_DRM_BUFFER_FORMAT_ARGB32_MESA, where each pixel

View File

@@ -145,7 +145,7 @@ Make sure the values in src/mesa/main/version.h are correct.
</p>
<p>
Update docs/news.html.
Update the docs/news.html file and docs/download.html files.
</p>
<p>
@@ -208,11 +208,10 @@ sftp USERNAME,mesa3d@web.sourceforge.net
<p>
Make an announcement on the mailing lists:
<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>,
<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>,
<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>
and
<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>
</p>

View File

@@ -19,23 +19,27 @@ API entry points and helper functions for use by the drivers. Drivers are
dynamically loaded by the main library and most of the EGL API calls are
directly dispatched to the drivers.</p>
<p>The driver in use decides the window system to support.</p>
<p>The driver in use decides the window system to support. For drivers that
support hardware rendering, there are usually multiple drivers supporting the
same window system. Each one of of them supports a certain range of graphics
cards.</p>
<h2>Build EGL</h2>
<ol>
<li>
<p>Run <code>configure</code> with the desired client APIs and enable
the driver for your hardware. For example</p>
<p>Run <code>configure</code> with the desired state trackers and enable
the Gallium driver for your hardware. For example</p>
<pre>
$ ./configure --enable-gles2 --enable-openvg --enable-gallium-nouveau
$ ./configure --enable-gles-overlay --with-state-trackers=egl,vega --enable-gallium-intel
</pre>
<p>The main library and OpenGL is enabled by default. The first option above
enables <a href="opengles.html">OpenGL ES 2.x</a>. The second option enables
<a href="openvg.html">OpenVG</a>.</p>
<p>The main library and OpenGL is enabled by default. The first option enables
<a href="opengles.html">OpenGL ES 1.x and 2.x</a>. The <code>egl</code> state
tracker is needed by a number of EGL drivers. EGL drivers will be covered
later. The <a href="openvg.html">vega state tracker</a> provides OpenVG
1.x.</p>
</li>
<li>Build and install Mesa as usual.</li>
@@ -76,38 +80,31 @@ types such as <code>EGLNativeDisplayType</code> or
<p>The available platforms are <code>x11</code>, <code>drm</code>,
<code>fbdev</code>, and <code>gdi</code>. The <code>gdi</code> platform can
only be built with SCons. Unless for special needs, the build system should
select the right platforms automatically.</p>
only be built with SCons.</p>
</li>
<li><code>--enable-gles1</code> and <code>--enable-gles2</code>
<li><code>--with-state-trackers</code>
<p>These options enable OpenGL ES support in OpenGL. The result is one big
internal library that supports multiple APIs.</p>
<p>The argument is a comma separated string. It is usually used to specify the
rendering APIs, such as OpenVG, to build. But it is also used to specify
<code>egl</code> state tracker that <code>egl_gallium</code> depends on.</p>
</li>
<li><code>--enable-gles-overlay</code>
<p>This option enables OpenGL ES as separate internal libraries. This is an
alternative approach to enable OpenGL ES.</p>
<p>This is only supported by <code>egl_gallium</code>. For systems using DRI
drivers, <code>--enable-gles1</code> and <code>--enable-gles2</code> are
suggested instead as all drivers will benefit.</p>
<p>OpenGL and OpenGL ES are not controlled by
<code>--with-state-trackers</code>. OpenGL is always built. To build OpenGL
ES, this option must be explicitly given.</p>
</li>
<li><code>--enable-openvg</code>
<li><code>--enable-gles1</code> and <code>--enable-gles2</code>
<p>OpenVG must be explicitly enabled by this option.</p>
</li>
<li><code>--enable-gallium-egl</code>
<p>Explicitly enable or disable <code>egl_gallium</code>.</p>
<p>Unlike <code>--enable-gles-overlay</code>, which builds one library for each
rendering API, these options enable OpenGL ES support in OpenGL. The result is
one big library that supports multiple APIs.</p>
</li>
@@ -134,16 +131,6 @@ colon-separated directories where the main library will look for drivers, in
addition to the default directory. This variable is ignored for setuid/setgid
binaries.</p>
<p>This variable is usually set to test an uninstalled build. For example, one
may set</p>
<pre>
$ export LD_LIBRARY_PATH=$mesa/lib
$ export EGL_DRIVERS_PATH=$mesa/lib/egl
</pre>
<p>to test a build without installation</p>
</li>
<li><code>EGL_DRIVER</code>
@@ -152,6 +139,10 @@ may set</p>
specified EGL driver to be loaded. It comes in handy when one wants to test a
specific driver. This variable is ignored for setuid/setgid binaries.</p>
<p><code>egl_gallium</code> dynamically loads hardware drivers and client API
modules found in <code>EGL_DRIVERS_PATH</code>. Thus, specifying this variable
alone is not sufficient for <code>egl_gallium</code> for uninstalled build.</p>
</li>
<li><code>EGL_PLATFORM</code>
@@ -159,12 +150,7 @@ specific driver. This variable is ignored for setuid/setgid binaries.</p>
<p>This variable specifies the native platform. The valid values are the same
as those for <code>--with-egl-platforms</code>. When the variable is not set,
the main library uses the first platform listed in
<code>--with-egl-platforms</code> as the native platform.</p>
<p>Extensions like <code>EGL_MESA_drm_display</code> define new functions to
create displays for non-native platforms. These extensions are usually used by
applications that support non-native platforms. Setting this variable is
probably required only for some of the demos found in mesa/demo repository.</p>
<code>--with-egl-platforms</code> as the native platform</p>
</li>
@@ -187,25 +173,11 @@ variable to true forces the use of software rendering.</p>
<h2>EGL Drivers</h2>
<ul>
<li><code>egl_dri2</code>
<p>This driver supports both <code>x11</code> and <code>drm</code> platforms.
It functions as a DRI driver loader. For <code>x11</code> support, it talks to
the X server directly using (XCB-)DRI2 protocol.</p>
<p>This driver can share DRI drivers with <code>libGL</code>.</p>
</li>
<li><code>egl_gallium</code>
<p>This driver is based on Gallium3D. It supports all rendering APIs and
hardwares supported by Gallium3D. It is the only driver that supports OpenVG.
The supported platforms are X11, DRM, FBDEV, and GDI.</p>
<p>This driver comes with its own hardware drivers
(<code>pipe_&lt;hw&gt;</code>) and client API modules
(<code>st_&lt;api&gt;</code>).</p>
The supported platforms are X11, KMS, FBDEV, and GDI.</p>
</li>
@@ -215,24 +187,26 @@ The supported platforms are X11, DRM, FBDEV, and GDI.</p>
the EGL API. It supports both direct and indirect rendering when the GLX does.
It is accelerated when the GLX is. As such, it cannot provide functions that
is not available in GLX or GLX extensions.</p>
</li>
<li><code>egl_dri2</code>
<p>This driver supports the X Window System as its window system. It functions
as a DRI2 driver loader. Unlike <code>egl_glx</code>, it has no dependency on
<code>libGL</code>. It talks to the X server directly using DRI2 protocol.</p>
</li>
<li><code>egl_dri</code>
<p>This driver lacks maintenance and does <em>not</em> build. It is similiar
to <code>egl_dri2</code> in that it functions as a DRI(1) driver loader. But
unlike <code>egl_dri2</code>, it supports Linux framebuffer devices as its
window system and supports EGL_MESA_screen_surface extension. As DRI1 drivers
are phasing out, it might eventually be replaced by <code>egl_dri2</code>.</p>
</li>
</ul>
<h2>Packaging</h2>
<p>The ABI between the main library and its drivers are not stable. Nor is
there a plan to stabilize it at the moment. Of the EGL drivers,
<code>egl_gallium</code> has its own hardware drivers and client API modules.
They are considered internal to <code>egl_gallium</code> and there is also no
stable ABI between them. These should be kept in mind when packaging for
distribution.</p>
<p>Generally, <code>egl_dri2</code> is preferred over <code>egl_gallium</code>
when the system already has DRI drivers. As <code>egl_gallium</code> is loaded
before <code>egl_dri2</code> when both are available, <code>egl_gallium</code>
may either be disabled with <code>--disable-gallium-egl</code> or packaged
separately.</p>
<h2>Developers</h2>
<p>The sources of the main library and the classic drivers can be found at
@@ -321,6 +295,7 @@ should as well lock the display before using it.
<ul>
<li>Pass the conformance tests</li>
<li>Reference counting in main library?</li>
<li>Mixed use of OpenGL, OpenGL ES 1.1, and OpenGL ES 2.0 is supported. But
which one of <code>libGL.so</code>, <code>libGLESv1_CM.so</code>, and
<code>libGLESv2.so</code> should an application link to? Bad things may happen

View File

@@ -11,18 +11,10 @@
<H1>News</H1>
<h2>October 4, 2010</h2>
<p>
<a href="relnotes-7.9.html">Mesa 7.9</a> (final) is released. This is a new
development release.
</p>
<h2>September 27, 2010</h2>
<p>
<a href="relnotes-7.9.html">Mesa 7.9.0-rc1</a> is released. This is a
<a href="relnotes-7.9.0.html">Mesa 7.9.0-rc1</a> is released. This is a
release candidate for the 7.9 development release.
</p>

View File

@@ -26,27 +26,36 @@ Please refer to <a href="egl.html">Mesa EGL</a> for more information about EGL.
<h2>Building the library</h2>
<ol>
<li>Run <code>configure</code> with <code>--enable-openvg</code>. If you do
not need OpenGL, you can add <code>--disable-opengl</code> to save the
compilation time.</li>
<li>Build and install Mesa as usual.</li>
<li>Build Mesa3D with Gallium3D. Any build that builds Gallium3D libraries, EGL, and Gallium EGL drivers will suffice</li>
<li>cd src/gallium/state_trackers/vega; make</li>
<li>The last step will build libOpenVG library. You can add the libdir to LD_LIBRARY_PATH or install libOpenVG</li>
</ol>
<h3>Sample build</h3>
A sample build looks as follows:
<pre>
$ ./configure --disable-opengl --enable-openvg
$ ./configure --with-state-trackers=egl,vega --enable-gallium-intel
$ make
$ make install
</pre>
<p>It will install <code>libOpenVG.so</code>, <code>libEGL.so</code>, and one
or more EGL drivers.</p>
<h2>OpenVG Demos</h2>
<p>OpenVG demos can be found in mesa/demos repository.</p>
<p>
To build the OpenVG demos:
</p>
<pre>
cd progs/openvg
make
</pre>
<p>
To run a demo:
</p>
<pre>
cd openvg/demos
./lion
</pre>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -26,15 +26,7 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
c89b63d253605ed40e8ac370d25a833c MesaLib-7.8.2.tar.gz
6be2d343a0089bfd395ce02aaf8adb57 MesaLib-7.8.2.tar.bz2
a04ad3b06ac5ff3969a003fa7bbf7d5b MesaLib-7.8.2.zip
7c213f92efeb471f0331670d5079d4c0 MesaDemos-7.8.2.tar.gz
757d9e2e06f48b1a52848be9b0307ced MesaDemos-7.8.2.tar.bz2
8d0e5cfe68b8ebf90265d350ae2c48b1 MesaDemos-7.8.2.zip
b74482e3f44f35ed395c4aada4fd8240 MesaGLUT-7.8.2.tar.gz
a471807b65e49c325808ba4551be93ed MesaGLUT-7.8.2.tar.bz2
9f190268c42be582ef66e47365ee61e3 MesaGLUT-7.8.2.zip
tbd
</pre>
@@ -52,95 +44,10 @@ a471807b65e49c325808ba4551be93ed MesaGLUT-7.8.2.tar.bz2
<ul>
<li>Fixed Gallium glDrawPixels(GL_DEPTH_COMPONENT).
<li>Fixed Gallium Cell driver to buildable, runable state
<li>Fixed bad error checking for glFramebufferRenderbuffer(attachment=GL_DEPTH_STENCIL_ATTACHMENT).
<li>Fixed incorrect Z coordinate handling in "meta" glDraw/CopyPixels.
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=23670">Bug
#23670</a>.</li>
<li>Assorted i965 driver fixes.
Including but not limited to:
<ul>
<li>Fix scissoring when width or height is
0. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27643">Bug
#27643</a>.
<li>Fix bit allocation for number of color regions for
ARB_draw_buffers.</li>
<li>Set the correct provoking vertex for clipped first-mode
trifans. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24470">Bug
#24470</a>.</li>
<li>Use <code>R16G16B16A16_FLOAT</code> for 3-component half-float.</li>
<li>Fix assertion for surface tile offset usage on Ironlake.</li>
<li>Fix cube map layouts on Ironlake.</li>
<li>When an RB gets a new region, clear the old from the state
cache. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24119">Bug
#24119</a>.</li>
<li>Reject shaders with uninlined function calls instead of hanging.</li>
</ul>
</li>
<li>Assorted i915 driver fixes. Including but not limited to:
<ul>
<li>Fixed texture LOD clamping in i915 driver.
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=24846">Bug
#24846</a>.</li>
<li>Fix off-by-one for drawing rectangle.
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=27408">Bug
#27408</a>.</li>
</ul>
</li>
<li>Fixed hangs in etracer on 830 and 845
chipsets. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=26557">Bug
#26557</a>.</li>
<li>Fixed tiling of small textures on all Intel drivers.</li>
<li>Fixed crash in Savage driver when using <code>_mesa_CopyTexImage2D</code>.
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=27652">Bug
#27652</a>.</li>
<li>Assorted GLX fixes. Including but not limited to:
<ul>
<li>Fixed <code>__glXInitializeVisualConfigFromTags</code>'s handling of
unrecognized fbconfig tags.</li>
<li>Fixed regression with <code>GLX_USE_GL</code>.
<li>Fixed config chooser logic for 'mask' matching.</li>
<li>Report swap events correctly in direct rendered case (DRI2)</li>
<li>Fixed build with dri2proto which doesn't define
<code>X_DRI2SwapInterval</code>.</li>
<li>Get <code>GLX_SCREEN</code> first in <code>__glXQueryContextInfo</code>.
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=14245">Bug
#14245</a>.</li>
</ul>
</li>
<li>Assorted GLSL fixes. Including but not limited to:
<ul>
<li>Change variable declared assertion into conditional in GLSL
compiler. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27921">Bug
#27921</a>.</li>
<li>Fix instruction indexing
bugs. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27566">Bug
#27566</a>.</li>
<li>Updated uniform location / offset encoding to be more like
other implementations.</li>
<li>Don't overwrite a driver's shader infolog with generic failure
message.</li>
</ul>
</li>
<li>Fixed OSMesa build for 16 and 32-bit color channel depth.
<li>Fixed OSMesa build with hidden symbol visibility. libOSMesa no longer links to libGL.
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=28305">Bug
#28305</a>.
<li>Fixed handling of multiple render targets in fixed-function
texture envrionmnent programs.</li>
<li>Fixed conversion errors in <code>signed_rgba8888[rev]</code> texel
fetch.</li>
<li>Don't set srcLevel on <code>GL_TEXTURE_RECTANGLE_ARB</code> targets.</li>
<li>Various build fixes for OpenBSD.</li>
<li>Various build fixes for OS X.</li>
<li>Various build fixes for GCC 3.3.</li>
</ul>
<h2>Changes</h2>
<p>None.</p>
</body>
</html>

View File

@@ -1,89 +0,0 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.8.3 Release Notes / (date tbd)</H1>
<p>
Mesa 7.8.3 is a bug fix release which fixes bugs found since the 7.8.2 release.
</p>
<p>
Mesa 7.8.3 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
x MesaLib-7.8.3.tar.gz
x MesaLib-7.8.3.tar.bz2
x MesaLib-7.8.3.zip
x MesaDemos-7.8.3.tar.gz
x MesaDemos-7.8.3.tar.bz2
x MesaDemos-7.8.3.zip
x MesaGLUT-7.8.3.tar.gz
x MesaGLUT-7.8.3.tar.bz2
x MesaGLUT-7.8.3.zip
</pre>
<h2>New features</h2>
<p>None.</p>
<h2>Changes</h2>
<ul>
<li>The radeon driver should use less memory when searching for a valid mip
image.</li>
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Fix unsupported FB with D24S8 (bug
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=23670">29116</a>)</li>
<li>Fix ReadPixels crash when reading depth/stencil from an FBO</li>
<li>Fixed a bug rendering to 16-bit buffers using swrast.</li>
<li>Fixed a state tracker/TGSI bug that caused crashes when using Windows'
memory debugging features.</li>
<li>Fixed an issue rendering to 32-bit channels with swrast (bug
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=29487">29487</a>)</li>
<li>GLSL: fix indirect <TT>gl_TextureMatrix</TT> addressing (bug
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=28967">28967</a>)</li>
<li>GLSL: fix for bug
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=27216">27216</a></li>
<li>GLSL: fix zw fragcoord entries in some cases (bug
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=29183">29183</a>)</li>
<li>Fix texture env generation in some cases (bug
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=28169">28169</a>)</li>
<li>osmesa: a fix for calling <TT>OSMesaMakeCurrent</TT> twice was applied (bug
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=10966">10966</a></li>
<li>A bug was fixed which could cause Mesa to ignore the
<TT>MESA_EXTENSION_OVERRIDE</TT> environment variable.</li>
<li>A bug related to specular highlights on backfaces was fixed.</li>
<li>A radeon-specific issue with <TT>glCopyTex(Sub)Image</TT> was
corrected.</li>
<li>radeon/wine: flush command stream in more cases, fixing wine d3d9
tests.</li>
<li>r600: fix sin+cos normalization.</li>
<li>r600: (properly) ignore <TT>GL_COORD_REPLACE</TT> when point sprites are
disabled.</li>
<li>radeon: avoid flushing when the context is not current.</li>
<li>r300c: a bug affecting unaligned BOs was fixed.</li>
<li>r300c: a hardlock caused by ARB_half_float_vertex incorrectly advertised on some chipsets.</li>
</ul>
</body>
</html>

View File

@@ -1,404 +0,0 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.9.1 Release Notes / January 7, 2011</H1>
<p>
Mesa 7.9.1 is a bug fix release which fixes bugs found since the 7.9 release.
</p>
<p>
Mesa 7.9.1 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
78422843ea875ad4eac35b9b8584032b MesaLib-7.9.1.tar.gz
07dc6cfb5928840b8b9df5bd1b3ae434 MesaLib-7.9.1.tar.bz2
c8eaea5b3c3d6dee784bd8c2db91c80f MesaLib-7.9.1.zip
ee9ecae4ca56fbb2d14dc15e3a0a7640 MesaGLUT-7.9.1.tar.gz
41fc477d524e7dc5c84da8ef22422bea MesaGLUT-7.9.1.tar.bz2
90b287229afdf19317aa989d19462e7a MesaGLUT-7.9.1.zip
</pre>
<h2>New features</h2>
<p>None.</p>
<h2>Bug fixes</h2>
<p>This list is likely incomplete.</p>
<ul>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28800">Bug 28800</a> - [r300c, r300g] Texture corruption with World of Warcraft</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29420">Bug 29420</a> - Amnesia / HPL2 RendererFeatTest - not rendering correctly</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29946">Bug 29946</a> - [swrast] piglit valgrind glsl-array-bounds-04 fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30261">Bug 30261</a> - [GLSL 1.20] allowing inconsistent invariant declaration between two vertex shaders</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30632">Bug 30632</a> - [softpipe] state_tracker/st_manager.c:489: st_context_notify_invalid_framebuffer: Assertion `stfb &amp;&amp; stfb-&gt;iface == stfbi' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30694">Bug 30694</a> - wincopy will crash on Gallium drivers when going to front buffer</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30787">Bug 30787</a> - Invalid asm shader does not generate draw-time error when used with GLSL shader</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30993">Bug 30993</a> - getFramebufferAttachmentParameteriv wrongly generates error</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31101">Bug 31101</a> - [glsl2] abort() in ir_validate::visit_enter(ir_assignment *ir)</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31193">Bug 31193</a> - [regression] aa43176e break water reflections</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31194">Bug 31194</a> - The mesa meta save/restore code doesn't ref the current GLSL program</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31371">Bug 31371</a> - glslparsertest: ir.cpp:358: ir_constant::ir_constant(const glsl_type*, const ir_constant_data*): Assertion `(type->base_type &gt;= 0) &amp;&amp; (type->base_type &lt;= 3)' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31439">Bug 31439</a> - Crash in glBufferSubData() with size == 0</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31495">Bug 31495</a> - [i965 gles2c bisected] OpenGL ES 2.0 conformance GL2Tests_GetBIFD_input.run regressed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31514">Bug 31514</a> - isBuffer returns true for unbound buffers</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31560">Bug 31560</a> - [tdfx] tdfx_tex.c:702: error: const struct gl_color_table has no member named Format</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31617">Bug 31617</a> - Radeon/Compiz: 'failed to attach dri2 front buffer', error case not handled</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31648">Bug 31648</a> - [GLSL] array-struct-array gets assertion: `(size &gt;= 1) && (size &lt;= 4)' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31650">Bug 31650</a> - [GLSL] varying gl_TexCoord fails to be re-declared to different size in the second shader</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31673">Bug 31673</a> - GL_FRAGMENT_PRECISION_HIGH preprocessor macro undefined in GLSL ES</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31690">Bug 31690</a> - i915 shader compiler fails to flatten if in Aquarium webgl demo.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31832">Bug 31832</a> - [i915] Bad renderbuffer format: 21</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31841">Bug 31841</a> - [drm:radeon_cs_ioctl] *ERROR* Invalid command stream !</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31894">Bug 31894</a> - Writing to gl_PointSize with GLES2 corrupts other varyings</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31909">Bug 31909</a> - [i965] brw_fs.cpp:1461: void fs_visitor::emit_bool_to_cond_code(ir_rvalue*): Assertion `expr-&gt;operands[i]-&gt;type-&gt;is_scalar()' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31934">Bug 31934</a> - [gallium] Mapping empty buffer object causes SIGSEGV</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31983">Bug 31983</a> - [i915 gles2] "if (expression with builtin/varying variables) discard" breaks linkage</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31985">Bug 31985</a> - [GLSL 1.20] initialized uniform array considered as "unsized"</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31987">Bug 31987</a> - [gles2] if input a wrong pname(GL_NONE) to glGetBoolean, it will not case GL_INVALID_ENUM</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32035">Bug 32035</a> - [GLSL bisected] comparing unsized array gets segfault</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32070">Bug 32070</a> - llvmpipe renders stencil demo incorrectly</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32273">Bug 32273</a> - assertion fails when starting vdrift 2010 release with shaders enabled</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32287">Bug 32287</a> - [bisected GLSL] float-int failure</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32311">Bug 32311</a> - [965 bisected] Array look-ups broken on GM45</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32520">Bug 32520</a> - [gles2] glBlendFunc(GL_ZERO, GL_DST_COLOR) will result in GL_INVALID_ENUM</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32825">Bug 32825</a> - egl_glx driver completely broken in 7.9 branch [fix in master]</li>
</ul>
<h2>Changes</h2>
<p>The full set of changes can be viewed by using the following GIT command:</p>
<pre>
git log mesa-7.9..mesa-7.9.1
</pre>
<p>Alex Deucher (5):
<ul>
<li>r100: revalidate after radeon_update_renderbuffers</li>
<li>r600c: add missing radeon_prepare_render() call on evergreen</li>
<li>r600c: properly align mipmaps to group size</li>
<li>gallium/egl: fix r300 vs r600 loading</li>
<li>r600c: fix some opcodes on evergreen</li>
</ul></p>
<p>Aras Pranckevicius (2):
<ul>
<li>glsl: fix crash in loop analysis when some controls can't be determined</li>
<li>glsl: fix matrix type check in ir_algebraic</li>
</ul></p>
<p>Brian Paul (27):
<ul>
<li>swrast: fix choose_depth_texture_level() to respect mipmap filtering state</li>
<li>st/mesa: replace assertion w/ conditional in framebuffer invalidation</li>
<li>egl/i965: include inline_wrapper_sw_helper.h</li>
<li>mesa: Add missing else in do_row_3D</li>
<li>mesa: add missing formats in _mesa_format_to_type_and_comps()</li>
<li>mesa: handle more pixel types in mipmap generation code</li>
<li>mesa: make glIsBuffer() return false for never bound buffers</li>
<li>mesa: fix glDeleteBuffers() regression</li>
<li>swrast: init alpha value to 1.0 in opt_sample_rgb_2d()</li>
<li>meta: Mask Stencil.Clear against stencilMax in _mesa_meta_Clear</li>
<li>st/mesa: fix mapping of zero-sized buffer objects</li>
<li>mesa: check for posix_memalign() errors</li>
<li>llvmpipe: fix broken stencil writemask</li>
<li>mesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query</li>
<li>mesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type</li>
<li>mesa: make glGet*(GL_NONE) generate GL_INVALID_ENUM</li>
<li>mesa: test for cube map completeness in glGenerateMipmap()</li>
<li>tnl: Initialize gl_program_machine memory in run_vp.</li>
<li>tnl: a better way to initialize the gl_program_machine memory</li>
<li>mesa, st/mesa: disable GL_ARB_geometry_shader4</li>
<li>glsl: fix off by one in register index assertion</li>
<li>st/mesa: fix mipmap generation bug</li>
<li>glsl: new glsl_strtod() wrapper to fix decimal point interpretation</li>
<li>mesa: no-op glBufferSubData() on size==0</li>
<li>tdfx: s/Format/_BaseFormat/</li>
<li>st/mesa: fix renderbuffer pointer check in st_Clear()</li>
<li>mesa: Bump the number of bits in the register index.</li>
</ul></p>
<p>Chad Versace (5):
<ul>
<li>glsl: Fix lexer rule for ^=</li>
<li>glsl: Fix ast-to-hir for ARB_fragment_coord_conventions</li>
<li>glsl: Fix ir_expression::constant_expression_value()</li>
<li>glsl: Fix erroneous cast in ast_jump_statement::hir()</li>
<li>glsl: Fix linker bug in cross_validate_globals()</li>
</ul></p>
<p>Chia-I Wu (10):
<ul>
<li>targets/egl: Fix linking with libdrm.</li>
<li>st/vega: Fix version check in context creation.</li>
<li>st/egl: Do not finish a fence that is NULL.</li>
<li>egl: Fix a false negative check in _eglCheckMakeCurrent.</li>
<li>st/mesa: Unreference the sampler view in st_bind_surface.</li>
<li>egl_dri2: Fix __DRI_DRI2 version 1 support.</li>
<li>st/vega: Do not wait NULL fences.</li>
<li>mesa: Do not advertise GL_OES_texture_3D.</li>
<li>egl_glx: Fix borken driver.</li>
<li>egl: Check extensions.</li>
</ul></p>
<p>Daniel Lichtenberger (1):
<ul>
<li>radeon: fix potential segfault in renderbuffer update</li>
</ul></p>
<p>Daniel Vetter (1):
<ul>
<li>r200: revalidate after radeon_update_renderbuffers</li>
</ul></p>
<p>Dave Airlie (1):
<ul>
<li>r300g: fixup rs690 tiling stride alignment calculations.</li>
</ul></p>
<p>Eric Anholt (13):
<ul>
<li>intel: Allow CopyTexSubImage to InternalFormat 3/4 textures, like RGB/RGBA.</li>
<li>glsl: Free the loop state context when we free the loop state.</li>
<li>i965: Allow OPCODE_SWZ to put immediates in the first arg.</li>
<li>i965: Add support for rendering to SARGB8 FBOs.</li>
<li>glsl: Add a helper constructor for expressions that works out result type.</li>
<li>glsl: Fix structure and array comparisions.</li>
<li>glsl: Quiet unreachable no-return-from-function warning.</li>
<li>glsl: Mark the array access for whole-array comparisons.</li>
<li>glsl: Fix flipped return of has_value() for array constants.</li>
<li>mesa: Add getters for the rest of the supported draw buffers.</li>
<li>mesa: Add getters for ARB_copy_buffer's attachment points.</li>
<li>i965: Correct the dp_read message descriptor setup on g4x.</li>
<li>glsl: Correct the marking of InputsRead/OutputsWritten on in/out matrices.</li>
</ul></p>
<p>Fabian Bieler (1):
<ul>
<li>glsl: fix lowering conditional returns in subroutines</li>
</ul></p>
<p>Francisco Jerez (3):
<ul>
<li>meta: Don't leak alpha function/reference value changes.</li>
<li>meta: Fix incorrect rendering of the bitmap alpha component.</li>
<li>meta: Don't try to disable cube maps if the driver doesn't expose the extension.</li>
</ul></p>
<p>Henri Verbeet (2):
<ul>
<li>r600: Evergreen has two extra frac_bits for the sampler LOD state.</li>
<li>st/mesa: Handle wrapped depth buffers in st_copy_texsubimage().</li>
</ul></p>
<p>Ian Romanick (33):
<ul>
<li>Add 7.9 md5sums</li>
<li>docs: Import 7.8.x release notes from 7.8 branch.</li>
<li>docs: download.html does not need to be updated for each release</li>
<li>docs: Update mailing lines from sf.net to freedesktop.org</li>
<li>docs: added news item for 7.9 release</li>
<li>mesa: Validate assembly shaders when GLSL shaders are used</li>
<li>linker: Reject shaders that have unresolved function calls</li>
<li>mesa: Refactor validation of shader targets</li>
<li>glsl: Slightly change the semantic of _LinkedShaders</li>
<li>linker: Improve handling of unread/unwritten shader inputs/outputs</li>
<li>glsl: Commit lexer files changed by previous cherry picking</li>
<li>mesa: Make metaops use program refcounts instead of names.</li>
<li>glsl: Fix incorrect gl_type of sampler2DArray and sampler1DArrayShadow</li>
<li>mesa: Allow query of MAX_SAMPLES with EXT_framebuffer_multisample</li>
<li>glsl: better handling of linker failures</li>
<li>mesa: Fix glGet of ES2's GL_MAX_*_VECTORS properties.</li>
<li>i915: Disallow alpha, red, RG, and sRGB as render targets</li>
<li>glsl/linker: Free any IR discarded by optimization passes.</li>
<li>glsl: Add an optimization pass to simplify discards.</li>
<li>glsl: Add a lowering pass to move discards out of if-statements.</li>
<li>i915: Correctly generate unconditional KIL instructions</li>
<li>glsl: Add unary ir_expression constructor</li>
<li>glsl: Ensure that equality comparisons don't return a NULL IR tree</li>
<li>glcpp: Commit changes in generated files cause by previous commit</li>
<li>glsl: Inherrit type of declared variable from initializer</li>
<li>glsl: Inherrit type of declared variable from initializer after processing assignment</li>
<li>linker: Ensure that unsized arrays have a size after linking</li>
<li>linker: Fix regressions caused by previous commit</li>
<li>linker: Allow built-in arrays to have different sizes between shader stages</li>
<li>ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors</li>
<li>Refresh autogenerated file builtin_function.cpp.</li>
<li>docs: Initial set of release notes for 7.9.1</li>
<li>mesa: set version string to 7.9.1</li>
</ul></p>
<p>Julien Cristau (1):
<ul>
<li>Makefile: don't include the same files twice in the tarball</li>
</ul></p>
<p>Kenneth Graunke (19):
<ul>
<li>glcpp: Return NEWLINE token for newlines inside multi-line comments.</li>
<li>generate_builtins.py: Output large strings as arrays of characters.</li>
<li>glsl: Fix constant component count in vector constructor emitting.</li>
<li>ir_dead_functions: Actually free dead functions and signatures.</li>
<li>glcpp: Define GL_FRAGMENT_PRECISION_HIGH if GLSL version &gt;= 1.30.</li>
<li>glsl: Unconditionally define GL_FRAGMENT_PRECISION_HIGH in ES2 shaders.</li>
<li>glsl: Fix constant expression handling for &lt, &gt;, &lt=, &gt;= on vectors.</li>
<li>glsl: Use do_common_optimization in the standalone compiler.</li>
<li>glsl: Don't inline function prototypes.</li>
<li>glsl: Add a virtual as_discard() method.</li>
<li>glsl: Remove "discard" support from lower_jumps.</li>
<li>glsl: Refactor get_num_operands.</li>
<li>glcpp: Don't emit SPACE tokens in conditional_tokens production.</li>
<li>glsl: Clean up code by adding a new is_break() function.</li>
<li>glsl: Consider the "else" branch when looking for loop breaks.</li>
<li>Remove OES_compressed_paletted_texture from the ES2 extension list.</li>
<li>glsl/builtins: Compute the correct value for smoothstep(vec, vec, vec).</li>
<li>Fix build on systems where "python" is python 3.</li>
<li>i965: Internally enable GL_NV_blend_square on ES2.</li>
</ul></p>
<p>Kristian Høgsberg (1):
<ul>
<li>i965: Don't write mrf assignment for pointsize output</li>
</ul></p>
<p>Luca Barbieri (1):
<ul>
<li>glsl: Unroll loops with conditional breaks anywhere (not just the end)</li>
</ul></p>
<p>Marek Olšák (17):
<ul>
<li>r300g: fix microtiling for 16-bits-per-channel formats</li>
<li>r300g: fix texture border for 16-bits-per-channel formats</li>
<li>r300g: add a default channel ordering of texture border for unhandled formats</li>
<li>r300g: fix texture border color for all texture formats</li>
<li>r300g: fix rendering with no vertex elements</li>
<li>r300/compiler: fix rc_rewrite_depth_out for it to work with any instruction</li>
<li>r300g: fix texture border color once again</li>
<li>r300g: fix texture swizzling with compressed textures on r400-r500</li>
<li>r300g: disable ARB_texture_swizzle if S3TC is enabled on r3xx-only</li>
<li>mesa, st/mesa: fix gl_FragCoord with FBOs in Gallium</li>
<li>st/mesa: initialize key in st_vp_varient</li>
<li>r300/compiler: fix swizzle lowering with a presubtract source operand</li>
<li>r300g: fix rendering with a vertex attrib having a zero stride</li>
<li>ir_to_mesa: Add support for conditional discards.</li>
<li>r300g: finally fix the texture corruption on r3xx-r4xx</li>
<li>mesa: fix texel store functions for some float formats</li>
<li>r300/compiler: disable the rename_regs pass for loops</li>
</ul></p>
<p>Mario Kleiner (1):
<ul>
<li>mesa/r300classic: Fix dri2Invalidate/radeon_prepare_render for page flipping.</li>
</ul></p>
<p>Peter Clifton (1):
<ul>
<li>intel: Fix emit_linear_blit to use DWORD aligned width blits</li>
</ul></p>
<p>Robert Hooker (2):
<ul>
<li>intel: Add a new B43 pci id.</li>
<li>egl_dri2: Add missing intel chip ids.</li>
</ul></p>
<p>Roland Scheidegger (1):
<ul>
<li>r200: fix r200 large points</li>
</ul></p>
<p>Thomas Hellstrom (17):
<ul>
<li>st/xorg: Don't try to use option values before processing options</li>
<li>xorg/vmwgfx: Make vmwarectrl work also on 64-bit servers</li>
<li>st/xorg: Add a customizer option to get rid of annoying cursor update flicker</li>
<li>xorg/vmwgfx: Don't hide HW cursors when updating them</li>
<li>st/xorg: Don't try to remove invalid fbs</li>
<li>st/xorg: Fix typo</li>
<li>st/xorg, xorg/vmwgfx: Be a bit more frendly towards cross-compiling environments</li>
<li>st/xorg: Fix compilation errors for Xservers compiled without Composite</li>
<li>st/xorg: Don't use deprecated x*alloc / xfree functions</li>
<li>xorg/vmwgfx: Don't use deprecated x*alloc / xfree functions</li>
<li>st/xorg: Fix compilation for Xservers &gt;= 1.10</li>
<li>mesa: Make sure we have the talloc cflags when using the talloc headers</li>
<li>egl: Add an include for size_t</li>
<li>mesa: Add talloc includes for gles</li>
<li>st/egl: Fix build for include files in nonstandard places</li>
<li>svga/drm: Optionally resolve calls to powf during link-time</li>
<li>gallium/targets: Trivial crosscompiling fix</li>
</ul></p>
<p>Tom Stellard (7):
<ul>
<li>r300/compiler: Make sure presubtract sources use supported swizzles</li>
<li>r300/compiler: Fix register allocator's handling of loops</li>
<li>r300/compiler: Fix instruction scheduling within IF blocks</li>
<li>r300/compiler: Use zero as the register index for unused sources</li>
<li>r300/compiler: Ignore alpha dest register when replicating the result</li>
<li>r300/compiler: Use correct swizzles for all presubtract sources</li>
<li>r300/compiler: Don't allow presubtract sources to be remapped twice</li>
</ul></p>
<p>Vinson Lee (1):
<ul>
<li>glsl: Fix 'control reaches end of non-void function' warning.</li>
</ul></p>
<p>richard (1):
<ul>
<li>r600c : inline vertex format is not updated in an app, switch to use vfetch constants. For the 7.9 and 7.10 branches as well.</li>
</ul></p>
</body>
</html>

View File

@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.9 Release Notes / October 4, 2010</H1>
<H1>Mesa 7.9 Release Notes / date TBD</H1>
<p>
Mesa 7.9 is a new development release.
@@ -28,12 +28,7 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
ed65ab425b25895c7f473d0a5e6e64f8 MesaLib-7.9.tar.gz
82c740c49d572baa6da2b1a1eee90bca MesaLib-7.9.tar.bz2
cd2b6ecec759b0457475e94bbb38fedb MesaLib-7.9.zip
7b54af9fb9b1f6a1a65db2520f50848f MesaGLUT-7.9.tar.gz
20d07419d1929f833fdb36bced290ad5 MesaGLUT-7.9.tar.bz2
62a7edecd7c92675cd6029b05217eb0a MesaGLUT-7.9.zip
tbd
</pre>
@@ -42,85 +37,16 @@ cd2b6ecec759b0457475e94bbb38fedb MesaLib-7.9.zip
<li>New, improved GLSL compiler written by Intel.
See the <a href="shading.html"> Shading Language</a> page for
more information.
<li>New, very experimental Gallium driver for R600-R700 Radeons.
<li>Support for AMD Evergreen-based Radeons (HD 5xxx)
<li>GL_EXT_timer_query extension (i965 driver and softpipe only)
<li>GL_EXT_timer_query extension (i965 driver only)
<li>GL_EXT_framebuffer_multisample extension (intel drivers, MAX_SAMPLES = 1)
<li>GL_ARB_texture_swizzle extension (alias of GL_EXT_texture_swizzle)
<li>GL_ARB_draw_elements_base_vertex, GL_ARB_fragment_program_shadow,
GL_ARB_window_pos, GL_EXT_gpu_program_parameters,
GL_ATI_texture_env_combine3, GL_MESA_pack_invert, and GL_OES_EGL_image
extensions in Gallium drivers
<li>GL_ARB_depth_clamp and GL_NV_depth_clamp extensions (in nv50 and r600
Gallium drivers)
<li>GL_ARB_half_float_vertex extension (in nvfx, r300, r600, softpipe,
and llvmpipe Gallium drivers)
<li>GL_EXT_draw_buffers2 (in nv50, r600, softpipe, and llvmpipe Gallium
drivers)
<li>GL_EXT_texture_swizzle (in nvfx, r300, r600, softpipe, and llvmpipe
Gallium drivers)
<li>GL_ATI_texture_mirror_once (in nvfx, nv50, r300, r600, softpipe, and
llvmpipe Gallium drivers)
<li>GL_NV_conditional_render (in r300 Gallium driver)
<li>Initial "signs of life" support for Sandybridge hardware in i965 DRI
driver.
<li>GL_ARB_draw_elements_base_vertex, GL_ARB_fragment_program_shadow
and GL_EXT_draw_buffers2 in Gallium drivers
</ul>
<h2>Bug fixes</h2>
<p>This list is likely incomplete.</p>
<ul>
<li>Massive improvements to the Gallium driver for R300-R500 Radeons; this
driver is now considered stable for use as a DRI (OpenGL) driver.
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=10908">Bug 10908</a> - GLSL: gl_FogParamaters gl_Fog built-in uniform not functioning</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=13753">Bug 13753</a> - Numerous bugs in GLSL uniform handling</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=16854">Bug 16854</a> - GLSL function call at global scope causes SEGV</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=16856">Bug 16856</a> - GLSL indexing of unsized array results in assertion failure</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=18659">Bug 18659</a> - Crash in shader/slang/slang_codegen.c _slang_gen_function_call_name()</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=19089">Bug 19089</a> - [GLSL] glsl1/shadow2D() cases fail</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=22622">Bug 22622</a> - [GM965 GLSL] noise*() cause GPU lockup</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=23743">Bug 23743</a> - For loop from 0 to 0 not optimized out</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=24553">Bug 24553</a> - shader compilation times explode when using more () pairs</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25664">Bug 25664</a> - [GLSL] re-declaring an empty array fails to compile</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25769">Bug 25769</a> - [GLSL] "float" can be implicitly converted to "int"</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25808">Bug 25808</a> - [GLSL] const variable is modified successfully</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25826">Bug 25826</a> - [GLSL] declaring an unsized array then re-declaring with a size fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25827">Bug 25827</a> - [GLSL] vector constructor accepts too many arguments successfully</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25829">Bug 25829</a> - [GLSL] allowing non-void function without returning value</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25830">Bug 25830</a> - [GLSL] allowing non-constant-expression as const declaration initializer</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25877">Bug 25877</a> - [GLSL 1.10] implicit conversion from "int" to "float" should not be allowed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25878">Bug 25878</a> - [GLSL] sampler is converted to int successfully</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25994">Bug 25994</a> - [GM45][GLSL] 'return' statement in vertex shader unsupported</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25999">Bug 25999</a> - [GLSL] embedded structure constructor fails to compile</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26000">Bug 26000</a> - [GLSL] allowing different parameter qualifier between the function definition and declaration</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26001">Bug 26001</a> - [GLSL 1.10] constructing matrix from matrix succeeds</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26224">Bug 26224</a> - [GLSL] Cannot get location of a uniform struct member</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26990">Bug 26990</a> - [GLSL] variable declaration in "while" fails to compile</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27004">Bug 27004</a> - [GLSL] allowing macro redefinition</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27060">Bug 27060</a> - [965] piglit glsl-fs-raytrace failure due to lack of function calls.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27216">Bug 27216</a> - Assignment with a function call in an if statement causes an assertion failure</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27261">Bug 27261</a> - GLSL Compiler fails on the following vertex shader</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27265">Bug 27265</a> - GLSL Compiler doesnt link the attached vertex shader</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27388">Bug 27388</a> - [i965] piglit glsl-vs-arrays failure</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27403">Bug 27403</a> - GLSL struct causing "Invalid src register file ..." error</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27914">Bug 27914</a> - GLSL compiler uses MUL+ADD where it could use MAD</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28055">Bug 28055</a> - glsl-texcoord-array fails GLSL compilation</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28374">Bug 28374</a> - SIGSEGV shader/slang/slang_typeinfo.c:534</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28748">Bug 28748</a> - [i965] uninlined function calls support</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28833">Bug 28833</a> - piglit/shaders/glsl-texcoord-array fail</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28834">Bug 28834</a> - Add support for system fpclassify to GL_OES_query_matrix function for OpenBSD / NetBSD</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28837">Bug 28837</a> - varying vec4 index support</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28845">Bug 28845</a> - The GLU tesselator code has some warnings</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28889">Bug 28889</a> - [regression] wine game crash</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28894">Bug 28894</a> - slang build fails if absolute path contains spaces</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28913">Bug 28913</a> - [GLSL] allowing two version statements</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28931">Bug 28931</a> - Floating Point Exception in Warzone2100 Trunk version</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28966">Bug 28966</a> - [r300g] Dynamic branching 3 demo does not run</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28967">Bug 28967</a> - slang/slang_emit.c:350: storage_to_src_reg: Assertion `index &gt;= 0' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29013">Bug 29013</a> - [r300g] translate_rgb_op: unknown opcode ILLEGAL OPCODE</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29020">Bug 29020</a> - [r300g] Wine d3d9 tests hardlock</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29910">Bug 29910</a> - Mesa advertises bogus GL_ARB_shading_language_120</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30196">Bug 30196</a> - [GLSL] gl_TextureMatrix{Inverse,Transpose,InverseTranspose} unsupported</li>
</ul>

View File

@@ -14,7 +14,6 @@ The release notes summarize what's new or changed in each Mesa release.
<UL>
<LI><A HREF="relnotes-7.9.html">7.9 release notes</A>
<LI><A HREF="relnotes-7.8.3.html">7.8.3 release notes</A>
<LI><A HREF="relnotes-7.8.2.html">7.8.2 release notes</A>
<LI><A HREF="relnotes-7.8.1.html">7.8.1 release notes</A>
<LI><A HREF="relnotes-7.8.html">7.8 release notes</A>

View File

@@ -29,9 +29,9 @@ extern "C" {
*/
/* Header file version number, required by OpenGL ABI for Linux */
/* glext.h last updated $Date: 2010-11-03 18:59:30 -0700 (Wed, 03 Nov 2010) $ */
/* glext.h last updated $Date: 2010-08-03 01:30:25 -0700 (Tue, 03 Aug 2010) $ */
/* Current version at http://www.opengl.org/registry/ */
#define GL_GLEXT_VERSION 66
#define GL_GLEXT_VERSION 64
/* Function declaration macros - to move into glplatform.h */
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@@ -4840,7 +4840,7 @@ extern "C" {
#endif
#ifndef GL_AMD_seamless_cubemap_per_texture
/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */
/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB */
#endif
#ifndef GL_AMD_conservative_depth
@@ -4925,8 +4925,6 @@ extern "C" {
#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B
#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C
#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D
#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E
#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F
#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44
#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45
#endif
@@ -5021,11 +5019,6 @@ extern "C" {
#ifndef GL_AMD_transform_feedback3_lines_triangles
#endif
#ifndef GL_AMD_depth_clamp_separate
#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E
#define GL_DEPTH_CLAMP_FAR_AMD 0x901F
#endif
/*************************************************************/
@@ -8772,8 +8765,8 @@ GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdoubl
GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v);
GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v);
GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLuint count, const GLdouble *v);
GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLuint count, const GLfloat *v);
GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs);
GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform);
GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
@@ -8837,8 +8830,8 @@ typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint in
typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v);
typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v);
typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v);
typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v);
typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
@@ -11027,10 +11020,6 @@ typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, cons
#define GL_AMD_transform_feedback3_lines_triangles 1
#endif
#ifndef GL_AMD_depth_clamp_separate
#define GL_AMD_depth_clamp_separate 1
#endif
#ifdef __cplusplus
}

View File

@@ -1,8 +1,8 @@
/* $Revision: 9203 $ on $Date:: 2009-10-07 02:21:52 -0700 #$ */
/* $Revision: 6822 $ on $Date:: 2008-10-30 05:14:19 -0400 #$ */
/*------------------------------------------------------------------------
*
* OpenVG 1.1 Reference Implementation
* OpenVG 1.0.1 Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
@@ -28,7 +28,7 @@
*
*//**
* \file
* \brief OpenVG 1.1 API.
* \brief OpenVG 1.0.1 API.
*//*-------------------------------------------------------------------*/
#ifndef _OPENVG_H
@@ -42,7 +42,6 @@ extern "C" {
#define OPENVG_VERSION_1_0 1
#define OPENVG_VERSION_1_0_1 1
#define OPENVG_VERSION_1_1 2
#ifndef VG_MAXSHORT
#define VG_MAXSHORT 0x7FFF
@@ -56,12 +55,10 @@ extern "C" {
#define VG_MAX_ENUM 0x7FFFFFFF
#endif
typedef VGuint VGHandle;
typedef long VGHandle;
typedef VGHandle VGPath;
typedef VGHandle VGImage;
typedef VGHandle VGMaskLayer;
typedef VGHandle VGFont;
typedef VGHandle VGPaint;
#define VG_INVALID_HANDLE ((VGHandle)0)
@@ -99,10 +96,6 @@ typedef enum {
/* Scissoring rectangles */
VG_SCISSOR_RECTS = 0x1106,
/* Color Transformation */
VG_COLOR_TRANSFORM = 0x1170,
VG_COLOR_TRANSFORM_VALUES = 0x1171,
/* Stroke parameters */
VG_STROKE_LINE_WIDTH = 0x1110,
VG_STROKE_CAP_STYLE = 0x1111,
@@ -118,9 +111,6 @@ typedef enum {
/* Color for vgClear */
VG_CLEAR_COLOR = 0x1121,
/* Glyph origin */
VG_GLYPH_ORIGIN = 0x1122,
/* Enable/disable alpha masking and scissoring */
VG_MASKING = 0x1130,
VG_SCISSORING = 0x1131,
@@ -175,7 +165,6 @@ typedef enum {
VG_MATRIX_IMAGE_USER_TO_SURFACE = 0x1401,
VG_MATRIX_FILL_PAINT_TO_USER = 0x1402,
VG_MATRIX_STROKE_PAINT_TO_USER = 0x1403,
VG_MATRIX_GLYPH_USER_TO_SURFACE = 0x1404,
VG_MATRIX_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGMatrixMode;
@@ -376,8 +365,6 @@ typedef enum {
VG_lL_8 = 10,
VG_A_8 = 11,
VG_BW_1 = 12,
VG_A_1 = 13,
VG_A_4 = 14,
/* {A,X}RGB channel ordering */
VG_sXRGB_8888 = 0 | (1 << 6),
@@ -461,12 +448,6 @@ typedef enum {
VG_BLEND_MODE_FORCE_SIZE = VG_MAX_ENUM
} VGBlendMode;
typedef enum {
VG_FONT_NUM_GLYPHS = 0x2F00,
VG_FONT_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGFontParamType;
typedef enum {
VG_IMAGE_FORMAT_QUERY = 0x2100,
VG_PATH_DATATYPE_QUERY = 0x2101,
@@ -560,22 +541,8 @@ VG_API_CALL void VG_API_ENTRY vgShear(VGfloat shx, VGfloat shy) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgRotate(VGfloat angle) VG_API_EXIT;
/* Masking and Clearing */
VG_API_CALL void VG_API_ENTRY vgMask(VGHandle mask, VGMaskOperation operation,
VGint x, VGint y,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgRenderToMask(VGPath path,
VGbitfield paintModes,
VGMaskOperation operation) VG_API_EXIT;
VG_API_CALL VGMaskLayer VG_API_ENTRY vgCreateMaskLayer(VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDestroyMaskLayer(VGMaskLayer maskLayer) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgFillMaskLayer(VGMaskLayer maskLayer,
VGint x, VGint y,
VGint width, VGint height,
VGfloat value) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgCopyMask(VGMaskLayer maskLayer,
VGint dx, VGint dy,
VGint sx, VGint sy,
VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgMask(VGImage mask, VGMaskOperation operation,
VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgClear(VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
/* Paths */
@@ -669,33 +636,6 @@ VG_API_CALL void VG_API_ENTRY vgCopyPixels(VGint dx, VGint dy,
VGint sx, VGint sy,
VGint width, VGint height) VG_API_EXIT;
/* Text */
VG_API_CALL VGFont VG_API_ENTRY vgCreateFont(VGint glyphCapacityHint) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDestroyFont(VGFont font) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetGlyphToPath(VGFont font,
VGuint glyphIndex,
VGPath path,
VGboolean isHinted,
const VGfloat glyphOrigin [2],
const VGfloat escapement[2]) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgSetGlyphToImage(VGFont font,
VGuint glyphIndex,
VGImage image,
const VGfloat glyphOrigin [2],
const VGfloat escapement[2]) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgClearGlyph(VGFont font,VGuint glyphIndex) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDrawGlyph(VGFont font,
VGuint glyphIndex,
VGbitfield paintModes,
VGboolean allowAutoHinting) VG_API_EXIT;
VG_API_CALL void VG_API_ENTRY vgDrawGlyphs(VGFont font,
VGint glyphCount,
const VGuint *glyphIndices,
const VGfloat *adjustments_x,
const VGfloat *adjustments_y,
VGbitfield paintModes,
VGboolean allowAutoHinting) VG_API_EXIT;
/* Image Filters */
VG_API_CALL void VG_API_ENTRY vgColorMatrix(VGImage dst, VGImage src,
const VGfloat * matrix) VG_API_EXIT;

View File

@@ -1,233 +1,233 @@
/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */
/*------------------------------------------------------------------------
*
* VG extensions Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VG extensions
*//*-------------------------------------------------------------------*/
#ifndef _VGEXT_H
#define _VGEXT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <VG/openvg.h>
#include <VG/vgu.h>
#ifndef VG_API_ENTRYP
# define VG_API_ENTRYP VG_API_ENTRY*
#endif
#ifndef VGU_API_ENTRYP
# define VGU_API_ENTRYP VGU_API_ENTRY*
#endif
/*-------------------------------------------------------------------------------
* KHR extensions
*------------------------------------------------------------------------------*/
typedef enum {
#ifndef VG_KHR_iterative_average_blur
VG_MAX_AVERAGE_BLUR_DIMENSION_KHR = 0x116B,
VG_AVERAGE_BLUR_DIMENSION_RESOLUTION_KHR = 0x116C,
VG_MAX_AVERAGE_BLUR_ITERATIONS_KHR = 0x116D,
#endif
VG_PARAM_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGParamTypeKHR;
#ifndef VG_KHR_EGL_image
#define VG_KHR_EGL_image 1
/* VGEGLImageKHR is an opaque handle to an EGLImage */
typedef void* VGeglImageKHR;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL VGImage VG_API_ENTRY vgCreateEGLImageTargetKHR(VGeglImageKHR image);
#endif
typedef VGImage (VG_API_ENTRYP PFNVGCREATEEGLIMAGETARGETKHRPROC) (VGeglImageKHR image);
#endif
#ifndef VG_KHR_iterative_average_blur
#define VG_KHR_iterative_average_blur 1
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void vgIterativeAverageBlurKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
#endif
typedef void (VG_API_ENTRYP PFNVGITERATIVEAVERAGEBLURKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
#endif
#ifndef VG_KHR_advanced_blending
#define VG_KHR_advanced_blending 1
typedef enum {
VG_BLEND_OVERLAY_KHR = 0x2010,
VG_BLEND_HARDLIGHT_KHR = 0x2011,
VG_BLEND_SOFTLIGHT_SVG_KHR = 0x2012,
VG_BLEND_SOFTLIGHT_KHR = 0x2013,
VG_BLEND_COLORDODGE_KHR = 0x2014,
VG_BLEND_COLORBURN_KHR = 0x2015,
VG_BLEND_DIFFERENCE_KHR = 0x2016,
VG_BLEND_SUBTRACT_KHR = 0x2017,
VG_BLEND_INVERT_KHR = 0x2018,
VG_BLEND_EXCLUSION_KHR = 0x2019,
VG_BLEND_LINEARDODGE_KHR = 0x201a,
VG_BLEND_LINEARBURN_KHR = 0x201b,
VG_BLEND_VIVIDLIGHT_KHR = 0x201c,
VG_BLEND_LINEARLIGHT_KHR = 0x201d,
VG_BLEND_PINLIGHT_KHR = 0x201e,
VG_BLEND_HARDMIX_KHR = 0x201f,
VG_BLEND_CLEAR_KHR = 0x2020,
VG_BLEND_DST_KHR = 0x2021,
VG_BLEND_SRC_OUT_KHR = 0x2022,
VG_BLEND_DST_OUT_KHR = 0x2023,
VG_BLEND_SRC_ATOP_KHR = 0x2024,
VG_BLEND_DST_ATOP_KHR = 0x2025,
VG_BLEND_XOR_KHR = 0x2026,
VG_BLEND_MODE_KHR_FORCE_SIZE= VG_MAX_ENUM
} VGBlendModeKHR;
#endif
#ifndef VG_KHR_parametric_filter
#define VG_KHR_parametric_filter 1
typedef enum {
VG_PF_OBJECT_VISIBLE_FLAG_KHR = (1 << 0),
VG_PF_KNOCKOUT_FLAG_KHR = (1 << 1),
VG_PF_OUTER_FLAG_KHR = (1 << 2),
VG_PF_INNER_FLAG_KHR = (1 << 3),
VG_PF_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGPfTypeKHR;
typedef enum {
VGU_IMAGE_IN_USE_ERROR = 0xF010,
VGU_ERROR_CODE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGUErrorCodeKHR;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void VG_API_ENTRY vgParametricFilterKHR(VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguDropShadowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA) ;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
#endif
typedef void (VG_API_ENTRYP PFNVGPARAMETRICFILTERKHRPROC) (VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUDROPSHADOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
#endif
/*-------------------------------------------------------------------------------
* NDS extensions
*------------------------------------------------------------------------------*/
#ifndef VG_NDS_paint_generation
#define VG_NDS_paint_generation 1
typedef enum {
VG_PAINT_COLOR_RAMP_LINEAR_NDS = 0x1A10,
VG_COLOR_MATRIX_NDS = 0x1A11,
VG_PAINT_COLOR_TRANSFORM_LINEAR_NDS = 0x1A12,
VG_PAINT_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPaintParamTypeNds;
typedef enum {
VG_DRAW_IMAGE_COLOR_MATRIX_NDS = 0x1F10,
VG_IMAGE_MODE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGImageModeNds;
#endif
#ifndef VG_NDS_projective_geometry
#define VG_NDS_projective_geometry 1
typedef enum {
VG_CLIP_MODE_NDS = 0x1180,
VG_CLIP_LINES_NDS = 0x1181,
VG_MAX_CLIP_LINES_NDS = 0x1182,
VG_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGParamTypeNds;
typedef enum {
VG_CLIPMODE_NONE_NDS = 0x3000,
VG_CLIPMODE_CLIP_CLOSED_NDS = 0x3001,
VG_CLIPMODE_CLIP_OPEN_NDS = 0x3002,
VG_CLIPMODE_CULL_NDS = 0x3003,
VG_CLIPMODE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGClipModeNds;
typedef enum {
VG_RQUAD_TO_NDS = ( 13 << 1 ),
VG_RCUBIC_TO_NDS = ( 14 << 1 ),
VG_PATH_SEGMENT_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPathSegmentNds;
typedef enum {
VG_RQUAD_TO_ABS_NDS = (VG_RQUAD_TO_NDS | VG_ABSOLUTE),
VG_RQUAD_TO_REL_NDS = (VG_RQUAD_TO_NDS | VG_RELATIVE),
VG_RCUBIC_TO_ABS_NDS = (VG_RCUBIC_TO_NDS | VG_ABSOLUTE),
VG_RCUBIC_TO_REL_NDS = (VG_RCUBIC_TO_NDS | VG_RELATIVE),
VG_PATH_COMMAND_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPathCommandNds;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void VG_API_ENTRY vgProjectiveMatrixNDS(VGboolean enable) ;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguTransformClipLineNDS(const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
#endif
typedef void (VG_API_ENTRYP PFNVGPROJECTIVEMATRIXNDSPROC) (VGboolean enable) ;
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUTRANSFORMCLIPLINENDSPROC) (const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _VGEXT_H */
/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */
/*------------------------------------------------------------------------
*
* VG extensions Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VG extensions
*//*-------------------------------------------------------------------*/
#ifndef _VGEXT_H
#define _VGEXT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <VG/openvg.h>
#include <VG/vgu.h>
#ifndef VG_API_ENTRYP
# define VG_API_ENTRYP VG_API_ENTRY*
#endif
#ifndef VGU_API_ENTRYP
# define VGU_API_ENTRYP VGU_API_ENTRY*
#endif
/*-------------------------------------------------------------------------------
* KHR extensions
*------------------------------------------------------------------------------*/
typedef enum {
#ifndef VG_KHR_iterative_average_blur
VG_MAX_AVERAGE_BLUR_DIMENSION_KHR = 0x116B,
VG_AVERAGE_BLUR_DIMENSION_RESOLUTION_KHR = 0x116C,
VG_MAX_AVERAGE_BLUR_ITERATIONS_KHR = 0x116D,
#endif
VG_PARAM_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGParamTypeKHR;
#ifndef VG_KHR_EGL_image
#define VG_KHR_EGL_image 1
/* VGEGLImageKHR is an opaque handle to an EGLImage */
typedef void* VGeglImageKHR;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL VGImage VG_API_ENTRY vgCreateEGLImageTargetKHR(VGeglImageKHR image);
#endif
typedef VGImage (VG_API_ENTRYP PFNVGCREATEEGLIMAGETARGETKHRPROC) (VGeglImageKHR image);
#endif
#ifndef VG_KHR_iterative_average_blur
#define VG_KHR_iterative_average_blur 1
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void vgIterativeAverageBlurKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
#endif
typedef void (VG_API_ENTRYP PFNVGITERATIVEAVERAGEBLURKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
#endif
#ifndef VG_KHR_advanced_blending
#define VG_KHR_advanced_blending 1
typedef enum {
VG_BLEND_OVERLAY_KHR = 0x2010,
VG_BLEND_HARDLIGHT_KHR = 0x2011,
VG_BLEND_SOFTLIGHT_SVG_KHR = 0x2012,
VG_BLEND_SOFTLIGHT_KHR = 0x2013,
VG_BLEND_COLORDODGE_KHR = 0x2014,
VG_BLEND_COLORBURN_KHR = 0x2015,
VG_BLEND_DIFFERENCE_KHR = 0x2016,
VG_BLEND_SUBTRACT_KHR = 0x2017,
VG_BLEND_INVERT_KHR = 0x2018,
VG_BLEND_EXCLUSION_KHR = 0x2019,
VG_BLEND_LINEARDODGE_KHR = 0x201a,
VG_BLEND_LINEARBURN_KHR = 0x201b,
VG_BLEND_VIVIDLIGHT_KHR = 0x201c,
VG_BLEND_LINEARLIGHT_KHR = 0x201d,
VG_BLEND_PINLIGHT_KHR = 0x201e,
VG_BLEND_HARDMIX_KHR = 0x201f,
VG_BLEND_CLEAR_KHR = 0x2020,
VG_BLEND_DST_KHR = 0x2021,
VG_BLEND_SRC_OUT_KHR = 0x2022,
VG_BLEND_DST_OUT_KHR = 0x2023,
VG_BLEND_SRC_ATOP_KHR = 0x2024,
VG_BLEND_DST_ATOP_KHR = 0x2025,
VG_BLEND_XOR_KHR = 0x2026,
VG_BLEND_MODE_KHR_FORCE_SIZE= VG_MAX_ENUM
} VGBlendModeKHR;
#endif
#ifndef VG_KHR_parametric_filter
#define VG_KHR_parametric_filter 1
typedef enum {
VG_PF_OBJECT_VISIBLE_FLAG_KHR = (1 << 0),
VG_PF_KNOCKOUT_FLAG_KHR = (1 << 1),
VG_PF_OUTER_FLAG_KHR = (1 << 2),
VG_PF_INNER_FLAG_KHR = (1 << 3),
VG_PF_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGPfTypeKHR;
typedef enum {
VGU_IMAGE_IN_USE_ERROR = 0xF010,
VGU_ERROR_CODE_KHR_FORCE_SIZE = VG_MAX_ENUM
} VGUErrorCodeKHR;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void VG_API_ENTRY vgParametricFilterKHR(VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguDropShadowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA) ;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
#endif
typedef void (VG_API_ENTRYP PFNVGPARAMETRICFILTERKHRPROC) (VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUDROPSHADOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
#endif
/*-------------------------------------------------------------------------------
* NDS extensions
*------------------------------------------------------------------------------*/
#ifndef VG_NDS_paint_generation
#define VG_NDS_paint_generation 1
typedef enum {
VG_PAINT_COLOR_RAMP_LINEAR_NDS = 0x1A10,
VG_COLOR_MATRIX_NDS = 0x1A11,
VG_PAINT_COLOR_TRANSFORM_LINEAR_NDS = 0x1A12,
VG_PAINT_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPaintParamTypeNds;
typedef enum {
VG_DRAW_IMAGE_COLOR_MATRIX_NDS = 0x1F10,
VG_IMAGE_MODE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGImageModeNds;
#endif
#ifndef VG_NDS_projective_geometry
#define VG_NDS_projective_geometry 1
typedef enum {
VG_CLIP_MODE_NDS = 0x1180,
VG_CLIP_LINES_NDS = 0x1181,
VG_MAX_CLIP_LINES_NDS = 0x1182,
VG_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGParamTypeNds;
typedef enum {
VG_CLIPMODE_NONE_NDS = 0x3000,
VG_CLIPMODE_CLIP_CLOSED_NDS = 0x3001,
VG_CLIPMODE_CLIP_OPEN_NDS = 0x3002,
VG_CLIPMODE_CULL_NDS = 0x3003,
VG_CLIPMODE_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGClipModeNds;
typedef enum {
VG_RQUAD_TO_NDS = ( 13 << 1 ),
VG_RCUBIC_TO_NDS = ( 14 << 1 ),
VG_PATH_SEGMENT_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPathSegmentNds;
typedef enum {
VG_RQUAD_TO_ABS_NDS = (VG_RQUAD_TO_NDS | VG_ABSOLUTE),
VG_RQUAD_TO_REL_NDS = (VG_RQUAD_TO_NDS | VG_RELATIVE),
VG_RCUBIC_TO_ABS_NDS = (VG_RCUBIC_TO_NDS | VG_ABSOLUTE),
VG_RCUBIC_TO_REL_NDS = (VG_RCUBIC_TO_NDS | VG_RELATIVE),
VG_PATH_COMMAND_NDS_FORCE_SIZE = VG_MAX_ENUM
} VGPathCommandNds;
#ifdef VG_VGEXT_PROTOTYPES
VG_API_CALL void VG_API_ENTRY vgProjectiveMatrixNDS(VGboolean enable) ;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguTransformClipLineNDS(const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
#endif
typedef void (VG_API_ENTRYP PFNVGPROJECTIVEMATRIXNDSPROC) (VGboolean enable) ;
typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUTRANSFORMCLIPLINENDSPROC) (const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _VGEXT_H */

View File

@@ -1,92 +1,92 @@
/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */
/*------------------------------------------------------------------------
*
* VG platform specific header Reference Implementation
* ----------------------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VG platform specific header
*//*-------------------------------------------------------------------*/
#ifndef _VGPLATFORM_H
#define _VGPLATFORM_H
#include <KHR/khrplatform.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef VG_API_CALL
#if defined(OPENVG_STATIC_LIBRARY)
# define VG_API_CALL
#else
# define VG_API_CALL KHRONOS_APICALL
#endif /* defined OPENVG_STATIC_LIBRARY */
#endif /* ifndef VG_API_CALL */
#ifndef VGU_API_CALL
#if defined(OPENVG_STATIC_LIBRARY)
# define VGU_API_CALL
#else
# define VGU_API_CALL KHRONOS_APICALL
#endif /* defined OPENVG_STATIC_LIBRARY */
#endif /* ifndef VGU_API_CALL */
#ifndef VG_API_ENTRY
#define VG_API_ENTRY
#endif
#ifndef VG_API_EXIT
#define VG_API_EXIT
#endif
#ifndef VGU_API_ENTRY
#define VGU_API_ENTRY
#endif
#ifndef VGU_API_EXIT
#define VGU_API_EXIT
#endif
typedef float VGfloat;
typedef signed char VGbyte;
typedef unsigned char VGubyte;
typedef signed short VGshort;
typedef signed int VGint;
typedef unsigned int VGuint;
typedef unsigned int VGbitfield;
#ifndef VG_VGEXT_PROTOTYPES
#define VG_VGEXT_PROTOTYPES
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _VGPLATFORM_H */
/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */
/*------------------------------------------------------------------------
*
* VG platform specific header Reference Implementation
* ----------------------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VG platform specific header
*//*-------------------------------------------------------------------*/
#ifndef _VGPLATFORM_H
#define _VGPLATFORM_H
#include <KHR/khrplatform.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef VG_API_CALL
#if defined(OPENVG_STATIC_LIBRARY)
# define VG_API_CALL
#else
# define VG_API_CALL KHRONOS_APICALL
#endif /* defined OPENVG_STATIC_LIBRARY */
#endif /* ifndef VG_API_CALL */
#ifndef VGU_API_CALL
#if defined(OPENVG_STATIC_LIBRARY)
# define VGU_API_CALL
#else
# define VGU_API_CALL KHRONOS_APICALL
#endif /* defined OPENVG_STATIC_LIBRARY */
#endif /* ifndef VGU_API_CALL */
#ifndef VG_API_ENTRY
#define VG_API_ENTRY
#endif
#ifndef VG_API_EXIT
#define VG_API_EXIT
#endif
#ifndef VGU_API_ENTRY
#define VGU_API_ENTRY
#endif
#ifndef VGU_API_EXIT
#define VGU_API_EXIT
#endif
typedef float VGfloat;
typedef signed char VGbyte;
typedef unsigned char VGubyte;
typedef signed short VGshort;
typedef signed int VGint;
typedef unsigned int VGuint;
typedef unsigned int VGbitfield;
#ifndef VG_VGEXT_PROTOTYPES
#define VG_VGEXT_PROTOTYPES
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _VGPLATFORM_H */

View File

@@ -1,131 +1,130 @@
/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */
/*------------------------------------------------------------------------
*
* VGU 1.1 Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VGU 1.1 API.
*//*-------------------------------------------------------------------*/
#ifndef _VGU_H
#define _VGU_H
#ifdef __cplusplus
extern "C" {
#endif
#include <VG/openvg.h>
#define VGU_VERSION_1_0 1
#define VGU_VERSION_1_1 2
#ifndef VGU_API_CALL
# error VGU_API_CALL must be defined
#endif
#ifndef VGU_API_ENTRY
# error VGU_API_ENTRY must be defined
#endif
#ifndef VGU_API_EXIT
# error VGU_API_EXIT must be defined
#endif
typedef enum {
VGU_NO_ERROR = 0,
VGU_BAD_HANDLE_ERROR = 0xF000,
VGU_ILLEGAL_ARGUMENT_ERROR = 0xF001,
VGU_OUT_OF_MEMORY_ERROR = 0xF002,
VGU_PATH_CAPABILITY_ERROR = 0xF003,
VGU_BAD_WARP_ERROR = 0xF004,
VGU_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM
} VGUErrorCode;
typedef enum {
VGU_ARC_OPEN = 0xF100,
VGU_ARC_CHORD = 0xF101,
VGU_ARC_PIE = 0xF102,
VGU_ARC_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGUArcType;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguLine(VGPath path,
VGfloat x0, VGfloat y0,
VGfloat x1, VGfloat y1) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguPolygon(VGPath path,
const VGfloat * points, VGint count,
VGboolean closed) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRect(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRoundRect(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height,
VGfloat arcWidth, VGfloat arcHeight) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguEllipse(VGPath path,
VGfloat cx, VGfloat cy,
VGfloat width, VGfloat height) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguArc(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height,
VGfloat startAngle, VGfloat angleExtent,
VGUArcType arcType) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
VGfloat sx3, VGfloat sy3,
VGfloat * matrix) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0,
VGfloat dx1, VGfloat dy1,
VGfloat dx2, VGfloat dy2,
VGfloat dx3, VGfloat dy3,
VGfloat * matrix) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0,
VGfloat dx1, VGfloat dy1,
VGfloat dx2, VGfloat dy2,
VGfloat dx3, VGfloat dy3,
VGfloat sx0, VGfloat sy0,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
VGfloat sx3, VGfloat sy3,
VGfloat * matrix) VGU_API_EXIT;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* #ifndef _VGU_H */
/* $Revision: 6810 $ on $Date:: 2008-10-29 10:31:37 -0400 #$ */
/*------------------------------------------------------------------------
*
* VGU 1.0.1 Reference Implementation
* -------------------------------------
*
* Copyright (c) 2008 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and /or associated documentation files
* (the "Materials "), to deal in the Materials without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Materials,
* and to permit persons to whom the Materials are furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*
*//**
* \file
* \brief VGU 1.0.1 API.
*//*-------------------------------------------------------------------*/
#ifndef _VGU_H
#define _VGU_H
#ifdef __cplusplus
extern "C" {
#endif
#include <VG/openvg.h>
#define VGU_VERSION_1_0 1
#ifndef VGU_API_CALL
# error VGU_API_CALL must be defined
#endif
#ifndef VGU_API_ENTRY
# error VGU_API_ENTRY must be defined
#endif
#ifndef VGU_API_EXIT
# error VGU_API_EXIT must be defined
#endif
typedef enum {
VGU_NO_ERROR = 0,
VGU_BAD_HANDLE_ERROR = 0xF000,
VGU_ILLEGAL_ARGUMENT_ERROR = 0xF001,
VGU_OUT_OF_MEMORY_ERROR = 0xF002,
VGU_PATH_CAPABILITY_ERROR = 0xF003,
VGU_BAD_WARP_ERROR = 0xF004,
VGU_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM
} VGUErrorCode;
typedef enum {
VGU_ARC_OPEN = 0xF100,
VGU_ARC_CHORD = 0xF101,
VGU_ARC_PIE = 0xF102,
VGU_ARC_TYPE_FORCE_SIZE = VG_MAX_ENUM
} VGUArcType;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguLine(VGPath path,
VGfloat x0, VGfloat y0,
VGfloat x1, VGfloat y1) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguPolygon(VGPath path,
const VGfloat * points, VGint count,
VGboolean closed) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRect(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRoundRect(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height,
VGfloat arcWidth, VGfloat arcHeight) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguEllipse(VGPath path,
VGfloat cx, VGfloat cy,
VGfloat width, VGfloat height) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguArc(VGPath path,
VGfloat x, VGfloat y,
VGfloat width, VGfloat height,
VGfloat startAngle, VGfloat angleExtent,
VGUArcType arcType) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
VGfloat sx3, VGfloat sy3,
VGfloat * matrix) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0,
VGfloat dx1, VGfloat dy1,
VGfloat dx2, VGfloat dy2,
VGfloat dx3, VGfloat dy3,
VGfloat * matrix) VGU_API_EXIT;
VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0,
VGfloat dx1, VGfloat dy1,
VGfloat dx2, VGfloat dy2,
VGfloat dx3, VGfloat dy3,
VGfloat sx0, VGfloat sy0,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
VGfloat sx3, VGfloat sy3,
VGfloat * matrix) VGU_API_EXIT;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* #ifndef _VGU_H */

View File

@@ -54,13 +54,11 @@ prefixes32 = SCons.Util.Split("""
i586-mingw32msvc-
i686-mingw32msvc-
i686-pc-mingw32-
i686-w64-mingw32-
""")
prefixes64 = SCons.Util.Split("""
amd64-mingw32-
amd64-mingw32msvc-
amd64-pc-mingw32-
x86_64-w64-mingw32-
""")
def find(env):

View File

@@ -49,35 +49,30 @@ def symlink(target, source, env):
os.symlink(os.path.basename(source), target)
def install(env, source, subdir):
target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'], subdir)
return env.Install(target_dir, source)
target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'], subdir)
env.Install(target_dir, source)
def install_program(env, source):
return install(env, source, 'bin')
install(env, source, 'bin')
def install_shared_library(env, sources, version = ()):
targets = []
install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'])
install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'])
version = tuple(map(str, version))
if env['SHLIBSUFFIX'] == '.dll':
dlls = env.FindIxes(sources, 'SHLIBPREFIX', 'SHLIBSUFFIX')
targets += install(env, dlls, 'bin')
install(env, dlls, 'bin')
libs = env.FindIxes(sources, 'LIBPREFIX', 'LIBSUFFIX')
targets += install(env, libs, 'lib')
install(env, libs, 'lib')
else:
for source in sources:
target_dir = os.path.join(install_dir, 'lib')
target_name = '.'.join((str(source),) + version)
last = env.InstallAs(os.path.join(target_dir, target_name), source)
targets += last
while len(version):
version = version[:-1]
target_name = '.'.join((str(source),) + version)
action = SCons.Action.Action(symlink, "$TARGET -> $SOURCE")
last = env.Command(os.path.join(target_dir, target_name), last, action)
targets += last
return targets
def createInstallMethods(env):
env.AddMethod(install_program, 'InstallProgram')
@@ -103,41 +98,6 @@ def num_jobs():
return 1
def pkg_config_modules(env, name, modules):
'''Simple wrapper for pkg-config.'''
env[name] = False
if env['platform'] == 'windows':
return
if not env.Detect('pkg-config'):
return
if subprocess.call(["pkg-config", "--exists", ' '.join(modules)]) != 0:
return
# Put -I and -L flags directly into the environment, as these don't affect
# the compilation of targets that do not use them
try:
env.ParseConfig('pkg-config --cflags-only-I --libs-only-L ' + ' '.join(modules))
except OSError:
return
# Other flags may affect the compilation of unrelated targets, so store
# them with a prefix, (e.g., XXX_CFLAGS, XXX_LIBS, etc)
try:
flags = env.ParseFlags('!pkg-config --cflags-only-other --libs-only-l --libs-only-other ' + ' '.join(modules))
except OSError:
return
prefix = name.upper() + '_'
for flag_name, flag_value in flags.iteritems():
env[prefix + flag_name] = flag_value
env[name] = True
def generate(env):
"""Common environment generation code"""
@@ -150,32 +110,27 @@ def generate(env):
env['toolchain'] = 'wcesdk'
env.Tool(env['toolchain'])
# Allow override compiler and specify additional flags from environment
if os.environ.has_key('CC'):
env['CC'] = os.environ['CC']
# Update CCVERSION to match
pipe = SCons.Action._subproc(env, [env['CC'], '--version'],
stdin = 'devnull',
stderr = 'devnull',
stdout = subprocess.PIPE)
if pipe.wait() == 0:
line = pipe.stdout.readline()
match = re.search(r'[0-9]+(\.[0-9]+)+', line)
if match:
env['CCVERSION'] = match.group(0)
if os.environ.has_key('CFLAGS'):
env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
if os.environ.has_key('CXX'):
env['CXX'] = os.environ['CXX']
if os.environ.has_key('CXXFLAGS'):
env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
if os.environ.has_key('LDFLAGS'):
env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
if env['platform'] == 'embedded':
# Allow overriding compiler from environment
if os.environ.has_key('CC'):
env['CC'] = os.environ['CC']
# Update CCVERSION to match
pipe = SCons.Action._subproc(env, [env['CC'], '--version'],
stdin = 'devnull',
stderr = 'devnull',
stdout = subprocess.PIPE)
if pipe.wait() == 0:
line = pipe.stdout.readline()
match = re.search(r'[0-9]+(\.[0-9]+)+', line)
if match:
env['CCVERSION'] = match.group(0)
env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
env['msvc'] = env['CC'] == 'cl'
# shortcuts
debug = env['debug']
machine = env['machine']
platform = env['platform']
x86 = env['machine'] == 'x86'
@@ -183,48 +138,20 @@ def generate(env):
gcc = env['gcc']
msvc = env['msvc']
# Backwards compatability with the debug= profile= options
if env['build'] == 'debug':
if not env['debug']:
print 'scons: warning: debug option is deprecated and will be removed eventually; use instead'
print
print ' scons build=release'
print
env['build'] = 'release'
if env['profile']:
print 'scons: warning: profile option is deprecated and will be removed eventually; use instead'
print
print ' scons build=profile'
print
env['build'] = 'profile'
if False:
# Enforce SConscripts to use the new build variable
env.popitem('debug')
env.popitem('profile')
else:
# Backwards portability with older sconscripts
if env['build'] in ('debug', 'checked'):
env['debug'] = True
env['profile'] = False
if env['build'] == 'profile':
env['debug'] = False
env['profile'] = True
if env['build'] == 'release':
env['debug'] = False
env['profile'] = False
# Put build output in a separate dir, which depends on the current
# configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
build_topdir = 'build'
build_subdir = env['platform']
if env['machine'] != 'generic':
build_subdir += '-' + env['machine']
if env['build'] != 'release':
build_subdir += '-' + env['build']
if env['debug']:
build_subdir += "-debug"
if env['profile']:
build_subdir += "-profile"
build_dir = os.path.join(build_topdir, build_subdir)
# Place the .sconsign file in the build dir too, to avoid issues with
# different scons versions building the same source file
env['build_dir'] = build_dir
env['build'] = build_dir
env.SConsignFile(os.path.join(build_dir, '.sconsign'))
if 'SCONS_CACHE_DIR' in os.environ:
print 'scons: Using build cache in %s.' % (os.environ['SCONS_CACHE_DIR'],)
@@ -236,16 +163,13 @@ def generate(env):
if env.GetOption('num_jobs') <= 1:
env.SetOption('num_jobs', num_jobs())
env.Decider('MD5-timestamp')
env.SetOption('max_drift', 60)
# C preprocessor options
cppdefines = []
if env['build'] in ('debug', 'checked'):
if debug:
cppdefines += ['DEBUG']
else:
cppdefines += ['NDEBUG']
if env['build'] == 'profile':
if env['profile']:
cppdefines += ['PROFILE']
if platform == 'windows':
cppdefines += [
@@ -266,7 +190,7 @@ def generate(env):
'_SCL_SECURE_NO_WARNINGS',
'_SCL_SECURE_NO_DEPRECATE',
]
if env['build'] in ('debug', 'checked'):
if debug:
cppdefines += ['_DEBUG']
if env['toolchain'] == 'winddk':
# Mimic WINDDK's builtin flags. See also:
@@ -293,7 +217,7 @@ def generate(env):
('__BUILDMACHINE__', 'WinDDK'),
('FPO', '0'),
]
if env['build'] in ('debug', 'checked'):
if debug:
cppdefines += [('DBG', 1)]
if platform == 'wince':
cppdefines += [
@@ -329,16 +253,15 @@ def generate(env):
ccflags = [] # C & C++
if gcc:
ccversion = env['CCVERSION']
if env['build'] == 'debug':
ccflags += ['-O0']
if debug:
ccflags += ['-O0', '-g3']
elif ccversion.startswith('4.2.'):
# gcc 4.2.x optimizer is broken
print "warning: gcc 4.2.x optimizer is broken -- disabling optimizations"
ccflags += ['-O0']
ccflags += ['-O0', '-g3']
else:
ccflags += ['-O3']
ccflags += ['-g3']
if env['build'] in ('checked', 'profile'):
ccflags += ['-O3', '-g3']
if env['profile']:
# See http://code.google.com/p/jrfonseca/wiki/Gprof2Dot#Which_options_should_I_pass_to_gcc_when_compiling_for_profiling?
ccflags += [
'-fno-omit-frame-pointer',
@@ -397,7 +320,7 @@ def generate(env):
# See also:
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
# - cl /?
if env['build'] == 'debug':
if debug:
ccflags += [
'/Od', # disable optimizations
'/Oi', # enable intrinsic functions
@@ -466,7 +389,7 @@ def generate(env):
if env['platform'] == 'windows' and msvc:
# Choose the appropriate MSVC CRT
# http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
if env['build'] in ('debug', 'checked'):
if env['debug']:
env.Append(CCFLAGS = ['/MTd'])
env.Append(SHCCFLAGS = ['/LDd'])
else:
@@ -498,7 +421,7 @@ def generate(env):
else:
env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
if msvc:
if env['build'] != 'debug':
if not env['debug']:
# enable Link-time Code Generation
linkflags += ['/LTCG']
env.Append(ARFLAGS = ['/LTCG'])
@@ -537,7 +460,7 @@ def generate(env):
'/entry:DrvEnableDriver',
]
if env['build'] != 'release':
if env['debug'] or env['profile']:
linkflags += [
'/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
]
@@ -554,19 +477,9 @@ def generate(env):
# Default libs
env.Append(LIBS = [])
# Load tools
# Load LLVM
if env['llvm']:
env.Tool('llvm')
env.Tool('udis86')
pkg_config_modules(env, 'x11', ['x11', 'xext'])
pkg_config_modules(env, 'drm', ['libdrm'])
pkg_config_modules(env, 'drm_intel', ['libdrm_intel'])
pkg_config_modules(env, 'drm_radeon', ['libdrm_radeon'])
pkg_config_modules(env, 'xorg', ['xorg-server'])
pkg_config_modules(env, 'kms', ['libkms'])
env['dri'] = env['x11'] and env['drm']
# Custom builders and methods
env.Tool('custom')

View File

@@ -38,8 +38,6 @@ import SCons.Util
def generate(env):
env['llvm'] = False
try:
llvm_dir = os.environ['LLVM']
except KeyError:
@@ -66,13 +64,13 @@ def generate(env):
# XXX: There is no llvm-config on Windows, so assume a standard layout
if llvm_dir is None:
print 'scons: LLVM environment variable must be specified when building for windows'
return
env.Exit(1)
# Try to determine the LLVM version from llvm/Config/config.h
llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
if not os.path.exists(llvm_config):
print 'scons: could not find %s' % llvm_config
return
env.Exit(1)
llvm_version_re = re.compile(r'^#define PACKAGE_VERSION "([^"]*)"')
llvm_version = None
for line in open(llvm_config, 'rt'):
@@ -83,7 +81,7 @@ def generate(env):
break
if llvm_version is None:
print 'scons: could not determine the LLVM version from %s' % llvm_config
return
env.Exit(1)
env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
env.AppendUnique(CPPDEFINES = [
@@ -126,7 +124,7 @@ def generate(env):
# Some of the LLVM C headers use the inline keyword without
# defining it.
env.Append(CPPDEFINES = [('inline', '__inline')])
if env['build'] in ('debug', 'checked'):
if env['debug']:
# LLVM libraries are static, build with /MT, and they
# automatically link agains LIBCMT. When we're doing a
# debug build we'll be linking against LIBCMTD, so disable
@@ -135,7 +133,7 @@ def generate(env):
else:
if not env.Detect('llvm-config'):
print 'scons: llvm-config script not found' % llvm_version
return
env.Exit(1)
llvm_version = env.backtick('llvm-config --version').rstrip()
llvm_version = distutils.version.LooseVersion(llvm_version)
@@ -146,12 +144,11 @@ def generate(env):
env.ParseConfig('llvm-config --ldflags')
except OSError:
print 'scons: llvm-config version %s failed' % llvm_version
return
env.Exit(1)
else:
env['LINK'] = env['CXX']
assert llvm_version is not None
env['llvm'] = True
print 'scons: Found LLVM version %s' % llvm_version
env['LLVM_VERSION'] = llvm_version

View File

@@ -31,10 +31,8 @@ def generate(env):
conf = env.Configure()
if conf.CheckHeader('udis86.h'): # and conf.CheckLib('udis86'):
env['UDIS86'] = True
env.Append(CPPDEFINES = [('HAVE_UDIS86', '1')])
env.Prepend(LIBS = ['udis86'])
else:
env['UDIS86'] = False
conf.Finish()

View File

@@ -122,7 +122,7 @@ def get_wce600_paths(env):
host_cpu = os.environ.get('_HOSTCPUTYPE', 'i386')
target_cpu = os.environ.get('_TGTCPU', 'x86')
if env['build'] == 'debug':
if env['debug']:
build = 'debug'
else:
build = 'retail'

View File

@@ -1,17 +1,19 @@
Import('*')
SConscript('mapi/vgapi/SConscript')
if env['platform'] == 'windows':
if 'egl' in env['statetrackers']:
SConscript('mapi/vgapi/SConscript')
SConscript('egl/main/SConscript')
SConscript('talloc/SConscript')
SConscript('glsl/SConscript')
SConscript('mapi/glapi/SConscript')
SConscript('mesa/SConscript')
if 'mesa' in env['statetrackers']:
if platform == 'windows':
SConscript('talloc/SConscript')
if env['platform'] != 'embedded':
SConscript('glut/glx/SConscript')
SConscript('glsl/SConscript')
SConscript('mapi/glapi/SConscript')
SConscript('mesa/SConscript')
if platform != 'embedded':
SConscript('glut/glx/SConscript')
SConscript('gallium/SConscript')

View File

@@ -24,8 +24,8 @@ $(EGL_DRIVER_PATH): $(EGL_DRIVER)
$(EGL_DRIVER): $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
@$(MKLIB) -o $(EGL_DRIVER) -noprefix \
-linker '$(CC)' -ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
$(MKLIB_OPTIONS) \
-linker '$(CC)' -ldflags '$(LDFLAGS)' \
-L$(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
$(EGL_OBJECTS) $(EGL_LIBS) -l$(EGL_LIB)
.c.o:

View File

@@ -248,20 +248,21 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
if (double_buffer)
return NULL;
if (depth > 0 && depth != base.BufferSize)
if (depth > 0 && depth != _eglGetConfigKey(&base, EGL_BUFFER_SIZE))
return NULL;
base.NativeRenderable = EGL_TRUE;
_eglSetConfigKey(&base, EGL_NATIVE_RENDERABLE, EGL_TRUE);
base.SurfaceType = surface_type;
_eglSetConfigKey(&base, EGL_SURFACE_TYPE, surface_type);
if (surface_type & (EGL_PIXMAP_BIT | EGL_PBUFFER_BIT)) {
base.BindToTextureRGB = bind_to_texture_rgb;
if (base.AlphaSize > 0)
base.BindToTextureRGBA = bind_to_texture_rgba;
_eglSetConfigKey(&base, EGL_BIND_TO_TEXTURE_RGB, bind_to_texture_rgb);
if (_eglGetConfigKey(&base, EGL_ALPHA_SIZE) > 0)
_eglSetConfigKey(&base,
EGL_BIND_TO_TEXTURE_RGBA, bind_to_texture_rgba);
}
base.RenderableType = disp->ClientAPIsMask;
base.Conformant = disp->ClientAPIsMask;
_eglSetConfigKey(&base, EGL_RENDERABLE_TYPE, disp->ClientAPIsMask);
_eglSetConfigKey(&base, EGL_CONFORMANT, disp->ClientAPIsMask);
if (!_eglValidateConfig(&base, EGL_FALSE)) {
_eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id);
@@ -272,7 +273,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
if (conf != NULL) {
memcpy(&conf->base, &base, sizeof base);
conf->dri_config = dri_config;
_eglLinkConfig(&conf->base);
_eglAddConfig(disp, &conf->base);
}
return conf;
@@ -291,7 +292,7 @@ dri2_process_buffers(struct dri2_egl_surface *dri2_surf,
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
xcb_rectangle_t rectangle;
unsigned i;
int i;
dri2_surf->buffer_count = count;
dri2_surf->have_fake_front = 0;
@@ -338,8 +339,6 @@ dri2_get_buffers(__DRIdrawable * driDrawable,
xcb_dri2_get_buffers_reply_t *reply;
xcb_dri2_get_buffers_cookie_t cookie;
(void) driDrawable;
cookie = xcb_dri2_get_buffers_unchecked (dri2_dpy->conn,
dri2_surf->drawable,
count, count, attachments);
@@ -361,16 +360,12 @@ dri2_get_buffers(__DRIdrawable * driDrawable,
static void
dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
{
(void) driDrawable;
/* FIXME: Does EGL support front buffer rendering at all? */
#if 0
struct dri2_egl_surface *dri2_surf = loaderPrivate;
dri2WaitGL(dri2_surf);
#else
(void) loaderPrivate;
#endif
}
@@ -381,8 +376,6 @@ dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data)
struct dri2_egl_image *dri2_img;
_EGLImage *img;
(void) screen;
img = _eglLookupImage(image, disp);
if (img == NULL) {
_eglError(EGL_BAD_PARAMETER, "dri2_lookup_egl_image");
@@ -413,8 +406,6 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
xcb_dri2_get_buffers_with_format_cookie_t cookie;
xcb_dri2_attach_format_t *format_attachments;
(void) driDrawable;
format_attachments = (xcb_dri2_attach_format_t *) attachments;
cookie = xcb_dri2_get_buffers_with_format_unchecked (dri2_dpy->conn,
dri2_surf->drawable,
@@ -448,14 +439,14 @@ struct dri2_extension_match {
static struct dri2_extension_match dri2_driver_extensions[] = {
{ __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) },
{ __DRI_DRI2, 1, offsetof(struct dri2_egl_display, dri2) },
{ NULL, 0, 0 }
{ NULL }
};
static struct dri2_extension_match dri2_core_extensions[] = {
{ __DRI2_FLUSH, 1, offsetof(struct dri2_egl_display, flush) },
{ __DRI_TEX_BUFFER, 2, offsetof(struct dri2_egl_display, tex_buffer) },
{ __DRI_IMAGE, 1, offsetof(struct dri2_egl_display, image) },
{ NULL, 0, 0 }
{ NULL }
};
static EGLBoolean
@@ -750,7 +741,7 @@ dri2_create_screen(_EGLDisplay *disp)
if (dri2_dpy->dri2->base.version >= 2)
api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen);
else
api_mask = 1 << __DRI_API_OPENGL;
api_mask = __DRI_API_OPENGL;
disp->ClientAPIsMask = 0;
if (api_mask & (1 <<__DRI_API_OPENGL))
@@ -780,8 +771,6 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp,
{
struct dri2_egl_display *dri2_dpy;
(void) drv;
dri2_dpy = malloc(sizeof *dri2_dpy);
if (!dri2_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
@@ -899,20 +888,10 @@ const int i915_chip_ids[] = {
0x29b2, /* PCI_CHIP_Q35_G */
0x29c2, /* PCI_CHIP_G33_G */
0x29d2, /* PCI_CHIP_Q33_G */
0xa001, /* PCI_CHIP_IGD_G */
0xa011, /* Pineview */
};
const int i965_chip_ids[] = {
0x0042, /* PCI_CHIP_ILD_G */
0x0046, /* PCI_CHIP_ILM_G */
0x0102, /* PCI_CHIP_SANDYBRIDGE_GT1 */
0x0106, /* PCI_CHIP_SANDYBRIDGE_M_GT1 */
0x010a, /* PCI_CHIP_SANDYBRIDGE_S */
0x0112, /* PCI_CHIP_SANDYBRIDGE_GT2 */
0x0116, /* PCI_CHIP_SANDYBRIDGE_M_GT2 */
0x0122, /* PCI_CHIP_SANDYBRIDGE_GT2_PLUS */
0x0126, /* PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS */
0x29a2, /* PCI_CHIP_I965_G */
0x2992, /* PCI_CHIP_I965_Q */
0x2982, /* PCI_CHIP_I965_G_1 */
@@ -924,440 +903,11 @@ const int i965_chip_ids[] = {
0x2e12, /* PCI_CHIP_Q45_G */
0x2e22, /* PCI_CHIP_G45_G */
0x2e32, /* PCI_CHIP_G41_G */
0x2e42, /* PCI_CHIP_B43_G */
0x2e92, /* PCI_CHIP_B43_G1 */
};
const int r100_chip_ids[] = {
0x4C57, /* PCI_CHIP_RADEON_LW */
0x4C58, /* PCI_CHIP_RADEON_LX */
0x4C59, /* PCI_CHIP_RADEON_LY */
0x4C5A, /* PCI_CHIP_RADEON_LZ */
0x5144, /* PCI_CHIP_RADEON_QD */
0x5145, /* PCI_CHIP_RADEON_QE */
0x5146, /* PCI_CHIP_RADEON_QF */
0x5147, /* PCI_CHIP_RADEON_QG */
0x5159, /* PCI_CHIP_RADEON_QY */
0x515A, /* PCI_CHIP_RADEON_QZ */
0x5157, /* PCI_CHIP_RV200_QW */
0x5158, /* PCI_CHIP_RV200_QX */
0x515E, /* PCI_CHIP_RN50_515E */
0x5969, /* PCI_CHIP_RN50_5969 */
0x4136, /* PCI_CHIP_RS100_4136 */
0x4336, /* PCI_CHIP_RS100_4336 */
0x4137, /* PCI_CHIP_RS200_4137 */
0x4337, /* PCI_CHIP_RS200_4337 */
0x4237, /* PCI_CHIP_RS250_4237 */
0x4437, /* PCI_CHIP_RS250_4437 */
};
const int r200_chip_ids[] = {
0x5148, /* PCI_CHIP_R200_QH */
0x514C, /* PCI_CHIP_R200_QL */
0x514D, /* PCI_CHIP_R200_QM */
0x4242, /* PCI_CHIP_R200_BB */
0x4243, /* PCI_CHIP_R200_BC */
0x4966, /* PCI_CHIP_RV250_If */
0x4967, /* PCI_CHIP_RV250_Ig */
0x4C64, /* PCI_CHIP_RV250_Ld */
0x4C66, /* PCI_CHIP_RV250_Lf */
0x4C67, /* PCI_CHIP_RV250_Lg */
0x5960, /* PCI_CHIP_RV280_5960 */
0x5961, /* PCI_CHIP_RV280_5961 */
0x5962, /* PCI_CHIP_RV280_5962 */
0x5964, /* PCI_CHIP_RV280_5964 */
0x5965, /* PCI_CHIP_RV280_5965 */
0x5C61, /* PCI_CHIP_RV280_5C61 */
0x5C63, /* PCI_CHIP_RV280_5C63 */
0x5834, /* PCI_CHIP_RS300_5834 */
0x5835, /* PCI_CHIP_RS300_5835 */
0x7834, /* PCI_CHIP_RS350_7834 */
0x7835, /* PCI_CHIP_RS350_7835 */
};
const int r300_chip_ids[] = {
0x4144, /* PCI_CHIP_R300_AD */
0x4145, /* PCI_CHIP_R300_AE */
0x4146, /* PCI_CHIP_R300_AF */
0x4147, /* PCI_CHIP_R300_AG */
0x4E44, /* PCI_CHIP_R300_ND */
0x4E45, /* PCI_CHIP_R300_NE */
0x4E46, /* PCI_CHIP_R300_NF */
0x4E47, /* PCI_CHIP_R300_NG */
0x4E48, /* PCI_CHIP_R350_NH */
0x4E49, /* PCI_CHIP_R350_NI */
0x4E4B, /* PCI_CHIP_R350_NK */
0x4148, /* PCI_CHIP_R350_AH */
0x4149, /* PCI_CHIP_R350_AI */
0x414A, /* PCI_CHIP_R350_AJ */
0x414B, /* PCI_CHIP_R350_AK */
0x4E4A, /* PCI_CHIP_R360_NJ */
0x4150, /* PCI_CHIP_RV350_AP */
0x4151, /* PCI_CHIP_RV350_AQ */
0x4152, /* PCI_CHIP_RV350_AR */
0x4153, /* PCI_CHIP_RV350_AS */
0x4154, /* PCI_CHIP_RV350_AT */
0x4155, /* PCI_CHIP_RV350_AU */
0x4156, /* PCI_CHIP_RV350_AV */
0x4E50, /* PCI_CHIP_RV350_NP */
0x4E51, /* PCI_CHIP_RV350_NQ */
0x4E52, /* PCI_CHIP_RV350_NR */
0x4E53, /* PCI_CHIP_RV350_NS */
0x4E54, /* PCI_CHIP_RV350_NT */
0x4E56, /* PCI_CHIP_RV350_NV */
0x5460, /* PCI_CHIP_RV370_5460 */
0x5462, /* PCI_CHIP_RV370_5462 */
0x5464, /* PCI_CHIP_RV370_5464 */
0x5B60, /* PCI_CHIP_RV370_5B60 */
0x5B62, /* PCI_CHIP_RV370_5B62 */
0x5B63, /* PCI_CHIP_RV370_5B63 */
0x5B64, /* PCI_CHIP_RV370_5B64 */
0x5B65, /* PCI_CHIP_RV370_5B65 */
0x3150, /* PCI_CHIP_RV380_3150 */
0x3152, /* PCI_CHIP_RV380_3152 */
0x3154, /* PCI_CHIP_RV380_3154 */
0x3155, /* PCI_CHIP_RV380_3155 */
0x3E50, /* PCI_CHIP_RV380_3E50 */
0x3E54, /* PCI_CHIP_RV380_3E54 */
0x4A48, /* PCI_CHIP_R420_JH */
0x4A49, /* PCI_CHIP_R420_JI */
0x4A4A, /* PCI_CHIP_R420_JJ */
0x4A4B, /* PCI_CHIP_R420_JK */
0x4A4C, /* PCI_CHIP_R420_JL */
0x4A4D, /* PCI_CHIP_R420_JM */
0x4A4E, /* PCI_CHIP_R420_JN */
0x4A4F, /* PCI_CHIP_R420_JO */
0x4A50, /* PCI_CHIP_R420_JP */
0x4A54, /* PCI_CHIP_R420_JT */
0x5548, /* PCI_CHIP_R423_UH */
0x5549, /* PCI_CHIP_R423_UI */
0x554A, /* PCI_CHIP_R423_UJ */
0x554B, /* PCI_CHIP_R423_UK */
0x5550, /* PCI_CHIP_R423_5550 */
0x5551, /* PCI_CHIP_R423_UQ */
0x5552, /* PCI_CHIP_R423_UR */
0x5554, /* PCI_CHIP_R423_UT */
0x5D57, /* PCI_CHIP_R423_5D57 */
0x554C, /* PCI_CHIP_R430_554C */
0x554D, /* PCI_CHIP_R430_554D */
0x554E, /* PCI_CHIP_R430_554E */
0x554F, /* PCI_CHIP_R430_554F */
0x5D48, /* PCI_CHIP_R430_5D48 */
0x5D49, /* PCI_CHIP_R430_5D49 */
0x5D4A, /* PCI_CHIP_R430_5D4A */
0x5D4C, /* PCI_CHIP_R480_5D4C */
0x5D4D, /* PCI_CHIP_R480_5D4D */
0x5D4E, /* PCI_CHIP_R480_5D4E */
0x5D4F, /* PCI_CHIP_R480_5D4F */
0x5D50, /* PCI_CHIP_R480_5D50 */
0x5D52, /* PCI_CHIP_R480_5D52 */
0x4B49, /* PCI_CHIP_R481_4B49 */
0x4B4A, /* PCI_CHIP_R481_4B4A */
0x4B4B, /* PCI_CHIP_R481_4B4B */
0x4B4C, /* PCI_CHIP_R481_4B4C */
0x564A, /* PCI_CHIP_RV410_564A */
0x564B, /* PCI_CHIP_RV410_564B */
0x564F, /* PCI_CHIP_RV410_564F */
0x5652, /* PCI_CHIP_RV410_5652 */
0x5653, /* PCI_CHIP_RV410_5653 */
0x5657, /* PCI_CHIP_RV410_5657 */
0x5E48, /* PCI_CHIP_RV410_5E48 */
0x5E4A, /* PCI_CHIP_RV410_5E4A */
0x5E4B, /* PCI_CHIP_RV410_5E4B */
0x5E4C, /* PCI_CHIP_RV410_5E4C */
0x5E4D, /* PCI_CHIP_RV410_5E4D */
0x5E4F, /* PCI_CHIP_RV410_5E4F */
0x5A41, /* PCI_CHIP_RS400_5A41 */
0x5A42, /* PCI_CHIP_RS400_5A42 */
0x5A61, /* PCI_CHIP_RC410_5A61 */
0x5A62, /* PCI_CHIP_RC410_5A62 */
0x5954, /* PCI_CHIP_RS480_5954 */
0x5955, /* PCI_CHIP_RS480_5955 */
0x5974, /* PCI_CHIP_RS482_5974 */
0x5975, /* PCI_CHIP_RS482_5975 */
0x7100, /* PCI_CHIP_R520_7100 */
0x7101, /* PCI_CHIP_R520_7101 */
0x7102, /* PCI_CHIP_R520_7102 */
0x7103, /* PCI_CHIP_R520_7103 */
0x7104, /* PCI_CHIP_R520_7104 */
0x7105, /* PCI_CHIP_R520_7105 */
0x7106, /* PCI_CHIP_R520_7106 */
0x7108, /* PCI_CHIP_R520_7108 */
0x7109, /* PCI_CHIP_R520_7109 */
0x710A, /* PCI_CHIP_R520_710A */
0x710B, /* PCI_CHIP_R520_710B */
0x710C, /* PCI_CHIP_R520_710C */
0x710E, /* PCI_CHIP_R520_710E */
0x710F, /* PCI_CHIP_R520_710F */
0x7140, /* PCI_CHIP_RV515_7140 */
0x7141, /* PCI_CHIP_RV515_7141 */
0x7142, /* PCI_CHIP_RV515_7142 */
0x7143, /* PCI_CHIP_RV515_7143 */
0x7144, /* PCI_CHIP_RV515_7144 */
0x7145, /* PCI_CHIP_RV515_7145 */
0x7146, /* PCI_CHIP_RV515_7146 */
0x7147, /* PCI_CHIP_RV515_7147 */
0x7149, /* PCI_CHIP_RV515_7149 */
0x714A, /* PCI_CHIP_RV515_714A */
0x714B, /* PCI_CHIP_RV515_714B */
0x714C, /* PCI_CHIP_RV515_714C */
0x714D, /* PCI_CHIP_RV515_714D */
0x714E, /* PCI_CHIP_RV515_714E */
0x714F, /* PCI_CHIP_RV515_714F */
0x7151, /* PCI_CHIP_RV515_7151 */
0x7152, /* PCI_CHIP_RV515_7152 */
0x7153, /* PCI_CHIP_RV515_7153 */
0x715E, /* PCI_CHIP_RV515_715E */
0x715F, /* PCI_CHIP_RV515_715F */
0x7180, /* PCI_CHIP_RV515_7180 */
0x7181, /* PCI_CHIP_RV515_7181 */
0x7183, /* PCI_CHIP_RV515_7183 */
0x7186, /* PCI_CHIP_RV515_7186 */
0x7187, /* PCI_CHIP_RV515_7187 */
0x7188, /* PCI_CHIP_RV515_7188 */
0x718A, /* PCI_CHIP_RV515_718A */
0x718B, /* PCI_CHIP_RV515_718B */
0x718C, /* PCI_CHIP_RV515_718C */
0x718D, /* PCI_CHIP_RV515_718D */
0x718F, /* PCI_CHIP_RV515_718F */
0x7193, /* PCI_CHIP_RV515_7193 */
0x7196, /* PCI_CHIP_RV515_7196 */
0x719B, /* PCI_CHIP_RV515_719B */
0x719F, /* PCI_CHIP_RV515_719F */
0x7200, /* PCI_CHIP_RV515_7200 */
0x7210, /* PCI_CHIP_RV515_7210 */
0x7211, /* PCI_CHIP_RV515_7211 */
0x71C0, /* PCI_CHIP_RV530_71C0 */
0x71C1, /* PCI_CHIP_RV530_71C1 */
0x71C2, /* PCI_CHIP_RV530_71C2 */
0x71C3, /* PCI_CHIP_RV530_71C3 */
0x71C4, /* PCI_CHIP_RV530_71C4 */
0x71C5, /* PCI_CHIP_RV530_71C5 */
0x71C6, /* PCI_CHIP_RV530_71C6 */
0x71C7, /* PCI_CHIP_RV530_71C7 */
0x71CD, /* PCI_CHIP_RV530_71CD */
0x71CE, /* PCI_CHIP_RV530_71CE */
0x71D2, /* PCI_CHIP_RV530_71D2 */
0x71D4, /* PCI_CHIP_RV530_71D4 */
0x71D5, /* PCI_CHIP_RV530_71D5 */
0x71D6, /* PCI_CHIP_RV530_71D6 */
0x71DA, /* PCI_CHIP_RV530_71DA */
0x71DE, /* PCI_CHIP_RV530_71DE */
0x7281, /* PCI_CHIP_RV560_7281 */
0x7283, /* PCI_CHIP_RV560_7283 */
0x7287, /* PCI_CHIP_RV560_7287 */
0x7290, /* PCI_CHIP_RV560_7290 */
0x7291, /* PCI_CHIP_RV560_7291 */
0x7293, /* PCI_CHIP_RV560_7293 */
0x7297, /* PCI_CHIP_RV560_7297 */
0x7280, /* PCI_CHIP_RV570_7280 */
0x7288, /* PCI_CHIP_RV570_7288 */
0x7289, /* PCI_CHIP_RV570_7289 */
0x728B, /* PCI_CHIP_RV570_728B */
0x728C, /* PCI_CHIP_RV570_728C */
0x7240, /* PCI_CHIP_R580_7240 */
0x7243, /* PCI_CHIP_R580_7243 */
0x7244, /* PCI_CHIP_R580_7244 */
0x7245, /* PCI_CHIP_R580_7245 */
0x7246, /* PCI_CHIP_R580_7246 */
0x7247, /* PCI_CHIP_R580_7247 */
0x7248, /* PCI_CHIP_R580_7248 */
0x7249, /* PCI_CHIP_R580_7249 */
0x724A, /* PCI_CHIP_R580_724A */
0x724B, /* PCI_CHIP_R580_724B */
0x724C, /* PCI_CHIP_R580_724C */
0x724D, /* PCI_CHIP_R580_724D */
0x724E, /* PCI_CHIP_R580_724E */
0x724F, /* PCI_CHIP_R580_724F */
0x7284, /* PCI_CHIP_R580_7284 */
0x793F, /* PCI_CHIP_RS600_793F */
0x7941, /* PCI_CHIP_RS600_7941 */
0x7942, /* PCI_CHIP_RS600_7942 */
0x791E, /* PCI_CHIP_RS690_791E */
0x791F, /* PCI_CHIP_RS690_791F */
0x796C, /* PCI_CHIP_RS740_796C */
0x796D, /* PCI_CHIP_RS740_796D */
0x796E, /* PCI_CHIP_RS740_796E */
0x796F, /* PCI_CHIP_RS740_796F */
};
const int r600_chip_ids[] = {
0x9400, /* PCI_CHIP_R600_9400 */
0x9401, /* PCI_CHIP_R600_9401 */
0x9402, /* PCI_CHIP_R600_9402 */
0x9403, /* PCI_CHIP_R600_9403 */
0x9405, /* PCI_CHIP_R600_9405 */
0x940A, /* PCI_CHIP_R600_940A */
0x940B, /* PCI_CHIP_R600_940B */
0x940F, /* PCI_CHIP_R600_940F */
0x94C0, /* PCI_CHIP_RV610_94C0 */
0x94C1, /* PCI_CHIP_RV610_94C1 */
0x94C3, /* PCI_CHIP_RV610_94C3 */
0x94C4, /* PCI_CHIP_RV610_94C4 */
0x94C5, /* PCI_CHIP_RV610_94C5 */
0x94C6, /* PCI_CHIP_RV610_94C6 */
0x94C7, /* PCI_CHIP_RV610_94C7 */
0x94C8, /* PCI_CHIP_RV610_94C8 */
0x94C9, /* PCI_CHIP_RV610_94C9 */
0x94CB, /* PCI_CHIP_RV610_94CB */
0x94CC, /* PCI_CHIP_RV610_94CC */
0x94CD, /* PCI_CHIP_RV610_94CD */
0x9580, /* PCI_CHIP_RV630_9580 */
0x9581, /* PCI_CHIP_RV630_9581 */
0x9583, /* PCI_CHIP_RV630_9583 */
0x9586, /* PCI_CHIP_RV630_9586 */
0x9587, /* PCI_CHIP_RV630_9587 */
0x9588, /* PCI_CHIP_RV630_9588 */
0x9589, /* PCI_CHIP_RV630_9589 */
0x958A, /* PCI_CHIP_RV630_958A */
0x958B, /* PCI_CHIP_RV630_958B */
0x958C, /* PCI_CHIP_RV630_958C */
0x958D, /* PCI_CHIP_RV630_958D */
0x958E, /* PCI_CHIP_RV630_958E */
0x958F, /* PCI_CHIP_RV630_958F */
0x9500, /* PCI_CHIP_RV670_9500 */
0x9501, /* PCI_CHIP_RV670_9501 */
0x9504, /* PCI_CHIP_RV670_9504 */
0x9505, /* PCI_CHIP_RV670_9505 */
0x9506, /* PCI_CHIP_RV670_9506 */
0x9507, /* PCI_CHIP_RV670_9507 */
0x9508, /* PCI_CHIP_RV670_9508 */
0x9509, /* PCI_CHIP_RV670_9509 */
0x950F, /* PCI_CHIP_RV670_950F */
0x9511, /* PCI_CHIP_RV670_9511 */
0x9515, /* PCI_CHIP_RV670_9515 */
0x9517, /* PCI_CHIP_RV670_9517 */
0x9519, /* PCI_CHIP_RV670_9519 */
0x95C0, /* PCI_CHIP_RV620_95C0 */
0x95C2, /* PCI_CHIP_RV620_95C2 */
0x95C4, /* PCI_CHIP_RV620_95C4 */
0x95C5, /* PCI_CHIP_RV620_95C5 */
0x95C6, /* PCI_CHIP_RV620_95C6 */
0x95C7, /* PCI_CHIP_RV620_95C7 */
0x95C9, /* PCI_CHIP_RV620_95C9 */
0x95CC, /* PCI_CHIP_RV620_95CC */
0x95CD, /* PCI_CHIP_RV620_95CD */
0x95CE, /* PCI_CHIP_RV620_95CE */
0x95CF, /* PCI_CHIP_RV620_95CF */
0x9590, /* PCI_CHIP_RV635_9590 */
0x9591, /* PCI_CHIP_RV635_9591 */
0x9593, /* PCI_CHIP_RV635_9593 */
0x9595, /* PCI_CHIP_RV635_9595 */
0x9596, /* PCI_CHIP_RV635_9596 */
0x9597, /* PCI_CHIP_RV635_9597 */
0x9598, /* PCI_CHIP_RV635_9598 */
0x9599, /* PCI_CHIP_RV635_9599 */
0x959B, /* PCI_CHIP_RV635_959B */
0x9610, /* PCI_CHIP_RS780_9610 */
0x9611, /* PCI_CHIP_RS780_9611 */
0x9612, /* PCI_CHIP_RS780_9612 */
0x9613, /* PCI_CHIP_RS780_9613 */
0x9614, /* PCI_CHIP_RS780_9614 */
0x9615, /* PCI_CHIP_RS780_9615 */
0x9616, /* PCI_CHIP_RS780_9616 */
0x9710, /* PCI_CHIP_RS880_9710 */
0x9711, /* PCI_CHIP_RS880_9711 */
0x9712, /* PCI_CHIP_RS880_9712 */
0x9713, /* PCI_CHIP_RS880_9713 */
0x9714, /* PCI_CHIP_RS880_9714 */
0x9715, /* PCI_CHIP_RS880_9715 */
0x9440, /* PCI_CHIP_RV770_9440 */
0x9441, /* PCI_CHIP_RV770_9441 */
0x9442, /* PCI_CHIP_RV770_9442 */
0x9443, /* PCI_CHIP_RV770_9443 */
0x9444, /* PCI_CHIP_RV770_9444 */
0x9446, /* PCI_CHIP_RV770_9446 */
0x944A, /* PCI_CHIP_RV770_944A */
0x944B, /* PCI_CHIP_RV770_944B */
0x944C, /* PCI_CHIP_RV770_944C */
0x944E, /* PCI_CHIP_RV770_944E */
0x9450, /* PCI_CHIP_RV770_9450 */
0x9452, /* PCI_CHIP_RV770_9452 */
0x9456, /* PCI_CHIP_RV770_9456 */
0x945A, /* PCI_CHIP_RV770_945A */
0x945B, /* PCI_CHIP_RV770_945B */
0x945E, /* PCI_CHIP_RV770_945E */
0x9460, /* PCI_CHIP_RV790_9460 */
0x9462, /* PCI_CHIP_RV790_9462 */
0x946A, /* PCI_CHIP_RV770_946A */
0x946B, /* PCI_CHIP_RV770_946B */
0x947A, /* PCI_CHIP_RV770_947A */
0x947B, /* PCI_CHIP_RV770_947B */
0x9480, /* PCI_CHIP_RV730_9480 */
0x9487, /* PCI_CHIP_RV730_9487 */
0x9488, /* PCI_CHIP_RV730_9488 */
0x9489, /* PCI_CHIP_RV730_9489 */
0x948A, /* PCI_CHIP_RV730_948A */
0x948F, /* PCI_CHIP_RV730_948F */
0x9490, /* PCI_CHIP_RV730_9490 */
0x9491, /* PCI_CHIP_RV730_9491 */
0x9495, /* PCI_CHIP_RV730_9495 */
0x9498, /* PCI_CHIP_RV730_9498 */
0x949C, /* PCI_CHIP_RV730_949C */
0x949E, /* PCI_CHIP_RV730_949E */
0x949F, /* PCI_CHIP_RV730_949F */
0x9540, /* PCI_CHIP_RV710_9540 */
0x9541, /* PCI_CHIP_RV710_9541 */
0x9542, /* PCI_CHIP_RV710_9542 */
0x954E, /* PCI_CHIP_RV710_954E */
0x954F, /* PCI_CHIP_RV710_954F */
0x9552, /* PCI_CHIP_RV710_9552 */
0x9553, /* PCI_CHIP_RV710_9553 */
0x9555, /* PCI_CHIP_RV710_9555 */
0x9557, /* PCI_CHIP_RV710_9557 */
0x955F, /* PCI_CHIP_RV710_955F */
0x94A0, /* PCI_CHIP_RV740_94A0 */
0x94A1, /* PCI_CHIP_RV740_94A1 */
0x94A3, /* PCI_CHIP_RV740_94A3 */
0x94B1, /* PCI_CHIP_RV740_94B1 */
0x94B3, /* PCI_CHIP_RV740_94B3 */
0x94B4, /* PCI_CHIP_RV740_94B4 */
0x94B5, /* PCI_CHIP_RV740_94B5 */
0x94B9, /* PCI_CHIP_RV740_94B9 */
0x68E0, /* PCI_CHIP_CEDAR_68E0 */
0x68E1, /* PCI_CHIP_CEDAR_68E1 */
0x68E4, /* PCI_CHIP_CEDAR_68E4 */
0x68E5, /* PCI_CHIP_CEDAR_68E5 */
0x68E8, /* PCI_CHIP_CEDAR_68E8 */
0x68E9, /* PCI_CHIP_CEDAR_68E9 */
0x68F1, /* PCI_CHIP_CEDAR_68F1 */
0x68F8, /* PCI_CHIP_CEDAR_68F8 */
0x68F9, /* PCI_CHIP_CEDAR_68F9 */
0x68FE, /* PCI_CHIP_CEDAR_68FE */
0x68C0, /* PCI_CHIP_REDWOOD_68C0 */
0x68C1, /* PCI_CHIP_REDWOOD_68C1 */
0x68C8, /* PCI_CHIP_REDWOOD_68C8 */
0x68C9, /* PCI_CHIP_REDWOOD_68C9 */
0x68D8, /* PCI_CHIP_REDWOOD_68D8 */
0x68D9, /* PCI_CHIP_REDWOOD_68D9 */
0x68DA, /* PCI_CHIP_REDWOOD_68DA */
0x68DE, /* PCI_CHIP_REDWOOD_68DE */
0x68A0, /* PCI_CHIP_JUNIPER_68A0 */
0x68A1, /* PCI_CHIP_JUNIPER_68A1 */
0x68A8, /* PCI_CHIP_JUNIPER_68A8 */
0x68A9, /* PCI_CHIP_JUNIPER_68A9 */
0x68B0, /* PCI_CHIP_JUNIPER_68B0 */
0x68B8, /* PCI_CHIP_JUNIPER_68B8 */
0x68B9, /* PCI_CHIP_JUNIPER_68B9 */
0x68BE, /* PCI_CHIP_JUNIPER_68BE */
0x6880, /* PCI_CHIP_CYPRESS_6880 */
0x6888, /* PCI_CHIP_CYPRESS_6888 */
0x6889, /* PCI_CHIP_CYPRESS_6889 */
0x688A, /* PCI_CHIP_CYPRESS_688A */
0x6898, /* PCI_CHIP_CYPRESS_6898 */
0x6899, /* PCI_CHIP_CYPRESS_6899 */
0x689E, /* PCI_CHIP_CYPRESS_689E */
0x689C, /* PCI_CHIP_HEMLOCK_689C */
0x689D, /* PCI_CHIP_HEMLOCK_689D */
};
const struct dri2_driver_map driver_map[] = {
{ 0x8086, "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) },
{ 0x8086, "i965", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) },
{ 0x1002, "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) },
{ 0x1002, "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) },
{ 0x1002, "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) },
{ 0x1002, "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) },
};
static char *
@@ -1524,8 +1074,6 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
const __DRIconfig *dri_config;
int api;
(void) drv;
dri2_ctx = malloc(sizeof *dri2_ctx);
if (!dri2_ctx) {
_eglError(EGL_BAD_ALLOC, "eglCreateContext");
@@ -1597,9 +1145,7 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
(void) drv;
if (!_eglPutSurface(surf))
if (_eglIsSurfaceBound(surf))
return EGL_TRUE;
(*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable);
@@ -1626,17 +1172,15 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
struct dri2_egl_surface *dri2_dsurf = dri2_egl_surface(dsurf);
struct dri2_egl_surface *dri2_rsurf = dri2_egl_surface(rsurf);
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
_EGLContext *old_ctx;
_EGLSurface *old_dsurf, *old_rsurf;
__DRIdrawable *ddraw, *rdraw;
__DRIcontext *cctx;
/* make new bindings */
if (!_eglBindContext(ctx, dsurf, rsurf, &old_ctx, &old_dsurf, &old_rsurf))
/* bind the new context and return the "orphaned" one */
if (!_eglBindContext(&ctx, &dsurf, &rsurf))
return EGL_FALSE;
/* flush before context switch */
if (old_ctx && dri2_drv->glFlush)
if (ctx && dri2_drv->glFlush)
dri2_drv->glFlush();
ddraw = (dri2_dsurf) ? dri2_dsurf->dri_drawable : NULL;
@@ -1645,33 +1189,16 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
if ((cctx == NULL && ddraw == NULL && rdraw == NULL) ||
dri2_dpy->core->bindContext(cctx, ddraw, rdraw)) {
dri2_destroy_surface(drv, disp, old_dsurf);
dri2_destroy_surface(drv, disp, old_rsurf);
if (old_ctx) {
/* unbind the old context only when there is no new context bound */
if (!ctx) {
__DRIcontext *old_cctx = dri2_egl_context(old_ctx)->dri_context;
dri2_dpy->core->unbindContext(old_cctx);
}
/* no destroy? */
_eglPutContext(old_ctx);
}
if (dsurf && !_eglIsSurfaceLinked(dsurf))
dri2_destroy_surface(drv, disp, dsurf);
if (rsurf && rsurf != dsurf && !_eglIsSurfaceLinked(dsurf))
dri2_destroy_surface(drv, disp, rsurf);
if (ctx != NULL && !_eglIsContextLinked(ctx))
dri2_dpy->core->unbindContext(dri2_egl_context(ctx)->dri_context);
return EGL_TRUE;
} else {
/* undo the previous _eglBindContext */
_eglBindContext(old_ctx, old_dsurf, old_rsurf, &ctx, &dsurf, &rsurf);
assert(&dri2_ctx->base == ctx &&
&dri2_dsurf->base == dsurf &&
&dri2_rsurf->base == rsurf);
_eglPutSurface(dsurf);
_eglPutSurface(rsurf);
_eglPutContext(ctx);
_eglPutSurface(old_dsurf);
_eglPutSurface(old_rsurf);
_eglPutContext(old_ctx);
_eglBindContext(&ctx, &dsurf, &rsurf);
return EGL_FALSE;
}
@@ -1693,8 +1220,6 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
xcb_screen_iterator_t s;
xcb_generic_error_t *error;
(void) drv;
dri2_surf = malloc(sizeof *dri2_surf);
if (!dri2_surf) {
_eglError(EGL_BAD_ALLOC, "dri2_create_surface");
@@ -1708,7 +1233,8 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
if (type == EGL_PBUFFER_BIT) {
dri2_surf->drawable = xcb_generate_id(dri2_dpy->conn);
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
xcb_create_pixmap(dri2_dpy->conn, conf->BufferSize,
xcb_create_pixmap(dri2_dpy->conn,
_eglGetConfigKey(conf, EGL_BUFFER_SIZE),
dri2_surf->drawable, s.data->root,
dri2_surf->base.Width, dri2_surf->base.Height);
} else {
@@ -1842,7 +1368,7 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
xcb_rectangle_t rectangles[16];
int i;
if (numRects > (int)ARRAY_SIZE(rectangles))
if (numRects > ARRAY_SIZE(rectangles))
return dri2_copy_region(drv, disp, draw, dri2_surf->region);
/* FIXME: Invert y here? */
@@ -1867,8 +1393,6 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
static _EGLProc
dri2_get_proc_address(_EGLDriver *drv, const char *procname)
{
(void) drv;
/* FIXME: Do we need to support lookup of EGL symbols too? */
return (_EGLProc) _glapi_get_proc_address(procname);
@@ -1880,8 +1404,6 @@ dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(ctx->DrawSurface);
(void) drv;
/* FIXME: If EGL allows frontbuffer rendering for window surfaces,
* we need to copy fake to real here.*/
@@ -1893,9 +1415,6 @@ dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
static EGLBoolean
dri2_wait_native(_EGLDriver *drv, _EGLDisplay *disp, EGLint engine)
{
(void) drv;
(void) disp;
if (engine != EGL_CORE_NATIVE_ENGINE)
return _eglError(EGL_BAD_PARAMETER, "eglWaitNative");
/* glXWaitX(); */
@@ -1918,8 +1437,6 @@ dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
xcb_gcontext_t gc;
(void) drv;
(*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
gc = xcb_generate_id(dri2_dpy->conn);
@@ -1983,11 +1500,6 @@ static EGLBoolean
dri2_release_tex_image(_EGLDriver *drv,
_EGLDisplay *disp, _EGLSurface *surf, EGLint buffer)
{
(void) drv;
(void) disp;
(void) surf;
(void) buffer;
return EGL_TRUE;
}
@@ -2007,8 +1519,6 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
xcb_generic_error_t *error;
int stride, format;
(void) ctx;
drawable = (xcb_drawable_t) buffer;
xcb_dri2_create_drawable (dri2_dpy->conn, drawable);
attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT;
@@ -2057,7 +1567,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
return EGL_NO_IMAGE_KHR;
}
if (!_eglInitImage(&dri2_img->base, disp)) {
if (!_eglInitImage(&dri2_img->base, disp, attr_list)) {
free(buffers_reply);
free(geometry_reply);
return EGL_NO_IMAGE_KHR;
@@ -2100,7 +1610,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx,
return EGL_NO_IMAGE_KHR;
}
if (!_eglInitImage(&dri2_img->base, disp))
if (!_eglInitImage(&dri2_img->base, disp, attr_list))
return EGL_NO_IMAGE_KHR;
dri2_img->dri_image =
@@ -2117,28 +1627,54 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_image *dri2_img;
EGLint format, name, pitch, err;
_EGLImageAttribs attrs;
(void) ctx;
EGLint width, height, format, name, stride, pitch, i, err;
name = (EGLint) buffer;
err = _eglParseImageAttribList(&attrs, disp, attr_list);
if (err != EGL_SUCCESS)
return NULL;
err = EGL_SUCCESS;
width = 0;
height = 0;
format = 0;
stride = 0;
if (attrs.Width <= 0 || attrs.Height <= 0 ||
attrs.DRMBufferStrideMESA <= 0) {
for (i = 0; attr_list[i] != EGL_NONE; i++) {
EGLint attr = attr_list[i++];
EGLint val = attr_list[i];
switch (attr) {
case EGL_WIDTH:
width = val;
break;
case EGL_HEIGHT:
height = val;
break;
case EGL_DRM_BUFFER_FORMAT_MESA:
format = val;
break;
case EGL_DRM_BUFFER_STRIDE_MESA:
stride = val;
break;
default:
err = EGL_BAD_ATTRIBUTE;
break;
}
if (err != EGL_SUCCESS) {
_eglLog(_EGL_WARNING, "bad image attribute 0x%04x", attr);
return NULL;
}
}
if (width <= 0 || height <= 0 || stride <= 0) {
_eglError(EGL_BAD_PARAMETER,
"bad width, height or stride");
return NULL;
}
switch (attrs.DRMBufferFormatMESA) {
switch (format) {
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
format = __DRI_IMAGE_FORMAT_ARGB8888;
pitch = attrs.DRMBufferStrideMESA;
pitch = stride;
break;
default:
_eglError(EGL_BAD_PARAMETER,
@@ -2152,15 +1688,15 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
return NULL;
}
if (!_eglInitImage(&dri2_img->base, disp)) {
if (!_eglInitImage(&dri2_img->base, disp, attr_list)) {
free(dri2_img);
return NULL;
}
dri2_img->dri_image =
dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
attrs.Width,
attrs.Height,
width,
height,
format,
name,
pitch,
@@ -2179,8 +1715,6 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
_EGLContext *ctx, EGLenum target,
EGLClientBuffer buffer, const EGLint *attr_list)
{
(void) drv;
switch (target) {
case EGL_NATIVE_PIXMAP_KHR:
return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list);
@@ -2200,8 +1734,6 @@ dri2_destroy_image_khr(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *image)
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_image *dri2_img = dri2_egl_image(image);
(void) drv;
dri2_dpy->image->destroyImage(dri2_img->dri_image);
free(dri2_img);
@@ -2214,13 +1746,10 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp,
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_image *dri2_img;
_EGLImageAttribs attrs;
unsigned int dri_use, valid_mask;
int format;
int width, height, format, i;
unsigned int use, dri_use, valid_mask;
EGLint err = EGL_SUCCESS;
(void) drv;
dri2_img = malloc(sizeof *dri2_img);
if (!dri2_img) {
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr");
@@ -2232,50 +1761,74 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp,
goto cleanup_img;
}
if (!_eglInitImage(&dri2_img->base, disp)) {
if (!_eglInitImage(&dri2_img->base, disp, attr_list)) {
err = EGL_BAD_PARAMETER;
goto cleanup_img;
}
err = _eglParseImageAttribList(&attrs, disp, attr_list);
if (err != EGL_SUCCESS)
goto cleanup_img;
width = 0;
height = 0;
format = 0;
use = 0;
for (i = 0; attr_list[i] != EGL_NONE; i++) {
EGLint attr = attr_list[i++];
EGLint val = attr_list[i];
if (attrs.Width <= 0 || attrs.Height <= 0) {
_eglLog(_EGL_WARNING, "bad width or height (%dx%d)",
attrs.Width, attrs.Height);
switch (attr) {
case EGL_WIDTH:
width = val;
break;
case EGL_HEIGHT:
height = val;
break;
case EGL_DRM_BUFFER_FORMAT_MESA:
format = val;
break;
case EGL_DRM_BUFFER_USE_MESA:
use = val;
break;
default:
err = EGL_BAD_ATTRIBUTE;
break;
}
if (err != EGL_SUCCESS) {
_eglLog(_EGL_WARNING, "bad image attribute 0x%04x", attr);
goto cleanup_img;
}
}
if (width <= 0 || height <= 0) {
_eglLog(_EGL_WARNING, "bad width or height (%dx%d)", width, height);
goto cleanup_img;
}
switch (attrs.DRMBufferFormatMESA) {
switch (format) {
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
format = __DRI_IMAGE_FORMAT_ARGB8888;
break;
default:
_eglLog(_EGL_WARNING, "bad image format value 0x%04x",
attrs.DRMBufferFormatMESA);
_eglLog(_EGL_WARNING, "bad image format value 0x%04x", format);
goto cleanup_img;
}
valid_mask =
EGL_DRM_BUFFER_USE_SCANOUT_MESA |
EGL_DRM_BUFFER_USE_SHARE_MESA;
if (attrs.DRMBufferUseMESA & ~valid_mask) {
_eglLog(_EGL_WARNING, "bad image use bit 0x%04x",
attrs.DRMBufferUseMESA & ~valid_mask);
if (use & ~valid_mask) {
_eglLog(_EGL_WARNING, "bad image use bit 0x%04x", use & ~valid_mask);
goto cleanup_img;
}
dri_use = 0;
if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_SHARE_MESA)
if (use & EGL_DRM_BUFFER_USE_SHARE_MESA)
dri_use |= __DRI_IMAGE_USE_SHARE;
if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_SCANOUT_MESA)
if (use & EGL_DRM_BUFFER_USE_SCANOUT_MESA)
dri_use |= __DRI_IMAGE_USE_SCANOUT;
dri2_img->dri_image =
dri2_dpy->image->createImage(dri2_dpy->dri_screen,
attrs.Width, attrs.Height,
format, dri_use, dri2_img);
width, height, format, dri_use, dri2_img);
if (dri2_img->dri_image == NULL) {
err = EGL_BAD_ALLOC;
goto cleanup_img;
@@ -2297,8 +1850,6 @@ dri2_export_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_image *dri2_img = dri2_egl_image(img);
(void) drv;
if (name && !dri2_dpy->image->queryImage(dri2_img->dri_image,
__DRI_IMAGE_ATTRIB_NAME, name)) {
_eglError(EGL_BAD_ALLOC, "dri2_export_drm_image_mesa");
@@ -2325,8 +1876,6 @@ _eglMain(const char *args)
{
struct dri2_egl_driver *dri2_drv;
(void) args;
dri2_drv = malloc(sizeof *dri2_drv);
if (!dri2_drv)
return NULL;

View File

@@ -132,38 +132,29 @@ static const struct {
int egl_attr;
} fbconfig_attributes[] = {
/* table 3.1 of GLX 1.4 */
{ GLX_FBCONFIG_ID, 0 },
{ GLX_BUFFER_SIZE, EGL_BUFFER_SIZE },
{ GLX_LEVEL, EGL_LEVEL },
{ GLX_DOUBLEBUFFER, 0 },
{ GLX_STEREO, 0 },
{ GLX_AUX_BUFFERS, 0 },
{ GLX_RED_SIZE, EGL_RED_SIZE },
{ GLX_GREEN_SIZE, EGL_GREEN_SIZE },
{ GLX_BLUE_SIZE, EGL_BLUE_SIZE },
{ GLX_ALPHA_SIZE, EGL_ALPHA_SIZE },
{ GLX_DEPTH_SIZE, EGL_DEPTH_SIZE },
{ GLX_STENCIL_SIZE, EGL_STENCIL_SIZE },
{ GLX_ACCUM_RED_SIZE, 0 },
{ GLX_ACCUM_GREEN_SIZE, 0 },
{ GLX_ACCUM_BLUE_SIZE, 0 },
{ GLX_ACCUM_ALPHA_SIZE, 0 },
{ GLX_SAMPLE_BUFFERS, EGL_SAMPLE_BUFFERS },
{ GLX_SAMPLES, EGL_SAMPLES },
{ GLX_RENDER_TYPE, 0 },
{ GLX_DRAWABLE_TYPE, EGL_SURFACE_TYPE },
{ GLX_X_RENDERABLE, EGL_NATIVE_RENDERABLE },
{ GLX_X_VISUAL_TYPE, EGL_NATIVE_VISUAL_TYPE },
{ GLX_CONFIG_CAVEAT, EGL_CONFIG_CAVEAT },
{ GLX_TRANSPARENT_TYPE, EGL_TRANSPARENT_TYPE },
{ GLX_TRANSPARENT_INDEX_VALUE, 0 },
{ GLX_TRANSPARENT_RED_VALUE, EGL_TRANSPARENT_RED_VALUE },
{ GLX_TRANSPARENT_GREEN_VALUE, EGL_TRANSPARENT_GREEN_VALUE },
{ GLX_TRANSPARENT_BLUE_VALUE, EGL_TRANSPARENT_BLUE_VALUE },
{ GLX_MAX_PBUFFER_WIDTH, EGL_MAX_PBUFFER_WIDTH },
{ GLX_MAX_PBUFFER_HEIGHT, EGL_MAX_PBUFFER_HEIGHT },
{ GLX_MAX_PBUFFER_PIXELS, EGL_MAX_PBUFFER_PIXELS },
{ GLX_VISUAL_ID, EGL_NATIVE_VISUAL_ID }
{ GLX_BUFFER_SIZE, EGL_BUFFER_SIZE },
{ GLX_LEVEL, EGL_LEVEL },
{ GLX_RED_SIZE, EGL_RED_SIZE },
{ GLX_GREEN_SIZE, EGL_GREEN_SIZE },
{ GLX_BLUE_SIZE, EGL_BLUE_SIZE },
{ GLX_ALPHA_SIZE, EGL_ALPHA_SIZE },
{ GLX_DEPTH_SIZE, EGL_DEPTH_SIZE },
{ GLX_STENCIL_SIZE, EGL_STENCIL_SIZE },
{ GLX_SAMPLE_BUFFERS, EGL_SAMPLE_BUFFERS },
{ GLX_SAMPLES, EGL_SAMPLES },
{ GLX_RENDER_TYPE, EGL_RENDERABLE_TYPE },
{ GLX_X_RENDERABLE, EGL_NATIVE_RENDERABLE },
{ GLX_X_VISUAL_TYPE, EGL_NATIVE_VISUAL_TYPE },
{ GLX_CONFIG_CAVEAT, EGL_CONFIG_CAVEAT },
{ GLX_TRANSPARENT_TYPE, EGL_TRANSPARENT_TYPE },
{ GLX_TRANSPARENT_RED_VALUE, EGL_TRANSPARENT_RED_VALUE },
{ GLX_TRANSPARENT_GREEN_VALUE, EGL_TRANSPARENT_GREEN_VALUE },
{ GLX_TRANSPARENT_BLUE_VALUE, EGL_TRANSPARENT_BLUE_VALUE },
{ GLX_MAX_PBUFFER_WIDTH, EGL_MAX_PBUFFER_WIDTH },
{ GLX_MAX_PBUFFER_HEIGHT, EGL_MAX_PBUFFER_HEIGHT },
{ GLX_MAX_PBUFFER_PIXELS, EGL_MAX_PBUFFER_PIXELS },
{ GLX_VISUAL_ID, EGL_NATIVE_VISUAL_ID },
{ GLX_X_VISUAL_TYPE, EGL_NATIVE_VISUAL_TYPE },
};
@@ -171,31 +162,12 @@ static EGLBoolean
convert_fbconfig(Display *dpy, GLXFBConfig fbconfig,
struct GLX_egl_config *GLX_conf)
{
int err, attr, val;
unsigned i;
/* must have rgba bit */
err = glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &val);
if (err || !(val & GLX_RGBA_BIT))
return EGL_FALSE;
/* must know whether it is double-buffered */
err = glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &val);
if (err)
return EGL_FALSE;
GLX_conf->double_buffered = val;
GLX_conf->Base.RenderableType = EGL_OPENGL_BIT;
GLX_conf->Base.Conformant = EGL_OPENGL_BIT;
int err = 0, attr, egl_attr, val, i;
EGLint conformant, config_caveat, surface_type;
for (i = 0; i < ARRAY_SIZE(fbconfig_attributes); i++) {
EGLint egl_attr, egl_val;
attr = fbconfig_attributes[i].attr;
egl_attr = fbconfig_attributes[i].egl_attr;
if (!egl_attr)
continue;
err = glXGetFBConfigAttrib(dpy, fbconfig, attr, &val);
if (err) {
if (err == GLX_BAD_ATTRIBUTE) {
@@ -205,71 +177,47 @@ convert_fbconfig(Display *dpy, GLXFBConfig fbconfig,
break;
}
switch (egl_attr) {
case EGL_SURFACE_TYPE:
egl_val = 0;
if (val & GLX_WINDOW_BIT)
egl_val |= EGL_WINDOW_BIT;
/* pixmap and pbuffer surfaces must be single-buffered in EGL */
if (!GLX_conf->double_buffered) {
if (val & GLX_PIXMAP_BIT)
egl_val |= EGL_PIXMAP_BIT;
if (val & GLX_PBUFFER_BIT)
egl_val |= EGL_PBUFFER_BIT;
}
break;
case EGL_NATIVE_VISUAL_TYPE:
switch (val) {
case GLX_TRUE_COLOR:
egl_val = TrueColor;
break;
case GLX_DIRECT_COLOR:
egl_val = DirectColor;
break;
case GLX_PSEUDO_COLOR:
egl_val = PseudoColor;
break;
case GLX_STATIC_COLOR:
egl_val = StaticColor;
break;
case GLX_GRAY_SCALE:
egl_val = GrayScale;
break;
case GLX_STATIC_GRAY:
egl_val = StaticGray;
break;
default:
egl_val = EGL_NONE;
break;
}
break;
case EGL_CONFIG_CAVEAT:
egl_val = EGL_NONE;
if (val == GLX_SLOW_CONFIG) {
egl_val = EGL_SLOW_CONFIG;
}
else if (val == GLX_NON_CONFORMANT_CONFIG) {
GLX_conf->Base.Conformant &= ~EGL_OPENGL_BIT;
egl_val = EGL_NONE;
}
break;
case EGL_TRANSPARENT_TYPE:
egl_val = (val == GLX_TRANSPARENT_RGB) ?
EGL_TRANSPARENT_RGB : EGL_NONE;
break;
default:
egl_val = val;
break;
}
_eglSetConfigKey(&GLX_conf->Base, egl_attr, egl_val);
_eglSetConfigKey(&GLX_conf->Base, egl_attr, val);
}
if (err)
return EGL_FALSE;
if (!GLX_conf->Base.SurfaceType)
/* must have rgba bit */
glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &val);
if (!(val & GLX_RGBA_BIT))
return EGL_FALSE;
conformant = EGL_OPENGL_BIT;
glXGetFBConfigAttrib(dpy, fbconfig, GLX_CONFIG_CAVEAT, &val);
if (val == GLX_SLOW_CONFIG)
config_caveat = EGL_SLOW_CONFIG;
if (val == GLX_NON_CONFORMANT_CONFIG)
conformant &= ~EGL_OPENGL_BIT;
if (!(conformant & EGL_OPENGL_ES_BIT))
config_caveat = EGL_NON_CONFORMANT_CONFIG;
_eglSetConfigKey(&GLX_conf->Base, EGL_CONFIG_CAVEAT, config_caveat);
surface_type = 0;
glXGetFBConfigAttrib(dpy, fbconfig, GLX_DRAWABLE_TYPE, &val);
if (val & GLX_WINDOW_BIT)
surface_type |= EGL_WINDOW_BIT;
if (val & GLX_PIXMAP_BIT)
surface_type |= EGL_PIXMAP_BIT;
if (val & GLX_PBUFFER_BIT)
surface_type |= EGL_PBUFFER_BIT;
/* pixmap and pbuffer surfaces must be single-buffered in EGL */
glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &val);
GLX_conf->double_buffered = val;
if (GLX_conf->double_buffered) {
surface_type &= ~(EGL_PIXMAP_BIT | EGL_PBUFFER_BIT);
if (!surface_type)
return EGL_FALSE;
}
_eglSetConfigKey(&GLX_conf->Base, EGL_SURFACE_TYPE, surface_type);
return EGL_TRUE;
}
@@ -278,69 +226,34 @@ static const struct {
int egl_attr;
} visual_attributes[] = {
/* table 3.7 of GLX 1.4 */
{ GLX_USE_GL, 0 },
{ GLX_BUFFER_SIZE, EGL_BUFFER_SIZE },
{ GLX_LEVEL, EGL_LEVEL },
{ GLX_RGBA, 0 },
{ GLX_DOUBLEBUFFER, 0 },
{ GLX_STEREO, 0 },
{ GLX_AUX_BUFFERS, 0 },
{ GLX_RED_SIZE, EGL_RED_SIZE },
{ GLX_GREEN_SIZE, EGL_GREEN_SIZE },
{ GLX_BLUE_SIZE, EGL_BLUE_SIZE },
{ GLX_ALPHA_SIZE, EGL_ALPHA_SIZE },
{ GLX_DEPTH_SIZE, EGL_DEPTH_SIZE },
{ GLX_STENCIL_SIZE, EGL_STENCIL_SIZE },
{ GLX_ACCUM_RED_SIZE, 0 },
{ GLX_ACCUM_GREEN_SIZE, 0 },
{ GLX_ACCUM_BLUE_SIZE, 0 },
{ GLX_ACCUM_ALPHA_SIZE, 0 },
{ GLX_SAMPLE_BUFFERS, EGL_SAMPLE_BUFFERS },
{ GLX_SAMPLES, EGL_SAMPLES },
{ GLX_FBCONFIG_ID, 0 },
/* GLX_EXT_visual_rating */
{ GLX_VISUAL_CAVEAT_EXT, EGL_CONFIG_CAVEAT }
/* no GLX_USE_GL */
{ GLX_BUFFER_SIZE, EGL_BUFFER_SIZE },
{ GLX_LEVEL, EGL_LEVEL },
{ GLX_RED_SIZE, EGL_RED_SIZE },
{ GLX_GREEN_SIZE, EGL_GREEN_SIZE },
{ GLX_BLUE_SIZE, EGL_BLUE_SIZE },
{ GLX_ALPHA_SIZE, EGL_ALPHA_SIZE },
{ GLX_DEPTH_SIZE, EGL_DEPTH_SIZE },
{ GLX_STENCIL_SIZE, EGL_STENCIL_SIZE },
{ GLX_SAMPLE_BUFFERS, EGL_SAMPLE_BUFFERS },
{ GLX_SAMPLES, EGL_SAMPLES },
};
static EGLBoolean
convert_visual(Display *dpy, XVisualInfo *vinfo,
struct GLX_egl_config *GLX_conf)
{
int err, attr, val;
unsigned i;
int err, attr, egl_attr, val, i;
EGLint conformant, config_caveat, surface_type;
/* the visual must support OpenGL and RGBA buffer */
/* the visual must support OpenGL */
err = glXGetConfig(dpy, vinfo, GLX_USE_GL, &val);
if (!err && val)
err = glXGetConfig(dpy, vinfo, GLX_RGBA, &val);
if (err || !val)
return EGL_FALSE;
/* must know whether it is double-buffered */
err = glXGetConfig(dpy, vinfo, GLX_DOUBLEBUFFER, &val);
if (err)
return EGL_FALSE;
GLX_conf->double_buffered = val;
GLX_conf->Base.RenderableType = EGL_OPENGL_BIT;
GLX_conf->Base.Conformant = EGL_OPENGL_BIT;
GLX_conf->Base.SurfaceType = EGL_WINDOW_BIT;
/* pixmap surfaces must be single-buffered in EGL */
if (!GLX_conf->double_buffered)
GLX_conf->Base.SurfaceType |= EGL_PIXMAP_BIT;
GLX_conf->Base.NativeVisualID = vinfo->visualid;
GLX_conf->Base.NativeVisualType = vinfo->class;
GLX_conf->Base.NativeRenderable = EGL_TRUE;
for (i = 0; i < ARRAY_SIZE(visual_attributes); i++) {
EGLint egl_attr, egl_val;
attr = visual_attributes[i].attr;
egl_attr = visual_attributes[i].egl_attr;
if (!egl_attr)
continue;
egl_attr = fbconfig_attributes[i].egl_attr;
err = glXGetConfig(dpy, vinfo, attr, &val);
if (err) {
if (err == GLX_BAD_ATTRIBUTE) {
@@ -350,26 +263,41 @@ convert_visual(Display *dpy, XVisualInfo *vinfo,
break;
}
switch (egl_attr) {
case EGL_CONFIG_CAVEAT:
egl_val = EGL_NONE;
if (val == GLX_SLOW_VISUAL_EXT) {
egl_val = EGL_SLOW_CONFIG;
}
else if (val == GLX_NON_CONFORMANT_VISUAL_EXT) {
GLX_conf->Base.Conformant &= ~EGL_OPENGL_BIT;
egl_val = EGL_NONE;
}
break;
break;
default:
egl_val = val;
break;
}
_eglSetConfigKey(&GLX_conf->Base, egl_attr, egl_val);
_eglSetConfigKey(&GLX_conf->Base, egl_attr, val);
}
if (err)
return EGL_FALSE;
return (err) ? EGL_FALSE : EGL_TRUE;
glXGetConfig(dpy, vinfo, GLX_RGBA, &val);
if (!val)
return EGL_FALSE;
conformant = EGL_OPENGL_BIT;
glXGetConfig(dpy, vinfo, GLX_VISUAL_CAVEAT_EXT, &val);
if (val == GLX_SLOW_CONFIG)
config_caveat = EGL_SLOW_CONFIG;
if (val == GLX_NON_CONFORMANT_CONFIG)
conformant &= ~EGL_OPENGL_BIT;
if (!(conformant & EGL_OPENGL_ES_BIT))
config_caveat = EGL_NON_CONFORMANT_CONFIG;
_eglSetConfigKey(&GLX_conf->Base, EGL_CONFIG_CAVEAT, config_caveat);
_eglSetConfigKey(&GLX_conf->Base, EGL_NATIVE_VISUAL_ID, vinfo->visualid);
_eglSetConfigKey(&GLX_conf->Base, EGL_NATIVE_VISUAL_TYPE, vinfo->class);
/* pixmap and pbuffer surfaces must be single-buffered in EGL */
glXGetConfig(dpy, vinfo, GLX_DOUBLEBUFFER, &val);
GLX_conf->double_buffered = val;
surface_type = EGL_WINDOW_BIT;
/* pixmap surfaces must be single-buffered in EGL */
if (!GLX_conf->double_buffered)
surface_type |= EGL_PIXMAP_BIT;
_eglSetConfigKey(&GLX_conf->Base, EGL_SURFACE_TYPE, surface_type);
_eglSetConfigKey(&GLX_conf->Base, EGL_NATIVE_RENDERABLE, EGL_TRUE);
return EGL_TRUE;
}
@@ -377,31 +305,30 @@ static void
fix_config(struct GLX_egl_display *GLX_dpy, struct GLX_egl_config *GLX_conf)
{
_EGLConfig *conf = &GLX_conf->Base;
EGLint surface_type, r, g, b, a;
surface_type = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE);
if (!GLX_conf->double_buffered && GLX_dpy->single_buffered_quirk) {
/* some GLX impls do not like single-buffered window surface */
conf->SurfaceType &= ~EGL_WINDOW_BIT;
surface_type &= ~EGL_WINDOW_BIT;
/* pbuffer bit is usually not set */
if (GLX_dpy->have_pbuffer)
conf->SurfaceType |= EGL_PBUFFER_BIT;
surface_type |= EGL_PBUFFER_BIT;
SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE, surface_type);
}
/* no visual attribs unless window bit is set */
if (!(conf->SurfaceType & EGL_WINDOW_BIT)) {
conf->NativeVisualID = 0;
conf->NativeVisualType = EGL_NONE;
}
if (conf->TransparentType != EGL_TRANSPARENT_RGB) {
/* some impls set them to -1 (GLX_DONT_CARE) */
conf->TransparentRedValue = 0;
conf->TransparentGreenValue = 0;
conf->TransparentBlueValue = 0;
if (!(surface_type & EGL_WINDOW_BIT)) {
SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID, 0);
SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, EGL_NONE);
}
/* make sure buffer size is set correctly */
conf->BufferSize =
conf->RedSize + conf->GreenSize + conf->BlueSize + conf->AlphaSize;
r = GET_CONFIG_ATTRIB(conf, EGL_RED_SIZE);
g = GET_CONFIG_ATTRIB(conf, EGL_GREEN_SIZE);
b = GET_CONFIG_ATTRIB(conf, EGL_BLUE_SIZE);
a = GET_CONFIG_ATTRIB(conf, EGL_ALPHA_SIZE);
SET_CONFIG_ATTRIB(conf, EGL_BUFFER_SIZE, r + g + b + a);
}
@@ -452,7 +379,7 @@ create_configs(_EGLDisplay *dpy, struct GLX_egl_display *GLX_dpy,
memcpy(GLX_conf, &template, sizeof(template));
GLX_conf->index = i;
_eglLinkConfig(&GLX_conf->Base);
_eglAddConfig(dpy, &GLX_conf->Base);
id++;
}
}
@@ -530,8 +457,6 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
{
struct GLX_egl_display *GLX_dpy;
(void) drv;
if (disp->Platform != _EGL_PLATFORM_X11)
return EGL_FALSE;
@@ -616,8 +541,6 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_context *GLX_ctx_shared = GLX_egl_context(share_list);
(void) drv;
if (!GLX_ctx) {
_eglError(EGL_BAD_ALLOC, "eglCreateContext");
return NULL;
@@ -677,16 +600,12 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
struct GLX_egl_surface *GLX_dsurf = GLX_egl_surface(dsurf);
struct GLX_egl_surface *GLX_rsurf = GLX_egl_surface(rsurf);
struct GLX_egl_context *GLX_ctx = GLX_egl_context(ctx);
_EGLContext *old_ctx;
_EGLSurface *old_dsurf, *old_rsurf;
GLXDrawable ddraw, rdraw;
GLXContext cctx;
EGLBoolean ret = EGL_FALSE;
(void) drv;
/* make new bindings */
if (!_eglBindContext(ctx, dsurf, rsurf, &old_ctx, &old_dsurf, &old_rsurf))
/* bind the new context and return the "orphaned" one */
if (!_eglBindContext(&ctx, &dsurf, &rsurf))
return EGL_FALSE;
ddraw = (GLX_dsurf) ? GLX_dsurf->glx_drawable : None;
@@ -699,27 +618,13 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
ret = glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx);
if (ret) {
if (_eglPutSurface(old_dsurf))
destroy_surface(disp, old_dsurf);
if (_eglPutSurface(old_rsurf))
destroy_surface(disp, old_rsurf);
/* no destroy? */
_eglPutContext(old_ctx);
if (dsurf && !_eglIsSurfaceLinked(dsurf))
destroy_surface(disp, dsurf);
if (rsurf && rsurf != dsurf && !_eglIsSurfaceLinked(rsurf))
destroy_surface(disp, rsurf);
}
else {
/* undo the previous _eglBindContext */
_eglBindContext(old_ctx, old_dsurf, old_rsurf, &ctx, &dsurf, &rsurf);
assert(&GLX_ctx->Base == ctx &&
&GLX_dsurf->Base == dsurf &&
&GLX_rsurf->Base == rsurf);
_eglPutSurface(dsurf);
_eglPutSurface(rsurf);
_eglPutContext(ctx);
_eglPutSurface(old_dsurf);
_eglPutSurface(old_rsurf);
_eglPutContext(old_ctx);
_eglBindContext(&ctx, &dsurf, &rsurf);
}
return ret;
@@ -751,8 +656,6 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp,
struct GLX_egl_surface *GLX_surf;
uint width, height;
(void) drv;
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf) {
_eglError(EGL_BAD_ALLOC, "eglCreateWindowSurface");
@@ -799,8 +702,6 @@ GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp,
struct GLX_egl_surface *GLX_surf;
uint width, height;
(void) drv;
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf) {
_eglError(EGL_BAD_ALLOC, "eglCreatePixmapSurface");
@@ -861,8 +762,6 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp,
int attribs[5];
int i;
(void) drv;
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf) {
_eglError(EGL_BAD_ALLOC, "eglCreatePbufferSurface");
@@ -921,9 +820,7 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp,
static EGLBoolean
GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
{
(void) drv;
if (_eglPutSurface(surf))
if (!_eglIsSurfaceBound(surf))
destroy_surface(disp, surf);
return EGL_TRUE;
@@ -936,8 +833,6 @@ GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf = GLX_egl_surface(draw);
(void) drv;
glXSwapBuffers(GLX_dpy->dpy, GLX_surf->glx_drawable);
return EGL_TRUE;
@@ -949,18 +844,12 @@ GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
static _EGLProc
GLX_eglGetProcAddress(_EGLDriver *drv, const char *procname)
{
(void) drv;
return (_EGLProc) glXGetProcAddress((const GLubyte *) procname);
}
static EGLBoolean
GLX_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
{
(void) drv;
(void) dpy;
(void) ctx;
glXWaitGL();
return EGL_TRUE;
}
@@ -968,9 +857,6 @@ GLX_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
static EGLBoolean
GLX_eglWaitNative(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine)
{
(void) drv;
(void) dpy;
if (engine != EGL_CORE_NATIVE_ENGINE)
return _eglError(EGL_BAD_PARAMETER, "eglWaitNative");
glXWaitX();
@@ -994,8 +880,6 @@ _eglMain(const char *args)
{
struct GLX_egl_driver *GLX_drv = CALLOC_STRUCT(GLX_egl_driver);
(void) args;
if (!GLX_drv)
return NULL;

View File

@@ -36,7 +36,6 @@ SOURCES = \
eglcurrent.c \
egldisplay.c \
egldriver.c \
eglfallbacks.c \
eglglobals.c \
eglimage.c \
egllog.c \

View File

@@ -4,49 +4,48 @@
Import('*')
env = env.Clone()
if env['platform'] != 'winddk':
env.Append(CPPDEFINES = [
'_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
'_EGL_DRIVER_SEARCH_DIR=\\"\\"',
'_EGL_OS_WINDOWS',
'_EGL_GET_CORE_ADDRESSES',
'KHRONOS_DLL_EXPORTS',
])
env = env.Clone()
env.Append(CPPPATH = [
'#/include',
])
env.Append(CPPDEFINES = [
'_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
'_EGL_DRIVER_SEARCH_DIR=\\"\\"',
'_EGL_OS_WINDOWS',
'_EGL_GET_CORE_ADDRESSES',
'KHRONOS_DLL_EXPORTS',
])
egl_sources = [
'eglapi.c',
'eglarray.c',
'eglconfig.c',
'eglcontext.c',
'eglcurrent.c',
'egldisplay.c',
'egldriver.c',
'eglfallbacks.c',
'eglglobals.c',
'eglimage.c',
'egllog.c',
'eglmisc.c',
'eglmode.c',
'eglscreen.c',
'eglstring.c',
'eglsurface.c',
'eglsync.c',
]
env.Append(CPPPATH = [
'#/include',
])
egl = env.SharedLibrary(
target = 'libEGL',
source = egl_sources + ['egl.def'],
)
egl_sources = [
'eglapi.c',
'eglarray.c',
'eglconfig.c',
'eglcontext.c',
'eglcurrent.c',
'egldisplay.c',
'egldriver.c',
'eglglobals.c',
'eglimage.c',
'egllog.c',
'eglmisc.c',
'eglmode.c',
'eglscreen.c',
'eglstring.c',
'eglsurface.c',
'eglsync.c',
]
installed_egl = env.InstallSharedLibrary(egl, version=(1, 4, 0))
egl = env.SharedLibrary(
target = 'libEGL',
source = egl_sources + ['egl.def'],
)
env.Alias('egl', installed_egl)
env.InstallSharedLibrary(egl, version=(1, 4, 0))
egl = [env.FindIxes(egl, 'LIBPREFIX', 'LIBSUFFIX')]
egl = [env.FindIxes(egl, 'LIBPREFIX', 'LIBSUFFIX')]
Export('egl')
Export('egl')

View File

@@ -402,21 +402,16 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
_EGLContext *context;
EGLContext ret;
_EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
if (!config) {
/* config may be NULL if surfaceless */
if (!disp->Extensions.KHR_surfaceless_gles1 &&
!disp->Extensions.KHR_surfaceless_gles2 &&
!disp->Extensions.KHR_surfaceless_opengl)
RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
}
if (config)
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
else
_EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
if (!share && share_list != EGL_NO_CONTEXT)
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
context = drv->API.CreateContext(drv, disp, conf, share, attrib_list);
ret = (context) ? _eglLinkContext(context) : EGL_NO_CONTEXT;
ret = (context) ? _eglLinkContext(context, disp) : EGL_NO_CONTEXT;
RETURN_EGL_EVAL(disp, ret);
}
@@ -464,19 +459,9 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
if (!context && ctx != EGL_NO_CONTEXT)
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
if (!draw_surf || !read_surf) {
/* surfaces may be NULL if surfaceless */
if (!disp->Extensions.KHR_surfaceless_gles1 &&
!disp->Extensions.KHR_surfaceless_gles2 &&
!disp->Extensions.KHR_surfaceless_opengl)
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
if ((!draw_surf && draw != EGL_NO_SURFACE) ||
(!read_surf && read != EGL_NO_SURFACE))
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
if (draw_surf || read_surf)
RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
}
if ((!draw_surf && draw != EGL_NO_SURFACE) ||
(!read_surf && read != EGL_NO_SURFACE))
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
ret = drv->API.MakeCurrent(drv, disp, draw_surf, read_surf, context);
@@ -515,7 +500,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
surf = drv->API.CreateWindowSurface(drv, disp, conf, window, attrib_list);
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
RETURN_EGL_EVAL(disp, ret);
}
@@ -536,7 +521,7 @@ eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);
surf = drv->API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list);
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
RETURN_EGL_EVAL(disp, ret);
}
@@ -555,7 +540,7 @@ eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
surf = drv->API.CreatePbufferSurface(drv, disp, conf, attrib_list);
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
RETURN_EGL_EVAL(disp, ret);
}
@@ -648,12 +633,11 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval)
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
ctx->Resource.Display != disp)
if (!ctx || !_eglIsContextLinked(ctx) || ctx->Resource.Display != disp)
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
surf = ctx->DrawSurface;
if (_eglGetSurfaceHandle(surf) == EGL_NO_SURFACE)
if (!_eglIsSurfaceLinked(surf))
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
ret = drv->API.SwapInterval(drv, disp, surf, interval);
@@ -674,8 +658,7 @@ eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
/* surface must be bound to current context in EGL 1.4 */
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
surf != ctx->DrawSurface)
if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface)
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
ret = drv->API.SwapBuffers(drv, disp, surf);
@@ -716,8 +699,7 @@ eglWaitClient(void)
_eglLockMutex(&disp->Mutex);
/* let bad current context imply bad current surface */
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
_eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE)
if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface))
RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
/* a valid current context implies an initialized current display */
@@ -766,8 +748,7 @@ eglWaitNative(EGLint engine)
_eglLockMutex(&disp->Mutex);
/* let bad current context imply bad current surface */
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
_eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE)
if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface))
RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
/* a valid current context implies an initialized current display */
@@ -1047,7 +1028,7 @@ eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config,
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
surf = drv->API.CreateScreenSurfaceMESA(drv, disp, conf, attrib_list);
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
RETURN_EGL_EVAL(disp, ret);
}
@@ -1239,7 +1220,7 @@ eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
surf = drv->API.CreatePbufferFromClientBuffer(drv, disp, buftype, buffer,
conf, attrib_list);
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
RETURN_EGL_EVAL(disp, ret);
}
@@ -1295,14 +1276,12 @@ eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
EGLImageKHR ret;
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv);
if (!disp->Extensions.KHR_image_base)
RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR);
if (!context && ctx != EGL_NO_CONTEXT)
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
img = drv->API.CreateImageKHR(drv,
disp, context, target, buffer, attr_list);
ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR;
ret = (img) ? _eglLinkImage(img, disp) : EGL_NO_IMAGE_KHR;
RETURN_EGL_EVAL(disp, ret);
}
@@ -1317,8 +1296,6 @@ eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
EGLBoolean ret;
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
if (!disp->Extensions.KHR_image_base)
RETURN_EGL_EVAL(disp, EGL_FALSE);
if (!img)
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
@@ -1344,11 +1321,9 @@ eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
EGLSyncKHR ret;
_EGL_CHECK_DISPLAY(disp, EGL_NO_SYNC_KHR, drv);
if (!disp->Extensions.KHR_reusable_sync)
RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR);
sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list);
ret = (sync) ? _eglLinkSync(sync) : EGL_NO_SYNC_KHR;
ret = (sync) ? _eglLinkSync(sync, disp) : EGL_NO_SYNC_KHR;
RETURN_EGL_EVAL(disp, ret);
}
@@ -1363,8 +1338,6 @@ eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
EGLBoolean ret;
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
assert(disp->Extensions.KHR_reusable_sync);
_eglUnlinkSync(s);
ret = drv->API.DestroySyncKHR(drv, disp, s);
@@ -1381,7 +1354,6 @@ eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR t
EGLint ret;
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
assert(disp->Extensions.KHR_reusable_sync);
ret = drv->API.ClientWaitSyncKHR(drv, disp, s, flags, timeout);
RETURN_EGL_EVAL(disp, ret);
@@ -1397,7 +1369,6 @@ eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode)
EGLBoolean ret;
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
assert(disp->Extensions.KHR_reusable_sync);
ret = drv->API.SignalSyncKHR(drv, disp, s, mode);
RETURN_EGL_EVAL(disp, ret);
@@ -1413,7 +1384,6 @@ eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *v
EGLBoolean ret;
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
assert(disp->Extensions.KHR_reusable_sync);
ret = drv->API.GetSyncAttribKHR(drv, disp, s, attribute, value);
RETURN_EGL_EVAL(disp, ret);
@@ -1437,15 +1407,14 @@ eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface,
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
if (!disp->Extensions.NOK_swap_region)
RETURN_EGL_EVAL(disp, EGL_FALSE);
/* surface must be bound to current context in EGL 1.4 */
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
surf != ctx->DrawSurface)
if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface)
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects);
if (drv->API.SwapBuffersRegionNOK)
ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects);
else
ret = drv->API.SwapBuffers(drv, disp, surf);
RETURN_EGL_EVAL(disp, ret);
}
@@ -1464,11 +1433,9 @@ eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list)
EGLImageKHR ret;
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv);
if (!disp->Extensions.MESA_drm_image)
RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR);
img = drv->API.CreateDRMImageMESA(drv, disp, attr_list);
ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR;
ret = (img) ? _eglLinkImage(img, disp) : EGL_NO_IMAGE_KHR;
RETURN_EGL_EVAL(disp, ret);
}
@@ -1483,8 +1450,6 @@ eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image,
EGLBoolean ret;
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
assert(disp->Extensions.MESA_drm_image);
if (!img)
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);

View File

@@ -118,39 +118,38 @@ _eglFindArray(_EGLArray *array, void *elem)
/**
* Filter an array and return the number of filtered elements.
* Filter an array and return the filtered data. The returned data pointer
* should be freed.
*/
EGLint
_eglFilterArray(_EGLArray *array, void **data, EGLint size,
void **
_eglFilterArray(_EGLArray *array, EGLint *size,
_EGLArrayForEach filter, void *filter_data)
{
void **data;
EGLint count = 0, i;
if (!array)
return 0;
if (!array) {
*size = 0;
return malloc(0);
}
data = malloc(array->Size * sizeof(array->Elements[0]));
if (!data)
return NULL;
if (filter) {
for (i = 0; i < array->Size; i++) {
if (filter(array->Elements[i], filter_data)) {
if (data && count < size)
data[count] = array->Elements[i];
count++;
}
if (data && count >= size)
break;
if (filter(array->Elements[i], filter_data))
data[count++] = array->Elements[i];
}
}
else {
if (data) {
count = (size < array->Size) ? size : array->Size;
memcpy(data, array->Elements, count * sizeof(array->Elements[0]));
}
else {
count = array->Size;
}
memcpy(data, array->Elements, array->Size * sizeof(array->Elements[0]));
}
return count;
*size = count;
return data;
}

View File

@@ -37,8 +37,8 @@ void *
_eglFindArray(_EGLArray *array, void *elem);
PUBLIC EGLint
_eglFilterArray(_EGLArray *array, void **data, EGLint size,
void **
_eglFilterArray(_EGLArray *array, EGLint *size,
_EGLArrayForEach filter, void *filter_data);

View File

@@ -24,34 +24,34 @@
* IDs are from 1 to N respectively.
*/
void
_eglInitConfig(_EGLConfig *conf, _EGLDisplay *dpy, EGLint id)
_eglInitConfig(_EGLConfig *config, _EGLDisplay *dpy, EGLint id)
{
memset(conf, 0, sizeof(*conf));
memset(config, 0, sizeof(*config));
conf->Display = dpy;
config->Display = dpy;
/* some attributes take non-zero default values */
conf->ConfigID = id;
conf->ConfigCaveat = EGL_NONE;
conf->TransparentType = EGL_NONE;
conf->NativeVisualType = EGL_NONE;
conf->ColorBufferType = EGL_RGB_BUFFER;
SET_CONFIG_ATTRIB(config, EGL_CONFIG_ID, id);
SET_CONFIG_ATTRIB(config, EGL_CONFIG_CAVEAT, EGL_NONE);
SET_CONFIG_ATTRIB(config, EGL_TRANSPARENT_TYPE, EGL_NONE);
SET_CONFIG_ATTRIB(config, EGL_NATIVE_VISUAL_TYPE, EGL_NONE);
#ifdef EGL_VERSION_1_2
SET_CONFIG_ATTRIB(config, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
#endif /* EGL_VERSION_1_2 */
}
/**
* Link a config to its display and return the handle of the link.
* Link a config to a display and return the handle of the link.
* The handle can be passed to client directly.
*
* Note that we just save the ptr to the config (we don't copy the config).
*/
PUBLIC EGLConfig
_eglLinkConfig(_EGLConfig *conf)
EGLConfig
_eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf)
{
_EGLDisplay *dpy = conf->Display;
/* sanity check */
assert(dpy && conf->ConfigID > 0);
assert(GET_CONFIG_ATTRIB(conf, EGL_CONFIG_ID) > 0);
if (!dpy->Configs) {
dpy->Configs = _eglCreateArray("Config", 16);
@@ -59,29 +59,23 @@ _eglLinkConfig(_EGLConfig *conf)
return (EGLConfig) NULL;
}
conf->Display = dpy;
_eglAppendArray(dpy->Configs, (void *) conf);
return (EGLConfig) conf;
}
/**
* Lookup a handle to find the linked config.
* Return NULL if the handle has no corresponding linked config.
*/
_EGLConfig *
_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy)
EGLBoolean
_eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy)
{
_EGLConfig *conf;
if (!dpy)
return NULL;
conf = (_EGLConfig *) _eglFindArray(dpy->Configs, (void *) config);
if (conf)
assert(conf->Display == dpy);
return conf;
return (conf != NULL);
}
@@ -110,7 +104,6 @@ static const struct {
EGLint default_value;
} _eglValidationTable[] =
{
/* core */
{ EGL_BUFFER_SIZE, ATTRIB_TYPE_INTEGER,
ATTRIB_CRITERION_ATLEAST,
0 },
@@ -207,13 +200,22 @@ static const struct {
{ EGL_TRANSPARENT_BLUE_VALUE, ATTRIB_TYPE_INTEGER,
ATTRIB_CRITERION_EXACT,
EGL_DONT_CARE },
/* these are not real attributes */
{ EGL_MATCH_NATIVE_PIXMAP, ATTRIB_TYPE_PSEUDO,
ATTRIB_CRITERION_SPECIAL,
EGL_NONE },
/* extensions */
/* there is a gap before EGL_SAMPLES */
{ 0x3030, ATTRIB_TYPE_PSEUDO,
ATTRIB_CRITERION_IGNORE,
0 },
{ EGL_NONE, ATTRIB_TYPE_PSEUDO,
ATTRIB_CRITERION_IGNORE,
0 },
{ EGL_Y_INVERTED_NOK, ATTRIB_TYPE_BOOLEAN,
ATTRIB_CRITERION_EXACT,
EGL_DONT_CARE }
EGL_DONT_CARE },
};
@@ -230,13 +232,18 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
{
EGLint i, attr, val;
EGLBoolean valid = EGL_TRUE;
EGLint red_size = 0, green_size = 0, blue_size = 0, luminance_size = 0;
EGLint alpha_size = 0, buffer_size = 0;
/* all attributes should have been listed */
assert(ARRAY_SIZE(_eglValidationTable) == _EGL_CONFIG_NUM_ATTRIBS);
/* check attributes by their types */
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) {
EGLint mask;
attr = _eglValidationTable[i].attr;
val = _eglGetConfigKey(conf, attr);
val = GET_CONFIG_ATTRIB(conf, attr);
switch (_eglValidationTable[i].type) {
case ATTRIB_TYPE_INTEGER:
@@ -248,14 +255,30 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
break;
case EGL_SAMPLE_BUFFERS:
/* there can be at most 1 sample buffer */
if (val > 1 || val < 0)
if (val > 1)
valid = EGL_FALSE;
break;
default:
if (val < 0)
valid = EGL_FALSE;
case EGL_RED_SIZE:
red_size = val;
break;
case EGL_GREEN_SIZE:
green_size = val;
break;
case EGL_BLUE_SIZE:
blue_size = val;
break;
case EGL_LUMINANCE_SIZE:
luminance_size = val;
break;
case EGL_ALPHA_SIZE:
alpha_size = val;
break;
case EGL_BUFFER_SIZE:
buffer_size = val;
break;
}
if (val < 0)
valid = EGL_FALSE;
break;
case ATTRIB_TYPE_BOOLEAN:
if (val != EGL_TRUE && val != EGL_FALSE)
@@ -343,18 +366,17 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
/* now check for conflicting attribute values */
switch (conf->ColorBufferType) {
switch (GET_CONFIG_ATTRIB(conf, EGL_COLOR_BUFFER_TYPE)) {
case EGL_RGB_BUFFER:
if (conf->LuminanceSize)
if (luminance_size)
valid = EGL_FALSE;
if (conf->RedSize + conf->GreenSize +
conf->BlueSize + conf->AlphaSize != conf->BufferSize)
if (red_size + green_size + blue_size + alpha_size != buffer_size)
valid = EGL_FALSE;
break;
case EGL_LUMINANCE_BUFFER:
if (conf->RedSize || conf->GreenSize || conf->BlueSize)
if (red_size || green_size || blue_size)
valid = EGL_FALSE;
if (conf->LuminanceSize + conf->AlphaSize != conf->BufferSize)
if (luminance_size + alpha_size != buffer_size)
valid = EGL_FALSE;
break;
}
@@ -363,19 +385,23 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
return EGL_FALSE;
}
if (!conf->SampleBuffers && conf->Samples)
val = GET_CONFIG_ATTRIB(conf, EGL_SAMPLE_BUFFERS);
if (!val && GET_CONFIG_ATTRIB(conf, EGL_SAMPLES))
valid = EGL_FALSE;
if (!valid) {
_eglLog(_EGL_DEBUG, "conflicting samples and sample buffers");
return EGL_FALSE;
}
if (!(conf->SurfaceType & EGL_WINDOW_BIT)) {
if (conf->NativeVisualID != 0 || conf->NativeVisualType != EGL_NONE)
val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE);
if (!(val & EGL_WINDOW_BIT)) {
if (GET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID) != 0 ||
GET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE) != EGL_NONE)
valid = EGL_FALSE;
}
if (!(conf->SurfaceType & EGL_PBUFFER_BIT)) {
if (conf->BindToTextureRGB || conf->BindToTextureRGBA)
if (!(val & EGL_PBUFFER_BIT)) {
if (GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB) ||
GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA))
valid = EGL_FALSE;
}
if (!valid) {
@@ -407,11 +433,11 @@ _eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria)
continue;
attr = _eglValidationTable[i].attr;
cmp = _eglGetConfigKey(criteria, attr);
cmp = GET_CONFIG_ATTRIB(criteria, attr);
if (cmp == EGL_DONT_CARE)
continue;
val = _eglGetConfigKey(conf, attr);
val = GET_CONFIG_ATTRIB(conf, attr);
switch (_eglValidationTable[i].criterion) {
case ATTRIB_CRITERION_EXACT:
if (val != cmp)
@@ -452,11 +478,16 @@ _eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria)
static INLINE EGLBoolean
_eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
{
if (_eglOffsetOfConfig(attr) < 0)
if (_eglIndexConfig(conf, attr) < 0)
return EGL_FALSE;
/* there are some holes in the range */
switch (attr) {
case 0x3030 /* a gap before EGL_SAMPLES */:
case EGL_NONE:
#ifdef EGL_VERSION_1_4
case EGL_MATCH_NATIVE_PIXMAP:
#endif
return EGL_FALSE;
case EGL_Y_INVERTED_NOK:
return conf->Display->Extensions.NOK_texture_from_pixmap;
@@ -472,18 +503,18 @@ _eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
* Return EGL_FALSE if any of the attribute is invalid.
*/
EGLBoolean
_eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *dpy,
const EGLint *attrib_list)
_eglParseConfigAttribList(_EGLConfig *conf, const EGLint *attrib_list)
{
EGLint attr, val, i;
_eglInitConfig(conf, dpy, EGL_DONT_CARE);
EGLint config_id = 0, level = 0;
EGLBoolean has_native_visual_type = EGL_FALSE;
EGLBoolean has_transparent_color = EGL_FALSE;
/* reset to default values */
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) {
attr = _eglValidationTable[i].attr;
val = _eglValidationTable[i].default_value;
_eglSetConfigKey(conf, attr, val);
SET_CONFIG_ATTRIB(conf, attr, val);
}
/* parse the list */
@@ -493,33 +524,59 @@ _eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *dpy,
if (!_eglIsConfigAttribValid(conf, attr))
return EGL_FALSE;
SET_CONFIG_ATTRIB(conf, attr, val);
_eglSetConfigKey(conf, attr, val);
/* rememeber some attributes for post-processing */
switch (attr) {
case EGL_CONFIG_ID:
config_id = val;
break;
case EGL_LEVEL:
level = val;
break;
case EGL_NATIVE_VISUAL_TYPE:
has_native_visual_type = EGL_TRUE;
break;
case EGL_TRANSPARENT_RED_VALUE:
case EGL_TRANSPARENT_GREEN_VALUE:
case EGL_TRANSPARENT_BLUE_VALUE:
has_transparent_color = EGL_TRUE;
break;
default:
break;
}
}
if (!_eglValidateConfig(conf, EGL_TRUE))
return EGL_FALSE;
/* the spec says that EGL_LEVEL cannot be EGL_DONT_CARE */
if (conf->Level == EGL_DONT_CARE)
if (level == EGL_DONT_CARE)
return EGL_FALSE;
/* ignore other attributes when EGL_CONFIG_ID is given */
if (conf->ConfigID != EGL_DONT_CARE) {
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) {
attr = _eglValidationTable[i].attr;
if (attr != EGL_CONFIG_ID)
_eglSetConfigKey(conf, attr, EGL_DONT_CARE);
}
if (config_id > 0) {
_eglResetConfigKeys(conf, EGL_DONT_CARE);
SET_CONFIG_ATTRIB(conf, EGL_CONFIG_ID, config_id);
}
else {
if (!(conf->SurfaceType & EGL_WINDOW_BIT))
conf->NativeVisualType = EGL_DONT_CARE;
if (has_native_visual_type) {
val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE);
if (!(val & EGL_WINDOW_BIT))
SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, EGL_DONT_CARE);
}
if (conf->TransparentType == EGL_NONE) {
conf->TransparentRedValue = EGL_DONT_CARE;
conf->TransparentGreenValue = EGL_DONT_CARE;
conf->TransparentBlueValue = EGL_DONT_CARE;
if (has_transparent_color) {
val = GET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_TYPE);
if (val == EGL_NONE) {
SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_RED_VALUE,
EGL_DONT_CARE);
SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_GREEN_VALUE,
EGL_DONT_CARE);
SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_BLUE_VALUE,
EGL_DONT_CARE);
}
}
}
@@ -553,6 +610,7 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
EGL_ALPHA_MASK_SIZE,
};
EGLint val1, val2;
EGLBoolean rgb_buffer;
EGLint i;
if (conf1 == conf2)
@@ -561,41 +619,44 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
/* the enum values have the desired ordering */
assert(EGL_NONE < EGL_SLOW_CONFIG);
assert(EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
val1 = conf1->ConfigCaveat - conf2->ConfigCaveat;
if (val1)
return val1;
val1 = GET_CONFIG_ATTRIB(conf1, EGL_CONFIG_CAVEAT);
val2 = GET_CONFIG_ATTRIB(conf2, EGL_CONFIG_CAVEAT);
if (val1 != val2)
return (val1 - val2);
/* the enum values have the desired ordering */
assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
val1 = conf1->ColorBufferType - conf2->ColorBufferType;
if (val1)
return val1;
val1 = GET_CONFIG_ATTRIB(conf1, EGL_COLOR_BUFFER_TYPE);
val2 = GET_CONFIG_ATTRIB(conf2, EGL_COLOR_BUFFER_TYPE);
if (val1 != val2)
return (val1 - val2);
rgb_buffer = (val1 == EGL_RGB_BUFFER);
if (criteria) {
val1 = val2 = 0;
if (conf1->ColorBufferType == EGL_RGB_BUFFER) {
if (criteria->RedSize > 0) {
val1 += conf1->RedSize;
val2 += conf2->RedSize;
if (rgb_buffer) {
if (GET_CONFIG_ATTRIB(criteria, EGL_RED_SIZE) > 0) {
val1 += GET_CONFIG_ATTRIB(conf1, EGL_RED_SIZE);
val2 += GET_CONFIG_ATTRIB(conf2, EGL_RED_SIZE);
}
if (criteria->GreenSize > 0) {
val1 += conf1->GreenSize;
val2 += conf2->GreenSize;
if (GET_CONFIG_ATTRIB(criteria, EGL_GREEN_SIZE) > 0) {
val1 += GET_CONFIG_ATTRIB(conf1, EGL_GREEN_SIZE);
val2 += GET_CONFIG_ATTRIB(conf2, EGL_GREEN_SIZE);
}
if (criteria->BlueSize > 0) {
val1 += conf1->BlueSize;
val2 += conf2->BlueSize;
if (GET_CONFIG_ATTRIB(criteria, EGL_BLUE_SIZE) > 0) {
val1 += GET_CONFIG_ATTRIB(conf1, EGL_BLUE_SIZE);
val2 += GET_CONFIG_ATTRIB(conf2, EGL_BLUE_SIZE);
}
}
else {
if (criteria->LuminanceSize > 0) {
val1 += conf1->LuminanceSize;
val2 += conf2->LuminanceSize;
if (GET_CONFIG_ATTRIB(criteria, EGL_LUMINANCE_SIZE) > 0) {
val1 += GET_CONFIG_ATTRIB(conf1, EGL_LUMINANCE_SIZE);
val2 += GET_CONFIG_ATTRIB(conf2, EGL_LUMINANCE_SIZE);
}
}
if (criteria->AlphaSize > 0) {
val1 += conf1->AlphaSize;
val2 += conf2->AlphaSize;
if (GET_CONFIG_ATTRIB(criteria, EGL_ALPHA_SIZE) > 0) {
val1 += GET_CONFIG_ATTRIB(conf1, EGL_ALPHA_SIZE);
val2 += GET_CONFIG_ATTRIB(conf2, EGL_ALPHA_SIZE);
}
}
else {
@@ -608,15 +669,24 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
return (val2 - val1);
for (i = 0; i < ARRAY_SIZE(compare_attribs); i++) {
val1 = _eglGetConfigKey(conf1, compare_attribs[i]);
val2 = _eglGetConfigKey(conf2, compare_attribs[i]);
val1 = GET_CONFIG_ATTRIB(conf1, compare_attribs[i]);
val2 = GET_CONFIG_ATTRIB(conf2, compare_attribs[i]);
if (val1 != val2)
return (val1 - val2);
}
/* EGL_NATIVE_VISUAL_TYPE cannot be compared here */
return (compare_id) ? (conf1->ConfigID - conf2->ConfigID) : 0;
if (compare_id) {
val1 = GET_CONFIG_ATTRIB(conf1, EGL_CONFIG_ID);
val2 = GET_CONFIG_ATTRIB(conf2, EGL_CONFIG_ID);
assert(val1 != val2);
}
else {
val1 = val2 = 0;
}
return (val1 - val2);
}
@@ -694,25 +764,15 @@ _eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list,
if (!num_configs)
return _eglError(EGL_BAD_PARAMETER, "eglChooseConfigs");
if (!_eglParseConfigAttribList(&criteria, disp, attrib_list))
_eglInitConfig(&criteria, disp, 0);
if (!_eglParseConfigAttribList(&criteria, attrib_list))
return _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
/* get the number of matched configs */
count = _eglFilterArray(disp->Configs, NULL, 0,
configList = (_EGLConfig **) _eglFilterArray(disp->Configs, &count,
(_EGLArrayForEach) _eglMatchConfig, (void *) &criteria);
if (!count) {
*num_configs = count;
return EGL_TRUE;
}
configList = malloc(sizeof(*configList) * count);
if (!configList)
return _eglError(EGL_BAD_ALLOC, "eglChooseConfig(out of memory)");
/* get the matched configs */
_eglFilterArray(disp->Configs, (void **) configList, count,
(_EGLArrayForEach) _eglMatchConfig, (void *) &criteria);
/* perform sorting of configs */
if (configs && count) {
_eglSortConfigs((const _EGLConfig **) configList, count,
@@ -742,7 +802,7 @@ _eglGetConfigAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
if (!value)
return _eglError(EGL_BAD_PARAMETER, "eglGetConfigAttrib");
*value = _eglGetConfigKey(conf, attribute);
*value = GET_CONFIG_ATTRIB(conf, attribute);
return EGL_TRUE;
}

View File

@@ -3,107 +3,72 @@
#include <assert.h>
#include <stddef.h>
#include "egltypedefs.h"
/* update _eglValidationTable and _eglOffsetOfConfig before updating this
* struct */
#define _EGL_CONFIG_FIRST_ATTRIB EGL_BUFFER_SIZE
#define _EGL_CONFIG_LAST_ATTRIB EGL_CONFORMANT
#define _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS \
(_EGL_CONFIG_LAST_ATTRIB - _EGL_CONFIG_FIRST_ATTRIB + 1)
/* Attributes outside the contiguous block:
*
* EGL_Y_INVERTED_NOK
*/
#define _EGL_CONFIG_FIRST_EXTRA_ATTRIB _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS
#define _EGL_CONFIG_NUM_EXTRA_ATTRIBS 1
#define _EGL_CONFIG_NUM_ATTRIBS \
_EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS + _EGL_CONFIG_NUM_EXTRA_ATTRIBS
struct _egl_config
{
_EGLDisplay *Display;
/* core */
EGLint BufferSize;
EGLint AlphaSize;
EGLint BlueSize;
EGLint GreenSize;
EGLint RedSize;
EGLint DepthSize;
EGLint StencilSize;
EGLint ConfigCaveat;
EGLint ConfigID;
EGLint Level;
EGLint MaxPbufferHeight;
EGLint MaxPbufferPixels;
EGLint MaxPbufferWidth;
EGLint NativeRenderable;
EGLint NativeVisualID;
EGLint NativeVisualType;
EGLint Samples;
EGLint SampleBuffers;
EGLint SurfaceType;
EGLint TransparentType;
EGLint TransparentBlueValue;
EGLint TransparentGreenValue;
EGLint TransparentRedValue;
EGLint BindToTextureRGB;
EGLint BindToTextureRGBA;
EGLint MinSwapInterval;
EGLint MaxSwapInterval;
EGLint LuminanceSize;
EGLint AlphaMaskSize;
EGLint ColorBufferType;
EGLint RenderableType;
EGLint MatchNativePixmap;
EGLint Conformant;
/* extensions */
EGLint YInvertedNOK;
EGLint Storage[_EGL_CONFIG_NUM_ATTRIBS];
};
/**
* Map an EGL attribute enum to the offset of the member in _EGLConfig.
* Macros for source level compatibility.
*/
#define SET_CONFIG_ATTRIB(CONF, ATTR, VAL) _eglSetConfigKey(CONF, ATTR, VAL)
#define GET_CONFIG_ATTRIB(CONF, ATTR) _eglGetConfigKey(CONF, ATTR)
/**
* Given a key, return an index into the storage of the config.
* Return -1 if the key is invalid.
*/
static INLINE EGLint
_eglOffsetOfConfig(EGLint attr)
_eglIndexConfig(const _EGLConfig *conf, EGLint key)
{
switch (attr) {
#define ATTRIB_MAP(attr, memb) case attr: return offsetof(_EGLConfig, memb)
/* core */
ATTRIB_MAP(EGL_BUFFER_SIZE, BufferSize);
ATTRIB_MAP(EGL_ALPHA_SIZE, AlphaSize);
ATTRIB_MAP(EGL_BLUE_SIZE, BlueSize);
ATTRIB_MAP(EGL_GREEN_SIZE, GreenSize);
ATTRIB_MAP(EGL_RED_SIZE, RedSize);
ATTRIB_MAP(EGL_DEPTH_SIZE, DepthSize);
ATTRIB_MAP(EGL_STENCIL_SIZE, StencilSize);
ATTRIB_MAP(EGL_CONFIG_CAVEAT, ConfigCaveat);
ATTRIB_MAP(EGL_CONFIG_ID, ConfigID);
ATTRIB_MAP(EGL_LEVEL, Level);
ATTRIB_MAP(EGL_MAX_PBUFFER_HEIGHT, MaxPbufferHeight);
ATTRIB_MAP(EGL_MAX_PBUFFER_PIXELS, MaxPbufferPixels);
ATTRIB_MAP(EGL_MAX_PBUFFER_WIDTH, MaxPbufferWidth);
ATTRIB_MAP(EGL_NATIVE_RENDERABLE, NativeRenderable);
ATTRIB_MAP(EGL_NATIVE_VISUAL_ID, NativeVisualID);
ATTRIB_MAP(EGL_NATIVE_VISUAL_TYPE, NativeVisualType);
ATTRIB_MAP(EGL_SAMPLES, Samples);
ATTRIB_MAP(EGL_SAMPLE_BUFFERS, SampleBuffers);
ATTRIB_MAP(EGL_SURFACE_TYPE, SurfaceType);
ATTRIB_MAP(EGL_TRANSPARENT_TYPE, TransparentType);
ATTRIB_MAP(EGL_TRANSPARENT_BLUE_VALUE, TransparentBlueValue);
ATTRIB_MAP(EGL_TRANSPARENT_GREEN_VALUE, TransparentGreenValue);
ATTRIB_MAP(EGL_TRANSPARENT_RED_VALUE, TransparentRedValue);
ATTRIB_MAP(EGL_BIND_TO_TEXTURE_RGB, BindToTextureRGB);
ATTRIB_MAP(EGL_BIND_TO_TEXTURE_RGBA, BindToTextureRGBA);
ATTRIB_MAP(EGL_MIN_SWAP_INTERVAL, MinSwapInterval);
ATTRIB_MAP(EGL_MAX_SWAP_INTERVAL, MaxSwapInterval);
ATTRIB_MAP(EGL_LUMINANCE_SIZE, LuminanceSize);
ATTRIB_MAP(EGL_ALPHA_MASK_SIZE, AlphaMaskSize);
ATTRIB_MAP(EGL_COLOR_BUFFER_TYPE, ColorBufferType);
ATTRIB_MAP(EGL_RENDERABLE_TYPE, RenderableType);
ATTRIB_MAP(EGL_MATCH_NATIVE_PIXMAP, MatchNativePixmap);
ATTRIB_MAP(EGL_CONFORMANT, Conformant);
/* extensions */
ATTRIB_MAP(EGL_Y_INVERTED_NOK, YInvertedNOK);
#undef ATTRIB_MAP
(void) conf;
if (key >= _EGL_CONFIG_FIRST_ATTRIB &&
key < _EGL_CONFIG_FIRST_ATTRIB + _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS)
return key - _EGL_CONFIG_FIRST_ATTRIB;
switch (key) {
case EGL_Y_INVERTED_NOK:
return _EGL_CONFIG_FIRST_EXTRA_ATTRIB;
default:
return -1;
}
}
/**
* Reset all keys in the config to a given value.
*/
static INLINE void
_eglResetConfigKeys(_EGLConfig *conf, EGLint val)
{
EGLint i;
for (i = 0; i < _EGL_CONFIG_NUM_ATTRIBS; i++)
conf->Storage[i] = val;
}
/**
* Update a config for a given key.
*
@@ -114,9 +79,9 @@ _eglOffsetOfConfig(EGLint attr)
static INLINE void
_eglSetConfigKey(_EGLConfig *conf, EGLint key, EGLint val)
{
EGLint offset = _eglOffsetOfConfig(key);
assert(offset >= 0);
*((EGLint *) ((char *) conf + offset)) = val;
EGLint idx = _eglIndexConfig(conf, key);
assert(idx >= 0);
conf->Storage[idx] = val;
}
@@ -126,9 +91,9 @@ _eglSetConfigKey(_EGLConfig *conf, EGLint key, EGLint val)
static INLINE EGLint
_eglGetConfigKey(const _EGLConfig *conf, EGLint key)
{
EGLint offset = _eglOffsetOfConfig(key);
assert(offset >= 0);
return *((EGLint *) ((char *) conf + offset));
EGLint idx = _eglIndexConfig(conf, key);
assert(idx >= 0);
return conf->Storage[idx];
}
@@ -137,20 +102,34 @@ _eglInitConfig(_EGLConfig *config, _EGLDisplay *dpy, EGLint id);
PUBLIC EGLConfig
_eglLinkConfig(_EGLConfig *conf);
_eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf);
extern _EGLConfig *
_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy);
extern EGLBoolean
_eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy);
/**
* Return the handle of a linked config.
* Lookup a handle to find the linked config.
* Return NULL if the handle has no corresponding linked config.
*/
static INLINE _EGLConfig *
_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy)
{
_EGLConfig *conf = (_EGLConfig *) config;
if (!dpy || !_eglCheckConfigHandle(config, dpy))
conf = NULL;
return conf;
}
/**
* Return the handle of a linked config, or NULL.
*/
static INLINE EGLConfig
_eglGetConfigHandle(_EGLConfig *conf)
{
return (EGLConfig) conf;
return (EGLConfig) ((conf && conf->Display) ? conf : NULL);
}
@@ -163,8 +142,7 @@ _eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria);
PUBLIC EGLBoolean
_eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *dpy,
const EGLint *attrib_list);
_eglParseConfigAttribList(_EGLConfig *conf, const EGLint *attrib_list);
PUBLIC EGLint

View File

@@ -103,7 +103,8 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf,
return EGL_FALSE;
}
_eglInitResource(&ctx->Resource, sizeof(*ctx), dpy);
memset(ctx, 0, sizeof(_EGLContext));
ctx->Resource.Display = dpy;
ctx->ClientAPI = api;
ctx->Config = conf;
ctx->WindowRenderBuffer = EGL_NONE;
@@ -112,12 +113,13 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf,
err = _eglParseContextAttribList(ctx, attrib_list);
if (err == EGL_SUCCESS && ctx->Config) {
EGLint api_bit;
EGLint renderable_type, api_bit;
renderable_type = GET_CONFIG_ATTRIB(ctx->Config, EGL_RENDERABLE_TYPE);
api_bit = _eglGetContextAPIBit(ctx);
if (!(ctx->Config->RenderableType & api_bit)) {
if (!(renderable_type & api_bit)) {
_eglLog(_EGL_DEBUG, "context api is 0x%x while config supports 0x%x",
api_bit, ctx->Config->RenderableType);
api_bit, renderable_type);
err = EGL_BAD_CONFIG;
}
}
@@ -128,6 +130,29 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf,
}
/**
* Just a placeholder/demo function. Real driver will never use this!
*/
_EGLContext *
_eglCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
_EGLContext *share_list, const EGLint *attrib_list)
{
return NULL;
}
/**
* Default fallback routine - drivers should usually override this.
*/
EGLBoolean
_eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
{
if (!_eglIsContextBound(ctx))
free(ctx);
return EGL_TRUE;
}
#ifdef EGL_VERSION_1_2
static EGLint
_eglQueryContextRenderBuffer(_EGLContext *ctx)
@@ -158,9 +183,7 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c,
switch (attribute) {
case EGL_CONFIG_ID:
if (!c->Config)
return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
*value = c->Config->ConfigID;
*value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID);
break;
case EGL_CONTEXT_CLIENT_VERSION:
*value = c->ClientVersion;
@@ -249,6 +272,10 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
if (!surfaceless && (draw == NULL || read == NULL))
return _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
/* context stealing from another thread is not allowed */
if (ctx->Binding && ctx->Binding != t)
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
/*
* The spec says
*
@@ -256,23 +283,16 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
* bound to contexts in another thread, an EGL_BAD_ACCESS error is
* generated."
*
* and
* But it also says
*
* "at most one context may be bound to a particular surface at a given
* time"
*
* The latter is more restrictive so we can check only the latter case.
*/
if (ctx->Binding && ctx->Binding != t)
if ((draw && draw->CurrentContext && draw->CurrentContext != ctx) ||
(read && read->CurrentContext && read->CurrentContext != ctx))
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
if (draw && draw->CurrentContext && draw->CurrentContext != ctx) {
if (draw->CurrentContext->Binding != t ||
draw->CurrentContext->ClientAPI != ctx->ClientAPI)
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
}
if (read && read->CurrentContext && read->CurrentContext != ctx) {
if (read->CurrentContext->Binding != t ||
read->CurrentContext->ClientAPI != ctx->ClientAPI)
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
}
/* simply require the configs to be equal */
if ((draw && draw->Config != ctx->Config) ||
@@ -303,65 +323,79 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
/**
* Bind the context to the current thread and given surfaces. Return the
* previous bound context and surfaces. The caller should unreference the
* returned context and surfaces.
*
* Making a second call with the resources returned by the first call
* unsurprisingly undoes the first call, except for the resouce reference
* counts.
* "orphaned" context and surfaces. Each argument is both input and output.
*/
EGLBoolean
_eglBindContext(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read,
_EGLContext **old_ctx,
_EGLSurface **old_draw, _EGLSurface **old_read)
_eglBindContext(_EGLContext **ctx, _EGLSurface **draw, _EGLSurface **read)
{
_EGLThreadInfo *t = _eglGetCurrentThread();
_EGLContext *prev_ctx;
_EGLSurface *prev_draw, *prev_read;
_EGLContext *newCtx = *ctx, *oldCtx;
_EGLSurface *newDraw = *draw, *newRead = *read;
if (!_eglCheckMakeCurrent(ctx, draw, read))
if (!_eglCheckMakeCurrent(newCtx, newDraw, newRead))
return EGL_FALSE;
/* increment refcounts before binding */
_eglGetContext(ctx);
_eglGetSurface(draw);
_eglGetSurface(read);
/* bind the new context */
prev_ctx = _eglBindContextToThread(ctx, t);
oldCtx = _eglBindContextToThread(newCtx, t);
/* break previous bindings */
if (prev_ctx) {
prev_draw = prev_ctx->DrawSurface;
prev_read = prev_ctx->ReadSurface;
/* break old bindings */
if (oldCtx) {
*ctx = oldCtx;
*draw = oldCtx->DrawSurface;
*read = oldCtx->ReadSurface;
if (prev_draw)
prev_draw->CurrentContext = NULL;
if (prev_read)
prev_read->CurrentContext = NULL;
if (*draw)
(*draw)->CurrentContext = NULL;
if (*read)
(*read)->CurrentContext = NULL;
prev_ctx->DrawSurface = NULL;
prev_ctx->ReadSurface = NULL;
}
else {
prev_draw = prev_read = NULL;
oldCtx->DrawSurface = NULL;
oldCtx->ReadSurface = NULL;
}
/* establish new bindings */
if (ctx) {
if (draw)
draw->CurrentContext = ctx;
if (read)
read->CurrentContext = ctx;
if (newCtx) {
if (newDraw)
newDraw->CurrentContext = newCtx;
if (newRead)
newRead->CurrentContext = newCtx;
ctx->DrawSurface = draw;
ctx->ReadSurface = read;
newCtx->DrawSurface = newDraw;
newCtx->ReadSurface = newRead;
}
assert(old_ctx && old_draw && old_read);
*old_ctx = prev_ctx;
*old_draw = prev_draw;
*old_read = prev_read;
/* an old context or surface is not orphaned if it is still bound */
if (*ctx == newCtx)
*ctx = NULL;
if (*draw == newDraw || *draw == newRead)
*draw = NULL;
if (*read == newDraw || *read == newRead)
*read = NULL;
return EGL_TRUE;
}
/**
* Just a placeholder/demo function. Drivers should override this.
*/
EGLBoolean
_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw,
_EGLSurface *read, _EGLContext *ctx)
{
return EGL_FALSE;
}
/**
* This is defined by the EGL_MESA_copy_context extension.
*/
EGLBoolean
_eglCopyContextMESA(_EGLDriver *drv, EGLDisplay dpy, EGLContext source,
EGLContext dest, EGLint mask)
{
/* This function will always have to be overridden/implemented in the
* device driver. If the driver is based on Mesa, use _mesa_copy_context().
*/
return EGL_FALSE;
}

View File

@@ -34,46 +34,51 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy,
_EGLConfig *config, const EGLint *attrib_list);
extern _EGLContext *
_eglCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list);
extern EGLBoolean
_eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
extern EGLBoolean
_eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint attribute, EGLint *value);
PUBLIC EGLBoolean
_eglBindContext(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read,
_EGLContext **old_ctx,
_EGLSurface **old_draw, _EGLSurface **old_read);
_eglBindContext(_EGLContext **ctx, _EGLSurface **draw, _EGLSurface **read);
extern EGLBoolean
_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx);
extern EGLBoolean
_eglCopyContextMESA(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
/**
* Increment reference count for the context.
*/
static INLINE _EGLContext *
_eglGetContext(_EGLContext *ctx)
{
if (ctx)
_eglGetResource(&ctx->Resource);
return ctx;
}
/**
* Decrement reference count for the context.
* Return true if the context is bound to a thread.
*
* The binding is considered a reference to the context. Drivers should not
* destroy a context when it is bound.
*/
static INLINE EGLBoolean
_eglPutContext(_EGLContext *ctx)
_eglIsContextBound(_EGLContext *ctx)
{
return (ctx) ? _eglPutResource(&ctx->Resource) : EGL_FALSE;
return (ctx->Binding != NULL);
}
/**
* Link a context to its display and return the handle of the link.
* Link a context to a display and return the handle of the link.
* The handle can be passed to client directly.
*/
static INLINE EGLContext
_eglLinkContext(_EGLContext *ctx)
_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy)
{
_eglLinkResource(&ctx->Resource, _EGL_RESOURCE_CONTEXT);
_eglLinkResource(&ctx->Resource, _EGL_RESOURCE_CONTEXT, dpy);
return (EGLContext) ctx;
}
@@ -115,4 +120,18 @@ _eglGetContextHandle(_EGLContext *ctx)
}
/**
* Return true if the context is linked to a display.
*
* The link is considered a reference to the context (the display is owning the
* context). Drivers should not destroy a context when it is linked.
*/
static INLINE EGLBoolean
_eglIsContextLinked(_EGLContext *ctx)
{
_EGLResource *res = (_EGLResource *) ctx;
return (res && _eglIsResourceLinked(res));
}
#endif /* EGLCONTEXT_INCLUDED */

View File

@@ -14,7 +14,33 @@
static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER;
#if PTHREADS
#ifdef GLX_USE_TLS
static __thread const _EGLThreadInfo *_egl_TSD
__attribute__ ((tls_model("initial-exec")));
static INLINE void _eglSetTSD(const _EGLThreadInfo *t)
{
_egl_TSD = t;
}
static INLINE _EGLThreadInfo *_eglGetTSD(void)
{
return (_EGLThreadInfo *) _egl_TSD;
}
static INLINE void _eglFiniTSD(void)
{
}
static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
{
/* TODO destroy TSD */
(void) dtor;
(void) _eglFiniTSD;
return EGL_TRUE;
}
#elif PTHREADS
#include <pthread.h>
static _EGL_DECLARE_MUTEX(_egl_TSDMutex);
@@ -22,26 +48,14 @@ static EGLBoolean _egl_TSDInitialized;
static pthread_key_t _egl_TSD;
static void (*_egl_FreeTSD)(_EGLThreadInfo *);
#ifdef GLX_USE_TLS
static __thread const _EGLThreadInfo *_egl_TLS
__attribute__ ((tls_model("initial-exec")));
#endif
static INLINE void _eglSetTSD(const _EGLThreadInfo *t)
{
pthread_setspecific(_egl_TSD, (const void *) t);
#ifdef GLX_USE_TLS
_egl_TLS = t;
#endif
}
static INLINE _EGLThreadInfo *_eglGetTSD(void)
{
#ifdef GLX_USE_TLS
return (_EGLThreadInfo *) _egl_TLS;
#else
return (_EGLThreadInfo *) pthread_getspecific(_egl_TSD);
#endif
}
static INLINE void _eglFiniTSD(void)

View File

@@ -233,53 +233,17 @@ _eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy)
/**
* Initialize a display resource.
* Link a resource to a display.
*/
void
_eglInitResource(_EGLResource *res, EGLint size, _EGLDisplay *dpy)
_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy)
{
memset(res, 0, size);
assert(!res->Display || res->Display == dpy);
res->Display = dpy;
res->RefCount = 1;
}
/**
* Increment reference count for the resource.
*/
void
_eglGetResource(_EGLResource *res)
{
assert(res && res->RefCount > 0);
/* hopefully a resource is always manipulated with its display locked */
res->RefCount++;
}
/**
* Decrement reference count for the resource.
*/
EGLBoolean
_eglPutResource(_EGLResource *res)
{
assert(res && res->RefCount > 0);
res->RefCount--;
return (!res->RefCount);
}
/**
* Link a resource to its display.
*/
void
_eglLinkResource(_EGLResource *res, _EGLResourceType type)
{
assert(res->Display);
res->IsLinked = EGL_TRUE;
res->Next = res->Display->ResourceLists[type];
res->Display->ResourceLists[type] = res;
_eglGetResource(res);
res->Next = dpy->ResourceLists[type];
dpy->ResourceLists[type] = res;
}
@@ -306,9 +270,6 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type)
}
res->Next = NULL;
/* do not reset res->Display */
res->IsLinked = EGL_FALSE;
_eglPutResource(res);
/* We always unlink before destroy. The driver still owns a reference */
assert(res->RefCount);
}

View File

@@ -40,7 +40,6 @@ struct _egl_resource
/* which display the resource belongs to */
_EGLDisplay *Display;
EGLBoolean IsLinked;
EGLint RefCount;
/* used to link resources of the same type */
_EGLResource *Next;
@@ -163,19 +162,7 @@ _eglGetDisplayHandle(_EGLDisplay *dpy)
extern void
_eglInitResource(_EGLResource *res, EGLint size, _EGLDisplay *dpy);
PUBLIC void
_eglGetResource(_EGLResource *res);
PUBLIC EGLBoolean
_eglPutResource(_EGLResource *res);
extern void
_eglLinkResource(_EGLResource *res, _EGLResourceType type);
_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy);
extern void

View File

@@ -9,10 +9,19 @@
#include <stdlib.h>
#include "eglstring.h"
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldefines.h"
#include "egldisplay.h"
#include "egldriver.h"
#include "egllog.h"
#include "eglmisc.h"
#include "eglmode.h"
#include "eglscreen.h"
#include "eglstring.h"
#include "eglsurface.h"
#include "eglimage.h"
#include "eglsync.h"
#include "eglmutex.h"
#if defined(_EGL_OS_UNIX)
@@ -395,62 +404,35 @@ _eglPreloadForEach(const char *search_path,
static const char *
_eglGetSearchPath(void)
{
static char search_path[1024];
static const char *search_path;
#if defined(_EGL_OS_UNIX) || defined(_EGL_OS_WINDOWS)
if (search_path[0] == '\0') {
char *buf = search_path;
size_t len = sizeof(search_path);
EGLBoolean use_env;
char dir_sep;
if (!search_path) {
static char buffer[1024];
const char *p;
int ret;
p = getenv("EGL_DRIVERS_PATH");
#if defined(_EGL_OS_UNIX)
use_env = (geteuid() == getuid() && getegid() == getgid());
dir_sep = '/';
#else
use_env = EGL_TRUE;
dir_sep = '\\';
#endif
if (use_env) {
char *p;
/* extract the dirname from EGL_DRIVER */
p = getenv("EGL_DRIVER");
if (p && strchr(p, dir_sep)) {
ret = _eglsnprintf(buf, len, "%s", p);
if (ret > 0 && ret < len) {
p = strrchr(buf, dir_sep);
*p++ = ':';
len -= p - buf;
buf = p;
}
}
/* append EGL_DRIVERS_PATH */
p = getenv("EGL_DRIVERS_PATH");
if (p) {
ret = _eglsnprintf(buf, len, "%s:", p);
if (ret > 0 && ret < len) {
buf += ret;
len -= ret;
}
}
}
else {
if (p && (geteuid() != getuid() || getegid() != getgid())) {
_eglLog(_EGL_DEBUG,
"ignore EGL_DRIVERS_PATH for setuid/setgid binaries");
p = NULL;
}
#endif /* _EGL_OS_UNIX */
ret = _eglsnprintf(buf, len, "%s", _EGL_DRIVER_SEARCH_DIR);
if (ret < 0 || ret >= len)
search_path[0] = '\0';
_eglLog(_EGL_DEBUG, "EGL search path is %s", search_path);
if (p) {
ret = _eglsnprintf(buffer, sizeof(buffer),
"%s:%s", p, _EGL_DRIVER_SEARCH_DIR);
if (ret > 0 && ret < sizeof(buffer))
search_path = buffer;
}
}
#endif /* defined(_EGL_OS_UNIX) || defined(_EGL_OS_WINDOWS) */
if (!search_path)
search_path = _EGL_DRIVER_SEARCH_DIR;
#else
search_path = "";
#endif
return search_path;
}
@@ -681,6 +663,77 @@ _eglUnloadDrivers(void)
}
/**
* Plug all the available fallback routines into the given driver's
* dispatch table.
*/
void
_eglInitDriverFallbacks(_EGLDriver *drv)
{
/* If a pointer is set to NULL, then the device driver _really_ has
* to implement it.
*/
drv->API.Initialize = NULL;
drv->API.Terminate = NULL;
drv->API.GetConfigs = _eglGetConfigs;
drv->API.ChooseConfig = _eglChooseConfig;
drv->API.GetConfigAttrib = _eglGetConfigAttrib;
drv->API.CreateContext = _eglCreateContext;
drv->API.DestroyContext = _eglDestroyContext;
drv->API.MakeCurrent = _eglMakeCurrent;
drv->API.QueryContext = _eglQueryContext;
drv->API.CreateWindowSurface = _eglCreateWindowSurface;
drv->API.CreatePixmapSurface = _eglCreatePixmapSurface;
drv->API.CreatePbufferSurface = _eglCreatePbufferSurface;
drv->API.DestroySurface = _eglDestroySurface;
drv->API.QuerySurface = _eglQuerySurface;
drv->API.SurfaceAttrib = _eglSurfaceAttrib;
drv->API.BindTexImage = _eglBindTexImage;
drv->API.ReleaseTexImage = _eglReleaseTexImage;
drv->API.SwapInterval = _eglSwapInterval;
drv->API.SwapBuffers = _eglSwapBuffers;
drv->API.CopyBuffers = _eglCopyBuffers;
drv->API.QueryString = _eglQueryString;
drv->API.WaitClient = _eglWaitClient;
drv->API.WaitNative = _eglWaitNative;
#ifdef EGL_MESA_screen_surface
drv->API.ChooseModeMESA = _eglChooseModeMESA;
drv->API.GetModesMESA = _eglGetModesMESA;
drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
drv->API.GetScreensMESA = _eglGetScreensMESA;
drv->API.CreateScreenSurfaceMESA = _eglCreateScreenSurfaceMESA;
drv->API.ShowScreenSurfaceMESA = _eglShowScreenSurfaceMESA;
drv->API.ScreenPositionMESA = _eglScreenPositionMESA;
drv->API.QueryScreenMESA = _eglQueryScreenMESA;
drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA;
drv->API.QueryModeStringMESA = _eglQueryModeStringMESA;
#endif /* EGL_MESA_screen_surface */
#ifdef EGL_VERSION_1_2
drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer;
#endif /* EGL_VERSION_1_2 */
#ifdef EGL_KHR_image_base
drv->API.CreateImageKHR = _eglCreateImageKHR;
drv->API.DestroyImageKHR = _eglDestroyImageKHR;
#endif /* EGL_KHR_image_base */
#ifdef EGL_KHR_reusable_sync
drv->API.CreateSyncKHR = _eglCreateSyncKHR;
drv->API.DestroySyncKHR = _eglDestroySyncKHR;
drv->API.ClientWaitSyncKHR = _eglClientWaitSyncKHR;
drv->API.SignalSyncKHR = _eglSignalSyncKHR;
drv->API.GetSyncAttribKHR = _eglGetSyncAttribKHR;
#endif /* EGL_KHR_reusable_sync */
}
/**
* Invoke a callback function on each EGL search path.
*

View File

@@ -4,7 +4,7 @@
#include "egltypedefs.h"
#include "eglapi.h"
#include <stddef.h>
/**
* Define an inline driver typecast function.
@@ -80,7 +80,6 @@ extern void
_eglUnloadDrivers(void);
/* defined in eglfallbacks.c */
PUBLIC void
_eglInitDriverFallbacks(_EGLDriver *drv);

View File

@@ -1,99 +0,0 @@
#include <string.h>
#include "egltypedefs.h"
#include "egldriver.h"
#include "eglconfig.h"
#include "eglcontext.h"
#include "eglsurface.h"
#include "eglmisc.h"
#include "eglscreen.h"
#include "eglmode.h"
#include "eglsync.h"
static EGLBoolean
_eglReturnFalse(void)
{
return EGL_FALSE;
}
/**
* Plug all the available fallback routines into the given driver's
* dispatch table.
*/
void
_eglInitDriverFallbacks(_EGLDriver *drv)
{
memset(&drv->API, 0, sizeof(drv->API));
/* the driver has to implement these */
drv->API.Initialize = NULL;
drv->API.Terminate = NULL;
drv->API.GetConfigs = _eglGetConfigs;
drv->API.ChooseConfig = _eglChooseConfig;
drv->API.GetConfigAttrib = _eglGetConfigAttrib;
drv->API.CreateContext = (CreateContext_t) _eglReturnFalse;
drv->API.DestroyContext = (DestroyContext_t) _eglReturnFalse;
drv->API.MakeCurrent = (MakeCurrent_t) _eglReturnFalse;
drv->API.QueryContext = _eglQueryContext;
drv->API.CreateWindowSurface = (CreateWindowSurface_t) _eglReturnFalse;
drv->API.CreatePixmapSurface = (CreatePixmapSurface_t) _eglReturnFalse;
drv->API.CreatePbufferSurface = (CreatePbufferSurface_t) _eglReturnFalse;
drv->API.CreatePbufferFromClientBuffer =
(CreatePbufferFromClientBuffer_t) _eglReturnFalse;
drv->API.DestroySurface = (DestroySurface_t) _eglReturnFalse;
drv->API.QuerySurface = _eglQuerySurface;
drv->API.SurfaceAttrib = _eglSurfaceAttrib;
drv->API.BindTexImage = (BindTexImage_t) _eglReturnFalse;
drv->API.ReleaseTexImage = (ReleaseTexImage_t) _eglReturnFalse;
drv->API.CopyBuffers = (CopyBuffers_t) _eglReturnFalse;
drv->API.SwapBuffers = (SwapBuffers_t) _eglReturnFalse;
drv->API.SwapInterval = _eglSwapInterval;
drv->API.WaitClient = (WaitClient_t) _eglReturnFalse;
drv->API.WaitNative = (WaitNative_t) _eglReturnFalse;
drv->API.GetProcAddress = (GetProcAddress_t) _eglReturnFalse;
drv->API.QueryString = _eglQueryString;
#ifdef EGL_MESA_screen_surface
drv->API.CopyContextMESA = (CopyContextMESA_t) _eglReturnFalse;
drv->API.CreateScreenSurfaceMESA =
(CreateScreenSurfaceMESA_t) _eglReturnFalse;
drv->API.ShowScreenSurfaceMESA = (ShowScreenSurfaceMESA_t) _eglReturnFalse;
drv->API.ChooseModeMESA = _eglChooseModeMESA;
drv->API.GetModesMESA = _eglGetModesMESA;
drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
drv->API.GetScreensMESA = _eglGetScreensMESA;
drv->API.ScreenPositionMESA = _eglScreenPositionMESA;
drv->API.QueryScreenMESA = _eglQueryScreenMESA;
drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA;
drv->API.QueryModeStringMESA = _eglQueryModeStringMESA;
#endif /* EGL_MESA_screen_surface */
#ifdef EGL_KHR_image_base
drv->API.CreateImageKHR = NULL;
drv->API.DestroyImageKHR = NULL;
#endif /* EGL_KHR_image_base */
#ifdef EGL_KHR_reusable_sync
drv->API.CreateSyncKHR = NULL;
drv->API.DestroySyncKHR = NULL;
drv->API.ClientWaitSyncKHR = NULL;
drv->API.SignalSyncKHR = NULL;
drv->API.GetSyncAttribKHR = _eglGetSyncAttribKHR;
#endif /* EGL_KHR_reusable_sync */
#ifdef EGL_MESA_drm_image
drv->API.CreateDRMImageMESA = NULL;
drv->API.ExportDRMImageMESA = NULL;
#endif
#ifdef EGL_NOK_swap_region
drv->API.SwapBuffersRegionNOK = NULL;
#endif
}

View File

@@ -2,6 +2,7 @@
#include <string.h>
#include "eglimage.h"
#include "eglcurrent.h"
#include "egllog.h"
@@ -11,57 +12,28 @@
/**
* Parse the list of image attributes and return the proper error code.
*/
EGLint
_eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
const EGLint *attrib_list)
static EGLint
_eglParseImageAttribList(_EGLImage *img, const EGLint *attrib_list)
{
EGLint i, err = EGL_SUCCESS;
(void) dpy;
memset(attrs, 0, sizeof(attrs));
attrs->ImagePreserved = EGL_FALSE;
attrs->GLTextureLevel = 0;
attrs->GLTextureZOffset = 0;
if (!attrib_list)
return err;
return EGL_SUCCESS;
for (i = 0; attrib_list[i] != EGL_NONE; i++) {
EGLint attr = attrib_list[i++];
EGLint val = attrib_list[i];
switch (attr) {
/* EGL_KHR_image_base */
case EGL_IMAGE_PRESERVED_KHR:
attrs->ImagePreserved = val;
img->Preserved = val;
break;
/* EGL_KHR_gl_image */
case EGL_GL_TEXTURE_LEVEL_KHR:
attrs->GLTextureLevel = val;
img->GLTextureLevel = val;
break;
case EGL_GL_TEXTURE_ZOFFSET_KHR:
attrs->GLTextureZOffset = val;
img->GLTextureZOffset = val;
break;
/* EGL_MESA_drm_image */
case EGL_WIDTH:
attrs->Width = val;
break;
case EGL_HEIGHT:
attrs->Height = val;
break;
case EGL_DRM_BUFFER_FORMAT_MESA:
attrs->DRMBufferFormatMESA = val;
break;
case EGL_DRM_BUFFER_USE_MESA:
attrs->DRMBufferUseMESA = val;
break;
case EGL_DRM_BUFFER_STRIDE_MESA:
attrs->DRMBufferStrideMESA = val;
break;
default:
/* unknown attrs are ignored */
break;
@@ -78,12 +50,41 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
EGLBoolean
_eglInitImage(_EGLImage *img, _EGLDisplay *dpy)
_eglInitImage(_EGLImage *img, _EGLDisplay *dpy, const EGLint *attrib_list)
{
_eglInitResource(&img->Resource, sizeof(*img), dpy);
EGLint err;
memset(img, 0, sizeof(_EGLImage));
img->Resource.Display = dpy;
img->Preserved = EGL_FALSE;
img->GLTextureLevel = 0;
img->GLTextureZOffset = 0;
err = _eglParseImageAttribList(img, attrib_list);
if (err != EGL_SUCCESS)
return _eglError(err, "eglCreateImageKHR");
return EGL_TRUE;
}
_EGLImage *
_eglCreateImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
EGLenum target, EGLClientBuffer buffer,
const EGLint *attr_list)
{
/* driver should override this function */
return NULL;
}
EGLBoolean
_eglDestroyImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image)
{
/* driver should override this function */
return EGL_FALSE;
}
#endif /* EGL_KHR_image_base */

View File

@@ -6,23 +6,6 @@
#include "egldisplay.h"
struct _egl_image_attribs
{
/* EGL_KHR_image_base */
EGLBoolean ImagePreserved;
/* EGL_KHR_gl_image */
EGLint GLTextureLevel;
EGLint GLTextureZOffset;
/* EGL_MESA_drm_image */
EGLint Width;
EGLint Height;
EGLint DRMBufferFormatMESA;
EGLint DRMBufferUseMESA;
EGLint DRMBufferStrideMESA;
};
/**
* "Base" class for device driver images.
*/
@@ -30,48 +13,34 @@ struct _egl_image
{
/* An image is a display resource */
_EGLResource Resource;
EGLBoolean Preserved;
EGLint GLTextureLevel;
EGLint GLTextureZOffset;
};
PUBLIC EGLint
_eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
const EGLint *attrib_list);
PUBLIC EGLBoolean
_eglInitImage(_EGLImage *img, _EGLDisplay *dpy);
_eglInitImage(_EGLImage *img, _EGLDisplay *dpy, const EGLint *attrib_list);
extern _EGLImage *
_eglCreateImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list);
extern EGLBoolean
_eglDestroyImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image);
/**
* Increment reference count for the image.
*/
static INLINE _EGLImage *
_eglGetImage(_EGLImage *img)
{
if (img)
_eglGetResource(&img->Resource);
return img;
}
/**
* Decrement reference count for the image.
*/
static INLINE EGLBoolean
_eglPutImage(_EGLImage *img)
{
return (img) ? _eglPutResource(&img->Resource) : EGL_FALSE;
}
/**
* Link an image to its display and return the handle of the link.
* Link an image to a display and return the handle of the link.
* The handle can be passed to client directly.
*/
static INLINE EGLImageKHR
_eglLinkImage(_EGLImage *img)
_eglLinkImage(_EGLImage *img, _EGLDisplay *dpy)
{
_eglLinkResource(&img->Resource, _EGL_RESOURCE_IMAGE);
_eglLinkResource(&img->Resource, _EGL_RESOURCE_IMAGE, dpy);
return (EGLImageKHR) img;
}
@@ -113,4 +82,15 @@ _eglGetImageHandle(_EGLImage *img)
}
/**
* Return true if the image is linked to a display.
*/
static INLINE EGLBoolean
_eglIsImageLinked(_EGLImage *img)
{
_EGLResource *res = (_EGLResource *) img;
return (res && _eglIsResourceLinked(res));
}
#endif /* EGLIMAGE_INCLUDED */

View File

@@ -151,7 +151,6 @@ _eglLog(EGLint level, const char *fmtStr, ...)
{
va_list args;
char msg[MAXSTRING];
int ret;
/* one-time initialization; a little race here is fine */
if (!logging.initialized)
@@ -163,9 +162,7 @@ _eglLog(EGLint level, const char *fmtStr, ...)
if (logging.logger) {
va_start(args, fmtStr);
ret = vsnprintf(msg, MAXSTRING, fmtStr, args);
if (ret < 0 || ret >= MAXSTRING)
strcpy(msg, "<message truncated>");
vsnprintf(msg, MAXSTRING, fmtStr, args);
va_end(args);
logging.logger(level, msg);

View File

@@ -158,3 +158,32 @@ _eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name)
return NULL;
}
}
EGLBoolean
_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
{
/* just a placeholder */
(void) drv;
(void) dpy;
(void) ctx;
return EGL_TRUE;
}
EGLBoolean
_eglWaitNative(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine)
{
/* just a placeholder */
(void) drv;
(void) dpy;
switch (engine) {
case EGL_CORE_NATIVE_ENGINE:
break;
default:
_eglError(EGL_BAD_PARAMETER, "eglWaitNative(engine)");
return EGL_FALSE;
}
return EGL_TRUE;
}

View File

@@ -37,4 +37,12 @@ extern const char *
_eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name);
extern EGLBoolean
_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
extern EGLBoolean
_eglWaitNative(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine);
#endif /* EGLMISC_INCLUDED */

View File

@@ -3,9 +3,11 @@
#include <string.h>
#include "egldisplay.h"
#include "egldriver.h"
#include "eglmode.h"
#include "eglcurrent.h"
#include "eglscreen.h"
#include "eglstring.h"
#ifdef EGL_MESA_screen_surface
@@ -29,19 +31,12 @@ _eglLookupMode(EGLModeMESA mode, _EGLDisplay *disp)
/* loop over all screens on the display */
for (scrnum = 0; scrnum < disp->Screens->Size; scrnum++) {
const _EGLScreen *scrn = disp->Screens->Elements[scrnum];
EGLint idx;
/*
* the mode ids of a screen ranges from scrn->Handle to scrn->Handle +
* scrn->NumModes
*/
if (mode >= scrn->Handle &&
mode < scrn->Handle + _EGL_SCREEN_MAX_MODES) {
idx = mode - scrn->Handle;
assert(idx < scrn->NumModes && scrn->Modes[idx].Handle == mode);
return &scrn->Modes[idx];
EGLint i;
/* search list of modes for handle */
for (i = 0; i < scrn->NumModes; i++) {
if (scrn->Modes[i].Handle == mode) {
return scrn->Modes + i;
}
}
}
@@ -49,6 +44,45 @@ _eglLookupMode(EGLModeMESA mode, _EGLDisplay *disp)
}
/**
* Add a new mode with the given attributes (width, height, depth, refreshRate)
* to the given screen.
* Assign a new mode ID/handle to the mode as well.
* \return pointer to the new _EGLMode
*/
_EGLMode *
_eglAddNewMode(_EGLScreen *screen, EGLint width, EGLint height,
EGLint refreshRate, const char *name)
{
EGLint n;
_EGLMode *newModes;
assert(screen);
assert(width > 0);
assert(height > 0);
assert(refreshRate > 0);
n = screen->NumModes;
newModes = (_EGLMode *) realloc(screen->Modes, (n+1) * sizeof(_EGLMode));
if (newModes) {
screen->Modes = newModes;
screen->Modes[n].Handle = n + 1;
screen->Modes[n].Width = width;
screen->Modes[n].Height = height;
screen->Modes[n].RefreshRate = refreshRate;
screen->Modes[n].Optimal = EGL_FALSE;
screen->Modes[n].Interlaced = EGL_FALSE;
screen->Modes[n].Name = _eglstrdup(name);
screen->NumModes++;
return screen->Modes + n;
}
else {
return NULL;
}
}
/**
* Parse the attrib_list to fill in the fields of the given _eglMode
* Return EGL_FALSE if any errors, EGL_TRUE otherwise.

View File

@@ -32,6 +32,11 @@ extern _EGLMode *
_eglLookupMode(EGLModeMESA mode, _EGLDisplay *dpy);
PUBLIC _EGLMode *
_eglAddNewMode(_EGLScreen *screen, EGLint width, EGLint height,
EGLint refreshRate, const char *name);
extern EGLBoolean
_eglChooseModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
const EGLint *attrib_list, EGLModeMESA *modes,

View File

@@ -18,6 +18,7 @@
#include "egldisplay.h"
#include "eglcurrent.h"
#include "eglmode.h"
#include "eglconfig.h"
#include "eglsurface.h"
#include "eglscreen.h"
#include "eglmutex.h"
@@ -41,8 +42,7 @@ _eglAllocScreenHandle(void)
EGLScreenMESA s;
_eglLockMutex(&_eglNextScreenHandleMutex);
s = _eglNextScreenHandle;
_eglNextScreenHandle += _EGL_SCREEN_MAX_MODES;
s = _eglNextScreenHandle++;
_eglUnlockMutex(&_eglNextScreenHandleMutex);
return s;
@@ -53,54 +53,16 @@ _eglAllocScreenHandle(void)
* Initialize an _EGLScreen object to default values.
*/
void
_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy, EGLint num_modes)
_eglInitScreen(_EGLScreen *screen)
{
memset(screen, 0, sizeof(_EGLScreen));
screen->Display = dpy;
screen->NumModes = num_modes;
screen->StepX = 1;
screen->StepY = 1;
if (num_modes > _EGL_SCREEN_MAX_MODES)
num_modes = _EGL_SCREEN_MAX_MODES;
screen->Modes = (_EGLMode *) calloc(num_modes, sizeof(*screen->Modes));
screen->NumModes = (screen->Modes) ? num_modes : 0;
}
/**
* Link a screen to its display and return the handle of the link.
* The handle can be passed to client directly.
*/
EGLScreenMESA
_eglLinkScreen(_EGLScreen *screen)
{
_EGLDisplay *display;
EGLint i;
assert(screen && screen->Display);
display = screen->Display;
if (!display->Screens) {
display->Screens = _eglCreateArray("Screen", 4);
if (!display->Screens)
return (EGLScreenMESA) 0;
}
screen->Handle = _eglAllocScreenHandle();
for (i = 0; i < screen->NumModes; i++)
screen->Modes[i].Handle = screen->Handle + i;
_eglAppendArray(display->Screens, (void *) screen);
return screen->Handle;
}
/**
* Lookup a handle to find the linked config.
* Return NULL if the handle has no corresponding linked config.
* Given a public screen handle, return the internal _EGLScreen object.
*/
_EGLScreen *
_eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *display)
@@ -112,21 +74,39 @@ _eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *display)
for (i = 0; i < display->Screens->Size; i++) {
_EGLScreen *scr = (_EGLScreen *) display->Screens->Elements[i];
if (scr->Handle == screen) {
assert(scr->Display == display);
if (scr->Handle == screen)
return scr;
}
}
return NULL;
}
/**
* Add the given _EGLScreen to the display's list of screens.
*/
void
_eglAddScreen(_EGLDisplay *display, _EGLScreen *screen)
{
assert(display);
assert(screen);
if (!display->Screens) {
display->Screens = _eglCreateArray("Screen", 4);
if (!display->Screens)
return;
}
screen->Handle = _eglAllocScreenHandle();
_eglAppendArray(display->Screens, (void *) screen);
}
static EGLBoolean
_eglFlattenScreen(void *elem, void *buffer)
{
_EGLScreen *scr = (_EGLScreen *) elem;
EGLScreenMESA *handle = (EGLScreenMESA *) buffer;
*handle = _eglGetScreenHandle(scr);
*handle = scr->Handle;
return EGL_TRUE;
}
@@ -142,6 +122,66 @@ _eglGetScreensMESA(_EGLDriver *drv, _EGLDisplay *display, EGLScreenMESA *screens
}
/**
* Drivers should do a proper implementation.
*/
_EGLSurface *
_eglCreateScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
const EGLint *attrib_list)
{
return NULL;
}
/**
* Show the given surface on the named screen.
* If surface is EGL_NO_SURFACE, disable the screen's output.
*
* This is just a placeholder function; drivers will always override
* this with code that _really_ shows the surface.
*/
EGLBoolean
_eglShowScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLScreen *scrn, _EGLSurface *surf,
_EGLMode *mode)
{
if (!surf) {
scrn->CurrentSurface = NULL;
}
else {
if (surf->Type != EGL_SCREEN_BIT_MESA) {
_eglError(EGL_BAD_SURFACE, "eglShowSurfaceMESA");
return EGL_FALSE;
}
if (surf->Width < mode->Width || surf->Height < mode->Height) {
_eglError(EGL_BAD_SURFACE,
"eglShowSurfaceMESA(surface smaller than screen size)");
return EGL_FALSE;
}
scrn->CurrentSurface = surf;
scrn->CurrentMode = mode;
}
return EGL_TRUE;
}
/**
* Set a screen's current display mode.
* Note: mode = EGL_NO_MODE is valid (turns off the screen)
*
* This is just a placeholder function; drivers will always override
* this with code that _really_ sets the mode.
*/
EGLBoolean
_eglScreenModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
_EGLMode *m)
{
scrn->CurrentMode = m;
return EGL_TRUE;
}
/**
* Set a screen's surface origin.
*/
@@ -202,4 +242,33 @@ _eglQueryScreenMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
}
/**
* Delete the modes associated with given screen.
*/
void
_eglDestroyScreenModes(_EGLScreen *scrn)
{
EGLint i;
for (i = 0; i < scrn->NumModes; i++) {
if (scrn->Modes[i].Name)
free((char *) scrn->Modes[i].Name); /* cast away const */
}
if (scrn->Modes)
free(scrn->Modes);
scrn->Modes = NULL;
scrn->NumModes = 0;
}
/**
* Default fallback routine - drivers should usually override this.
*/
void
_eglDestroyScreen(_EGLScreen *scrn)
{
_eglDestroyScreenModes(scrn);
free(scrn);
}
#endif /* EGL_MESA_screen_surface */

View File

@@ -8,9 +8,6 @@
#ifdef EGL_MESA_screen_surface
#define _EGL_SCREEN_MAX_MODES 16
/**
* Per-screen information.
* Note that an EGL screen doesn't have a size. A screen may be set to
@@ -22,8 +19,6 @@
*/
struct _egl_screen
{
_EGLDisplay *Display;
EGLScreenMESA Handle; /* The public/opaque handle which names this object */
_EGLMode *CurrentMode;
@@ -38,35 +33,41 @@ struct _egl_screen
PUBLIC void
_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy, EGLint num_modes);
PUBLIC EGLScreenMESA
_eglLinkScreen(_EGLScreen *screen);
_eglInitScreen(_EGLScreen *screen);
extern _EGLScreen *
_eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *dpy);
/**
* Return the handle of a linked screen.
*/
static INLINE EGLScreenMESA
_eglGetScreenHandle(_EGLScreen *screen)
{
return (screen) ? screen->Handle : (EGLScreenMESA) 0;
}
PUBLIC void
_eglAddScreen(_EGLDisplay *display, _EGLScreen *screen);
extern EGLBoolean
_eglGetScreensMESA(_EGLDriver *drv, _EGLDisplay *dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
extern _EGLSurface *
_eglCreateScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list);
extern EGLBoolean
_eglShowScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, _EGLSurface *surf, _EGLMode *m);
extern EGLBoolean
_eglScreenModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, _EGLMode *m);
extern EGLBoolean
_eglScreenPositionMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLint x, EGLint y);
extern EGLBoolean
_eglQueryDisplayMESA(_EGLDriver *drv, _EGLDisplay *dpy, EGLint attribute, EGLint *value);
extern EGLBoolean
_eglQueryScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLScreen *scrn, _EGLSurface **surface);
@@ -80,6 +81,14 @@ extern EGLBoolean
_eglQueryScreenMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLint attribute, EGLint *value);
extern void
_eglDestroyScreenModes(_EGLScreen *scrn);
PUBLIC void
_eglDestroyScreen(_EGLScreen *scrn);
#endif /* EGL_MESA_screen_surface */

View File

@@ -17,12 +17,12 @@
static void
_eglClampSwapInterval(_EGLSurface *surf, EGLint interval)
{
EGLint bound = surf->Config->MaxSwapInterval;
EGLint bound = GET_CONFIG_ATTRIB(surf->Config, EGL_MAX_SWAP_INTERVAL);
if (interval >= bound) {
interval = bound;
}
else {
bound = surf->Config->MinSwapInterval;
bound = GET_CONFIG_ATTRIB(surf->Config, EGL_MIN_SWAP_INTERVAL);
if (interval < bound)
interval = bound;
}
@@ -263,13 +263,14 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
return EGL_FALSE;
}
if ((conf->SurfaceType & type) == 0) {
if ((GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE) & type) == 0) {
/* The config can't be used to create a surface of this type */
_eglError(EGL_BAD_CONFIG, func);
return EGL_FALSE;
}
_eglInitResource(&surf->Resource, sizeof(*surf), dpy);
memset(surf, 0, sizeof(_EGLSurface));
surf->Resource.Display = dpy;
surf->Type = type;
surf->Config = conf;
@@ -302,6 +303,24 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
}
EGLBoolean
_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
{
/* Drivers have to do the actual buffer swap. */
return EGL_TRUE;
}
EGLBoolean
_eglCopyBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
EGLNativePixmapType target)
{
/* copy surface to native pixmap */
/* All implementation burdon for this is in the device driver */
return EGL_FALSE;
}
EGLBoolean
_eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
EGLint attribute, EGLint *value)
@@ -314,7 +333,7 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
*value = surface->Height;
break;
case EGL_CONFIG_ID:
*value = surface->Config->ConfigID;
*value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID);
break;
case EGL_LARGEST_PBUFFER:
*value = surface->LargestPbuffer;
@@ -369,6 +388,51 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
}
/**
* Drivers should do a proper implementation.
*/
_EGLSurface *
_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
EGLNativeWindowType window, const EGLint *attrib_list)
{
return NULL;
}
/**
* Drivers should do a proper implementation.
*/
_EGLSurface *
_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
EGLNativePixmapType pixmap, const EGLint *attrib_list)
{
return NULL;
}
/**
* Drivers should do a proper implementation.
*/
_EGLSurface *
_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
const EGLint *attrib_list)
{
return NULL;
}
/**
* Default fallback routine - drivers should usually override this.
*/
EGLBoolean
_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
{
if (!_eglIsSurfaceBound(surf))
free(surf);
return EGL_TRUE;
}
/**
* Default fallback routine - drivers might override this.
*/
@@ -381,7 +445,7 @@ _eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
switch (attribute) {
case EGL_MIPMAP_LEVEL:
confval = surface->Config->RenderableType;
confval = GET_CONFIG_ATTRIB(surface->Config, EGL_RENDERABLE_TYPE);
if (!(confval & (EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT))) {
err = EGL_BAD_PARAMETER;
break;
@@ -393,7 +457,7 @@ _eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
case EGL_MULTISAMPLE_RESOLVE_DEFAULT:
break;
case EGL_MULTISAMPLE_RESOLVE_BOX:
confval = surface->Config->SurfaceType;
confval = GET_CONFIG_ATTRIB(surface->Config, EGL_SURFACE_TYPE);
if (!(confval & EGL_MULTISAMPLE_RESOLVE_BOX_BIT))
err = EGL_BAD_MATCH;
break;
@@ -410,7 +474,7 @@ _eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
case EGL_BUFFER_DESTROYED:
break;
case EGL_BUFFER_PRESERVED:
confval = surface->Config->SurfaceType;
confval = GET_CONFIG_ATTRIB(surface->Config, EGL_SURFACE_TYPE);
if (!(confval & EGL_SWAP_BEHAVIOR_PRESERVED_BIT))
err = EGL_BAD_MATCH;
break;
@@ -472,6 +536,40 @@ _eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
}
EGLBoolean
_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
EGLint buffer)
{
/* Just do basic error checking and return success/fail.
* Drivers must implement the real stuff.
*/
if (surface->Type != EGL_PBUFFER_BIT) {
_eglError(EGL_BAD_SURFACE, "eglBindTexImage");
return EGL_FALSE;
}
if (surface->TextureFormat == EGL_NO_TEXTURE) {
_eglError(EGL_BAD_MATCH, "eglBindTexImage");
return EGL_FALSE;
}
if (buffer != EGL_BACK_BUFFER) {
_eglError(EGL_BAD_PARAMETER, "eglReleaseTexImage");
return EGL_FALSE;
}
if (!surface->BoundToTexture) {
_eglError(EGL_BAD_SURFACE, "eglReleaseTexImage");
return EGL_FALSE;
}
surface->BoundToTexture = EGL_FALSE;
return EGL_TRUE;
}
EGLBoolean
_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
EGLint interval)
@@ -479,3 +577,24 @@ _eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
_eglClampSwapInterval(surf, interval);
return EGL_TRUE;
}
#ifdef EGL_VERSION_1_2
/**
* Example function - drivers should do a proper implementation.
*/
_EGLSurface *
_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, _EGLDisplay *dpy,
EGLenum buftype, EGLClientBuffer buffer,
_EGLConfig *conf, const EGLint *attrib_list)
{
if (buftype != EGL_OPENVG_IMAGE) {
_eglError(EGL_BAD_PARAMETER, "eglCreatePbufferFromClientBuffer");
return NULL;
}
return NULL;
}
#endif /* EGL_VERSION_1_2 */

View File

@@ -51,10 +51,34 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
_EGLConfig *config, const EGLint *attrib_list);
extern EGLBoolean
_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf);
extern EGLBoolean
_eglCopyBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLNativePixmapType target);
extern EGLBoolean
_eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint attribute, EGLint *value);
extern _EGLSurface *
_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, EGLNativeWindowType window, const EGLint *attrib_list);
extern _EGLSurface *
_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, EGLNativePixmapType pixmap, const EGLint *attrib_list);
extern _EGLSurface *
_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list);
extern EGLBoolean
_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf);
extern EGLBoolean
_eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint attribute, EGLint value);
@@ -63,40 +87,45 @@ PUBLIC extern EGLBoolean
_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint buffer);
extern EGLBoolean
_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint buffer);
extern EGLBoolean
_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval);
/**
* Increment reference count for the surface.
*/
static INLINE _EGLSurface *
_eglGetSurface(_EGLSurface *surf)
{
if (surf)
_eglGetResource(&surf->Resource);
return surf;
}
#ifdef EGL_VERSION_1_2
extern _EGLSurface *
_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, _EGLDisplay *dpy,
EGLenum buftype, EGLClientBuffer buffer,
_EGLConfig *conf, const EGLint *attrib_list);
#endif /* EGL_VERSION_1_2 */
/**
* Decrement reference count for the surface.
* Return true if there is a context bound to the surface.
*
* The binding is considered a reference to the surface. Drivers should not
* destroy a surface when it is bound.
*/
static INLINE EGLBoolean
_eglPutSurface(_EGLSurface *surf)
_eglIsSurfaceBound(_EGLSurface *surf)
{
return (surf) ? _eglPutResource(&surf->Resource) : EGL_FALSE;
return (surf->CurrentContext != NULL);
}
/**
* Link a surface to its display and return the handle of the link.
* Link a surface to a display and return the handle of the link.
* The handle can be passed to client directly.
*/
static INLINE EGLSurface
_eglLinkSurface(_EGLSurface *surf)
_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy)
{
_eglLinkResource(&surf->Resource, _EGL_RESOURCE_SURFACE);
_eglLinkResource(&surf->Resource, _EGL_RESOURCE_SURFACE, dpy);
return (EGLSurface) surf;
}
@@ -138,4 +167,18 @@ _eglGetSurfaceHandle(_EGLSurface *surf)
}
/**
* Return true if the surface is linked to a display.
*
* The link is considered a reference to the surface (the display is owning the
* surface). Drivers should not destroy a surface when it is linked.
*/
static INLINE EGLBoolean
_eglIsSurfaceLinked(_EGLSurface *surf)
{
_EGLResource *res = (_EGLResource *) surf;
return (res && _eglIsResourceLinked(res));
}
#endif /* EGLSURFACE_INCLUDED */

View File

@@ -50,7 +50,10 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type,
!(type == EGL_SYNC_FENCE_KHR && dpy->Extensions.KHR_fence_sync))
return _eglError(EGL_BAD_ATTRIBUTE, "eglCreateSyncKHR");
_eglInitResource(&sync->Resource, sizeof(*sync), dpy);
memset(sync, 0, sizeof(*sync));
sync->Resource.Display = dpy;
sync->Type = type;
sync->SyncStatus = EGL_UNSIGNALED_KHR;
sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR;
@@ -63,6 +66,37 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type,
}
_EGLSync *
_eglCreateSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy,
EGLenum type, const EGLint *attrib_list)
{
return NULL;
}
EGLBoolean
_eglDestroySyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync)
{
return EGL_TRUE;
}
EGLint
_eglClientWaitSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
EGLint flags, EGLTimeKHR timeout)
{
return EGL_FALSE;
}
EGLBoolean
_eglSignalSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
EGLenum mode)
{
return EGL_FALSE;
}
EGLBoolean
_eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
EGLint attribute, EGLint *value)

View File

@@ -28,41 +28,38 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type,
const EGLint *attrib_list);
extern _EGLSync *
_eglCreateSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy,
EGLenum type, const EGLint *attrib_list);
extern EGLBoolean
_eglDestroySyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync);
extern EGLint
_eglClientWaitSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
EGLint flags, EGLTimeKHR timeout);
extern EGLBoolean
_eglSignalSyncKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
EGLenum mode);
extern EGLBoolean
_eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
EGLint attribute, EGLint *value);
/**
* Increment reference count for the sync.
*/
static INLINE _EGLSync *
_eglGetSync(_EGLSync *sync)
{
if (sync)
_eglGetResource(&sync->Resource);
return sync;
}
/**
* Decrement reference count for the sync.
*/
static INLINE EGLBoolean
_eglPutSync(_EGLSync *sync)
{
return (sync) ? _eglPutResource(&sync->Resource) : EGL_FALSE;
}
/**
* Link a sync to its display and return the handle of the link.
* Link a sync to a display and return the handle of the link.
* The handle can be passed to client directly.
*/
static INLINE EGLSyncKHR
_eglLinkSync(_EGLSync *sync)
_eglLinkSync(_EGLSync *sync, _EGLDisplay *dpy)
{
_eglLinkResource(&sync->Resource, _EGL_RESOURCE_SYNC);
_eglLinkResource(&sync->Resource, _EGL_RESOURCE_SYNC, dpy);
return (EGLSyncKHR) sync;
}
@@ -103,6 +100,20 @@ _eglGetSyncHandle(_EGLSync *sync)
}
/**
* Return true if the sync is linked to a display.
*
* The link is considered a reference to the sync (the display is owning the
* sync). Drivers should not destroy a sync when it is linked.
*/
static INLINE EGLBoolean
_eglIsSyncLinked(_EGLSync *sync)
{
_EGLResource *res = (_EGLResource *) sync;
return (res && _eglIsResourceLinked(res));
}
#endif /* EGL_KHR_reusable_sync */

View File

@@ -24,8 +24,6 @@ typedef struct _egl_extensions _EGLExtensions;
typedef struct _egl_image _EGLImage;
typedef struct _egl_image_attribs _EGLImageAttribs;
typedef struct _egl_mode _EGLMode;
typedef struct _egl_resource _EGLResource;

View File

@@ -40,7 +40,7 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURC
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2> /dev/null
$(PROGS): % : %.o $(PROGS_DEPS)
$(PROGS): % : %.o
$(LD) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group
# Emacs tags

View File

@@ -1,135 +1,30 @@
Import('env')
import os
#
# Auxiliary modules
#
Import('*')
SConscript('auxiliary/SConscript')
#
# Drivers
#
SConscript([
'drivers/failover/SConscript',
'drivers/galahad/SConscript',
'drivers/identity/SConscript',
'drivers/llvmpipe/SConscript',
'drivers/rbug/SConscript',
'drivers/softpipe/SConscript',
'drivers/svga/SConscript',
'drivers/trace/SConscript',
])
if not env['msvc']:
# These drivers do not build on MSVC compilers
SConscript([
'drivers/i915/SConscript',
'drivers/i965/SConscript',
'drivers/r300/SConscript',
])
if env['drm']:
# These drivers depend on drm headers
if env['drm_radeon']:
SConscript([
'drivers/r600/SConscript',
])
# XXX: nouveau drivers have a tight dependency on libdrm, so to enable
# we need some version logic before we enable them. Also, ATM there is
# no nouveau target in scons
# if env['drm_nouveau']:
# SConscript([
# 'drivers/nouveau/SConscript',
# 'drivers/nv50/SConscript',
# 'drivers/nvfx/SConscript',
# ])
#
# State trackers
#
for driver in env['drivers']:
SConscript(os.path.join('drivers', driver, 'SConscript'))
# Needed by some state trackers
SConscript('winsys/sw/null/SConscript')
SConscript('state_trackers/python/SConscript')
if env['platform'] != 'embedded':
SConscript('state_trackers/vega/SConscript')
if platform != 'embedded':
SConscript('state_trackers/glx/xlib/SConscript')
SConscript('state_trackers/dri/SConscript')
SConscript('state_trackers/xorg/SConscript')
SConscript('state_trackers/egl/SConscript')
SConscript('state_trackers/vega/SConscript')
if env['x11']:
SConscript('state_trackers/glx/xlib/SConscript')
if env['dri']:
SConscript('state_trackers/dri/SConscript')
if env['dri'] and env['xorg']:
SConscript('state_trackers/xorg/SConscript')
if env['platform'] == 'windows':
SConscript([
'state_trackers/egl/SConscript',
'state_trackers/wgl/SConscript',
])
#
# Winsys
#
if platform == 'windows':
SConscript('state_trackers/wgl/SConscript')
SConscript('winsys/SConscript')
#
# Targets
#
SConscript('targets/SConscript')
SConscript([
'targets/graw-null/SConscript',
])
if env['x11']:
SConscript([
'targets/graw-xlib/SConscript',
'targets/libgl-xlib/SConscript',
])
if env['platform'] == 'windows':
SConscript([
'targets/graw-gdi/SConscript',
'targets/libgl-gdi/SConscript',
#'egl-gdi/SConscript',
])
if env['dri']:
SConscript([
'targets/SConscript.dri',
'targets/dri-swrast/SConscript',
'targets/dri-vmwgfx/SConscript',
#'targets/dri-nouveau/SConscript',
])
if env['drm_intel']:
SConscript([
'targets/dri-i915/SConscript',
'targets/dri-i965/SConscript',
])
if env['drm_radeon']:
SConscript([
'targets/dri-r300/SConscript',
'targets/dri-r600/SConscript',
])
if env['xorg'] and env['drm']:
SConscript([
#'targets/xorg-i915/SConscript',
#'targets/xorg-i965/SConscript',
#'targets/xorg-nouveau/SConscript',
#'targets/xorg-radeon/SConscript',
'targets/xorg-vmwgfx/SConscript',
])
#
# Unit tests & tools
#
if env['platform'] != 'embedded':
SConscript('tests/unit/SConscript')
SConscript('tests/graw/SConscript')
if platform != 'embedded':
SConscript('tests/unit/SConscript')
SConscript('tests/graw/SConscript')

View File

@@ -8,7 +8,6 @@ C_SOURCES = \
cso_cache/cso_context.c \
cso_cache/cso_hash.c \
draw/draw_context.c \
draw/draw_fs.c \
draw/draw_gs.c \
draw/draw_pipe.c \
draw/draw_pipe_aaline.c \
@@ -122,18 +121,17 @@ C_SOURCES = \
util/u_handle_table.c \
util/u_hash.c \
util/u_hash_table.c \
util/u_index_modify.c \
util/u_keymap.c \
util/u_linear.c \
util/u_linkage.c \
util/u_network.c \
util/u_math.c \
util/u_mempool.c \
util/u_mm.c \
util/u_rect.c \
util/u_ringbuffer.c \
util/u_sampler.c \
util/u_simple_shaders.c \
util/u_slab.c \
util/u_snprintf.c \
util/u_staging.c \
util/u_surface.c \
@@ -142,7 +140,8 @@ C_SOURCES = \
util/u_tile.c \
util/u_transfer.c \
util/u_resource.c \
util/u_upload_mgr.c
util/u_upload_mgr.c \
target-helpers/wrap_screen.c
# Disabling until pipe-video branch gets merged in
#vl/vl_bitstream_parser.c \
@@ -154,7 +153,6 @@ C_SOURCES = \
GALLIVM_SOURCES = \
gallivm/lp_bld_arit.c \
gallivm/lp_bld_assert.c \
gallivm/lp_bld_bitarit.c \
gallivm/lp_bld_const.c \
gallivm/lp_bld_conv.c \
gallivm/lp_bld_debug.c \
@@ -170,12 +168,10 @@ GALLIVM_SOURCES = \
gallivm/lp_bld_printf.c \
gallivm/lp_bld_quad.c \
gallivm/lp_bld_sample.c \
gallivm/lp_bld_sample_aos.c \
gallivm/lp_bld_sample_soa.c \
gallivm/lp_bld_struct.c \
gallivm/lp_bld_swizzle.c \
gallivm/lp_bld_tgsi_aos.c \
gallivm/lp_bld_tgsi_info.c \
gallivm/lp_bld_tgsi_soa.c \
gallivm/lp_bld_type.c \
draw/draw_llvm.c \
@@ -185,7 +181,7 @@ GALLIVM_SOURCES = \
draw/draw_pt_fetch_shade_pipeline_llvm.c
GALLIVM_CPP_SOURCES = \
gallivm/lp_bld_misc.cpp
gallivm/lp_bld_misc.cpp
GENERATED_SOURCES = \
indices/u_indices_gen.c \
@@ -203,20 +199,23 @@ CPP_SOURCES += \
endif
LIBRARY_DEFINES += -D__STDC_CONSTANT_MACROS
include ../Makefile.template
indices/u_indices_gen.c: indices/u_indices_gen.py
$(PYTHON2) $< > $@
python $< > $@
indices/u_unfilled_gen.c: indices/u_unfilled_gen.py
$(PYTHON2) $< > $@
python $< > $@
util/u_format_srgb.c: util/u_format_srgb.py
$(PYTHON2) $< > $@
python $< > $@
util/u_format_table.c: util/u_format_table.py util/u_format_pack.py util/u_format_parse.py util/u_format.csv
$(PYTHON2) util/u_format_table.py util/u_format.csv > $@
python util/u_format_table.py util/u_format.csv > $@
util/u_half.c: util/u_half.py
$(PYTHON2) util/u_half.py > $@
python util/u_half.py > $@

View File

@@ -7,6 +7,8 @@ env.Append(CPPPATH = [
'util',
])
env.Tool('udis86')
env.CodeGenerate(
target = 'indices/u_indices_gen.c',
script = 'indices/u_indices_gen.py',
@@ -52,7 +54,6 @@ source = [
'cso_cache/cso_context.c',
'cso_cache/cso_hash.c',
'draw/draw_context.c',
'draw/draw_fs.c',
'draw/draw_gs.c',
'draw/draw_pipe.c',
'draw/draw_pipe_aaline.c',
@@ -169,19 +170,18 @@ source = [
'util/u_handle_table.c',
'util/u_hash.c',
'util/u_hash_table.c',
'util/u_index_modify.c',
'util/u_keymap.c',
'util/u_linear.c',
'util/u_linkage.c',
'util/u_network.c',
'util/u_math.c',
'util/u_mempool.c',
'util/u_mm.c',
'util/u_rect.c',
'util/u_resource.c',
'util/u_ringbuffer.c',
'util/u_sampler.c',
'util/u_simple_shaders.c',
'util/u_slab.c',
'util/u_snprintf.c',
'util/u_staging.c',
'util/u_surface.c',
@@ -196,45 +196,40 @@ source = [
#'vl/vl_compositor.c',
#'vl/vl_csc.c',
#'vl/vl_shader_build.c',
'target-helpers/wrap_screen.c',
]
if env['llvm']:
if env['UDIS86']:
env.Append(CPPDEFINES = [('HAVE_UDIS86', '1')])
source += [
'gallivm/lp_bld_arit.c',
'gallivm/lp_bld_assert.c',
'gallivm/lp_bld_bitarit.c',
'gallivm/lp_bld_const.c',
'gallivm/lp_bld_conv.c',
'gallivm/lp_bld_debug.c',
'gallivm/lp_bld_flow.c',
'gallivm/lp_bld_format_aos.c',
'gallivm/lp_bld_format_soa.c',
'gallivm/lp_bld_format_yuv.c',
'gallivm/lp_bld_gather.c',
'gallivm/lp_bld_init.c',
'gallivm/lp_bld_intr.c',
'gallivm/lp_bld_logic.c',
'gallivm/lp_bld_misc.cpp',
'gallivm/lp_bld_pack.c',
'gallivm/lp_bld_printf.c',
'gallivm/lp_bld_quad.c',
'gallivm/lp_bld_sample.c',
'gallivm/lp_bld_sample_aos.c',
'gallivm/lp_bld_sample_soa.c',
'gallivm/lp_bld_struct.c',
'gallivm/lp_bld_swizzle.c',
'gallivm/lp_bld_tgsi_aos.c',
'gallivm/lp_bld_tgsi_info.c',
'gallivm/lp_bld_tgsi_soa.c',
'gallivm/lp_bld_type.c',
'draw/draw_llvm.c',
'draw/draw_llvm_sample.c',
'draw/draw_llvm_translate.c',
'draw/draw_pt_fetch_shade_pipeline_llvm.c',
'draw/draw_vs_llvm.c'
'gallivm/lp_bld_arit.c',
'gallivm/lp_bld_assert.c',
'gallivm/lp_bld_const.c',
'gallivm/lp_bld_conv.c',
'gallivm/lp_bld_debug.c',
'gallivm/lp_bld_flow.c',
'gallivm/lp_bld_format_aos.c',
'gallivm/lp_bld_format_soa.c',
'gallivm/lp_bld_format_yuv.c',
'gallivm/lp_bld_gather.c',
'gallivm/lp_bld_init.c',
'gallivm/lp_bld_intr.c',
'gallivm/lp_bld_logic.c',
'gallivm/lp_bld_misc.cpp',
'gallivm/lp_bld_pack.c',
'gallivm/lp_bld_printf.c',
'gallivm/lp_bld_quad.c',
'gallivm/lp_bld_sample.c',
'gallivm/lp_bld_sample_soa.c',
'gallivm/lp_bld_struct.c',
'gallivm/lp_bld_swizzle.c',
'gallivm/lp_bld_tgsi_aos.c',
'gallivm/lp_bld_tgsi_soa.c',
'gallivm/lp_bld_type.c',
'draw/draw_llvm.c',
'draw/draw_llvm_sample.c',
'draw/draw_llvm_translate.c',
'draw/draw_pt_fetch_shade_pipeline_llvm.c',
'draw/draw_vs_llvm.c'
]
gallium = env.ConvenienceLibrary(
@@ -242,6 +237,4 @@ gallium = env.ConvenienceLibrary(
source = source,
)
env.Alias('gallium', gallium)
Export('gallium')

View File

@@ -63,32 +63,19 @@ draw_get_option_use_llvm(void)
}
#endif
/**
* Create new draw module context.
*/
struct draw_context *
draw_create(struct pipe_context *pipe)
{
return draw_create_gallivm(pipe, NULL);
}
/**
* Create new draw module context with gallivm state for LLVM JIT.
*/
struct draw_context *
draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm)
struct draw_context *draw_create( struct pipe_context *pipe )
{
struct draw_context *draw = CALLOC_STRUCT( draw_context );
if (draw == NULL)
goto fail;
#if HAVE_LLVM
if (draw_get_option_use_llvm() && gallivm) {
draw->llvm = draw_llvm_create(draw, gallivm);
if(draw_get_option_use_llvm())
{
lp_build_init();
assert(lp_build_engine);
draw->engine = lp_build_engine;
draw->llvm = draw_llvm_create(draw);
}
#endif
@@ -104,8 +91,6 @@ fail:
return NULL;
}
boolean draw_init(struct draw_context *draw)
{
/*
@@ -350,7 +335,6 @@ draw_set_mapped_constant_buffer(struct draw_context *draw,
case PIPE_SHADER_VERTEX:
draw->pt.user.vs_constants[slot] = buffer;
draw->pt.user.vs_constants_size[slot] = size;
draw->pt.user.planes = (float (*) [12][4]) &(draw->plane[0]);
draw_vs_set_constants(draw, slot, buffer, size);
break;
case PIPE_SHADER_GEOMETRY:
@@ -429,42 +413,6 @@ draw_set_force_passthrough( struct draw_context *draw, boolean enable )
}
/**
* Allocate an extra vertex/geometry shader vertex attribute.
* This is used by some of the optional draw module stages such
* as wide_point which may need to allocate additional generic/texcoord
* attributes.
*/
int
draw_alloc_extra_vertex_attrib(struct draw_context *draw,
uint semantic_name, uint semantic_index)
{
const int num_outputs = draw_current_shader_outputs(draw);
const int n = draw->extra_shader_outputs.num;
assert(n < Elements(draw->extra_shader_outputs.semantic_name));
draw->extra_shader_outputs.semantic_name[n] = semantic_name;
draw->extra_shader_outputs.semantic_index[n] = semantic_index;
draw->extra_shader_outputs.slot[n] = num_outputs + n;
draw->extra_shader_outputs.num++;
return draw->extra_shader_outputs.slot[n];
}
/**
* Remove all extra vertex attributes that were allocated with
* draw_alloc_extra_vertex_attrib().
*/
void
draw_remove_extra_vertex_attribs(struct draw_context *draw)
{
draw->extra_shader_outputs.num = 0;
}
/**
* Ask the draw module for the location/slot of the given vertex attribute in
* a post-transformed vertex.
@@ -498,12 +446,12 @@ draw_find_shader_output(const struct draw_context *draw,
return i;
}
/* Search the extra vertex attributes */
for (i = 0; i < draw->extra_shader_outputs.num; i++) {
if (draw->extra_shader_outputs.semantic_name[i] == semantic_name &&
draw->extra_shader_outputs.semantic_index[i] == semantic_index) {
return draw->extra_shader_outputs.slot[i];
}
/* XXX there may be more than one extra vertex attrib.
* For example, simulated gl_FragCoord and gl_PointCoord.
*/
if (draw->extra_shader_outputs.semantic_name == semantic_name &&
draw->extra_shader_outputs.semantic_index == semantic_index) {
return draw->extra_shader_outputs.slot;
}
return 0;
@@ -522,18 +470,16 @@ draw_find_shader_output(const struct draw_context *draw,
uint
draw_num_shader_outputs(const struct draw_context *draw)
{
uint count;
uint count = draw->vs.vertex_shader->info.num_outputs;
/* If a geometry shader is present, its outputs go to the
* driver, else the vertex shader's outputs.
*/
if (draw->gs.geometry_shader)
count = draw->gs.geometry_shader->info.num_outputs;
else
count = draw->vs.vertex_shader->info.num_outputs;
count += draw->extra_shader_outputs.num;
if (draw->extra_shader_outputs.slot > 0)
count++;
return count;
}
@@ -725,11 +671,6 @@ draw_set_samplers(struct draw_context *draw,
draw->samplers[i] = NULL;
draw->num_samplers = num;
#ifdef HAVE_LLVM
if (draw->llvm)
draw_llvm_set_sampler_state(draw);
#endif
}
void
@@ -737,9 +678,9 @@ draw_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS])
uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS],
uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS],
const void *data[DRAW_MAX_TEXTURE_LEVELS])
{
#ifdef HAVE_LLVM
if(draw->llvm)

View File

@@ -46,17 +46,12 @@ struct draw_context;
struct draw_stage;
struct draw_vertex_shader;
struct draw_geometry_shader;
struct draw_fragment_shader;
struct tgsi_sampler;
struct gallivm_state;
#define DRAW_MAX_TEXTURE_LEVELS 13 /* 4K x 4K for now */
struct draw_context *draw_create( struct pipe_context *pipe );
struct draw_context *
draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm);
void draw_destroy( struct draw_context *draw );
void draw_flush(struct draw_context *draw);
@@ -124,9 +119,9 @@ draw_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS]);
uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS],
uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS],
const void *data[DRAW_MAX_TEXTURE_LEVELS]);
/*
@@ -142,17 +137,6 @@ void draw_delete_vertex_shader(struct draw_context *draw,
struct draw_vertex_shader *dvs);
/*
* Fragment shader functions
*/
struct draw_fragment_shader *
draw_create_fragment_shader(struct draw_context *draw,
const struct pipe_shader_state *shader);
void draw_bind_fragment_shader(struct draw_context *draw,
struct draw_fragment_shader *dvs);
void draw_delete_fragment_shader(struct draw_context *draw,
struct draw_fragment_shader *dvs);
/*
* Geometry shader functions
*/

View File

@@ -1,73 +0,0 @@
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "pipe/p_shader_tokens.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_prim.h"
#include "tgsi/tgsi_parse.h"
#include "draw_fs.h"
#include "draw_private.h"
#include "draw_context.h"
struct draw_fragment_shader *
draw_create_fragment_shader(struct draw_context *draw,
const struct pipe_shader_state *shader)
{
struct draw_fragment_shader *dfs;
dfs = CALLOC_STRUCT(draw_fragment_shader);
if (dfs) {
dfs->base = *shader;
tgsi_scan_shader(shader->tokens, &dfs->info);
}
return dfs;
}
void
draw_bind_fragment_shader(struct draw_context *draw,
struct draw_fragment_shader *dfs)
{
draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
draw->fs.fragment_shader = dfs;
}
void
draw_delete_fragment_shader(struct draw_context *draw,
struct draw_fragment_shader *dfs)
{
FREE(dfs);
}

View File

@@ -1,42 +0,0 @@
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef DRAW_FS_H
#define DRAW_FS_H
#include "tgsi/tgsi_scan.h"
struct draw_fragment_shader
{
struct pipe_shader_state base;
struct tgsi_shader_info info;
};
#endif /* DRAW_FS_H */

File diff suppressed because it is too large Load Diff

View File

@@ -41,6 +41,7 @@
#include <llvm-c/Target.h>
#include <llvm-c/ExecutionEngine.h>
#define DRAW_MAX_TEXTURE_LEVELS 13 /* 4K x 4K for now */
struct draw_llvm;
struct llvm_vertex_shader;
@@ -51,13 +52,9 @@ struct draw_jit_texture
uint32_t height;
uint32_t depth;
uint32_t last_level;
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
const void *data[PIPE_MAX_TEXTURE_LEVELS];
float min_lod;
float max_lod;
float lod_bias;
float border_color[4];
uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS];
uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS];
const void *data[DRAW_MAX_TEXTURE_LEVELS];
};
enum {
@@ -68,10 +65,6 @@ enum {
DRAW_JIT_TEXTURE_ROW_STRIDE,
DRAW_JIT_TEXTURE_IMG_STRIDE,
DRAW_JIT_TEXTURE_DATA,
DRAW_JIT_TEXTURE_MIN_LOD,
DRAW_JIT_TEXTURE_MAX_LOD,
DRAW_JIT_TEXTURE_LOD_BIAS,
DRAW_JIT_TEXTURE_BORDER_COLOR,
DRAW_JIT_TEXTURE_NUM_FIELDS /* number of fields above */
};
@@ -96,51 +89,46 @@ struct draw_jit_context
{
const float *vs_constants;
const float *gs_constants;
float (*planes) [12][4];
float *viewport;
struct draw_jit_texture textures[PIPE_MAX_VERTEX_SAMPLERS];
};
#define draw_jit_context_vs_constants(_gallivm, _ptr) \
lp_build_struct_get(_gallivm, _ptr, 0, "vs_constants")
#define draw_jit_context_vs_constants(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 0, "vs_constants")
#define draw_jit_context_gs_constants(_gallivm, _ptr) \
lp_build_struct_get(_gallivm, _ptr, 1, "gs_constants")
#define draw_jit_context_gs_constants(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 1, "gs_constants")
#define draw_jit_context_planes(_gallivm, _ptr) \
lp_build_struct_get(_gallivm, _ptr, 2, "planes")
#define DRAW_JIT_CTX_TEXTURES 2
#define draw_jit_context_viewport(_gallivm, _ptr) \
lp_build_struct_get(_gallivm, _ptr, 3, "viewport")
#define DRAW_JIT_CTX_TEXTURES 4
#define draw_jit_context_textures(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_TEXTURES, "textures")
#define draw_jit_header_id(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, 0, "id")
#define draw_jit_header_clip(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, 1, "clip")
#define draw_jit_header_data(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, 2, "data")
#define draw_jit_context_textures(_builder, _ptr) \
lp_build_struct_get_ptr(_builder, _ptr, DRAW_JIT_CTX_TEXTURES, "textures")
#define draw_jit_vbuffer_stride(_gallivm, _ptr) \
lp_build_struct_get(_gallivm, _ptr, 0, "stride")
#define draw_jit_vbuffer_max_index(_gallivm, _ptr) \
lp_build_struct_get(_gallivm, _ptr, 1, "max_index")
#define draw_jit_header_id(_builder, _ptr) \
lp_build_struct_get_ptr(_builder, _ptr, 0, "id")
#define draw_jit_vbuffer_offset(_gallivm, _ptr) \
lp_build_struct_get(_gallivm, _ptr, 2, "buffer_offset")
#define draw_jit_header_clip(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 1, "clip")
#define draw_jit_header_data(_builder, _ptr) \
lp_build_struct_get_ptr(_builder, _ptr, 2, "data")
typedef int
#define draw_jit_vbuffer_stride(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 0, "stride")
#define draw_jit_vbuffer_max_index(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 1, "max_index")
#define draw_jit_vbuffer_offset(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 2, "buffer_offset")
typedef void
(*draw_jit_vert_func)(struct draw_jit_context *context,
struct vertex_header *io,
const char *vbuffers[PIPE_MAX_ATTRIBS],
@@ -151,7 +139,7 @@ typedef int
unsigned instance_id);
typedef int
typedef void
(*draw_jit_vert_func_elts)(struct draw_jit_context *context,
struct vertex_header *io,
const char *vbuffers[PIPE_MAX_ATTRIBS],
@@ -163,16 +151,8 @@ typedef int
struct draw_llvm_variant_key
{
unsigned nr_vertex_elements:8;
unsigned nr_samplers:8;
unsigned clip_xy:1;
unsigned clip_z:1;
unsigned clip_user:1;
unsigned clip_halfz:1;
unsigned bypass_viewport:1;
unsigned need_edgeflags:1;
unsigned nr_planes:4;
unsigned pad:6;
unsigned nr_vertex_elements:16;
unsigned nr_samplers:16;
/* Variable number of vertex elements:
*/
@@ -246,19 +226,21 @@ struct draw_llvm {
struct draw_jit_context jit_context;
struct gallivm_state *gallivm;
struct draw_llvm_variant_list_item vs_variants_list;
int nr_variants;
/* LLVM JIT builder types */
LLVMModuleRef module;
LLVMExecutionEngineRef engine;
LLVMModuleProviderRef provider;
LLVMTargetDataRef target;
LLVMPassManagerRef pass;
LLVMTypeRef context_ptr_type;
LLVMTypeRef vertex_header_ptr_type;
LLVMTypeRef buffer_ptr_type;
LLVMTypeRef vb_ptr_type;
LLVMTypeRef vertex_header_ptr_type;
};
static INLINE struct llvm_vertex_shader *
llvm_vertex_shader(struct draw_vertex_shader *vs)
{
@@ -267,7 +249,7 @@ llvm_vertex_shader(struct draw_vertex_shader *vs)
struct draw_llvm *
draw_llvm_create(struct draw_context *draw, struct gallivm_state *gallivm);
draw_llvm_create(struct draw_context *draw);
void
draw_llvm_destroy(struct draw_llvm *llvm);
@@ -284,7 +266,7 @@ struct draw_llvm_variant_key *
draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
LLVMValueRef
draw_llvm_translate_from(struct gallivm_state *gallivm,
draw_llvm_translate_from(LLVMBuilderRef builder,
LLVMValueRef vbuffer,
enum pipe_format from_format);
@@ -292,16 +274,13 @@ struct lp_build_sampler_soa *
draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
LLVMValueRef context_ptr);
void
draw_llvm_set_sampler_state(struct draw_context *draw);
void
draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS]);
uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS],
uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS],
const void *data[DRAW_MAX_TEXTURE_LEVELS]);
#endif

View File

@@ -32,7 +32,6 @@
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
#include "gallivm/lp_bld_const.h"
#include "gallivm/lp_bld_debug.h"
#include "gallivm/lp_bld_type.h"
#include "gallivm/lp_bld_sample.h"
@@ -85,13 +84,12 @@ struct draw_llvm_sampler_soa
*/
static LLVMValueRef
draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
struct gallivm_state *gallivm,
LLVMBuilderRef builder,
unsigned unit,
unsigned member_index,
const char *member_name,
boolean emit_load)
{
LLVMBuilderRef builder = gallivm->builder;
struct draw_llvm_sampler_dynamic_state *state =
(struct draw_llvm_sampler_dynamic_state *)base;
LLVMValueRef indices[4];
@@ -101,13 +99,13 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
debug_assert(unit < PIPE_MAX_VERTEX_SAMPLERS);
/* context[0] */
indices[0] = lp_build_const_int32(gallivm, 0);
indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
/* context[0].textures */
indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_TEXTURES);
indices[1] = LLVMConstInt(LLVMInt32Type(), DRAW_JIT_CTX_TEXTURES, 0);
/* context[0].textures[unit] */
indices[2] = lp_build_const_int32(gallivm, unit);
indices[2] = LLVMConstInt(LLVMInt32Type(), unit, 0);
/* context[0].textures[unit].member */
indices[3] = lp_build_const_int32(gallivm, member_index);
indices[3] = LLVMConstInt(LLVMInt32Type(), member_index, 0);
ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), "");
@@ -134,10 +132,10 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
#define DRAW_LLVM_TEXTURE_MEMBER(_name, _index, _emit_load) \
static LLVMValueRef \
draw_llvm_texture_##_name( const struct lp_sampler_dynamic_state *base, \
struct gallivm_state *gallivm, \
LLVMBuilderRef builder, \
unsigned unit) \
{ \
return draw_llvm_texture_member(base, gallivm, unit, _index, #_name, _emit_load ); \
return draw_llvm_texture_member(base, builder, unit, _index, #_name, _emit_load ); \
}
@@ -148,10 +146,6 @@ DRAW_LLVM_TEXTURE_MEMBER(last_level, DRAW_JIT_TEXTURE_LAST_LEVEL, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(row_stride, DRAW_JIT_TEXTURE_ROW_STRIDE, FALSE)
DRAW_LLVM_TEXTURE_MEMBER(img_stride, DRAW_JIT_TEXTURE_IMG_STRIDE, FALSE)
DRAW_LLVM_TEXTURE_MEMBER(data_ptr, DRAW_JIT_TEXTURE_DATA, FALSE)
DRAW_LLVM_TEXTURE_MEMBER(min_lod, DRAW_JIT_TEXTURE_MIN_LOD, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(max_lod, DRAW_JIT_TEXTURE_MAX_LOD, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(lod_bias, DRAW_JIT_TEXTURE_LOD_BIAS, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(border_color, DRAW_JIT_TEXTURE_BORDER_COLOR, FALSE)
static void
@@ -167,7 +161,7 @@ draw_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
*/
static void
draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
struct gallivm_state *gallivm,
LLVMBuilderRef builder,
struct lp_type type,
unsigned unit,
unsigned num_coords,
@@ -182,7 +176,7 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
assert(unit < PIPE_MAX_VERTEX_SAMPLERS);
lp_build_sample_soa(gallivm,
lp_build_sample_soa(builder,
&sampler->dynamic_state.static_state[unit],
&sampler->dynamic_state.base,
type,
@@ -213,10 +207,6 @@ draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
sampler->dynamic_state.base.row_stride = draw_llvm_texture_row_stride;
sampler->dynamic_state.base.img_stride = draw_llvm_texture_img_stride;
sampler->dynamic_state.base.data_ptr = draw_llvm_texture_data_ptr;
sampler->dynamic_state.base.min_lod = draw_llvm_texture_min_lod;
sampler->dynamic_state.base.max_lod = draw_llvm_texture_max_lod;
sampler->dynamic_state.base.lod_bias = draw_llvm_texture_lod_bias;
sampler->dynamic_state.base.border_color = draw_llvm_texture_border_color;
sampler->dynamic_state.static_state = static_state;
sampler->dynamic_state.context_ptr = context_ptr;

View File

@@ -3,7 +3,7 @@
#include "draw_llvm.h"
#include "gallivm/lp_bld_const.h"
#include "gallivm/lp_bld_arit.h"
#include "gallivm/lp_bld_struct.h"
#include "gallivm/lp_bld_format.h"
#include "gallivm/lp_bld_debug.h"
@@ -17,279 +17,272 @@
#define DRAW_DBG 0
static LLVMValueRef
from_64_float(struct gallivm_state *gallivm, LLVMValueRef val)
from_64_float(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMDoubleTypeInContext(gallivm->context), 0) , "");
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
return LLVMBuildFPTrunc(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMDoubleType(), 0) , "");
LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
return LLVMBuildFPTrunc(builder, l, LLVMFloatType(), "");
}
static LLVMValueRef
from_32_float(struct gallivm_state *gallivm, LLVMValueRef val)
from_32_float(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMFloatTypeInContext(gallivm->context), 0) , "");
return LLVMBuildLoad(gallivm->builder, bc, "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMFloatType(), 0) , "");
return LLVMBuildLoad(builder, bc, "");
}
static INLINE LLVMValueRef
from_8_uscaled(struct gallivm_state *gallivm, LLVMValueRef val)
from_8_uscaled(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, val, "");
return LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
LLVMValueRef l = LLVMBuildLoad(builder, val, "");
return LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
}
static INLINE LLVMValueRef
from_16_uscaled(struct gallivm_state *gallivm, LLVMValueRef val)
from_16_uscaled(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 16), 0) , "");
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
return LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMIntType(16), 0) , "");
LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
return LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
}
static INLINE LLVMValueRef
from_32_uscaled(struct gallivm_state *gallivm, LLVMValueRef val)
from_32_uscaled(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 32), 0) , "");
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
return LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMIntType(32), 0) , "");
LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
return LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
}
static INLINE LLVMValueRef
from_8_sscaled(struct gallivm_state *gallivm, LLVMValueRef val)
from_8_sscaled(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, val, "");
return LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
LLVMValueRef l = LLVMBuildLoad(builder, val, "");
return LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
}
static INLINE LLVMValueRef
from_16_sscaled(struct gallivm_state *gallivm, LLVMValueRef val)
from_16_sscaled(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 16), 0) , "");
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
return LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMIntType(16), 0) , "");
LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
return LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
}
static INLINE LLVMValueRef
from_32_sscaled(struct gallivm_state *gallivm, LLVMValueRef val)
from_32_sscaled(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 32), 0) , "");
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
return LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMIntType(32), 0) , "");
LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
return LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
}
static INLINE LLVMValueRef
from_8_unorm(struct gallivm_state *gallivm, LLVMValueRef val)
from_8_unorm(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, val, "");
LLVMValueRef uscaled = LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
return LLVMBuildFDiv(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 255.), "");
LLVMValueRef l = LLVMBuildLoad(builder, val, "");
LLVMValueRef uscaled = LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
return LLVMBuildFDiv(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 255.), "");
}
static INLINE LLVMValueRef
from_16_unorm(struct gallivm_state *gallivm, LLVMValueRef val)
from_16_unorm(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 16), 0) , "");
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
LLVMValueRef uscaled = LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
return LLVMBuildFDiv(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 65535.), "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMIntType(16), 0) , "");
LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
LLVMValueRef uscaled = LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
return LLVMBuildFDiv(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 65535.), "");
}
static INLINE LLVMValueRef
from_32_unorm(struct gallivm_state *gallivm, LLVMValueRef val)
from_32_unorm(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 32), 0) , "");
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
LLVMValueRef uscaled = LLVMBuildUIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMIntType(32), 0) , "");
LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
LLVMValueRef uscaled = LLVMBuildUIToFP(builder, l, LLVMFloatType(), "");
return LLVMBuildFDiv(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 4294967295.), "");
return LLVMBuildFDiv(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 4294967295.), "");
}
static INLINE LLVMValueRef
from_8_snorm(struct gallivm_state *gallivm, LLVMValueRef val)
from_8_snorm(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, val, "");
LLVMValueRef uscaled = LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
return LLVMBuildFDiv(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 127.0), "");
LLVMValueRef l = LLVMBuildLoad(builder, val, "");
LLVMValueRef uscaled = LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
return LLVMBuildFDiv(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 127.0), "");
}
static INLINE LLVMValueRef
from_16_snorm(struct gallivm_state *gallivm, LLVMValueRef val)
from_16_snorm(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 16), 0) , "");
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
LLVMValueRef uscaled = LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
return LLVMBuildFDiv(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 32767.0f), "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMIntType(16), 0) , "");
LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
LLVMValueRef uscaled = LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
return LLVMBuildFDiv(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 32767.0f), "");
}
static INLINE LLVMValueRef
from_32_snorm(struct gallivm_state *gallivm, LLVMValueRef val)
from_32_snorm(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 32), 0) , "");
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
LLVMValueRef uscaled = LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMIntType(32), 0) , "");
LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
LLVMValueRef uscaled = LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
return LLVMBuildFDiv(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 2147483647.0), "");
return LLVMBuildFDiv(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 2147483647.0), "");
}
static INLINE LLVMValueRef
from_32_fixed(struct gallivm_state *gallivm, LLVMValueRef val)
from_32_fixed(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef bc = LLVMBuildBitCast(gallivm->builder, val,
LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 32), 0) , "");
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, bc, "");
LLVMValueRef uscaled = LLVMBuildSIToFP(gallivm->builder, l, LLVMFloatTypeInContext(gallivm->context), "");
LLVMValueRef bc = LLVMBuildBitCast(builder, val,
LLVMPointerType(LLVMIntType(32), 0) , "");
LLVMValueRef l = LLVMBuildLoad(builder, bc, "");
LLVMValueRef uscaled = LLVMBuildSIToFP(builder, l, LLVMFloatType(), "");
return LLVMBuildFDiv(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 65536.0), "");
return LLVMBuildFDiv(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 65536.0), "");
}
static LLVMValueRef
to_64_float(struct gallivm_state *gallivm, LLVMValueRef fp)
to_64_float(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
return LLVMBuildFPExt(gallivm->builder, l, LLVMDoubleTypeInContext(gallivm->context), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
return LLVMBuildFPExt(builder, l, LLVMDoubleType(), "");
}
static LLVMValueRef
to_32_float(struct gallivm_state *gallivm, LLVMValueRef fp)
to_32_float(LLVMBuilderRef builder, LLVMValueRef fp)
{
return LLVMBuildLoad(gallivm->builder, fp, "");
return LLVMBuildLoad(builder, fp, "");
}
static INLINE LLVMValueRef
to_8_uscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
to_8_uscaled(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
return LLVMBuildFPToUI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 8), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
return LLVMBuildFPToUI(builder, l, LLVMIntType(8), "");
}
static INLINE LLVMValueRef
to_16_uscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
to_16_uscaled(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
return LLVMBuildFPToUI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 16), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
return LLVMBuildFPToUI(builder, l, LLVMIntType(16), "");
}
static INLINE LLVMValueRef
to_32_uscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
to_32_uscaled(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
return LLVMBuildFPToUI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 32), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
return LLVMBuildFPToUI(builder, l, LLVMIntType(32), "");
}
static INLINE LLVMValueRef
to_8_sscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
to_8_sscaled(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
return LLVMBuildFPToSI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 8), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
return LLVMBuildFPToSI(builder, l, LLVMIntType(8), "");
}
static INLINE LLVMValueRef
to_16_sscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
to_16_sscaled(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
return LLVMBuildFPToSI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 16), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
return LLVMBuildFPToSI(builder, l, LLVMIntType(16), "");
}
static INLINE LLVMValueRef
to_32_sscaled(struct gallivm_state *gallivm, LLVMValueRef fp)
to_32_sscaled(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
return LLVMBuildFPToSI(gallivm->builder, l, LLVMIntTypeInContext(gallivm->context, 32), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
return LLVMBuildFPToSI(builder, l, LLVMIntType(32), "");
}
static INLINE LLVMValueRef
to_8_unorm(struct gallivm_state *gallivm, LLVMValueRef fp)
to_8_unorm(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToUI(gallivm->builder, l,
LLVMIntTypeInContext(gallivm->context, 8), "");
return LLVMBuildFMul(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 255.), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToUI(builder, l, LLVMIntType(8), "");
return LLVMBuildFMul(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 255.), "");
}
static INLINE LLVMValueRef
to_16_unorm(struct gallivm_state *gallivm, LLVMValueRef fp)
to_16_unorm(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToUI(gallivm->builder, l,
LLVMIntTypeInContext(gallivm->context, 32), "");
return LLVMBuildFMul(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 65535.), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToUI(builder, l, LLVMIntType(32), "");
return LLVMBuildFMul(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 65535.), "");
}
static INLINE LLVMValueRef
to_32_unorm(struct gallivm_state *gallivm, LLVMValueRef fp)
to_32_unorm(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToUI(gallivm->builder, l,
LLVMIntTypeInContext(gallivm->context, 32), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToUI(builder, l, LLVMIntType(32), "");
return LLVMBuildFMul(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 4294967295.), "");
return LLVMBuildFMul(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 4294967295.), "");
}
static INLINE LLVMValueRef
to_8_snorm(struct gallivm_state *gallivm, LLVMValueRef val)
to_8_snorm(LLVMBuilderRef builder, LLVMValueRef val)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, val, "");
LLVMValueRef uscaled = LLVMBuildFPToSI(gallivm->builder, l,
LLVMIntTypeInContext(gallivm->context, 8), "");
return LLVMBuildFMul(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 127.0), "");
LLVMValueRef l = LLVMBuildLoad(builder, val, "");
LLVMValueRef uscaled = LLVMBuildFPToSI(builder, l, LLVMIntType(8), "");
return LLVMBuildFMul(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 127.0), "");
}
static INLINE LLVMValueRef
to_16_snorm(struct gallivm_state *gallivm, LLVMValueRef fp)
to_16_snorm(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToSI(gallivm->builder, l,
LLVMIntTypeInContext(gallivm->context, 16), "");
return LLVMBuildFMul(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 32767.0f), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToSI(builder, l, LLVMIntType(16), "");
return LLVMBuildFMul(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 32767.0f), "");
}
static INLINE LLVMValueRef
to_32_snorm(struct gallivm_state *gallivm, LLVMValueRef fp)
to_32_snorm(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToSI(gallivm->builder, l,
LLVMIntTypeInContext(gallivm->context, 32), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToSI(builder, l, LLVMIntType(32), "");
return LLVMBuildFMul(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 2147483647.0), "");
return LLVMBuildFMul(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 2147483647.0), "");
}
static INLINE LLVMValueRef
to_32_fixed(struct gallivm_state *gallivm, LLVMValueRef fp)
to_32_fixed(LLVMBuilderRef builder, LLVMValueRef fp)
{
LLVMValueRef l = LLVMBuildLoad(gallivm->builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToSI(gallivm->builder, l,
LLVMIntTypeInContext(gallivm->context, 32), "");
LLVMValueRef l = LLVMBuildLoad(builder, fp, "");
LLVMValueRef uscaled = LLVMBuildFPToSI(builder, l, LLVMIntType(32), "");
return LLVMBuildFMul(gallivm->builder, uscaled,
lp_build_const_float(gallivm, 65536.0), "");
return LLVMBuildFMul(builder, uscaled,
LLVMConstReal(LLVMFloatType(), 65536.0), "");
}
typedef LLVMValueRef (*from_func)(struct gallivm_state *, LLVMValueRef);
typedef LLVMValueRef (*to_func)(struct gallivm_state *, LLVMValueRef);
typedef LLVMValueRef (*from_func)(LLVMBuilderRef, LLVMValueRef);
typedef LLVMValueRef (*to_func)(LLVMBuilderRef, LLVMValueRef);
/* so that underneath can avoid function calls which are prohibited
* for static initialization we need this conversion */
@@ -302,21 +295,21 @@ enum ll_type {
};
static INLINE LLVMTypeRef
ll_type_to_llvm(struct gallivm_state *gallivm, enum ll_type type)
ll_type_to_llvm(enum ll_type type)
{
switch (type) {
case LL_Double:
return LLVMDoubleTypeInContext(gallivm->context);
return LLVMDoubleType();
case LL_Float:
return LLVMFloatTypeInContext(gallivm->context);
return LLVMFloatType();
case LL_Int32:
return LLVMInt32TypeInContext(gallivm->context);
return LLVMInt32Type();
case LL_Int16:
return LLVMIntTypeInContext(gallivm->context, 16);
return LLVMIntType(16);
case LL_Int8:
return LLVMIntTypeInContext(gallivm->context, 8);
return LLVMIntType(8);
}
return LLVMIntTypeInContext(gallivm->context, 8);
return LLVMIntType(8);
}
static INLINE int
@@ -422,42 +415,42 @@ struct draw_llvm_translate {
static LLVMValueRef
fetch(struct gallivm_state *gallivm,
fetch(LLVMBuilderRef builder,
LLVMValueRef ptr, int val_size, int nr_components,
from_func func)
{
int i;
int offset = 0;
LLVMValueRef res =
LLVMConstNull(LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4));
LLVMValueRef res = LLVMConstNull(
LLVMVectorType(LLVMFloatType(), 4));
LLVMValueRef defaults[4];
defaults[0] =
defaults[1] =
defaults[2] = lp_build_const_float(gallivm, 0.0);
defaults[3] = lp_build_const_float(gallivm, 1.0);
defaults[0] = LLVMConstReal(LLVMFloatType(), 0);
defaults[1] = LLVMConstReal(LLVMFloatType(), 0);
defaults[2] = LLVMConstReal(LLVMFloatType(), 0);
defaults[3] = LLVMConstReal(LLVMFloatType(), 1);
for (i = 0; i < nr_components; ++i) {
LLVMValueRef src_index = lp_build_const_int32(gallivm, offset);
LLVMValueRef dst_index = lp_build_const_int32(gallivm, i);
LLVMValueRef src_index = LLVMConstInt(LLVMInt32Type(), offset, 0);
LLVMValueRef dst_index = LLVMConstInt(LLVMInt32Type(), i, 0);
LLVMValueRef src_tmp;
LLVMValueRef component;
src_tmp = LLVMBuildGEP(gallivm->builder, ptr, &src_index, 1, "src_tmp");
src_tmp = LLVMBuildGEP(builder, ptr, &src_index, 1, "src_tmp");
/* convert src_tmp to float */
component = func(gallivm, src_tmp);
component = func(builder, src_tmp);
/* vec.comp = component */
res = LLVMBuildInsertElement(gallivm->builder,
res = LLVMBuildInsertElement(builder,
res,
component,
dst_index, "");
offset += val_size;
}
for (; i < 4; ++i) {
LLVMValueRef dst_index = lp_build_const_int32(gallivm, i);
res = LLVMBuildInsertElement(gallivm->builder,
LLVMValueRef dst_index = LLVMConstInt(LLVMInt32Type(), i, 0);
res = LLVMBuildInsertElement(builder,
res,
defaults[i],
dst_index, "");
@@ -467,7 +460,7 @@ fetch(struct gallivm_state *gallivm,
LLVMValueRef
draw_llvm_translate_from(struct gallivm_state *gallivm,
draw_llvm_translate_from(LLVMBuilderRef builder,
LLVMValueRef vbuffer,
enum pipe_format from_format)
{
@@ -484,7 +477,7 @@ draw_llvm_translate_from(struct gallivm_state *gallivm,
for (i = 0; i < Elements(translates); ++i) {
if (translates[i].format == from_format) {
/*LLVMTypeRef type = ll_type_to_llvm(translates[i].type);*/
return fetch(gallivm,
return fetch(builder,
vbuffer,
ll_type_size(translates[i].type),
translates[i].num_components,
@@ -501,6 +494,6 @@ draw_llvm_translate_from(struct gallivm_state *gallivm,
*/
format_desc = util_format_description(from_format);
zero = LLVMConstNull(LLVMInt32TypeInContext(gallivm->context));
return lp_build_fetch_rgba_aos(gallivm, format_desc, type, vbuffer, zero, zero, zero);
zero = LLVMConstNull(LLVMInt32Type());
return lp_build_fetch_rgba_aos(builder, format_desc, type, vbuffer, zero, zero, zero);
}

View File

@@ -406,7 +406,6 @@ aaline_create_texture(struct aaline_stage *aaline)
texTemp.width0 = 1 << MAX_TEXTURE_LEVEL;
texTemp.height0 = 1 << MAX_TEXTURE_LEVEL;
texTemp.depth0 = 1;
texTemp.array_size = 1;
texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
aaline->texture = screen->resource_create(screen, &texTemp);
@@ -442,10 +441,10 @@ aaline_create_texture(struct aaline_stage *aaline)
/* This texture is new, no need to flush.
*/
transfer = pipe->get_transfer(pipe,
aaline->texture,
level,
PIPE_TRANSFER_WRITE,
&box);
aaline->texture,
u_subresource(0, level),
PIPE_TRANSFER_WRITE,
&box);
data = pipe->transfer_map(pipe, transfer);
if (data == NULL)
@@ -689,9 +688,10 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header)
aaline->tex_slot = draw_current_shader_outputs(draw);
aaline->pos_slot = draw_current_shader_position_output(draw);;
/* allocate the extra post-transformed vertex attribute */
(void) draw_alloc_extra_vertex_attrib(draw, TGSI_SEMANTIC_GENERIC,
aaline->fs->generic_attrib);
/* advertise the extra post-transformed vertex attribute */
draw->extra_shader_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
draw->extra_shader_outputs.semantic_index = aaline->fs->generic_attrib;
draw->extra_shader_outputs.slot = aaline->tex_slot;
/* how many samplers? */
/* we'll use sampler/texture[pstip->sampler_unit] for the stipple */
@@ -744,7 +744,7 @@ aaline_flush(struct draw_stage *stage, unsigned flags)
draw->suspend_flushing = FALSE;
draw_remove_extra_vertex_attribs(draw);
draw->extra_shader_outputs.slot = 0;
}

View File

@@ -701,9 +701,9 @@ aapoint_first_point(struct draw_stage *stage, struct prim_header *header)
aapoint->pos_slot = draw_current_shader_position_output(draw);
/* allocate the extra post-transformed vertex attribute */
(void) draw_alloc_extra_vertex_attrib(draw, TGSI_SEMANTIC_GENERIC,
aapoint->fs->generic_attrib);
draw->extra_shader_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
draw->extra_shader_outputs.semantic_index = aapoint->fs->generic_attrib;
draw->extra_shader_outputs.slot = aapoint->tex_slot;
/* find psize slot in post-transform vertex */
aapoint->psize_slot = -1;
@@ -754,7 +754,7 @@ aapoint_flush(struct draw_stage *stage, unsigned flags)
draw->suspend_flushing = FALSE;
draw_remove_extra_vertex_attribs(draw);
draw->extra_shader_outputs.slot = 0;
}

View File

@@ -393,8 +393,8 @@ pstip_update_texture(struct pstip_stage *pstip)
*/
pipe->flush( pipe, PIPE_FLUSH_TEXTURE_CACHE, NULL );
transfer = pipe_get_transfer(pipe, pstip->texture, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0, 32, 32);
transfer = pipe_get_transfer(pipe, pstip->texture, 0, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0, 32, 32);
data = pipe->transfer_map(pipe, transfer);
/*
@@ -440,7 +440,6 @@ pstip_create_texture(struct pstip_stage *pstip)
texTemp.width0 = 32;
texTemp.height0 = 32;
texTemp.depth0 = 1;
texTemp.array_size = 1;
texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
pstip->texture = screen->resource_create(screen, &texTemp);

View File

@@ -172,7 +172,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
wide_lines = (rast->line_width > draw->pipeline.wide_line_threshold
&& !rast->line_smooth);
/* drawing large/sprite points (but not AA points)? */
/* drawing large points? */
if (rast->sprite_coord_enable && draw->pipeline.point_sprite)
wide_points = TRUE;
else if (rast->point_smooth && draw->pipeline.aapoint)
@@ -207,7 +207,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
precalc_flat = TRUE;
}
if (wide_points) {
if (wide_points || rast->sprite_coord_enable) {
draw->pipeline.wide_point->next = next;
next = draw->pipeline.wide_point;
}

View File

@@ -57,24 +57,26 @@
#include "util/u_memory.h"
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
#include "draw_fs.h"
#include "draw_vs.h"
#include "draw_pipe.h"
struct widepoint_stage {
struct draw_stage stage; /**< base class */
struct draw_stage stage;
float half_point_size;
float xbias;
float ybias;
/** for automatic texcoord generation/replacement */
uint num_texcoord_gen;
uint texcoord_gen_slot[PIPE_MAX_SHADER_OUTPUTS];
uint texcoord_slot[PIPE_MAX_SHADER_OUTPUTS];
uint texcoord_enable[PIPE_MAX_SHADER_OUTPUTS];
uint num_texcoords;
uint texcoord_mode;
int psize_slot;
int point_coord_fs_input; /**< input for pointcoord */
};
@@ -94,20 +96,30 @@ widepoint_stage( struct draw_stage *stage )
static void set_texcoords(const struct widepoint_stage *wide,
struct vertex_header *v, const float tc[4])
{
const struct draw_context *draw = wide->stage.draw;
const struct pipe_rasterizer_state *rast = draw->rasterizer;
const uint texcoord_mode = rast->sprite_coord_mode;
uint i;
for (i = 0; i < wide->num_texcoords; i++) {
if (wide->texcoord_enable[i]) {
uint j = wide->texcoord_slot[i];
v->data[j][0] = tc[0];
if (wide->texcoord_mode == PIPE_SPRITE_COORD_LOWER_LEFT)
v->data[j][1] = 1.0f - tc[1];
else
v->data[j][1] = tc[1];
v->data[j][2] = tc[2];
v->data[j][3] = tc[3];
}
}
for (i = 0; i < wide->num_texcoord_gen; i++) {
const uint slot = wide->texcoord_gen_slot[i];
if (wide->point_coord_fs_input >= 0) {
/* put gl_PointCoord into the extra vertex slot */
uint slot = wide->stage.draw->extra_shader_outputs.slot;
v->data[slot][0] = tc[0];
if (texcoord_mode == PIPE_SPRITE_COORD_LOWER_LEFT)
if (wide->texcoord_mode == PIPE_SPRITE_COORD_LOWER_LEFT)
v->data[slot][1] = 1.0f - tc[1];
else
v->data[slot][1] = tc[1];
v->data[slot][2] = tc[2];
v->data[slot][3] = tc[3];
v->data[slot][2] = 0.0F;
v->data[slot][3] = 1.0F;
}
}
@@ -189,9 +201,18 @@ static void widepoint_point( struct draw_stage *stage,
}
static void
widepoint_first_point(struct draw_stage *stage,
struct prim_header *header)
static int
find_pntc_input_attrib(struct draw_context *draw)
{
/* Scan the fragment program's input decls to find the pointcoord
* attribute. The xy components will store the point coord.
*/
return 0; /* XXX fix this */
}
static void widepoint_first_point( struct draw_stage *stage,
struct prim_header *header )
{
struct widepoint_stage *wide = widepoint_stage(stage);
struct draw_context *draw = stage->draw;
@@ -223,49 +244,31 @@ widepoint_first_point(struct draw_stage *stage,
stage->point = draw_pipe_passthrough_point;
}
draw_remove_extra_vertex_attribs(draw);
if (rast->point_quad_rasterization) {
const struct draw_fragment_shader *fs = draw->fs.fragment_shader;
uint i;
wide->num_texcoord_gen = 0;
/* Loop over fragment shader inputs looking for generic inputs
* for which bit 'k' in sprite_coord_enable is set.
*/
for (i = 0; i < fs->info.num_inputs; i++) {
if (fs->info.input_semantic_name[i] == TGSI_SEMANTIC_GENERIC) {
const int generic_index = fs->info.input_semantic_index[i];
/* Note that sprite_coord enable is a bitfield of
* PIPE_MAX_SHADER_OUTPUTS bits.
*/
if (generic_index < PIPE_MAX_SHADER_OUTPUTS &&
(rast->sprite_coord_enable & (1 << generic_index))) {
/* OK, this generic attribute needs to be replaced with a
* texcoord (see above).
*/
int slot = draw_find_shader_output(draw,
TGSI_SEMANTIC_GENERIC,
generic_index);
if (slot > 0) {
/* there's already a post-vertex shader attribute
* for this fragment shader input attribute.
*/
}
else {
/* need to allocate a new post-vertex shader attribute */
slot = draw_alloc_extra_vertex_attrib(draw,
TGSI_SEMANTIC_GENERIC,
generic_index);
}
/* add this slot to the texcoord-gen list */
wide->texcoord_gen_slot[wide->num_texcoord_gen++] = slot;
}
/* find vertex shader texcoord outputs */
const struct draw_vertex_shader *vs = draw->vs.vertex_shader;
uint i, j = 0;
wide->texcoord_mode = rast->sprite_coord_mode;
for (i = 0; i < vs->info.num_outputs; i++) {
if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_GENERIC) {
wide->texcoord_slot[j] = i;
wide->texcoord_enable[j] = (rast->sprite_coord_enable >> j) & 1;
j++;
}
}
wide->num_texcoords = j;
/* find fragment shader PointCoord input */
wide->point_coord_fs_input = find_pntc_input_attrib(draw);
/* setup extra vp output (point coord implemented as a texcoord) */
draw->extra_shader_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
draw->extra_shader_outputs.semantic_index = 0;
draw->extra_shader_outputs.slot = draw_current_shader_outputs(draw);
}
else {
wide->point_coord_fs_input = -1;
draw->extra_shader_outputs.slot = 0;
}
wide->psize_slot = -1;
@@ -292,8 +295,7 @@ static void widepoint_flush( struct draw_stage *stage, unsigned flags )
stage->point = widepoint_first_point;
stage->next->flush( stage->next, flags );
draw_remove_extra_vertex_attribs(draw);
stage->draw->extra_shader_outputs.slot = 0;
/* restore original rasterizer state */
if (draw->rast_handle) {

View File

@@ -169,9 +169,6 @@ struct draw_context
unsigned vs_constants_size[PIPE_MAX_CONSTANT_BUFFERS];
const void *gs_constants[PIPE_MAX_CONSTANT_BUFFERS];
unsigned gs_constants_size[PIPE_MAX_CONSTANT_BUFFERS];
/* pointer to planes */
float (*planes)[12][4];
} user;
boolean test_fse; /* enable FSE even though its not correct (eg for softpipe) */
@@ -253,11 +250,6 @@ struct draw_context
struct tgsi_sampler **samplers;
} gs;
/** Fragment shader state */
struct {
struct draw_fragment_shader *fragment_shader;
} fs;
/** Stream output (vertex feedback) state */
struct {
struct pipe_stream_output_state state;
@@ -274,10 +266,9 @@ struct draw_context
/* If a prim stage introduces new vertex attributes, they'll be stored here
*/
struct {
uint num;
uint semantic_name[10];
uint semantic_index[10];
uint slot[10];
uint semantic_name;
uint semantic_index;
int slot;
} extra_shader_outputs;
unsigned reduced_prim;
@@ -286,6 +277,7 @@ struct draw_context
#ifdef HAVE_LLVM
struct draw_llvm *llvm;
LLVMExecutionEngineRef engine;
#endif
struct pipe_sampler_view *sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
@@ -370,11 +362,6 @@ void draw_gs_destroy( struct draw_context *draw );
uint draw_current_shader_outputs(const struct draw_context *draw);
uint draw_current_shader_position_output(const struct draw_context *draw);
int draw_alloc_extra_vertex_attrib(struct draw_context *draw,
uint semantic_name, uint semantic_index);
void draw_remove_extra_vertex_attribs(struct draw_context *draw);
/*******************************************************************************
* Vertex processing (was passthrough) code:
*/

View File

@@ -287,84 +287,6 @@ draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count)
}
/** Helper code for below */
#define PRIM_RESTART_LOOP(elements) \
do { \
for (i = start; i < end; i++) { \
if (elements[i] == info->restart_index) { \
if (cur_count > 0) { \
/* draw elts up to prev pos */ \
draw_pt_arrays(draw, prim, cur_start, cur_count); \
} \
/* begin new prim at next elt */ \
cur_start = i + 1; \
cur_count = 0; \
} \
else { \
cur_count++; \
} \
} \
if (cur_count > 0) { \
draw_pt_arrays(draw, prim, cur_start, cur_count); \
} \
} while (0)
/**
* For drawing prims with primitive restart enabled.
* Scan for restart indexes and draw the runs of elements/vertices between
* the restarts.
*/
static void
draw_pt_arrays_restart(struct draw_context *draw,
const struct pipe_draw_info *info)
{
const unsigned prim = info->mode;
const unsigned start = info->start;
const unsigned count = info->count;
const unsigned end = start + count;
unsigned i, cur_start, cur_count;
assert(info->primitive_restart);
if (draw->pt.user.elts) {
/* indexed prims (draw_elements) */
cur_start = start;
cur_count = 0;
switch (draw->pt.user.eltSize) {
case 1:
{
const ubyte *elt_ub = (const ubyte *) draw->pt.user.elts;
PRIM_RESTART_LOOP(elt_ub);
}
break;
case 2:
{
const ushort *elt_us = (const ushort *) draw->pt.user.elts;
PRIM_RESTART_LOOP(elt_us);
}
break;
case 4:
{
const uint *elt_ui = (const uint *) draw->pt.user.elts;
PRIM_RESTART_LOOP(elt_ui);
}
break;
default:
assert(0 && "bad eltSize in draw_arrays()");
}
}
else {
/* Non-indexed prims (draw_arrays).
* Primitive restart should have been handled in the state tracker.
*/
draw_pt_arrays(draw, prim, start, count);
}
}
/**
* Non-instanced drawing.
* \sa draw_arrays_instanced
@@ -473,12 +395,6 @@ draw_vbo(struct draw_context *draw,
for (instance = 0; instance < info->instance_count; instance++) {
draw->instance_id = instance + info->start_instance;
if (info->primitive_restart) {
draw_pt_arrays_restart(draw, info);
}
else {
draw_pt_arrays(draw, info->mode, info->start, info->count);
}
draw_pt_arrays(draw, info->mode, info->start, info->count);
}
}

View File

@@ -34,7 +34,6 @@
#include "draw/draw_pt.h"
#include "draw/draw_vs.h"
#include "draw/draw_llvm.h"
#include "gallivm/lp_bld_init.h"
struct llvm_middle_end {
@@ -73,18 +72,19 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
struct draw_llvm_variant_list_item *li;
unsigned i;
unsigned instance_id_index = ~0;
const unsigned out_prim = (draw->gs.geometry_shader ?
draw->gs.geometry_shader->output_primitive :
in_prim);
unsigned out_prim = (draw->gs.geometry_shader ?
draw->gs.geometry_shader->output_primitive :
in_prim);
/* Add one to num_outputs because the pipeline occasionally tags on
* an additional texcoord, eg for AA lines.
*/
const unsigned nr = MAX2( shader->base.info.num_inputs,
shader->base.info.num_outputs + 1 );
unsigned nr = MAX2( shader->base.info.num_inputs,
shader->base.info.num_outputs + 1 );
/* Scan for instanceID system value.
* XXX but we never use instance_id_index?!
*/
for (i = 0; i < shader->base.info.num_inputs; i++) {
if (shader->base.info.input_semantic_name[i] == TGSI_SEMANTIC_INSTANCEID) {
@@ -133,10 +133,9 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
key = draw_llvm_make_variant_key(fpme->llvm, store);
/* Search shader's list of variants for the key */
li = first_elem(&shader->variants);
while (!at_end(&shader->variants, li)) {
if (memcmp(&li->base->key, key, shader->variant_key_size) == 0) {
while(!at_end(&shader->variants, li)) {
if(memcmp(&li->base->key, key, shader->variant_key_size) == 0) {
variant = li->base;
break;
}
@@ -144,16 +143,10 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
}
if (variant) {
/* found the variant, move to head of global list (for LRU) */
move_to_head(&fpme->llvm->vs_variants_list, &variant->list_item_global);
}
else {
/* Need to create new variant */
unsigned i;
/* First check if we've created too many variants. If so, free
* 25% of the LRU to avoid using too much memory.
*/
if (fpme->llvm->nr_variants >= DRAW_MAX_SHADER_VARIANTS) {
/*
* XXX: should we flush here ?
@@ -182,11 +175,6 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
draw->pt.user.vs_constants[0];
fpme->llvm->jit_context.gs_constants =
draw->pt.user.gs_constants[0];
fpme->llvm->jit_context.planes =
(float (*) [12][4]) draw->pt.user.planes[0];
fpme->llvm->jit_context.viewport =
(float *)draw->viewport.scale;
}
@@ -229,7 +217,6 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle,
struct draw_vertex_info gs_vert_info;
struct draw_vertex_info *vert_info;
unsigned opt = fpme->opt;
unsigned clipped = 0;
llvm_vert_info.count = fetch_info->count;
llvm_vert_info.vertex_size = fpme->vertex_size;
@@ -243,7 +230,7 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle,
}
if (fetch_info->linear)
clipped = fpme->current_variant->jit_func( &fpme->llvm->jit_context,
fpme->current_variant->jit_func( &fpme->llvm->jit_context,
llvm_vert_info.verts,
(const char **)draw->pt.user.vbuffer,
fetch_info->start,
@@ -252,7 +239,7 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle,
draw->pt.vertex_buffer,
draw->instance_id);
else
clipped = fpme->current_variant->jit_func_elts( &fpme->llvm->jit_context,
fpme->current_variant->jit_func_elts( &fpme->llvm->jit_context,
llvm_vert_info.verts,
(const char **)draw->pt.user.vbuffer,
fetch_info->elts,
@@ -279,9 +266,6 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle,
FREE(vert_info->verts);
vert_info = &gs_vert_info;
prim_info = &gs_prim_info;
clipped = draw_pt_post_vs_run( fpme->post_vs, vert_info );
}
/* stream output needs to be done before clipping */
@@ -289,11 +273,11 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle,
vert_info,
prim_info );
if (clipped) {
if (draw_pt_post_vs_run( fpme->post_vs, vert_info )) {
opt |= PT_PIPELINE;
}
/* Do we need to run the pipeline? Now will come here if clipped
/* Do we need to run the pipeline?
*/
if (opt & PT_PIPELINE) {
pipeline( fpme,
@@ -429,7 +413,7 @@ draw_pt_fetch_pipeline_or_emit_llvm(struct draw_context *draw)
{
struct llvm_middle_end *fpme = 0;
if (!draw->llvm->gallivm->engine)
if (!draw->engine)
return NULL;
fpme = CALLOC_STRUCT( llvm_middle_end );

View File

@@ -65,7 +65,19 @@ static void
vs_llvm_delete( struct draw_vertex_shader *dvs )
{
struct llvm_vertex_shader *shader = llvm_vertex_shader(dvs);
struct pipe_fence_handle *fence = NULL;
struct draw_llvm_variant_list_item *li;
struct pipe_context *pipe = dvs->draw->pipe;
/*
* XXX: This might be not neccessary at all.
*/
pipe->flush(pipe, 0, &fence);
if (fence) {
pipe->screen->fence_finish(pipe->screen, fence, 0);
pipe->screen->fence_reference(pipe->screen, &fence, NULL);
}
li = first_elem(&shader->variants);
while(!at_end(&shader->variants, li)) {

View File

@@ -55,33 +55,4 @@
#endif
/**
* Redefine these LLVM entrypoints as invalid macros to make sure we
* don't accidentally use them. We need to use the functions which
* take an explicit LLVMContextRef parameter.
*/
#define LLVMInt1Type ILLEGAL_LLVM_FUNCTION
#define LLVMInt8Type ILLEGAL_LLVM_FUNCTION
#define LLVMInt16Type ILLEGAL_LLVM_FUNCTION
#define LLVMInt32Type ILLEGAL_LLVM_FUNCTION
#define LLVMInt64Type ILLEGAL_LLVM_FUNCTION
#define LLVMIntType ILLEGAL_LLVM_FUNCTION
#define LLVMFloatType ILLEGAL_LLVM_FUNCTION
#define LLVMDoubleType ILLEGAL_LLVM_FUNCTION
#define LLVMX86FP80Type ILLEGAL_LLVM_FUNCTION
#define LLVMFP128Type ILLEGAL_LLVM_FUNCTION
#define LLVMPPCFP128Type ILLEGAL_LLVM_FUNCTION
#define LLVMStructType ILLEGAL_LLVM_FUNCTION
#define LLVMVoidType ILLEGAL_LLVM_FUNCTION
#define LLVMLabelType ILLEGAL_LLVM_FUNCTION
#define LLVMOpaqueType ILLEGAL_LLVM_FUNCTION
#define LLVMUnionType ILLEGAL_LLVM_FUNCTION
#define LLVMMDString ILLEGAL_LLVM_FUNCTION
#define LLVMMDNode ILLEGAL_LLVM_FUNCTION
#define LLVMConstString ILLEGAL_LLVM_FUNCTION
#define LLVMConstStruct ILLEGAL_LLVM_FUNCTION
#define LLVMAppendBasicBlock ILLEGAL_LLVM_FUNCTION
#define LLVMInsertBasicBlock ILLEGAL_LLVM_FUNCTION
#define LLVMCreateBuilder ILLEGAL_LLVM_FUNCTION
#endif /* LP_BLD_H */

File diff suppressed because it is too large Load Diff

View File

@@ -171,12 +171,6 @@ LLVMValueRef
lp_build_itrunc(struct lp_build_context *bld,
LLVMValueRef a);
void
lp_build_ifloor_fract(struct lp_build_context *bld,
LLVMValueRef a,
LLVMValueRef *out_ipart,
LLVMValueRef *out_fpart);
LLVMValueRef
lp_build_sqrt(struct lp_build_context *bld,
LLVMValueRef a);
@@ -214,27 +208,10 @@ LLVMValueRef
lp_build_exp2(struct lp_build_context *bld,
LLVMValueRef a);
LLVMValueRef
lp_build_extract_exponent(struct lp_build_context *bld,
LLVMValueRef x,
int bias);
LLVMValueRef
lp_build_extract_mantissa(struct lp_build_context *bld,
LLVMValueRef x);
LLVMValueRef
lp_build_log2(struct lp_build_context *bld,
LLVMValueRef a);
LLVMValueRef
lp_build_fast_log2(struct lp_build_context *bld,
LLVMValueRef a);
LLVMValueRef
lp_build_ilog2(struct lp_build_context *bld,
LLVMValueRef x);
void
lp_build_exp2_approx(struct lp_build_context *bld,
LLVMValueRef x,

View File

@@ -56,21 +56,20 @@ lp_assert(int condition, const char *msg)
* \param msg a string to print if the assertion fails.
*/
LLVMValueRef
lp_build_assert(struct gallivm_state *gallivm,
LLVMValueRef condition,
lp_build_assert(LLVMBuilderRef builder, LLVMValueRef condition,
const char *msg)
{
LLVMBuilderRef builder = gallivm->builder;
LLVMContextRef context = gallivm->context;
LLVMModuleRef module = gallivm->module;
LLVMModuleRef module;
LLVMTypeRef arg_types[2];
LLVMValueRef msg_string, assert_func, params[2], r;
msg_string = lp_build_const_string_variable(module, context,
msg, strlen(msg) + 1);
module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(
LLVMGetInsertBlock(builder)));
arg_types[0] = LLVMInt32TypeInContext(context);
arg_types[1] = LLVMPointerType(LLVMInt8TypeInContext(context), 0);
msg_string = lp_build_const_string_variable(module, msg, strlen(msg) + 1);
arg_types[0] = LLVMInt32Type();
arg_types[1] = LLVMPointerType(LLVMInt8Type(), 0);
/* lookup the lp_assert function */
assert_func = LLVMGetNamedFunction(module, "lp_assert");
@@ -78,12 +77,12 @@ lp_build_assert(struct gallivm_state *gallivm,
/* Create the assertion function if not found */
if (!assert_func) {
LLVMTypeRef func_type =
LLVMFunctionType(LLVMVoidTypeInContext(context), arg_types, 2, 0);
LLVMFunctionType(LLVMVoidType(), arg_types, 2, 0);
assert_func = LLVMAddFunction(module, "lp_assert", func_type);
LLVMSetFunctionCallConv(assert_func, LLVMCCallConv);
LLVMSetLinkage(assert_func, LLVMExternalLinkage);
LLVMAddGlobalMapping(gallivm->engine, assert_func,
LLVMAddGlobalMapping(lp_build_engine, assert_func,
func_to_pointer((func_pointer)lp_assert));
}
assert(assert_func);

View File

@@ -30,12 +30,10 @@
#include "lp_bld.h"
#include "lp_bld_init.h"
LLVMValueRef
lp_build_assert(struct gallivm_state *gallivm,
LLVMValueRef condition,
lp_build_assert(LLVMBuilderRef builder, LLVMValueRef condition,
const char *msg);

View File

@@ -1,192 +0,0 @@
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
**************************************************************************/
#include "util/u_debug.h"
#include "lp_bld_type.h"
#include "lp_bld_debug.h"
#include "lp_bld_const.h"
#include "lp_bld_bitarit.h"
/**
* Return (a | b)
*/
LLVMValueRef
lp_build_or(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
{
LLVMBuilderRef builder = bld->gallivm->builder;
const struct lp_type type = bld->type;
LLVMValueRef res;
assert(lp_check_value(type, a));
assert(lp_check_value(type, b));
/* can't do bitwise ops on floating-point values */
if (type.floating) {
a = LLVMBuildBitCast(builder, a, bld->int_vec_type, "");
b = LLVMBuildBitCast(builder, b, bld->int_vec_type, "");
}
res = LLVMBuildOr(builder, a, b, "");
if (type.floating) {
res = LLVMBuildBitCast(builder, res, bld->vec_type, "");
}
return res;
}
/**
* Return (a & b)
*/
LLVMValueRef
lp_build_and(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
{
LLVMBuilderRef builder = bld->gallivm->builder;
const struct lp_type type = bld->type;
LLVMValueRef res;
assert(lp_check_value(type, a));
assert(lp_check_value(type, b));
/* can't do bitwise ops on floating-point values */
if (type.floating) {
a = LLVMBuildBitCast(builder, a, bld->int_vec_type, "");
b = LLVMBuildBitCast(builder, b, bld->int_vec_type, "");
}
res = LLVMBuildAnd(builder, a, b, "");
if (type.floating) {
res = LLVMBuildBitCast(builder, res, bld->vec_type, "");
}
return res;
}
/**
* Return (a & ~b)
*/
LLVMValueRef
lp_build_andnot(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
{
LLVMBuilderRef builder = bld->gallivm->builder;
const struct lp_type type = bld->type;
LLVMValueRef res;
assert(lp_check_value(type, a));
assert(lp_check_value(type, b));
/* can't do bitwise ops on floating-point values */
if (type.floating) {
a = LLVMBuildBitCast(builder, a, bld->int_vec_type, "");
b = LLVMBuildBitCast(builder, b, bld->int_vec_type, "");
}
res = LLVMBuildNot(builder, b, "");
res = LLVMBuildAnd(builder, a, res, "");
if (type.floating) {
res = LLVMBuildBitCast(builder, res, bld->vec_type, "");
}
return res;
}
/**
* Shift left.
*/
LLVMValueRef
lp_build_shl(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
{
LLVMBuilderRef builder = bld->gallivm->builder;
const struct lp_type type = bld->type;
LLVMValueRef res;
assert(!type.floating);
assert(lp_check_value(type, a));
assert(lp_check_value(type, b));
res = LLVMBuildShl(builder, a, b, "");
return res;
}
/**
* Shift right.
*/
LLVMValueRef
lp_build_shr(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
{
LLVMBuilderRef builder = bld->gallivm->builder;
const struct lp_type type = bld->type;
LLVMValueRef res;
assert(!type.floating);
assert(lp_check_value(type, a));
assert(lp_check_value(type, b));
if (type.sign) {
res = LLVMBuildAShr(builder, a, b, "");
} else {
res = LLVMBuildLShr(builder, a, b, "");
}
return res;
}
/**
* Shift left with immediate.
*/
LLVMValueRef
lp_build_shl_imm(struct lp_build_context *bld, LLVMValueRef a, unsigned imm)
{
LLVMValueRef b = lp_build_const_int_vec(bld->gallivm, bld->type, imm);
assert(imm <= bld->type.width);
return lp_build_shl(bld, a, b);
}
/**
* Shift right with immediate.
*/
LLVMValueRef
lp_build_shr_imm(struct lp_build_context *bld, LLVMValueRef a, unsigned imm)
{
LLVMValueRef b = lp_build_const_int_vec(bld->gallivm, bld->type, imm);
assert(imm <= bld->type.width);
return lp_build_shr(bld, a, b);
}

View File

@@ -1,69 +0,0 @@
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/**
* @file
* Helper bitwise arithmetic functions.
*
* @author Jose Fonseca <jfonseca@vmware.com>
*/
#ifndef LP_BLD_BITARIT_H
#define LP_BLD_BITARIT_H
#include "gallivm/lp_bld.h"
struct lp_type;
struct lp_build_context;
LLVMValueRef
lp_build_or(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b);
LLVMValueRef
lp_build_and(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b);
LLVMValueRef
lp_build_andnot(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b);
LLVMValueRef
lp_build_shl(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b);
LLVMValueRef
lp_build_shr(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b);
LLVMValueRef
lp_build_shl_imm(struct lp_build_context *bld, LLVMValueRef a, unsigned imm);
LLVMValueRef
lp_build_shr_imm(struct lp_build_context *bld, LLVMValueRef a, unsigned imm);
#endif /* !LP_BLD_ARIT_H */

View File

@@ -39,7 +39,6 @@
#include "lp_bld_type.h"
#include "lp_bld_const.h"
#include "lp_bld_init.h"
unsigned
@@ -212,31 +211,31 @@ lp_const_eps(struct lp_type type)
LLVMValueRef
lp_build_undef(struct gallivm_state *gallivm, struct lp_type type)
lp_build_undef(struct lp_type type)
{
LLVMTypeRef vec_type = lp_build_vec_type(gallivm, type);
LLVMTypeRef vec_type = lp_build_vec_type(type);
return LLVMGetUndef(vec_type);
}
LLVMValueRef
lp_build_zero(struct gallivm_state *gallivm, struct lp_type type)
lp_build_zero(struct lp_type type)
{
if (type.length == 1) {
if (type.floating)
return lp_build_const_float(gallivm, 0.0);
return LLVMConstReal(LLVMFloatType(), 0.0);
else
return LLVMConstInt(LLVMIntTypeInContext(gallivm->context, type.width), 0, 0);
return LLVMConstInt(LLVMIntType(type.width), 0, 0);
}
else {
LLVMTypeRef vec_type = lp_build_vec_type(gallivm, type);
LLVMTypeRef vec_type = lp_build_vec_type(type);
return LLVMConstNull(vec_type);
}
}
LLVMValueRef
lp_build_one(struct gallivm_state *gallivm, struct lp_type type)
lp_build_one(struct lp_type type)
{
LLVMTypeRef elem_type;
LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
@@ -244,7 +243,7 @@ lp_build_one(struct gallivm_state *gallivm, struct lp_type type)
assert(type.length <= LP_MAX_VECTOR_LENGTH);
elem_type = lp_build_elem_type(gallivm, type);
elem_type = lp_build_elem_type(type);
if(type.floating)
elems[0] = LLVMConstReal(elem_type, 1.0);
@@ -284,11 +283,10 @@ lp_build_one(struct gallivm_state *gallivm, struct lp_type type)
* Build constant-valued element from a scalar value.
*/
LLVMValueRef
lp_build_const_elem(struct gallivm_state *gallivm,
struct lp_type type,
lp_build_const_elem(struct lp_type type,
double val)
{
LLVMTypeRef elem_type = lp_build_elem_type(gallivm, type);
LLVMTypeRef elem_type = lp_build_elem_type(type);
LLVMValueRef elem;
if(type.floating) {
@@ -308,15 +306,15 @@ lp_build_const_elem(struct gallivm_state *gallivm,
* Build constant-valued vector from a scalar value.
*/
LLVMValueRef
lp_build_const_vec(struct gallivm_state *gallivm, struct lp_type type,
lp_build_const_vec(struct lp_type type,
double val)
{
if (type.length == 1) {
return lp_build_const_elem(gallivm, type, val);
return lp_build_const_elem(type, val);
} else {
LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
unsigned i;
elems[0] = lp_build_const_elem(gallivm, type, val);
elems[0] = lp_build_const_elem(type, val);
for(i = 1; i < type.length; ++i)
elems[i] = elems[0];
return LLVMConstVector(elems, type.length);
@@ -325,10 +323,10 @@ lp_build_const_vec(struct gallivm_state *gallivm, struct lp_type type,
LLVMValueRef
lp_build_const_int_vec(struct gallivm_state *gallivm, struct lp_type type,
long long val)
lp_build_const_int_vec(struct lp_type type,
long long val)
{
LLVMTypeRef elem_type = lp_build_int_elem_type(gallivm, type);
LLVMTypeRef elem_type = lp_build_int_elem_type(type);
LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
unsigned i;
@@ -345,8 +343,7 @@ lp_build_const_int_vec(struct gallivm_state *gallivm, struct lp_type type,
LLVMValueRef
lp_build_const_aos(struct gallivm_state *gallivm,
struct lp_type type,
lp_build_const_aos(struct lp_type type,
double r, double g, double b, double a,
const unsigned char *swizzle)
{
@@ -358,7 +355,7 @@ lp_build_const_aos(struct gallivm_state *gallivm,
assert(type.length % 4 == 0);
assert(type.length <= LP_MAX_VECTOR_LENGTH);
elem_type = lp_build_elem_type(gallivm, type);
elem_type = lp_build_elem_type(type);
if(swizzle == NULL)
swizzle = default_swizzle;
@@ -389,11 +386,10 @@ lp_build_const_aos(struct gallivm_state *gallivm,
* @param mask TGSI_WRITEMASK_xxx
*/
LLVMValueRef
lp_build_const_mask_aos(struct gallivm_state *gallivm,
struct lp_type type,
lp_build_const_mask_aos(struct lp_type type,
unsigned mask)
{
LLVMTypeRef elem_type = LLVMIntTypeInContext(gallivm->context, type.width);
LLVMTypeRef elem_type = LLVMIntType(type.width);
LLVMValueRef masks[LP_MAX_VECTOR_LENGTH];
unsigned i, j;

View File

@@ -39,7 +39,6 @@
#include "pipe/p_compiler.h"
#include "gallivm/lp_bld.h"
#include "gallivm/lp_bld_init.h"
@@ -74,55 +73,46 @@ lp_const_eps(struct lp_type type);
LLVMValueRef
lp_build_undef(struct gallivm_state *gallivm, struct lp_type type);
lp_build_undef(struct lp_type type);
LLVMValueRef
lp_build_zero(struct gallivm_state *gallivm, struct lp_type type);
lp_build_zero(struct lp_type type);
LLVMValueRef
lp_build_one(struct gallivm_state *gallivm, struct lp_type type);
lp_build_one(struct lp_type type);
LLVMValueRef
lp_build_const_elem(struct gallivm_state *gallivm, struct lp_type type,
lp_build_const_elem(struct lp_type type,
double val);
LLVMValueRef
lp_build_const_vec(struct gallivm_state *gallivm, struct lp_type type,
double val);
lp_build_const_vec(struct lp_type type, double val);
LLVMValueRef
lp_build_const_int_vec(struct gallivm_state *gallivm,
struct lp_type type, long long val);
lp_build_const_int_vec(struct lp_type type, long long val);
LLVMValueRef
lp_build_const_aos(struct gallivm_state *gallivm, struct lp_type type,
lp_build_const_aos(struct lp_type type,
double r, double g, double b, double a,
const unsigned char *swizzle);
LLVMValueRef
lp_build_const_mask_aos(struct gallivm_state *gallivm,
struct lp_type type,
lp_build_const_mask_aos(struct lp_type type,
unsigned mask);
static INLINE LLVMValueRef
lp_build_const_int32(struct gallivm_state *gallivm, int i)
lp_build_const_int32(int i)
{
return LLVMConstInt(LLVMInt32TypeInContext(gallivm->context), i, 0);
return LLVMConstInt(LLVMInt32Type(), i, 0);
}
static INLINE LLVMValueRef
lp_build_const_float(struct gallivm_state *gallivm, float x)
{
return LLVMConstReal(LLVMFloatTypeInContext(gallivm->context), x);
}
#endif /* !LP_BLD_CONST_H */

View File

@@ -63,7 +63,6 @@
#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/u_cpu_detect.h"
#include "lp_bld_type.h"
#include "lp_bld_const.h"
@@ -89,118 +88,66 @@
* return { i32, i32, i32, i32 } where each value is in [0, 2^dst_width-1].
*/
LLVMValueRef
lp_build_clamped_float_to_unsigned_norm(struct gallivm_state *gallivm,
lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
struct lp_type src_type,
unsigned dst_width,
LLVMValueRef src)
{
LLVMBuilderRef builder = gallivm->builder;
LLVMTypeRef int_vec_type = lp_build_int_vec_type(gallivm, src_type);
LLVMTypeRef int_vec_type = lp_build_int_vec_type(src_type);
LLVMValueRef res;
unsigned mantissa;
unsigned n;
unsigned long long ubound;
unsigned long long mask;
double scale;
double bias;
assert(src_type.floating);
assert(dst_width <= src_type.width);
src_type.sign = FALSE;
mantissa = lp_mantissa(src_type);
if (dst_width <= mantissa) {
/*
* Apply magic coefficients that will make the desired result to appear
* in the lowest significant bits of the mantissa, with correct rounding.
*
* This only works if the destination width fits in the mantissa.
/* We cannot carry more bits than the mantissa */
n = MIN2(mantissa, dst_width);
/* This magic coefficients will make the desired result to appear in the
* lowest significant bits of the mantissa.
*/
ubound = ((unsigned long long)1 << n);
mask = ubound - 1;
scale = (double)mask/ubound;
bias = (double)((unsigned long long)1 << (mantissa - n));
res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), "");
res = LLVMBuildFAdd(builder, res, lp_build_const_vec(src_type, bias), "");
res = LLVMBuildBitCast(builder, res, int_vec_type, "");
if(dst_width > n) {
int shift = dst_width - n;
res = LLVMBuildShl(builder, res, lp_build_const_int_vec(src_type, shift), "");
/* TODO: Fill in the empty lower bits for additional precision? */
/* YES: this fixes progs/trivial/tri-z-eq.c.
* Otherwise vertex Z=1.0 values get converted to something like
* 0xfffffb00 and the test for equality with 0xffffffff fails.
*/
unsigned long long ubound;
unsigned long long mask;
double scale;
double bias;
ubound = (1ULL << dst_width);
mask = ubound - 1;
scale = (double)mask/ubound;
bias = (double)(1ULL << (mantissa - dst_width));
res = LLVMBuildFMul(builder, src, lp_build_const_vec(gallivm, src_type, scale), "");
res = LLVMBuildFAdd(builder, res, lp_build_const_vec(gallivm, src_type, bias), "");
res = LLVMBuildBitCast(builder, res, int_vec_type, "");
res = LLVMBuildAnd(builder, res,
lp_build_const_int_vec(gallivm, src_type, mask), "");
}
else if (dst_width == (mantissa + 1)) {
/*
* The destination width matches exactly what can be represented in
* floating point (i.e., mantissa + 1 bits). So do a straight
* multiplication followed by casting. No further rounding is necessary.
*/
double scale;
scale = (double)((1ULL << dst_width) - 1);
res = LLVMBuildFMul(builder, src,
lp_build_const_vec(gallivm, src_type, scale), "");
res = LLVMBuildFPToSI(builder, res, int_vec_type, "");
}
else {
/*
* The destination exceeds what can be represented in the floating point.
* So multiply by the largest power two we get away with, and when
* subtract the most significant bit to rescale to normalized values.
*
* The largest power of two factor we can get away is
* (1 << (src_type.width - 1)), because we need to use signed . In theory it
* should be (1 << (src_type.width - 2)), but IEEE 754 rules states
* INT_MIN should be returned in FPToSI, which is the correct result for
* values near 1.0!
*
* This means we get (src_type.width - 1) correct bits for values near 0.0,
* and (mantissa + 1) correct bits for values near 1.0. Equally or more
* important, we also get exact results for 0.0 and 1.0.
*/
unsigned n = MIN2(src_type.width - 1, dst_width);
double scale = (double)(1ULL << n);
unsigned lshift = dst_width - n;
unsigned rshift = n;
LLVMValueRef lshifted;
LLVMValueRef rshifted;
res = LLVMBuildFMul(builder, src,
lp_build_const_vec(gallivm, src_type, scale), "");
res = LLVMBuildFPToSI(builder, res, int_vec_type, "");
/*
* Align the most significant bit to its final place.
*
* This will cause 1.0 to overflow to 0, but the later adjustment will
* get it right.
*/
if (lshift) {
lshifted = LLVMBuildShl(builder, res,
lp_build_const_int_vec(gallivm, src_type,
lshift), "");
} else {
lshifted = res;
#if 0
{
LLVMValueRef msb;
msb = LLVMBuildLShr(builder, res, lp_build_const_int_vec(src_type, dst_width - 1), "");
msb = LLVMBuildShl(builder, msb, lp_build_const_int_vec(src_type, shift), "");
msb = LLVMBuildSub(builder, msb, lp_build_const_int_vec(src_type, 1), "");
res = LLVMBuildOr(builder, res, msb, "");
}
/*
* Align the most significant bit to the right.
*/
rshifted = LLVMBuildAShr(builder, res,
lp_build_const_int_vec(gallivm, src_type, rshift),
"");
/*
* Subtract the MSB to the LSB, therefore re-scaling from
* (1 << dst_width) to ((1 << dst_width) - 1).
*/
res = LLVMBuildSub(builder, lshifted, rshifted, "");
#elif 0
while(shift > 0) {
res = LLVMBuildOr(builder, res, LLVMBuildLShr(builder, res, lp_build_const_int_vec(src_type, n), ""), "");
shift -= n;
n *= 2;
}
#endif
}
else
res = LLVMBuildAnd(builder, res, lp_build_const_int_vec(src_type, mask), "");
return res;
}
@@ -212,14 +159,13 @@ lp_build_clamped_float_to_unsigned_norm(struct gallivm_state *gallivm,
* return {float, float, float, float} with values in range [0, 1].
*/
LLVMValueRef
lp_build_unsigned_norm_to_float(struct gallivm_state *gallivm,
lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
unsigned src_width,
struct lp_type dst_type,
LLVMValueRef src)
{
LLVMBuilderRef builder = gallivm->builder;
LLVMTypeRef vec_type = lp_build_vec_type(gallivm, dst_type);
LLVMTypeRef int_vec_type = lp_build_int_vec_type(gallivm, dst_type);
LLVMTypeRef vec_type = lp_build_vec_type(dst_type);
LLVMTypeRef int_vec_type = lp_build_int_vec_type(dst_type);
LLVMValueRef bias_;
LLVMValueRef res;
unsigned mantissa;
@@ -231,17 +177,6 @@ lp_build_unsigned_norm_to_float(struct gallivm_state *gallivm,
assert(dst_type.floating);
/* Special-case int8->float, though most cases could be handled
* this way:
*/
if (src_width == 8) {
scale = 1.0/255.0;
res = LLVMBuildSIToFP(builder, src, vec_type, "");
res = LLVMBuildFMul(builder, res,
lp_build_const_vec(gallivm, dst_type, scale), "");
return res;
}
mantissa = lp_mantissa(dst_type);
n = MIN2(mantissa, src_width);
@@ -255,11 +190,10 @@ lp_build_unsigned_norm_to_float(struct gallivm_state *gallivm,
if(src_width > mantissa) {
int shift = src_width - mantissa;
res = LLVMBuildLShr(builder, res,
lp_build_const_int_vec(gallivm, dst_type, shift), "");
res = LLVMBuildLShr(builder, res, lp_build_const_int_vec(dst_type, shift), "");
}
bias_ = lp_build_const_vec(gallivm, dst_type, bias);
bias_ = lp_build_const_vec(dst_type, bias);
res = LLVMBuildOr(builder,
res,
@@ -268,7 +202,7 @@ lp_build_unsigned_norm_to_float(struct gallivm_state *gallivm,
res = LLVMBuildBitCast(builder, res, vec_type, "");
res = LLVMBuildFSub(builder, res, bias_, "");
res = LLVMBuildFMul(builder, res, lp_build_const_vec(gallivm, dst_type, scale), "");
res = LLVMBuildFMul(builder, res, lp_build_const_vec(dst_type, scale), "");
return res;
}
@@ -281,13 +215,12 @@ lp_build_unsigned_norm_to_float(struct gallivm_state *gallivm,
* to the lp_type union.
*/
void
lp_build_conv(struct gallivm_state *gallivm,
lp_build_conv(LLVMBuilderRef builder,
struct lp_type src_type,
struct lp_type dst_type,
const LLVMValueRef *src, unsigned num_srcs,
LLVMValueRef *dst, unsigned num_dsts)
{
LLVMBuilderRef builder = gallivm->builder;
struct lp_type tmp_type;
LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH];
unsigned num_tmps;
@@ -308,87 +241,6 @@ lp_build_conv(struct gallivm_state *gallivm,
}
num_tmps = num_srcs;
/* Special case 4x4f --> 1x16ub
*/
if (src_type.floating == 1 &&
src_type.fixed == 0 &&
src_type.sign == 1 &&
src_type.norm == 0 &&
src_type.width == 32 &&
src_type.length == 4 &&
dst_type.floating == 0 &&
dst_type.fixed == 0 &&
dst_type.sign == 0 &&
dst_type.norm == 1 &&
dst_type.width == 8 &&
dst_type.length == 16 &&
util_cpu_caps.has_sse2)
{
int i;
for (i = 0; i < num_dsts; i++, src += 4) {
struct lp_type int16_type = dst_type;
struct lp_type int32_type = dst_type;
LLVMValueRef lo, hi;
LLVMValueRef src_int0;
LLVMValueRef src_int1;
LLVMValueRef src_int2;
LLVMValueRef src_int3;
LLVMTypeRef int16_vec_type;
LLVMTypeRef int32_vec_type;
LLVMTypeRef src_vec_type;
LLVMTypeRef dst_vec_type;
LLVMValueRef const_255f;
LLVMValueRef a, b, c, d;
int16_type.width *= 2;
int16_type.length /= 2;
int16_type.sign = 1;
int32_type.width *= 4;
int32_type.length /= 4;
int32_type.sign = 1;
src_vec_type = lp_build_vec_type(gallivm, src_type);
dst_vec_type = lp_build_vec_type(gallivm, dst_type);
int16_vec_type = lp_build_vec_type(gallivm, int16_type);
int32_vec_type = lp_build_vec_type(gallivm, int32_type);
const_255f = lp_build_const_vec(gallivm, src_type, 255.0f);
a = LLVMBuildFMul(builder, src[0], const_255f, "");
b = LLVMBuildFMul(builder, src[1], const_255f, "");
c = LLVMBuildFMul(builder, src[2], const_255f, "");
d = LLVMBuildFMul(builder, src[3], const_255f, "");
{
struct lp_build_context bld;
bld.gallivm = gallivm;
bld.type = src_type;
bld.vec_type = src_vec_type;
bld.int_elem_type = lp_build_elem_type(gallivm, int32_type);
bld.int_vec_type = int32_vec_type;
bld.undef = lp_build_undef(gallivm, src_type);
bld.zero = lp_build_zero(gallivm, src_type);
bld.one = lp_build_one(gallivm, src_type);
src_int0 = lp_build_iround(&bld, a);
src_int1 = lp_build_iround(&bld, b);
src_int2 = lp_build_iround(&bld, c);
src_int3 = lp_build_iround(&bld, d);
}
/* relying on clamping behavior of sse2 intrinsics here */
lo = lp_build_pack2(gallivm, int32_type, int16_type, src_int0, src_int1);
hi = lp_build_pack2(gallivm, int32_type, int16_type, src_int2, src_int3);
dst[i] = lp_build_pack2(gallivm, int16_type, dst_type, lo, hi);
}
return;
}
/*
* Clamp if necessary
*/
@@ -401,13 +253,13 @@ lp_build_conv(struct gallivm_state *gallivm,
double dst_max = lp_const_max(dst_type);
LLVMValueRef thres;
lp_build_context_init(&bld, gallivm, tmp_type);
lp_build_context_init(&bld, builder, tmp_type);
if(src_min < dst_min) {
if(dst_min == 0.0)
thres = bld.zero;
else
thres = lp_build_const_vec(gallivm, src_type, dst_min);
thres = lp_build_const_vec(src_type, dst_min);
for(i = 0; i < num_tmps; ++i)
tmp[i] = lp_build_max(&bld, tmp[i], thres);
}
@@ -416,7 +268,7 @@ lp_build_conv(struct gallivm_state *gallivm,
if(dst_max == 1.0)
thres = bld.one;
else
thres = lp_build_const_vec(gallivm, src_type, dst_max);
thres = lp_build_const_vec(src_type, dst_max);
for(i = 0; i < num_tmps; ++i)
tmp[i] = lp_build_min(&bld, tmp[i], thres);
}
@@ -432,7 +284,7 @@ lp_build_conv(struct gallivm_state *gallivm,
else if(tmp_type.floating) {
if(!dst_type.fixed && !dst_type.sign && dst_type.norm) {
for(i = 0; i < num_tmps; ++i) {
tmp[i] = lp_build_clamped_float_to_unsigned_norm(gallivm,
tmp[i] = lp_build_clamped_float_to_unsigned_norm(builder,
tmp_type,
dst_type.width,
tmp[i]);
@@ -444,14 +296,14 @@ lp_build_conv(struct gallivm_state *gallivm,
LLVMTypeRef tmp_vec_type;
if (dst_scale != 1.0) {
LLVMValueRef scale = lp_build_const_vec(gallivm, tmp_type, dst_scale);
LLVMValueRef scale = lp_build_const_vec(tmp_type, dst_scale);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildFMul(builder, tmp[i], scale, "");
}
/* Use an equally sized integer for intermediate computations */
tmp_type.floating = FALSE;
tmp_vec_type = lp_build_vec_type(gallivm, tmp_type);
tmp_vec_type = lp_build_vec_type(tmp_type);
for(i = 0; i < num_tmps; ++i) {
#if 0
if(dst_type.sign)
@@ -471,8 +323,7 @@ lp_build_conv(struct gallivm_state *gallivm,
/* FIXME: compensate different offsets too */
if(src_shift > dst_shift) {
LLVMValueRef shift = lp_build_const_int_vec(gallivm, tmp_type,
src_shift - dst_shift);
LLVMValueRef shift = lp_build_const_int_vec(tmp_type, src_shift - dst_shift);
for(i = 0; i < num_tmps; ++i)
if(src_type.sign)
tmp[i] = LLVMBuildAShr(builder, tmp[i], shift, "");
@@ -496,7 +347,7 @@ lp_build_conv(struct gallivm_state *gallivm,
new_type.width = dst_type.width;
new_type.length = dst_type.length;
lp_build_resize(gallivm, tmp_type, new_type, tmp, num_srcs, tmp, num_dsts);
lp_build_resize(builder, tmp_type, new_type, tmp, num_srcs, tmp, num_dsts);
tmp_type = new_type;
num_tmps = num_dsts;
@@ -512,7 +363,7 @@ lp_build_conv(struct gallivm_state *gallivm,
else if(!src_type.floating && dst_type.floating) {
if(!src_type.fixed && !src_type.sign && src_type.norm) {
for(i = 0; i < num_tmps; ++i) {
tmp[i] = lp_build_unsigned_norm_to_float(gallivm,
tmp[i] = lp_build_unsigned_norm_to_float(builder,
src_type.width,
dst_type,
tmp[i]);
@@ -526,7 +377,7 @@ lp_build_conv(struct gallivm_state *gallivm,
/* Use an equally sized integer for intermediate computations */
tmp_type.floating = TRUE;
tmp_type.sign = TRUE;
tmp_vec_type = lp_build_vec_type(gallivm, tmp_type);
tmp_vec_type = lp_build_vec_type(tmp_type);
for(i = 0; i < num_tmps; ++i) {
#if 0
if(dst_type.sign)
@@ -540,7 +391,7 @@ lp_build_conv(struct gallivm_state *gallivm,
}
if (src_scale != 1.0) {
LLVMValueRef scale = lp_build_const_vec(gallivm, tmp_type, 1.0/src_scale);
LLVMValueRef scale = lp_build_const_vec(tmp_type, 1.0/src_scale);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildFMul(builder, tmp[i], scale, "");
}
@@ -552,7 +403,7 @@ lp_build_conv(struct gallivm_state *gallivm,
/* FIXME: compensate different offsets too */
if(src_shift < dst_shift) {
LLVMValueRef shift = lp_build_const_int_vec(gallivm, tmp_type, dst_shift - src_shift);
LLVMValueRef shift = lp_build_const_int_vec(tmp_type, dst_shift - src_shift);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildShl(builder, tmp[i], shift, "");
}
@@ -576,7 +427,7 @@ lp_build_conv(struct gallivm_state *gallivm,
* This is basically a very trimmed down version of lp_build_conv.
*/
void
lp_build_conv_mask(struct gallivm_state *gallivm,
lp_build_conv_mask(LLVMBuilderRef builder,
struct lp_type src_type,
struct lp_type dst_type,
const LLVMValueRef *src, unsigned num_srcs,
@@ -610,11 +461,11 @@ lp_build_conv_mask(struct gallivm_state *gallivm,
if(src_type.width > dst_type.width) {
assert(num_dsts == 1);
dst[0] = lp_build_pack(gallivm, src_type, dst_type, TRUE, src, num_srcs);
dst[0] = lp_build_pack(builder, src_type, dst_type, TRUE, src, num_srcs);
}
else if(src_type.width < dst_type.width) {
assert(num_srcs == 1);
lp_build_unpack(gallivm, src_type, dst_type, src[0], dst, num_dsts);
lp_build_unpack(builder, src_type, dst_type, src[0], dst, num_dsts);
}
else {
assert(num_srcs == num_dsts);

View File

@@ -44,27 +44,27 @@ struct lp_type;
LLVMValueRef
lp_build_clamped_float_to_unsigned_norm(struct gallivm_state *gallivm,
lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
struct lp_type src_type,
unsigned dst_width,
LLVMValueRef src);
LLVMValueRef
lp_build_unsigned_norm_to_float(struct gallivm_state *gallivm,
lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
unsigned src_width,
struct lp_type dst_type,
LLVMValueRef src);
void
lp_build_conv(struct gallivm_state *gallivm,
lp_build_conv(LLVMBuilderRef builder,
struct lp_type src_type,
struct lp_type dst_type,
const LLVMValueRef *srcs, unsigned num_srcs,
LLVMValueRef *dsts, unsigned num_dsts);
void
lp_build_conv_mask(struct gallivm_state *gallivm,
lp_build_conv_mask(LLVMBuilderRef builder,
struct lp_type src_type,
struct lp_type dst_type,
const LLVMValueRef *src, unsigned num_srcs,

View File

@@ -57,8 +57,6 @@ lp_disassemble(const void* func)
#ifdef HAVE_UDIS86
ud_t ud_obj;
uint64_t max_jmp_pc;
uint inst_no;
boolean emit_addrs = TRUE, emit_line_nos = FALSE;
ud_init(&ud_obj);
@@ -78,18 +76,13 @@ lp_disassemble(const void* func)
while (ud_disassemble(&ud_obj)) {
if (emit_addrs) {
#ifdef PIPE_ARCH_X86
debug_printf("0x%08lx:\t", (unsigned long)ud_insn_off(&ud_obj));
debug_printf("0x%08lx:\t", (unsigned long)ud_insn_off(&ud_obj));
#endif
#ifdef PIPE_ARCH_X86_64
debug_printf("0x%016llx:\t", (unsigned long long)ud_insn_off(&ud_obj));
debug_printf("0x%016llx:\t", (unsigned long long)ud_insn_off(&ud_obj));
#endif
}
else if (emit_line_nos) {
debug_printf("%6d:\t", inst_no);
inst_no++;
}
#if 0
debug_printf("%-16s ", ud_insn_hex(&ud_obj));
#endif
@@ -122,10 +115,8 @@ lp_disassemble(const void* func)
}
}
if (ud_obj.mnemonic == UD_Iinvalid ||
(ud_insn_off(&ud_obj) >= max_jmp_pc &&
(ud_obj.mnemonic == UD_Iret ||
ud_obj.mnemonic == UD_Ijmp)))
if ((ud_insn_off(&ud_obj) >= max_jmp_pc && ud_obj.mnemonic == UD_Iret) ||
ud_obj.mnemonic == UD_Iinvalid)
break;
}

View File

@@ -36,13 +36,11 @@
#include "util/u_string.h"
#define GALLIVM_DEBUG_TGSI (1 << 0)
#define GALLIVM_DEBUG_IR (1 << 1)
#define GALLIVM_DEBUG_ASM (1 << 2)
#define GALLIVM_DEBUG_NO_OPT (1 << 3)
#define GALLIVM_DEBUG_PERF (1 << 4)
#define GALLIVM_DEBUG_NO_BRILINEAR (1 << 5)
#define GALLIVM_DEBUG_GC (1 << 6)
#define GALLIVM_DEBUG_TGSI 0x1
#define GALLIVM_DEBUG_IR 0x2
#define GALLIVM_DEBUG_ASM 0x4
#define GALLIVM_DEBUG_NO_OPT 0x8
#define GALLIVM_DEBUG_PERF 0x10
#ifdef DEBUG

View File

@@ -34,60 +34,352 @@
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "lp_bld_init.h"
#include "lp_bld_type.h"
#include "lp_bld_flow.h"
#define LP_BUILD_FLOW_MAX_VARIABLES 64
#define LP_BUILD_FLOW_MAX_DEPTH 32
/**
* Insert a new block, right where builder is pointing to.
* Enumeration of all possible flow constructs.
*/
enum lp_build_flow_construct_kind {
LP_BUILD_FLOW_SCOPE,
LP_BUILD_FLOW_SKIP,
LP_BUILD_FLOW_IF
};
/**
* Variable declaration scope.
*/
struct lp_build_flow_scope
{
/** Number of variables declared in this scope */
unsigned num_variables;
};
/**
* Early exit. Useful to skip to the end of a function or block when
* the execution mask becomes zero or when there is an error condition.
*/
struct lp_build_flow_skip
{
/** Block to skip to */
LLVMBasicBlockRef block;
/** Number of variables declared at the beginning */
unsigned num_variables;
LLVMValueRef *phi; /**< array [num_variables] */
};
/**
* if/else/endif.
*/
struct lp_build_flow_if
{
unsigned num_variables;
LLVMValueRef *phi; /**< array [num_variables] */
LLVMValueRef condition;
LLVMBasicBlockRef entry_block, true_block, false_block, merge_block;
};
/**
* Union of all possible flow constructs' data
*/
union lp_build_flow_construct_data
{
struct lp_build_flow_scope scope;
struct lp_build_flow_skip skip;
struct lp_build_flow_if ifthen;
};
/**
* Element of the flow construct stack.
*/
struct lp_build_flow_construct
{
enum lp_build_flow_construct_kind kind;
union lp_build_flow_construct_data data;
};
/**
* All necessary data to generate LLVM control flow constructs.
*
* This is useful important not only for aesthetic reasons, but also for
* performance reasons, as frequently run blocks should be laid out next to
* each other and fall-throughs maximized.
* Besides keeping track of the control flow construct themselves we also
* need to keep track of variables in order to generate SSA Phi values.
*/
struct lp_build_flow_context
{
LLVMBuilderRef builder;
/**
* Control flow stack.
*/
struct lp_build_flow_construct constructs[LP_BUILD_FLOW_MAX_DEPTH];
unsigned num_constructs;
/**
* Variable stack
*/
LLVMValueRef *variables[LP_BUILD_FLOW_MAX_VARIABLES];
unsigned num_variables;
};
struct lp_build_flow_context *
lp_build_flow_create(LLVMBuilderRef builder)
{
struct lp_build_flow_context *flow;
flow = CALLOC_STRUCT(lp_build_flow_context);
if(!flow)
return NULL;
flow->builder = builder;
return flow;
}
void
lp_build_flow_destroy(struct lp_build_flow_context *flow)
{
assert(flow->num_constructs == 0);
assert(flow->num_variables == 0);
FREE(flow);
}
/**
* Begin/push a new flow control construct, such as a loop, skip block
* or variable scope.
*/
static union lp_build_flow_construct_data *
lp_build_flow_push(struct lp_build_flow_context *flow,
enum lp_build_flow_construct_kind kind)
{
assert(flow->num_constructs < LP_BUILD_FLOW_MAX_DEPTH);
if(flow->num_constructs >= LP_BUILD_FLOW_MAX_DEPTH)
return NULL;
flow->constructs[flow->num_constructs].kind = kind;
return &flow->constructs[flow->num_constructs++].data;
}
/**
* Return the current/top flow control construct on the stack.
* \param kind the expected type of the top-most construct
*/
static union lp_build_flow_construct_data *
lp_build_flow_peek(struct lp_build_flow_context *flow,
enum lp_build_flow_construct_kind kind)
{
assert(flow->num_constructs);
if(!flow->num_constructs)
return NULL;
assert(flow->constructs[flow->num_constructs - 1].kind == kind);
if(flow->constructs[flow->num_constructs - 1].kind != kind)
return NULL;
return &flow->constructs[flow->num_constructs - 1].data;
}
/**
* End/pop the current/top flow control construct on the stack.
* \param kind the expected type of the top-most construct
*/
static union lp_build_flow_construct_data *
lp_build_flow_pop(struct lp_build_flow_context *flow,
enum lp_build_flow_construct_kind kind)
{
assert(flow->num_constructs);
if(!flow->num_constructs)
return NULL;
assert(flow->constructs[flow->num_constructs - 1].kind == kind);
if(flow->constructs[flow->num_constructs - 1].kind != kind)
return NULL;
return &flow->constructs[--flow->num_constructs].data;
}
/**
* Begin a variable scope.
*
* See also llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp.
*
*/
void
lp_build_flow_scope_begin(struct lp_build_flow_context *flow)
{
struct lp_build_flow_scope *scope;
scope = &lp_build_flow_push(flow, LP_BUILD_FLOW_SCOPE)->scope;
if(!scope)
return;
scope->num_variables = 0;
}
/**
* Declare a variable.
*
* A variable is a named entity which can have different LLVMValueRef's at
* different points of the program. This is relevant for control flow because
* when there are multiple branches to a same location we need to replace
* the variable's value with a Phi function as explained in
* http://en.wikipedia.org/wiki/Static_single_assignment_form .
*
* We keep track of variables by keeping around a pointer to where they're
* current.
*
* There are a few cautions to observe:
*
* - Variable's value must not be NULL. If there is no initial value then
* LLVMGetUndef() should be used.
*
* - Variable's value must be kept up-to-date. If the variable is going to be
* modified by a function then a pointer should be passed so that its value
* is accurate. Failure to do this will cause some of the variables'
* transient values to be lost, leading to wrong results.
*
* - A program should be written from top to bottom, by always appending
* instructions to the bottom with a single LLVMBuilderRef. Inserting and/or
* modifying existing statements will most likely lead to wrong results.
*
*/
void
lp_build_flow_scope_declare(struct lp_build_flow_context *flow,
LLVMValueRef *variable)
{
struct lp_build_flow_scope *scope;
scope = &lp_build_flow_peek(flow, LP_BUILD_FLOW_SCOPE)->scope;
if(!scope)
return;
assert(*variable);
if(!*variable)
return;
assert(flow->num_variables < LP_BUILD_FLOW_MAX_VARIABLES);
if(flow->num_variables >= LP_BUILD_FLOW_MAX_VARIABLES)
return;
flow->variables[flow->num_variables++] = variable;
++scope->num_variables;
}
void
lp_build_flow_scope_end(struct lp_build_flow_context *flow)
{
struct lp_build_flow_scope *scope;
scope = &lp_build_flow_pop(flow, LP_BUILD_FLOW_SCOPE)->scope;
if(!scope)
return;
assert(flow->num_variables >= scope->num_variables);
if(flow->num_variables < scope->num_variables) {
flow->num_variables = 0;
return;
}
flow->num_variables -= scope->num_variables;
}
/**
* Note: this function has no dependencies on the flow code and could
* be used elsewhere.
*/
LLVMBasicBlockRef
lp_build_insert_new_block(struct gallivm_state *gallivm, const char *name)
lp_build_insert_new_block(LLVMBuilderRef builder, const char *name)
{
LLVMBasicBlockRef current_block;
LLVMBasicBlockRef next_block;
LLVMBasicBlockRef new_block;
/* get current basic block */
current_block = LLVMGetInsertBlock(gallivm->builder);
current_block = LLVMGetInsertBlock(builder);
/* check if there's another block after this one */
next_block = LLVMGetNextBasicBlock(current_block);
if (next_block) {
/* insert the new block before the next block */
new_block = LLVMInsertBasicBlockInContext(gallivm->context, next_block, name);
new_block = LLVMInsertBasicBlock(next_block, name);
}
else {
/* append new block after current block */
LLVMValueRef function = LLVMGetBasicBlockParent(current_block);
new_block = LLVMAppendBasicBlockInContext(gallivm->context, function, name);
new_block = LLVMAppendBasicBlock(function, name);
}
return new_block;
}
static LLVMBasicBlockRef
lp_build_flow_insert_block(struct lp_build_flow_context *flow)
{
return lp_build_insert_new_block(flow->builder, "");
}
/**
* Begin a "skip" block. Inside this block we can test a condition and
* skip to the end of the block if the condition is false.
*/
void
lp_build_flow_skip_begin(struct lp_build_skip_context *skip,
struct gallivm_state *gallivm)
lp_build_flow_skip_begin(struct lp_build_flow_context *flow)
{
skip->gallivm = gallivm;
struct lp_build_flow_skip *skip;
LLVMBuilderRef builder;
unsigned i;
skip = &lp_build_flow_push(flow, LP_BUILD_FLOW_SKIP)->skip;
if(!skip)
return;
/* create new basic block */
skip->block = lp_build_insert_new_block(gallivm, "skip");
skip->block = lp_build_flow_insert_block(flow);
skip->num_variables = flow->num_variables;
if(!skip->num_variables) {
skip->phi = NULL;
return;
}
/* Allocate a Phi node for each variable in this skip scope */
skip->phi = MALLOC(skip->num_variables * sizeof *skip->phi);
if(!skip->phi) {
skip->num_variables = 0;
return;
}
builder = LLVMCreateBuilder();
LLVMPositionBuilderAtEnd(builder, skip->block);
/* create a Phi node for each variable */
for(i = 0; i < skip->num_variables; ++i)
skip->phi[i] = LLVMBuildPhi(builder, LLVMTypeOf(*flow->variables[i]), "");
LLVMDisposeBuilder(builder);
}
@@ -96,50 +388,83 @@ lp_build_flow_skip_begin(struct lp_build_skip_context *skip,
* skip block if the condition is true.
*/
void
lp_build_flow_skip_cond_break(struct lp_build_skip_context *skip,
lp_build_flow_skip_cond_break(struct lp_build_flow_context *flow,
LLVMValueRef cond)
{
struct lp_build_flow_skip *skip;
LLVMBasicBlockRef current_block;
LLVMBasicBlockRef new_block;
unsigned i;
new_block = lp_build_insert_new_block(skip->gallivm, "");
skip = &lp_build_flow_peek(flow, LP_BUILD_FLOW_SKIP)->skip;
if(!skip)
return;
current_block = LLVMGetInsertBlock(flow->builder);
new_block = lp_build_flow_insert_block(flow);
/* for each variable, update the Phi node with a (variable, block) pair */
for(i = 0; i < skip->num_variables; ++i) {
assert(*flow->variables[i]);
assert(LLVMTypeOf(skip->phi[i]) == LLVMTypeOf(*flow->variables[i]));
LLVMAddIncoming(skip->phi[i], flow->variables[i], &current_block, 1);
}
/* if cond is true, goto skip->block, else goto new_block */
LLVMBuildCondBr(skip->gallivm->builder, cond, skip->block, new_block);
LLVMBuildCondBr(flow->builder, cond, skip->block, new_block);
LLVMPositionBuilderAtEnd(skip->gallivm->builder, new_block);
LLVMPositionBuilderAtEnd(flow->builder, new_block);
}
void
lp_build_flow_skip_end(struct lp_build_skip_context *skip)
lp_build_flow_skip_end(struct lp_build_flow_context *flow)
{
struct lp_build_flow_skip *skip;
LLVMBasicBlockRef current_block;
unsigned i;
skip = &lp_build_flow_pop(flow, LP_BUILD_FLOW_SKIP)->skip;
if(!skip)
return;
current_block = LLVMGetInsertBlock(flow->builder);
/* add (variable, block) tuples to the phi nodes */
for(i = 0; i < skip->num_variables; ++i) {
assert(*flow->variables[i]);
assert(LLVMTypeOf(skip->phi[i]) == LLVMTypeOf(*flow->variables[i]));
LLVMAddIncoming(skip->phi[i], flow->variables[i], &current_block, 1);
*flow->variables[i] = skip->phi[i];
}
/* goto block */
LLVMBuildBr(skip->gallivm->builder, skip->block);
LLVMPositionBuilderAtEnd(skip->gallivm->builder, skip->block);
LLVMBuildBr(flow->builder, skip->block);
LLVMPositionBuilderAtEnd(flow->builder, skip->block);
FREE(skip->phi);
}
/**
* Check if the mask predicate is zero. If so, jump to the end of the block.
*/
void
static void
lp_build_mask_check(struct lp_build_mask_context *mask)
{
LLVMBuilderRef builder = mask->skip.gallivm->builder;
LLVMValueRef value;
LLVMBuilderRef builder = mask->flow->builder;
LLVMValueRef cond;
value = lp_build_mask_value(mask);
/* cond = (mask == 0) */
cond = LLVMBuildICmp(builder,
LLVMIntEQ,
LLVMBuildBitCast(builder, value, mask->reg_type, ""),
LLVMBuildBitCast(builder, mask->value, mask->reg_type, ""),
LLVMConstNull(mask->reg_type),
"");
/* if cond, goto end of block */
lp_build_flow_skip_cond_break(&mask->skip, cond);
lp_build_flow_skip_cond_break(mask->flow, cond);
}
@@ -152,27 +477,21 @@ lp_build_mask_check(struct lp_build_mask_context *mask)
*/
void
lp_build_mask_begin(struct lp_build_mask_context *mask,
struct gallivm_state *gallivm,
struct lp_build_flow_context *flow,
struct lp_type type,
LLVMValueRef value)
{
memset(mask, 0, sizeof *mask);
mask->reg_type = LLVMIntTypeInContext(gallivm->context, type.width * type.length);
mask->var = lp_build_alloca(gallivm,
lp_build_int_vec_type(gallivm, type),
"execution_mask");
mask->flow = flow;
mask->reg_type = LLVMIntType(type.width * type.length);
mask->value = value;
LLVMBuildStore(gallivm->builder, value, mask->var);
lp_build_flow_scope_begin(flow);
lp_build_flow_scope_declare(flow, &mask->value);
lp_build_flow_skip_begin(flow);
lp_build_flow_skip_begin(&mask->skip, gallivm);
}
LLVMValueRef
lp_build_mask_value(struct lp_build_mask_context *mask)
{
return LLVMBuildLoad(mask->skip.gallivm->builder, mask->var, "");
lp_build_mask_check(mask);
}
@@ -185,10 +504,9 @@ void
lp_build_mask_update(struct lp_build_mask_context *mask,
LLVMValueRef value)
{
value = LLVMBuildAnd(mask->skip.gallivm->builder,
lp_build_mask_value(mask),
value, "");
LLVMBuildStore(mask->skip.gallivm->builder, value, mask->var);
mask->value = LLVMBuildAnd( mask->flow->builder, mask->value, value, "");
lp_build_mask_check(mask);
}
@@ -198,42 +516,42 @@ lp_build_mask_update(struct lp_build_mask_context *mask,
LLVMValueRef
lp_build_mask_end(struct lp_build_mask_context *mask)
{
lp_build_flow_skip_end(&mask->skip);
return lp_build_mask_value(mask);
lp_build_flow_skip_end(mask->flow);
lp_build_flow_scope_end(mask->flow);
return mask->value;
}
void
lp_build_loop_begin(struct lp_build_loop_state *state,
struct gallivm_state *gallivm,
LLVMValueRef start)
lp_build_loop_begin(LLVMBuilderRef builder,
LLVMValueRef start,
struct lp_build_loop_state *state)
{
LLVMBuilderRef builder = gallivm->builder;
LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
LLVMValueRef function = LLVMGetBasicBlockParent(block);
state->block = lp_build_insert_new_block(gallivm, "loop_begin");
state->counter_var = lp_build_alloca(gallivm, LLVMTypeOf(start), "loop_counter");
state->gallivm = gallivm;
LLVMBuildStore(builder, start, state->counter_var);
state->block = LLVMAppendBasicBlock(function, "loop");
LLVMBuildBr(builder, state->block);
LLVMPositionBuilderAtEnd(builder, state->block);
state->counter = LLVMBuildLoad(builder, state->counter_var, "");
state->counter = LLVMBuildPhi(builder, LLVMTypeOf(start), "");
LLVMAddIncoming(state->counter, &start, &block, 1);
}
void
lp_build_loop_end_cond(struct lp_build_loop_state *state,
LLVMValueRef end,
LLVMValueRef step,
LLVMIntPredicate llvm_cond)
lp_build_loop_end(LLVMBuilderRef builder,
LLVMValueRef end,
LLVMValueRef step,
struct lp_build_loop_state *state)
{
LLVMBuilderRef builder = state->gallivm->builder;
LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
LLVMValueRef function = LLVMGetBasicBlockParent(block);
LLVMValueRef next;
LLVMValueRef cond;
LLVMBasicBlockRef after_block;
@@ -243,26 +561,44 @@ lp_build_loop_end_cond(struct lp_build_loop_state *state,
next = LLVMBuildAdd(builder, state->counter, step, "");
LLVMBuildStore(builder, next, state->counter_var);
cond = LLVMBuildICmp(builder, LLVMIntNE, next, end, "");
cond = LLVMBuildICmp(builder, llvm_cond, next, end, "");
after_block = lp_build_insert_new_block(state->gallivm, "loop_end");
after_block = LLVMAppendBasicBlock(function, "");
LLVMBuildCondBr(builder, cond, after_block, state->block);
LLVMPositionBuilderAtEnd(builder, after_block);
LLVMAddIncoming(state->counter, &next, &block, 1);
state->counter = LLVMBuildLoad(builder, state->counter_var, "");
LLVMPositionBuilderAtEnd(builder, after_block);
}
void
lp_build_loop_end(struct lp_build_loop_state *state,
LLVMValueRef end,
LLVMValueRef step)
lp_build_loop_end_cond(LLVMBuilderRef builder,
LLVMValueRef end,
LLVMValueRef step,
int llvm_cond,
struct lp_build_loop_state *state)
{
lp_build_loop_end_cond(state, end, step, LLVMIntNE);
LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
LLVMValueRef function = LLVMGetBasicBlockParent(block);
LLVMValueRef next;
LLVMValueRef cond;
LLVMBasicBlockRef after_block;
if (!step)
step = LLVMConstInt(LLVMTypeOf(end), 1, 0);
next = LLVMBuildAdd(builder, state->counter, step, "");
cond = LLVMBuildICmp(builder, llvm_cond, next, end, "");
after_block = LLVMAppendBasicBlock(function, "");
LLVMBuildCondBr(builder, cond, after_block, state->block);
LLVMAddIncoming(state->counter, &next, &block, 1);
LLVMPositionBuilderAtEnd(builder, after_block);
}
@@ -280,16 +616,24 @@ lp_build_loop_end(struct lp_build_loop_state *state,
Is built with:
// x needs an alloca variable
x = lp_build_alloca(builder, type, "x");
LLVMValueRef x = LLVMGetUndef(); // or something else
flow = lp_build_flow_create(builder);
lp_build_if(ctx, builder, cond);
LLVMBuildStore(LLVMBuildAdd(1, 2), x);
lp_build_else(ctx);
LLVMBuildStore(LLVMBuildAdd(2, 3). x);
lp_build_endif(ctx);
lp_build_flow_scope_begin(flow);
// x needs a phi node
lp_build_flow_scope_declare(flow, &x);
lp_build_if(ctx, flow, builder, cond);
x = LLVMAdd(1, 2);
lp_build_else(ctx);
x = LLVMAdd(2, 3);
lp_build_endif(ctx);
lp_build_flow_scope_end(flow);
lp_build_flow_destroy(flow);
*/
@@ -298,28 +642,53 @@ lp_build_loop_end(struct lp_build_loop_state *state,
* Begin an if/else/endif construct.
*/
void
lp_build_if(struct lp_build_if_state *ifthen,
struct gallivm_state *gallivm,
lp_build_if(struct lp_build_if_state *ctx,
struct lp_build_flow_context *flow,
LLVMBuilderRef builder,
LLVMValueRef condition)
{
LLVMBasicBlockRef block = LLVMGetInsertBlock(gallivm->builder);
LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
struct lp_build_flow_if *ifthen;
unsigned i;
memset(ifthen, 0, sizeof *ifthen);
ifthen->gallivm = gallivm;
memset(ctx, 0, sizeof(*ctx));
ctx->builder = builder;
ctx->flow = flow;
/* push/create new scope */
ifthen = &lp_build_flow_push(flow, LP_BUILD_FLOW_IF)->ifthen;
assert(ifthen);
ifthen->num_variables = flow->num_variables;
ifthen->condition = condition;
ifthen->entry_block = block;
/* create a Phi node for each variable in this flow scope */
ifthen->phi = MALLOC(ifthen->num_variables * sizeof(*ifthen->phi));
if (!ifthen->phi) {
ifthen->num_variables = 0;
return;
}
/* create endif/merge basic block for the phi functions */
ifthen->merge_block = lp_build_insert_new_block(gallivm, "endif-block");
ifthen->merge_block = lp_build_insert_new_block(builder, "endif-block");
LLVMPositionBuilderAtEnd(builder, ifthen->merge_block);
/* create a phi node for each variable */
for (i = 0; i < flow->num_variables; i++) {
ifthen->phi[i] = LLVMBuildPhi(builder, LLVMTypeOf(*flow->variables[i]), "");
/* add add the initial value of the var from the entry block */
if (!LLVMIsUndef(*flow->variables[i]))
LLVMAddIncoming(ifthen->phi[i], flow->variables[i],
&ifthen->entry_block, 1);
}
/* create/insert true_block before merge_block */
ifthen->true_block =
LLVMInsertBasicBlockInContext(gallivm->context,
ifthen->merge_block,
"if-true-block");
ifthen->true_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-true-block");
/* successive code goes into the true block */
LLVMPositionBuilderAtEnd(gallivm->builder, ifthen->true_block);
LLVMPositionBuilderAtEnd(builder, ifthen->true_block);
}
@@ -327,21 +696,27 @@ lp_build_if(struct lp_build_if_state *ifthen,
* Begin else-part of a conditional
*/
void
lp_build_else(struct lp_build_if_state *ifthen)
lp_build_else(struct lp_build_if_state *ctx)
{
LLVMBuilderRef builder = ifthen->gallivm->builder;
struct lp_build_flow_context *flow = ctx->flow;
struct lp_build_flow_if *ifthen;
unsigned i;
/* Append an unconditional Br(anch) instruction on the true_block */
LLVMBuildBr(builder, ifthen->merge_block);
ifthen = &lp_build_flow_peek(flow, LP_BUILD_FLOW_IF)->ifthen;
assert(ifthen);
/* for each variable, update the Phi node with a (variable, block) pair */
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block);
for (i = 0; i < flow->num_variables; i++) {
assert(*flow->variables[i]);
LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &ifthen->true_block, 1);
}
/* create/insert false_block before the merge block */
ifthen->false_block =
LLVMInsertBasicBlockInContext(ifthen->gallivm->context,
ifthen->merge_block,
"if-false-block");
ifthen->false_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-false-block");
/* successive code goes into the else block */
LLVMPositionBuilderAtEnd(builder, ifthen->false_block);
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->false_block);
}
@@ -349,32 +724,75 @@ lp_build_else(struct lp_build_if_state *ifthen)
* End a conditional.
*/
void
lp_build_endif(struct lp_build_if_state *ifthen)
lp_build_endif(struct lp_build_if_state *ctx)
{
LLVMBuilderRef builder = ifthen->gallivm->builder;
struct lp_build_flow_context *flow = ctx->flow;
struct lp_build_flow_if *ifthen;
LLVMBasicBlockRef curBlock = LLVMGetInsertBlock(ctx->builder);
unsigned i;
ifthen = &lp_build_flow_pop(flow, LP_BUILD_FLOW_IF)->ifthen;
assert(ifthen);
/* Insert branch to the merge block from current block */
LLVMBuildBr(builder, ifthen->merge_block);
LLVMBuildBr(ctx->builder, ifthen->merge_block);
/*
* Now patch in the various branch instructions.
*/
if (ifthen->false_block) {
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block);
/* for each variable, update the Phi node with a (variable, block) pair */
for (i = 0; i < flow->num_variables; i++) {
assert(*flow->variables[i]);
LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &curBlock, 1);
/* replace the variable ref with the phi function */
*flow->variables[i] = ifthen->phi[i];
}
}
else {
/* no else clause */
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block);
for (i = 0; i < flow->num_variables; i++) {
assert(*flow->variables[i]);
LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &ifthen->true_block, 1);
/* replace the variable ref with the phi function */
*flow->variables[i] = ifthen->phi[i];
}
}
FREE(ifthen->phi);
/***
*** Now patch in the various branch instructions.
***/
/* Insert the conditional branch instruction at the end of entry_block */
LLVMPositionBuilderAtEnd(builder, ifthen->entry_block);
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->entry_block);
if (ifthen->false_block) {
/* we have an else clause */
LLVMBuildCondBr(builder, ifthen->condition,
LLVMBuildCondBr(ctx->builder, ifthen->condition,
ifthen->true_block, ifthen->false_block);
}
else {
/* no else clause */
LLVMBuildCondBr(builder, ifthen->condition,
LLVMBuildCondBr(ctx->builder, ifthen->condition,
ifthen->true_block, ifthen->merge_block);
}
/* Insert branch from end of true_block to merge_block */
if (ifthen->false_block) {
/* Append an unconditional Br(anch) instruction on the true_block */
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->true_block);
LLVMBuildBr(ctx->builder, ifthen->merge_block);
}
else {
/* No else clause.
* Note that we've already inserted the branch at the end of
* true_block. See the very first LLVMBuildBr() call in this function.
*/
}
/* Resume building code at end of the ifthen->merge_block */
LLVMPositionBuilderAtEnd(builder, ifthen->merge_block);
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block);
}
@@ -394,16 +812,15 @@ lp_build_endif(struct lp_build_if_state *ifthen)
* - http://www.llvm.org/docs/tutorial/OCamlLangImpl7.html#memory
*/
LLVMValueRef
lp_build_alloca(struct gallivm_state *gallivm,
lp_build_alloca(LLVMBuilderRef builder,
LLVMTypeRef type,
const char *name)
{
LLVMBuilderRef builder = gallivm->builder;
LLVMBasicBlockRef current_block = LLVMGetInsertBlock(builder);
LLVMValueRef function = LLVMGetBasicBlockParent(current_block);
LLVMBasicBlockRef first_block = LLVMGetEntryBasicBlock(function);
LLVMValueRef first_instr = LLVMGetFirstInstruction(first_block);
LLVMBuilderRef first_builder = LLVMCreateBuilderInContext(gallivm->context);
LLVMBuilderRef first_builder = LLVMCreateBuilder();
LLVMValueRef res;
if (first_instr) {
@@ -413,7 +830,6 @@ lp_build_alloca(struct gallivm_state *gallivm,
}
res = LLVMBuildAlloca(first_builder, type, name);
LLVMBuildStore(builder, LLVMConstNull(type), res);
LLVMDisposeBuilder(first_builder);
@@ -436,17 +852,16 @@ lp_build_alloca(struct gallivm_state *gallivm,
* - http://www.llvm.org/docs/tutorial/OCamlLangImpl7.html#memory
*/
LLVMValueRef
lp_build_array_alloca(struct gallivm_state *gallivm,
lp_build_array_alloca(LLVMBuilderRef builder,
LLVMTypeRef type,
LLVMValueRef count,
const char *name)
{
LLVMBuilderRef builder = gallivm->builder;
LLVMBasicBlockRef current_block = LLVMGetInsertBlock(builder);
LLVMValueRef function = LLVMGetBasicBlockParent(current_block);
LLVMBasicBlockRef first_block = LLVMGetEntryBasicBlock(function);
LLVMValueRef first_instr = LLVMGetFirstInstruction(first_block);
LLVMBuilderRef first_builder = LLVMCreateBuilderInContext(gallivm->context);
LLVMBuilderRef first_builder = LLVMCreateBuilder();
LLVMValueRef res;
if (first_instr) {

View File

@@ -41,49 +41,52 @@
struct lp_type;
/**
* Early exit. Useful to skip to the end of a function or block when
* the execution mask becomes zero or when there is an error condition.
*/
struct lp_build_skip_context
{
struct gallivm_state *gallivm;
struct lp_build_flow_context;
/** Block to skip to */
LLVMBasicBlockRef block;
};
struct lp_build_flow_context *
lp_build_flow_create(LLVMBuilderRef builder);
void
lp_build_flow_skip_begin(struct lp_build_skip_context *ctx,
struct gallivm_state *gallivm);
lp_build_flow_destroy(struct lp_build_flow_context *flow);
void
lp_build_flow_skip_cond_break(struct lp_build_skip_context *ctx,
lp_build_flow_scope_begin(struct lp_build_flow_context *flow);
void
lp_build_flow_scope_declare(struct lp_build_flow_context *flow,
LLVMValueRef *variable);
void
lp_build_flow_scope_end(struct lp_build_flow_context *flow);
void
lp_build_flow_skip_begin(struct lp_build_flow_context *flow);
void
lp_build_flow_skip_cond_break(struct lp_build_flow_context *flow,
LLVMValueRef cond);
void
lp_build_flow_skip_end(struct lp_build_skip_context *ctx);
lp_build_flow_skip_end(struct lp_build_flow_context *flow);
struct lp_build_mask_context
{
struct lp_build_skip_context skip;
struct lp_build_flow_context *flow;
LLVMTypeRef reg_type;
LLVMValueRef var;
LLVMValueRef value;
};
void
lp_build_mask_begin(struct lp_build_mask_context *mask,
struct gallivm_state *gallivm,
struct lp_build_flow_context *flow,
struct lp_type type,
LLVMValueRef value);
LLVMValueRef
lp_build_mask_value(struct lp_build_mask_context *mask);
/**
* Bitwise AND the mask with the given value, if a previous mask was set.
*/
@@ -91,9 +94,6 @@ void
lp_build_mask_update(struct lp_build_mask_context *mask,
LLVMValueRef value);
void
lp_build_mask_check(struct lp_build_mask_context *mask);
LLVMValueRef
lp_build_mask_end(struct lp_build_mask_context *mask);
@@ -107,48 +107,44 @@ lp_build_mask_end(struct lp_build_mask_context *mask);
*/
struct lp_build_loop_state
{
LLVMBasicBlockRef block;
LLVMValueRef counter_var;
LLVMValueRef counter;
struct gallivm_state *gallivm;
LLVMBasicBlockRef block;
LLVMValueRef counter;
};
void
lp_build_loop_begin(struct lp_build_loop_state *state,
struct gallivm_state *gallivm,
LLVMValueRef start);
lp_build_loop_begin(LLVMBuilderRef builder,
LLVMValueRef start,
struct lp_build_loop_state *state);
void
lp_build_loop_end(struct lp_build_loop_state *state,
lp_build_loop_end(LLVMBuilderRef builder,
LLVMValueRef end,
LLVMValueRef step);
LLVMValueRef step,
struct lp_build_loop_state *state);
void
lp_build_loop_end_cond(struct lp_build_loop_state *state,
lp_build_loop_end_cond(LLVMBuilderRef builder,
LLVMValueRef end,
LLVMValueRef step,
LLVMIntPredicate cond);
int cond, /* LLVM condition */
struct lp_build_loop_state *state);
/**
* if/else/endif.
*/
struct lp_build_if_state
{
struct gallivm_state *gallivm;
LLVMValueRef condition;
LLVMBasicBlockRef entry_block;
LLVMBasicBlockRef true_block;
LLVMBasicBlockRef false_block;
LLVMBasicBlockRef merge_block;
LLVMBuilderRef builder;
struct lp_build_flow_context *flow;
};
void
lp_build_if(struct lp_build_if_state *ctx,
struct gallivm_state *gallivm,
struct lp_build_flow_context *flow,
LLVMBuilderRef builder,
LLVMValueRef condition);
void
@@ -158,15 +154,15 @@ void
lp_build_endif(struct lp_build_if_state *ctx);
LLVMBasicBlockRef
lp_build_insert_new_block(struct gallivm_state *gallivm, const char *name);
lp_build_insert_new_block(LLVMBuilderRef builder, const char *name);
LLVMValueRef
lp_build_alloca(struct gallivm_state *gallivm,
lp_build_alloca(LLVMBuilderRef builder,
LLVMTypeRef type,
const char *name);
LLVMValueRef
lp_build_array_alloca(struct gallivm_state *gallivm,
lp_build_array_alloca(LLVMBuilderRef builder,
LLVMTypeRef type,
LLVMValueRef count,
const char *name);

Some files were not shown because too many files have changed in this diff Show More