Compare commits

..

699 Commits

Author SHA1 Message Date
Ian Romanick
17493b8848 docs: Update relelase notes 2013-02-22 17:46:24 -08:00
Ian Romanick
3ea699ff3c mesa: Bump version to 9.1 (final)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-02-22 17:46:23 -08:00
Ian Romanick
ea38e7e2e3 i965: Enable OpenGL ES 3.0 on Sandy Bridge
Regardless of what we put in the screen structure, all of the extensions
that compute_version_es2 checks are present and 3.0 will be exposed
anyway.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 7ae6864f0d)
2013-02-22 17:46:23 -08:00
Alex Deucher
4212dbae1c r600g: fixup PS_PARTIAL_FLUSH flag handling for cayman
So we don't emit it twice if we ever use the flag on
cayman.

Note: this is a candidate for the 9.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 8b5acad0e9)
2013-02-22 18:45:40 -05:00
Alex Deucher
a650092fd6 r600g: r6xx deadlock workaround (v6)
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=50655
https://bugs.freedesktop.org/show_bug.cgi?id=47116

v2: flush along with workaround.
v3: just need a flush
v4: try WAIT_UNTIL
v5: switch to PS partial flush
v6: rework patch

Note: this is a candidate for the 9.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 8442b67f5f)
2013-02-22 18:27:37 -05:00
Alex Deucher
11d9f75f01 r600g: add PS_PARTIAL_FLUSH flag
PS_PARTIAL flushes seems to be required in certain
cases to prevent hangs, especially on r6xx.

Note: this is a candidate for the 9.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 7ebf83f109)
2013-02-22 18:27:24 -05:00
Lauri Kasanen
6427e1609e configure: Fix build with automake < 1.11
Commit 86d30dea3c broke building with older
automake versions with this error:

Makefile:769: *** Recursive variable am__v_YACC_ references itself (eventually).  Stop.

This patch fixes it. Fix stolen from xorg-macros.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
(cherry picked from commit 0a82828ad5)
2013-02-22 13:15:40 -08:00
Michel Dänzer
47f7f803ae radeonsi: Fix PIPE_FORMAT_X32_S8X24_UINT sampler hardware format
4 more little piglits.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit 9c1107b3e1)
2013-02-22 20:24:33 +01:00
Michel Dänzer
cb8bacd87a radeonsi: Use stencil surface level information for stencil texturing
7 more little dwarves^W piglits.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit 8356962853)
2013-02-22 20:24:24 +01:00
Michel Dänzer
0d08abd461 radeonsi: properly implement S8Z24 depth-stencil format
Based on r600g commit 2b9659c9e6 .

Fixes crashes with 4 piglit tests which are now hitting these formats.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit f9adf79876)
2013-02-22 20:24:17 +01:00
Michel Dänzer
5baa8ec737 radeonsi: Fix w component of TGSI_SEMANTIC_POSITION fragment shader inputs.
It's the reciprocal of the register value.

Fixes piglit fragcoord_w and glsl-fs-fragcoord-zw-perspective.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit 954bc4ac34)
2013-02-22 20:15:17 +01:00
Michel Dänzer
0c3b96a6c6 radeonsi: Fix blending using destination alpha factor but non-alpha destination
11 more little piglits.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 95bced5929)
2013-02-22 20:13:45 +01:00
Marek Olšák
24e8ad6204 radeonsi: implement 3D transfers
That means we can map and read multiple slices with one transfer_map call.

[ Cherry-picked from r600g commit 1aebb6911e ]

11 more little piglits on master, 1 more on the 9.1 branch (Marek's
glTex(Sub)Image improvements on master broke the other 10).

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 72f4490b55)
2013-02-22 20:13:27 +01:00
Marek Olšák
8013101c2d radeonsi: add assertions to prevent creation of invalid surfaces
[ Cherry-picked from r600g commit ef11ed61a0 ]

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit a84c4edeed)
2013-02-22 20:13:18 +01:00
Marek Olšák
6894c127d9 radeonsi: use u_box_origin_2d helper function
[ Cherry-picked from r600g commit b278aba423 ]

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit c4faab63c4)
2013-02-22 20:13:04 +01:00
Marek Olšák
f0f3ebb777 st/mesa: don't do sRGB conversion in CopyTexSubImage
Assuming I understand EXT_texture_sRGB correctly.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 6520a86c67)
2013-02-22 13:20:10 +01:00
Marek Olšák
deeb4b056f r600g: fix random corruption with CP DMA in TF2
NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit aac8138744)
2013-02-22 12:50:27 +01:00
Andreas Boll
8818d01d33 llvmpipe/build: add DLOPEN_LIBS and PTHREAD_LIBS to the lp_test_* targets
Fixes undefined symbols.

NOTE: This is a candidate for the 9.1 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61052
Tested-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit c1f2c3a80f)
2013-02-22 10:24:53 +01:00
Andreas Boll
ea51f870f6 targets/xa-vmwgfx: Force c++ linker to fix undefined symbols
NOTE: This is a candidate for the 9.1 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61200
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit c1eb585f3d)
2013-02-22 10:24:47 +01:00
Tom Stellard
dfc35a4fc5 r300g/compiler: Fix bug in OMOD folding
The OMOD value was only being folded to one instruction in cases where
the MUL instruction was reading a value written by more than one
instruction.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 10bcc843f8)
2013-02-21 22:09:51 -05:00
Tom Stellard
c7fdb6a861 r300g/tests: Add helper functions for creating a full program
Now you can convert assembly strings into a full struct radeon_compiler
object and use it to test individual compiler pases.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 5e1321ddf4)
2013-02-21 22:09:42 -05:00
Tom Stellard
74790900ca r300g/tests: Exit test runner with a valid status code
This way make check can report whether or not the tests pass.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit bcf2e157ca)
2013-02-21 22:09:33 -05:00
Tom Stellard
42cfb1ef47 r300g/complier: Make r300_vertprog_swizzle_caps visible in other files
This will be used by the test suite in later commits.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 5355fc1e87)
2013-02-21 22:09:22 -05:00
Tom Stellard
754447d81f r300g/compiler: Add missing license headers
These are all files that I authored, but forgot to add the license
headers.

NOTE: This is a candidate for the stable branches.

Signed-off-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 27d140b960)
2013-02-21 22:09:11 -05:00
Alex Deucher
e41bdc223e r600g: don't enable ReZ mode on evergreen
Can cause lockups in certain cases when
zfunc/zenable/zwrite change without a flush
in between.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=60969
and lockups on Civ4 with wine.

This is a candidate for the 9.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 2e4ef989a2)
2013-02-21 12:02:15 -05:00
Ian Romanick
6ff7080a4c mesa: Don't install glEvalMesh in the beginend dispatch table
NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59740
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 8b586322e7)
2013-02-20 15:25:55 -08:00
Zack Rusin
bdffccf91e DRI2: Don't disable GLX_INTEL_swap_event unconditionally
GLX_INTEL_swap_event is broken on the server side, where it's
currently unconditionally enabled. This completely breaks
systems running on drivers which don't support that extension.
There's no way to test for its presence on this side, so instead
of disabling it uncondtionally, just disable it for drivers
which are known to not support it. It makes sense because
most drivers do support it right now.
We'll be able to remove this once Xserver properly advertises
GLX_INTEL_swap_event.

Note: This is a candidate for stable branch branches.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60052
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 076403c30d)
2013-02-19 12:50:55 -08:00
Stefan Brüns
c41ba5bda9 glx: fix glGetTexLevelParameteriv for indirect rendering
A single element in a GLX reply is contained in the header itself.
The number of elements is denoted in the "n" field of the reply.
If "n" is 1, the length of additional data is 0.
The XXX_data_length() function of xcb does not return the length of
the (optional, n>1) data but the number of elements.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=59876

Note: This is a candidate for the stable branches.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 5876a5dbc0)
2013-02-19 12:17:26 -08:00
Ian Romanick
456cdb6d01 mesa: Bump version to 9.1-rc2
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-02-17 14:49:02 -08:00
Eric Anholt
aaee862305 i965/fs: Use a helper function for checking for flow control instructions.
In 2 of our checks, we were missing BREAK and CONTINUE.

NOTE: Candidate for the stable branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit bf91f0b039)
2013-02-17 14:20:39 -08:00
bma
b84d9aa0c6 shaderapi: Fix AttachShader error
Detect a duplicate Shader type as and error instead of silently allowing
it, restrict to ES2 API.

v2: Tapani Pälli <tapani.palli@intel.com>
    - make the check run time instead of compile time

v3: chadv
    - Quote spec on which error to generate.

Signed-off-by: bma <Bo.Ma@windriver.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit ce3dfa19ab)
2013-02-17 14:20:34 -08:00
Eric Anholt
bb4b1494e3 i965: Re-enable the -RHW workaround for original gen4 chips.
Fixes broken clipping in supertuxkart and presumably many other applications.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51471
NOTE: Candidate for the stable branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit cb4616d32d)
2013-02-17 14:20:27 -08:00
Eric Anholt
321abaaa8d i965/gen4: Work around missing sRGB RGB DXT1 support.
The hardware just doesn't support it.  I suspect this was a regression from
the move to fixed MESA_FORMATs for compressed textures and that previously we
were storing uncompressed for this or something.

Fixes GPU hangs in piglit "texwrap GL_EXT_texture_sRGB-s3tc bordercolor
swizzled" on my GM965.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit ddc2b453d0)
2013-02-17 14:20:22 -08:00
Ian Romanick
95f1203a7c mesa: Add .cherry-ignore for 9.1
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-02-17 14:16:22 -08:00
Christopher James Halse Rogers
96fb4d61fb i965: Fix leak in blorp CopyTexSubImage2D
_mesa_delete_renderbuffer does not call the driver-specific
renderbuffer delete function, so the blorp code was leaking the
Intel-specific bits, including some GEM objects.

Call the renderbuffer's ->Delete() method instead, which does the
right thing.

Fixes Unity rapidly sending the machine into the arms of the OOM-killer

Note: This is a candidate for the 9.1 branch.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit dd599188d2)
2013-02-17 14:13:27 -08:00
Brian Paul
d8a0439c65 st/mesa: fix format query for GL_ARB_texture_rg
The GL_ARB_texture_rg spec says that we need to support both texturing
and rendering for the GL_RED and GL_RG formats.  So move the format
check up into the rendertarget_mapping[] list.  Also, add
PIPE_FORMAT_R8_UNORM to the list of formats required.

Note: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 4be5a06752)
2013-02-17 14:13:13 -08:00
Eric Anholt
c785315f3d i965/gen7: Set up all samplers even if samplers are sparsely used.
In GLSL, sampler indices are allocated contiguously from 0.  But in the
case of ARB_fragment_program (and possibly fixed function), an app that
uses texture 0 and 2 will use sampler indices 0 and 2, so we were only
allocating space for samplers 0 and 1 and setting up sampler 0.  We
would read garbage for sampler 2, resulting in flickering textures and
an angry simulator.

Fixes bad rendering in 0 A.D. and ETQW.  This was fixed for pre-gen7 by
28f4be9eb9

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=25201
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58680
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
NOTE: This is a candidate for stable branches.
(cherry picked from commit 5bb05c6e6d)
2013-02-17 14:12:47 -08:00
Kenneth Graunke
0e3c755ca3 i965: Use derived state for Haswell's 3DSTATE_VF packet.
Otherwise, we fail to correctly handle GL_PRIMITIVE_RESTART_FIXED_INDEX.

Fixes gles3conform's primitive_restart_mode test.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 8cabe26f5d)
2013-02-17 14:12:10 -08:00
Brian Paul
4d11454e90 util: fix incorrect Z bit masking in util_clear_depth_stencil()
For PIPE_FORMAT_Z24_UNORM_S8_UINT, the Z bits are in the 24
least significant bits.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=60527
and http://bugs.freedesktop.org/show_bug.cgi?id=60524
and http://bugs.freedesktop.org/show_bug.cgi?id=60047

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 4bfdef87e6)
2013-02-17 14:10:55 -08:00
Marek Olšák
9838215f3c mesa: fix GetTexImage if mesa format and internal format don't match
Tested with softpipe only exposing RGBA formats.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit cb6470775c)
2013-02-17 14:10:40 -08:00
Marek Olšák
2e4473d9e3 mesa: don't use memcpy fast path for GetTexImage if base format is different
The Mesa format can be RGBA8888_REV, the format/type can be
GL_RGBA/GL_UNSIGNED_BYTE, but the actual texture internal format can be
LUMINANCE_ALPHA, INTENSITY, etc. Therefore we should look at the base
internal format as well.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit c8379204ab)
2013-02-17 14:10:28 -08:00
Marek Olšák
11eb644cc9 mesa: don't use _mesa_base_tex_format for format parameter of GetTexImage
_mesa_base_tex_format doesn't accept GL_BGR and GL_ABGR_EXT, etc.

v2: add a (now hopefully complete) helper function to deal with this

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 09a99867ab)
2013-02-17 14:09:55 -08:00
Ian Romanick
60bad0ddc3 intel: Do not expose OES_compressed_ETC1_RGB8_texture or ARB_texture_rgb10_a2ui pre-GEN4
Older hardware cannot do ARB_texture_rgb10_a2ui, and the translation
code for OES_compressed_ETC1_RGB8_texture was never implemented in the
i915 driver.

NOTE: This is a candidate for all stable branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 0e2f26d5ea)
2013-02-17 14:09:09 -08:00
Roland Scheidegger
d41e9b4d14 softpipe: fix using optimized filter function
This optimized filter (when using repeat wrap modes,
linear min/mag/mip filters, pot textures) only applies to 2d textures,
but nothing prevented it from being used for other textures (likely
leading to very bogus sample results).

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 66b6d51214)
2013-02-17 14:09:01 -08:00
Kristian Høgsberg
60f05f0eef egl-wayland: Make sure we allocate a back buffer even if nothing was rendered
At eglSwapBuffer time, we blindly assume we have a back buffer, but the
back buffer only gets allocated when somebody tries to render something.

NOTE: This is a candidate for the 9.0 and 9.1 branches.

https://bugs.freedesktop.org/show_bug.cgi?id=60086
(cherry picked from commit 1fe007399c)
2013-02-17 14:08:41 -08:00
Brian Paul
714d8b3f8c svga: fix sRGB rendering
We weren't emitting the SVGA_RS_OUTPUTGAMMA state so sRGB rendering
didn't work properly.

Fixes piglit's framebuffer-srgb test.

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit ff60509157)
2013-02-17 14:08:22 -08:00
Brian Paul
ac22dffaf6 st/mesa: don't choose DXT formats if we can't do DXT compression
If we call gl[Copy]TexImage2D() with a generic compression format
(e.g. intFormat=GL_COMPRESSED_RGBA) we can't choose a DXT format if
we don't have the external DXT compression library.

We weren't actually enforcing this before since the
pipe_screen::is_format_supported(DXT) query has no dependency on
the DXT compression library.

Now if we're given a generic compressed format and we can't do DXT
compression we'll fall back to a non-compressed format.

v2: use util_format_is_s3tc() function and add more comments about
the allow_dxt parameter.

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 4df42890c5)
2013-02-17 14:08:16 -08:00
Brian Paul
4ec3843a54 mesa: don't use format chooser code for glCompressedTexImage
When glCompressedTexImage is called the internalFormat is a specific
format for the incoming image and the the hardware format should be
the same (since we never do format transcoding).  So use the simpler
_mesa_glenum_to_compressed_format() function.  This change is also
needed for the next patch.

Note: This is a candidate for the stable branches.
(cherry picked from commit 478056b81a)
2013-02-17 14:07:37 -08:00
Michel Dänzer
30ae2f97c5 configure.ac: GLX cannot work without OpenGL
GLX uses mapi/glapi/libglapi.la, which is only built for OpenGL.

If the user specified --enable-xlib-glx --disable-opengl, error out, as these
cannot be both observed at the same time. If the user just specified
--disable-opengl but not --disable-glx, print a warning and disable GLX as
well.

NOTE: This is a candidate for the stable branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59364

Tested-by: Tom Stellard <thomas.stellard@amd.com>
(cherry picked from commit 3b888f534c)
2013-02-17 14:07:22 -08:00
Stéphane Marchesin
b289e639e4 glx: Check that swap_buffers_reply is non-NULL before using it
Check that the return value from xcb_dri2_swap_buffers_reply is
non-NULL before accessing the struct members.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 67e7263e45)
2013-02-17 14:02:29 -08:00
Brian Paul
c7e5e9ddce st/mesa: only enable GL_EXT_framebuffer_multisample if GL_MAX_SAMPLES >= 2
We never really have multisampling with one sample per pixel.
See also http://bugs.freedesktop.org/show_bug.cgi?id=59873

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>

(cherry picked from commit c80bacba2e)
2013-02-17 14:01:37 -08:00
Brian Paul
7b9e99f45b mesa: don't enable GL_EXT_framebuffer_multisample for software drivers
Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 8f3c81d018)
2013-02-17 14:00:11 -08:00
Brian Paul
9cea40321c osmesa: use _mesa_generate_mipmap() for mipmap generation, not meta
See previous commit for more info.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 2180f32972)
2013-02-17 13:59:52 -08:00
Brian Paul
29e63455aa xlib: use _mesa_generate_mipmap() for mipmap generation, not meta
The swrast fragment program interpreter has trouble computing the
right texture LOD because it doesn't have easy access to input
derivatives.  This causes the GLSL-based meta generate mipmap code
to fetch texels from the wrong mipmap level.

One possible fix would be to set the GL_TEXTURE_MIN/MAX_LOD parameters
to limit sampling from the right level.  But let's just use the
_mesa_generate_mipmap() fallback since it's a lot faster than using
the fragment shader interpreter.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=54240

Note: This is a candidate for the 9.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 89551ae04f)
2013-02-17 13:59:43 -08:00
Paul Berry
632a5a3a5b glsl: don't allow non-flat integral types in varying structs/arrays.
In the GLSL 1.30 spec, section 4.3.6 ("Outputs") says:

    "If a vertex output is a signed or unsigned integer or integer
    vector, then it must be qualified with the interpolation qualifier
    flat."

The GLSL ES 3.00 spec further clarifies, in section 4.3.6 ("Output
Variables"):

    "Vertex shader outputs that are, *or contain*, signed or unsigned
    integers or integer vectors must be qualified with the
    interpolation qualifier flat."

(Emphasis mine.)

The language in the GLSL ES 3.00 spec is clearly correct and should be
applied to all shading language versions, since varyings that contain
ints can't be interpolated, regardless of which shading language
version is in use.

(Note that in GLSL 1.50 the restriction is changed to apply to
fragment shader inputs rather than vertex shader outputs, to
accommodate the fact that in the presence of geometry shaders, vertex
shader outputs are not necessarily interpolated.  That will be
addressed by a future patch).

NOTE: This is a candidate for stable branches.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
(cherry picked from commit 93c913485e)
2013-02-15 13:28:01 -08:00
Paul Berry
2cd4824fbc glsl: Allow default precision qualifiers to be set for sampler types.
From GLSL ES 3.00 section 4.5.4 ("Default Precision Qualifiers"):

    "The precision statement

        precision precision-qualifier type;

    can be used to establish a default precision qualifier. The type
    field can be either int or float or any of the sampler types, and
    the precision-qualifier can be lowp, mediump, or highp."

GLSL ES 1.00 has similar language.  GLSL 1.30 doesn't allow precision
qualifiers on sampler types, but this seems like an oversight (since
the intention of including these in GLSL 1.30 is to allow
compatibility with ES shaders).

Previously, Mesa followed GLSL 1.30 and only allowed default precision
qualifiers to be set for float and int.  This patch makes it follow
GLSL ES rules in all cases.

Fixes Piglit tests default-precision-sampler.{vert,frag}.

Partially addresses https://bugs.freedesktop.org/show_bug.cgi?id=60737.

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit d5948f2f5e)
2013-02-15 13:27:48 -08:00
Michel Dänzer
05de84442b radeonsi: Handle TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS
8 more little piglits.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit c840270ebe)
2013-02-15 18:47:28 +01:00
Michel Dänzer
14372a70ec radeonsi: Fix array indices for detecting integer vertex formats
(cherry picked from commit f34ad85765)
2013-02-15 18:47:21 +01:00
Christian König
baa9070346 radeonsi: remove constant index limitation v3
With the llvm patches, fixing 14 piglit tests in total.

v2: increase the const limit
v3: document the const limit

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit 8c80894fb3)
2013-02-15 18:46:32 +01:00
Christian König
f50e4e21f4 radeonsi: support constants as TEX coordinates
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit 8514f5ac01)
2013-02-15 18:45:29 +01:00
Tom Stellard
38e728498b configure.ac: Add components to LLVM_COMPONENTS when using llvm shared libs
This is required when LLVM is built with CMake, which creates one
shared library for each component.
(cherry picked from commit 0898047e7b)
2013-02-13 17:02:12 -05:00
Matt Turner
fb2eb65126 Revert "mesa: Return INVALID_OPERATION when type is known but not allowed"
This reverts commit 2906e2034c.

Fixes a regression in the glean depthStencil test.

Reverting this does not affect any tests in es3conform, so a more recent
patch must have also fixed the failure this one was intended to fix.

Reported-by: lu hua <huax.lu@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59494
(cherry picked from commit a527b2192e)
2013-02-13 15:31:50 -05:00
Tom Stellard
741a249cbf r600g: Handle SET*_DX10 instructions in r600_bytecode_get_num_operands() 2013-02-13 15:31:34 -05:00
Jerome Glisse
3ae8678f81 r600g: fix lockup when hyperz & alpha test are enabled together. v3
Seems that alpha test being enabled confuse the GPU on the order in
which it should perform the Z testing. So force the order programmed
throught db shader control.

v2: Only force z order when alpha test is enabled
v3: Update db shader when binding new dsa + spelling fix

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 974b482aca)
2013-02-12 17:06:36 -05:00
Jordan Justen
85604f3d48 CopyTexImage: Don't check sRGB vs LINEAR for desktop GL
In OpenGL 4.3, new language was added that would require
this check. But, if this check results in broken applications
then perhaps it will be reversed.

For now, remove this check and re-evaluate when
desktop GL 4.3 is closer.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2013-02-12 11:25:15 -08:00
Quentin Glidic
9119b4e8ee configure.ac: Fix --with-llvm-shared-libs
The third argument of AC_ARG_WITH is evaluated for any provided value,
not only on --with-, so it must not force-enable the feature
Also, setting $with_llvm_shared_libs in the opencl check was overriding
the user switch

https://bugs.freedesktop.org/show_bug.cgi?id=59851

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
(cherry picked from commit 1e857130f0)
2013-02-12 15:58:22 +00:00
Tom Stellard
f4f306b8ba r600g/llvm: Select the correct GPU type for RV670
RV670 belongs in the R600 chip class

https://bugs.freedesktop.org/show_bug.cgi?id=58666

NOTE: This is a candidate for the 9.1 branch
(cherry picked from commit 257006e2a4)
2013-02-12 15:58:04 +00:00
Jerome Glisse
99adec8a88 r600g: make sure async blit is done 8 * pitch at a time v2
The blit must be aligned on 8 horizontal block.

v2: no need to align the reminder

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
(cherry picked from commit 323a448825)
2013-02-11 18:44:55 -05:00
Martin Andersson
3b609f12f6 winsys/radeon: fix bo with virtual address referencing mismatch
If the same context try to flink and open the object, use the
same bo struct instead of opening a new gem handle for the object.
This way we avoid avoid having 2 different handle pointing to the
same kernel object which can latter lead to trouble with virtual
address.

Fix:
https://bugs.freedesktop.org/show_bug.cgi?id=60200

Signed-off-by: Martin Andersson <g02maran@gmail.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
(cherry picked from commit a37835c8ed)
2013-02-11 18:41:28 -05:00
Andreas Boll
ecd310bd67 docs: document removal of makedepend build dependency
Build dependency removed with
424f200881

Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 44a5d7371c)
2013-02-11 18:12:30 +01:00
Matt Turner
2a7affc1d5 builtin_compiler/build: Don't use *_FOR_BUILD when not cross compiling
Previously we were relying on CFLAGS_FOR_BUILD to be the same as CFLAGS
when not cross compiling, but this assumption didn't take into
consideration 32-bit builds on 64-bit systems. More generally, not
honoring CFLAGS is bad.

Automake is evidently too stupid to accept

if CROSS_COMPILING
CC = @CC_FOR_BUILD@
...
else
CC = @CC@
endif

without warning that CC has been already defined. The warnings are
harmless, but I'd prefer to avoid future reports about them, so define
proxy variables, which are assigned inside the conditional and then
unconditionally assigned to CC et al.

NOTE: This is a candidate for the 9.1 branch.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59737
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60038
(cherry picked from commit 2db1f73849)
2013-02-11 12:28:06 +01:00
Quentin Glidic
c684e3b53e gallium/egl: Fix include dirs for VPATH build
NOTE: This is a candidate for the 9.1 branch.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
(cherry picked from commit 11bd1b0f58)
2013-02-11 11:48:54 +01:00
Andreas Boll
b94eeffe60 mesa: Bump version to 9.1-rc1 2013-02-11 09:21:54 +01:00
Jerome Glisse
a0528269a3 winsys/radeon: improve debuging printing
Make sure one can identify virtual address failure from allocation
failure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
(cherry picked from commit 9a47684564)
2013-02-08 20:33:22 -05:00
Jerome Glisse
18ef6b1265 xorg: fix exa finish access
The exa core will already set the pointer to NULL prior calling
the callback function. So don't bail out in the callback if it's
already NULL.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
(cherry picked from commit 3310acdf47)
2013-02-08 19:01:51 -05:00
Paul Berry
0419b7a3a1 glsl: Support transform feedback of varying structs.
Since transform feedback needs to be able to access individual fields
of varying structs, we can no longer match up the arguments to
glTransformFeedbackVaryings() with variables in the vertex shader.

Instead, we build up a hashtable which records information about each
possible name that is a candidate for transform feedback, and then
match up the arguments to glTransformFeedbackVaryings() with the
contents of that hashtable.

Populating the hashtable uses the program_resource_visitor
infrastructure, so the logic is shared with how we handle uniforms.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 99b78337e3)
2013-02-08 11:17:33 -08:00
Paul Berry
5be2e14393 glsl: Use parse_program_resource_name to parse transform feedback varyings.
Previously, transform feedback varyings were parsed in an ad-hoc
fashion that wasn't compatible with structs (or array of structs).
This patch makes it use parse_program_resource_name(), which correctly
handles both.

Note that parse_program_resource_name()'s technique for handling
mal-formed input strings is to simply let them through and rely on the
fact that a future name lookup will fail.  Because of this,
tfeedback_decl::init() no longer needs to return a boolean error
code--it always succeeds, and if the input was mal-formed the error
will be detected later.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 53febac02c)
2013-02-08 11:17:28 -08:00
Paul Berry
11e4347bff glsl: Rename uniform_field_visitor to program_resource_visitor.
There's actually nothing uniform-specific in uniform_field_visitor.
It is potentially useful for all kinds of program resources (in
particular, future patches will use it for transform feedback
varyings).

This patch renames it to program_resource_visitor, and clarifies
several comments, to reflect the fact that it is useful for more than
just uniforms.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit b4db34cc4c)
2013-02-08 11:17:23 -08:00
Paul Berry
49a5f829f7 mesa/glsl: Separate parsing logic from _mesa_get_uniform_location.
The parsing logic is moved to a new function in the GLSL module,
parse_program_resource_name().  This name was chosen because it should
eventually be useful for handling everything that OpenGL 4.3 calls
"program resources" (e.g. uniforms, vertex inputs, fragment outputs,
and transform feedback varyings).

Future patches will make use of this function for linking transform
feedback varyings.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit b92900d26a)
2013-02-08 11:17:17 -08:00
Kenneth Graunke
5265c42e52 i965/blorp: Support blits between ARGB and XRGB formats.
Now that we have support for overriding alpha to 1.0, we can handle
blitting between these formats in either direction.

For now, we only support two XRGB formats: MESA_FORMAT_XRGB8888 and
MESA_FORMAT_RGBX8888_REV.  Most places only appear to worry about the
former, so ignore the latter for now.  We can always add it later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
(cherry picked from commit 7d467f3c15)
2013-02-07 22:31:29 -08:00
Kenneth Graunke
3114f5acd3 i965/blorp: Support overriding destination alpha to 1.0.
Currently, Blorp requires the source and destination formats to be
equal.  However, we'd really like to be able to blit between XRGB and
ARGB formats; our BLT engine paths have supported this for a long time.

For ARGB -> XRGB, nothing needs to occur: the missing alpha is already
interpreted as 1.0.  For XRGB -> ARGB, we need to smash the alpha
channel to 1.0 when writing the destination colors.  This is fairly
straightforward with blending.

For now, this code is never used, as the source and destination formats
still must be equal.  The next patch will relax that restriction.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
(cherry picked from commit c0554141a9)
2013-02-07 22:31:29 -08:00
Kenneth Graunke
332c50b666 i965: Implement CopyTexSubImage2D via BLORP (and use it by default).
The BLT engine has many limitations.  Currently, it can only blit
X-tiled buffers (since we don't have a kernel API to whack the BLT
tiling mode register), which means all depth/stencil operations get
punted to meta code, which can be very CPU-intensive.

Even if we used the BLT engine, it can't blit between buffers with
different tiling modes, such as an X-tiled non-MSAA ARGB8888 texture
and a Y-tiled CMS ARGB8888 renderbuffer.  This is a fundamental
limitation, and the only way around that is to use BLORP.

Previously, BLORP only handled BlitFramebuffer.  This patch adds an
additional frontend for doing CopyTexSubImage.  It also makes it the
default.  This is partly to increase testing and avoid hiding bugs,
and partly because the BLORP path can already handle more cases.  With
trivial extensions, it should be able to handle everything the BLT can.

This helps PlaneShift massively, which tries to CopyTexSubImage2D
between depth buffers whenever a player casts a spell.  Since these
are Y-tiled, we hit meta and software ReadPixels paths, eating 99% CPU
while delivering ~1 FPS.  This is particularly bad in an MMO setting
because people cast spells all the time.

It also helps Xonotic in 4X MSAA mode.  At default power management
settings, I measured a 6.35138% +/- 0.672548% performance boost (n=5).
(This data is from v1 of the patch.)

No Piglit regressions on Ivybridge (v3) or Sandybridge (v2).

v2: Create a fake intel_renderbuffer to wrap the destination texture
    image and then reuse do_blorp_blit rather than reimplementing most
    of it.  Remove unnecessary clipping code and conditional rendering
    check.

v3: Reuse formats_match() to centralize checks; delete temporary
    renderbuffers.  Reorganize the code.

v4: Actually copy stencil when dealing with separate stencil buffers but
    packed depth/stencil formats.  Tested by a new Piglit test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com> [v4]
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v3]
Reviewed-and-tested-by: Carl Worth <cworth@cworth.org> [v2]
Tested-by: Martin Steigerwald <martin@lichtvoll.de> [v3]
(cherry picked from commit 0b3bebbaac)
2013-02-07 22:31:29 -08:00
Kenneth Graunke
55e3f79d55 mesa: Put extern "C" guards in renderbuffer.h.
I need to use this from C++ code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 29aef6cce8)
2013-02-07 22:31:29 -08:00
Kenneth Graunke
1d2ef43032 i965: Fix the SF Vertex URB Read Length calculation for Gen7 platforms.
Ivybridge doesn't appear to have the same errata as Sandybridge; no
corruption was observed by setting it to more than the minimal correct
value.  It's possible that we were simply lucky, since the URB entries
are 1024-bit on Ivybridge vs. 512-bit Sandybridge.  Or perhaps the
underlying hardware issue is fixed.

Either way, we may as well program the minimum value since it's now
readily available, likely to be more efficient, and possibly more
correct.

v2: Use GEN7_SBE_* defines rather than GEN6_SF_*.  (A copy and paste
    mistake.)  They're the same, but using the right names is better.

NOTE: This is a candidate for all stable branches.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 44aa2e15f6)
2013-02-07 22:31:28 -08:00
Kenneth Graunke
3acd5ed75b i965: Fix the SF Vertex URB Read Length calculation for Sandybridge.
(This commit message was primarily written by Paul Berry, who explained
 what's going on far better than I would have.)

Previous to this patch, we thought that the only restrictions on
3DSTATE_SF's URB read length were (a) it needs to be large enough to
read all the VUE data that the SF needs, and (b) it can't be so large
that it tries to read VUE data that doesn't exist.  Since the VUE map
already tells us how much VUE data exists, we didn't bother worrying
about restriction (a); we just did the easy thing and programmed the
read length to satisfy restriction (b).

However, we didn't notice this erratum in the hardware docs: "[errata]
Corruption/Hang possible if length programmed larger than recommended".
Judging by the context surrounding this erratum, it's pretty clear that
it means "URB read length must be exactly the size necessary to read all
the VUE data that the SF needs, and no larger".  Which means that we
can't program the read length based on restriction (b)--we have to
program it based on restriction (a).

The URB read size needs to precisely match the amount of data that the
SF consumes; it doesn't work to simply base it on the size of the VUE.

Thankfully, the PRM contains the precise formula the hardware expects.

Fixes random UI corruption in Steam's "Big Picture Mode", random terrain
corruption in PlaneShift, and Piglit's fbo-5-varyings test.

NOTE: This is a candidate for all stable branches.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56920
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60172
Tested-by: Jordan Justen <jordan.l.justen@intel.com> (v1/Piglit)
Tested-by: Martin Steigerwald <martin@lichtvoll.de> (PlaneShift)
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 09fbc29828)
2013-02-07 22:31:28 -08:00
Kenneth Graunke
697f8e56dc i965: Compute the maximum SF source attribute.
The maximum SF source attribute is necessary to compute the Vertex URB
read length properly, which will be done in the next commit.

NOTE: This is a candidate for all stable branches.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 5e9bc7bd12)
2013-02-07 22:31:28 -08:00
Kenneth Graunke
45ae093e5c i965: Refactor Gen6+ SF attribute override code.
The next patch will benefit from easy access to the source attribute
number and whether or not we're swizzling.  It doesn't want the final
attr_override DWord form, however.

NOTE: This is a candidate for all stable branches.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit b3efc5bea8)
2013-02-07 22:31:28 -08:00
Kenneth Graunke
535e95299a i965: Add chipset limits for Haswell GT1/GT2.
The maximum number of URB entries come from the 3DSTATE_URB_VS and
3DSTATE_URB_GS state packet documentation; the thread count information
comes from the 3DSTATE_VS and 3DSTATE_PS state packet documentation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
(cherry picked from commit 9add4e8038)
2013-02-07 22:31:28 -08:00
Vinson Lee
a7e2c615f1 i965: Fix assignment instead of comparison in asserts.
Fixes side effect in assertion defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 1559994cba)
2013-02-07 22:31:28 -08:00
Paul Berry
5611a5a387 mesa: Don't check (offset + size <= bufObj->Size) in BindBufferRange.
In the documentation for BindBufferRange, OpenGL specs from 3.0
through 4.1 contain this language:

    "The error INVALID_VALUE is generated if size is less than or
    equal to zero or if offset + size is greater than the value of
    BUFFER_SIZE."

This text was dropped from OpenGL 4.2, and it does not appear in the
GLES 3.0 spec.

Presumably the reason for the change is because come clients change
the size of the buffer after calling BindBufferRange.  We don't want
to generate an error at the time of the BindBufferRange call just
because the old size of the buffer was too small, when the buffer is
about to be resized.

Since this is a deliberate relaxation of error conditions in order to
allow clients to work, it seems sensible to apply it to all versions
of GL, not just GL 4.2 and above.

(Note that there is no danger of this change allowing a client to
access data beyond the end of a buffer.  We already have code to
ensure that that doesn't happen in the case where the client shrinks
the buffer after calling BindBufferRange).

Eliminates a spurious error message in the gles3 conformance test
"transform_feedback_offset_size".

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 04f0d6cc22)
2013-02-07 21:20:32 -08:00
Ian Romanick
a48e5526c2 i965: Set UniformBufferOffsetAlignment to sizeof(vec4)
This matches the behavior of the Windows driver, but a bspec reference
should would be nice.

NOTE: This is a candidate for the 9.0 and 9.1 branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit f29ab4ece5)
2013-02-07 21:20:16 -08:00
Matt Turner
c59808c700 mesa: Allow glGet* queries of MAX_VARYING_COMPONENTS in ES 3
Should have been done in d9948e49 but I missed it because
MAX_VARYING_FLOATS doesn't appear in the ES 3 spec, but is the same
value as MAX_VARYING_COMPONENTS.

NOTE: Candidate for the 9.1 branch
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-02-07 17:54:16 -08:00
Michel Dänzer
ad62f424b3 radeonsi: Handle scaled and integer formats for samplers and vertex elements.
Also, add assertions to stress that render targets don't support scaled
formats.

20 more little piglits.
(cherry picked from commit 46dd16bca8b4526e46badc9cb1d7c058a8e6173e)
2013-02-07 19:11:30 +01:00
Michel Dänzer
fc04455533 radeonsi: Don't advertise PIPE_FORMAT_L8A8_SRGB support.
The hardware can't do it.
(cherry picked from commit f6e9430da2d3510f84baefa0fdf26ec5c457f146)
2013-02-07 19:11:19 +01:00
Michel Dänzer
6799bddf6b radeonsi: Remove incorrect (and dead) assignment in tex_fetch_args().
The proper return type is assigned at the end of the function.
(cherry picked from commit 180db2bcb28e94bb1ce18d76b2b3a5818d76262c)
2013-02-07 19:11:09 +01:00
Michel Dänzer
93f61addb5 radeonsi: Use unique names for referring to texture sampling intrinsics.
Append the overloaded vector type used for passing in the addressing
parameters.

Without this, LLVM uses the same function signature for all those types,
which cannot work.

Fixes problems e.g. with FlightGear and Red Eclipse.
(cherry picked from commit 1b3afea30de757815555d9eb1d6e72e2586d6a0c)
2013-02-07 19:10:17 +01:00
Jerome Glisse
d04b50b4de r600g: fix slice tile max for compressed texture and async dma
Was using the pixel size instead of the number of block for the slice
tile max computation which resulted in dma writing at wrong address.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-02-07 10:43:37 -05:00
Marek Olšák
f1c46c8418 r300g: fix blending with blend color and RGBA formats
NOTE: This is a candidate for the stable branches.
(cherry picked from commit f40a7fc34a)
2013-02-06 22:24:04 +01:00
Michel Dänzer
4bc85f9aac Require libdrm_radeon 2.4.42 for radeonsi.
It has new PCI IDs and an important tiled surface layout fix.
(cherry picked from commit 02a423b239)
2013-02-05 15:15:49 +01:00
Alex Deucher
e1d798a901 radeonsi: add Oland pci ids
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Note: this is a candidate for the 9.1 branch.
(cherry picked from commit 4161d70bba)
2013-02-04 17:20:22 -05:00
Alex Deucher
6b0fa537a9 radeonsi: default PA_SC_RASTER_CONFIG to 0
That should work in all cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Note: this is a candidate for the 9.1 branch.
(cherry picked from commit af0af75881)
2013-02-04 17:20:03 -05:00
Alex Deucher
0cc0097bb0 radeonsi: add support for Oland chips
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Note: this is a candidate for the 9.1 branch
(cherry picked from commit 83e4407f44)
2013-02-04 17:19:43 -05:00
Michel Dänzer
7f90de5414 radeonsi: Fix draws using user index buffer.
Was broken since commit bf469f4edc
('gallium: add void *user_buffer in pipe_index_buffer').

Fixes 11 piglit tests and lots of missing geometry e.g. in TORCS.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit a8a5055f2d)
2013-02-04 17:54:03 +01:00
Michel Dänzer
8cd237bcbe radeonsi: Remove spurious traces of R16G16B16 support.
The hardware can't do it, and these were causing warnings in some piglit tests.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit 6455d40b7e)
2013-02-04 17:28:18 +01:00
Michel Dänzer
5ca77c27a6 radeonsi: Enable texture arrays.
28/30 piglit tests pass.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit 6bcb823844)
2013-02-04 17:28:14 +01:00
Michel Dänzer
b104d151f1 radeonsi: Improve packing of texture address parameters.
In particular, the LOD bias and depth comparison values are packed before the
'normal' texture coordinates, and the array slice and LOD values are appended.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit 120efeef8b)
2013-02-04 17:27:43 +01:00
Michel Dänzer
5f9f3f381f radeonsi: Adapt to sample intrinsics changes.
Fix up intrinsic names, and bitcast texture address parameters to integers.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit e5fb7347a7)
2013-02-04 17:27:34 +01:00
Marek Olšák
b127ad3489 mesa: don't expose IBM_rasterpos_clip in a core context
glRasterPos doesn't exist in the core profile.

NOTE: This is a candidate for the stable branches (9.0 and 9.1).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit cc5fdaf2dc)
2013-02-01 16:35:24 +01:00
Marek Olšák
1003652a7f r300g: always put MSAA resources in VRAM
This along with the latest drm-fixes branch should help with bad performance
of MSAA. Remember: Nx MSAA can't be more than N times slower (where N=2,4,6).

Anyway, I recommend at least 512 MB of VRAM for Full HD 6x MSAA.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit a06f03d795)
2013-02-01 16:35:18 +01:00
Jerome Glisse
9d8a866db3 r600g: add cs memory usage accounting and limit it v3
We are now seing cs that can go over the vram+gtt size to avoid
failing flush early cs that goes over 70% (gtt+vram) usage. 70%
is use to allow some fragmentation.

The idea is to compute a gross estimate of memory requirement of
each draw call. After each draw call, memory will be precisely
accounted. So the uncertainty is only on the current draw call.
In practice this gave very good estimate (+/- 10% of the target
memory limit).

v2: Remove left over from testing version, remove useless NULL
    checking. Improve commit message.
v3: Add comment to code on memory accounting precision

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
2013-01-31 14:25:30 -05:00
Marek Olšák
3b8d4f941f r600g: fix htile buffer leak
NOTE: This is a candidate for the 9.1 branch.
2013-01-31 14:25:10 -05:00
Matt Turner
ff515c4e7c build: Add missing comma in AS_IF
Reported-by: Lauri Kasanen<curaga@operamail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47248#c15
2013-01-29 15:06:47 -08:00
Marek Olšák
d7ca04a7c3 docs/relnotes-9.1: document new features in radeon drivers
(cherry picked from commit 845130951f)
2013-01-29 17:38:14 +01:00
Matt Turner
48af880f81 docs: List new extensions added in Mesa 9.1
I did not list the *_get_program_binary extensions since they're not
useful to anyone with their current implementation (that supports 0
binary formats).
2013-01-28 16:49:24 -08:00
Jerome Glisse
af2d8f8072 r600g: use uint64_t instead of unsigned long for proper 32bits cpu support
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-01-28 19:10:29 -05:00
Jerome Glisse
d8d17441e2 r600g: real fix for non 3.8 kernel
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-01-28 17:44:49 -05:00
Jerome Glisse
72916698b0 r600g: fix segfault with old kernel
Old kernel do not have dma support, patch pushed were missing some
of the check needed to not use dma.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-01-28 14:51:40 -05:00
Zack Rusin
dbb2d192de glx: only advertise GLX_INTEL_swap_event if it's supported
Only drivers supporting DRI2 version >=4 support GLX_INTEL_swap_event.
So lets mark it as such otherwise applications which use this extension
(i.e. everything based on Clutter, e.g. gnome-shell) break horribly on
drivers supporting DRI2 versions only up to 3.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-24 19:13:05 -08:00
Vadim Girlin
c9343047cf r600g: improve inputs/interpolation handling with llvm backend
Get rid of special handling for reserved regs.
Use one intrinsic for all kinds of interpolation.

v2[Vincent Lejeune]: Rebased against current master

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
2013-01-28 18:30:38 +00:00
Tom Stellard
33dc412b89 r600g: Add ar_chan member to struct r600_bytecode
r600_bytecode::ar_chan stores the register channel for the value that
will be loaded into the AR register.

At the moment, this field is only used by the LLVM backend.  The default
backend always sets ar_chan = 0.
2013-01-28 18:30:38 +00:00
Tom Stellard
0ba0926861 r600g: More robust checks for MOVA_INT instructions 2013-01-28 18:30:37 +00:00
Vincent Lejeune
a871e01174 r600g/llvm: Add dummy export for vs output
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=59588

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
2013-01-28 18:30:37 +00:00
Tom Stellard
91a160b19f r600g: Fix building with --enable-r600-llvm-compiler
https://bugs.freedesktop.org/show_bug.cgi?id=59877
2013-01-28 18:30:37 +00:00
Alex Deucher
e110c98cae r600g: don't emit WAIT_UNTIL on cayman/TN (v2)
It shouldn't be needed and older kernels don't support
it.

v2: Replace with PS partial flush as before.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=59945

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
2013-01-28 12:11:27 -05:00
Jerome Glisse
325422c494 r600g: add async for staging buffer upload v2
v2: Add virtual address to dma src/dst offset for cayman

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-01-28 11:30:35 -05:00
Jerome Glisse
bff07638a8 r600g: add multi ring support with dma as first second ring v4
We keep track of ring emission order in a stack, whenever we need to
flush we empty the stack in a fifo order. There is few helpers function
for bo mapping and other ring activities that will make sure that
the ring stack is properly flush and submitted.

v2: fix st flush path, and other flush path to properly flush all
    rings if necessary
v3: - improve name of ring helpers
    - make sure that each time a cs is gona be written it endup at
      top of the stack to avoid any issue such as :
      STACK[0] = dma (withbo A,B)
      STACK[1] = gfx (withbo C,D)
      Now if code try to emit a dma command relative to bo C or D
      it will start writting cmd stream into the cs and once it
      reach the point where it adds relocation it will flush.
      At that point the cs will have cmd that don't have proper
      relocation into the relocation buffer and kernel will just
      refuse to run.
v4: - Drop the stack idea as it turn out there is no way to use it
      or benefit from it. Any time the driver start command on other
      ring, it always need to flush the previous ring. So make code
      simpler by not using a stack.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-01-28 11:30:35 -05:00
Jerome Glisse
6c064fd749 radeon/winsys: add dma ring support to winsys v3
Add ring support, you can create a cs for each ring. DMA ring is
bit special regarding relocation as you must emit as much relocation
as there is use of the buffer.

v2: - Improved comment on relocation changes
    - Use a single thread to queue cs submittion this simplify driver
      code while not impacting performances. Rational for this is that
      you have to wait for all previous submission to have completed
      so there was never a case while we could have 2 different thread
      submitting a command stream at the same time. This code just
      consolidate submission into one single thread per winsys.
v3: - Do not use semaphore for empty queue signaling, instead use
      cond var. This is because it's tricky to maintain an even number
      of call to semaphore wait and semaphore signal (the number of
      cs in the stack would for instance make that number vary).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-01-28 11:30:35 -05:00
Roland Scheidegger
cbf0f66631 gallivm,draw,llvmpipe: mass rename of unit->texture_unit/sampler_unit
Make it obvious what "unit" this is (no change in functionality).
draw still uses "unit" in places where it changes the shader by adding
texture sampling itself - it seems like this can't work with shaders
using dx10-style sample opcodes (can't mix gl-style and dx10-style
sample instructions in a shader).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-01-28 06:58:06 -08:00
Roland Scheidegger
c789b981b2 gallivm: split sampler and texture state
Split the sampler interface to use separate sampler and texture (sampler_view)
state. This is needed to support dx10-style sampling instructions.
This is not quite complete since both draw/llvmpipe don't really track
textures/samplers independently yet, as well as the gallivm code not quite
using the right sampler or texture index respectively (but it should work
for the sampling codes used by opengl).
We are however losing some optimizations in the process, apply_max_lod will
no longer work, and we potentially could end up with more (unnecessary)
recompiles (if switching textures with/without mipmaps only so it shouldn't
be too bad).

v2: don't use different callback structs for sampler/sampler view functions
(which just complicates things), fix up sampling code to actually use the
right texture or sampler index, and similar for llvmpipe/draw actually
distinguish between samplers and sampler views.

v3: fix more of PIPE_MAX_SAMPLER / PIPE_MAX_SHADER_SAMPLER_VIEWS mismatches
(both in draw and llvmpipe), based on feedback from José get rid of unneeded
static sampler derived state.(which also fixes the only 2 piglit regressions
due to a forgotten assignment), fix comments based on Brian's feedback.

v4: remove some accidental unrelated whitespace changes

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-28 06:50:36 -08:00
Marek Olšák
87592cff57 gallium/u_upload_mgr: fix a serious memory leak
It can eat all memory and crash in a matter of minutes with r600g.
2013-01-28 02:51:52 +01:00
Christoph Bumiller
e058f2ac97 nouveau: don't try to use push_data if it's not implemented 2013-01-27 13:45:06 +01:00
Matt Turner
51b64ce47b gles3: Update gl3.h
Contains a fix for Khronos bug 9557.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-26 20:42:19 -08:00
Marek Olšák
8891b2f9c9 r600g: add more cases for copying unsupported formats to resource_copy_region
just in case a new format is added to gallium
2013-01-26 14:59:04 +01:00
Marek Olšák
26c872c2a2 r600g: don't use radeon_surface_level::npix_x/y/z
npix_x/y/z is wrong with NPOT textures, since it's always aligned to POT
if the level is non-zero, so we can't use that.

This fixes piglit/spec/EXT_texture_shared_exponent/fbo-generatemipmap-formats.
2013-01-26 14:58:52 +01:00
Marek Olšák
edc38330da r600g: fix compile warnings in r600_cp_dma_copy_buffer on 32-bit gcc 2013-01-26 14:50:36 +01:00
Alex Deucher
f951f2f52c r600g: fix up CP DMA for VM on cayman and TN
Need to add the virtual address.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-01-25 21:57:42 -05:00
Brian Paul
c1d35aece0 svga: use pipe_sampler_view_release() in svga_cleanup_tss_binding()
Fixes a crash when the Redway3D Turbine demo exits.  We've made this
change in other places in the past.  The root issue is texture objects
are being shared by multiple contexts and sampler views get shared too.
Sampler views have a context pointer and if that context gets deleted
we may try to reference that context when finally deleting the sampler
view.

pipe_sampler_view_release() avoids this problem because it takes
an explicit context.

Reviewed-by: Zack Rusin <zackr@vmware.com>
2013-01-25 15:57:35 -07:00
Brian Paul
50c4c818aa st/mesa: handle new GLSL IR enumerants in switch statements
To silence warnings about unhandled cases.
2013-01-25 15:46:14 -07:00
Brian Paul
9227c53741 svga: add NULL pointer check in svga_create_sampler_state()
Note: This is a candidate for the 9.0 branch.
2013-01-25 15:41:41 -07:00
Brian Paul
7a89f08a22 vbo: add a null pointer check to handle OOM instead of crashing
Note: This is a candidate for the 9.0 branch.
2013-01-25 15:41:41 -07:00
Brian Paul
b13c534f14 util: add new error checking code in vbuf helper
Check the return value of calls to u_upload_alloc() and
u_upload_data() and return early if needed.

Since we don't have a way to propagate errors all the way up to
Mesa through pipe_context::draw_vbo(), call debug_warn_once() so
the user might have some clue about OOM errors.

Note: This is a candidate for the 9.0 branch.
2013-01-25 15:41:40 -07:00
Brian Paul
8c3f9ea073 st/mesa: do proper error checking for u_upload_alloc() calls
We weren't properly checking the return value of these calls (and
calls to u_upload_data()) to detect OOM errors.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:40 -07:00
Brian Paul
68a097596e util: add some defensive coding in u_upload_alloc()
Some callers of this function were checking the 'ptr' result to see if
the function failed.  But the correct way is to check the regular
return value for PIPE_ERROR_x.  Now we initialize all the returned
values at the top of the function in case we do hit an error (like OOM).

Callers are more likely to detect OOM conditions now.  But there
are some callers which don't do any error checking...

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:40 -07:00
Brian Paul
d6f8b7ef38 glsl: use glsl_strtof() instead of glsl_strtod()
Since the result of those calls is always assigned to a float.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-25 15:41:40 -07:00
Brian Paul
811b5b4b39 glsl: add new glsl_strtof() function
Note, we could alternately implement this in terms of glsl_strtod()
with a (float) cast.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-25 15:41:39 -07:00
Brian Paul
6102b9d441 softpipe: add casts to silence MSVC warnings
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:39 -07:00
Brian Paul
257783b939 util: silence MSVC signed/unsigned comparison warnings
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:39 -07:00
Brian Paul
539541f2e2 util: silence MSVC double->float conversion warnings
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:39 -07:00
Brian Paul
869071dfb7 util: silence MSVC signed/unsigned warnings in debug_get_flags_option()
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:39 -07:00
Brian Paul
1a15772b7c st/mesa: silence assorted MSVC warnings in DrawPixels code
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:38 -07:00
Brian Paul
eee762258e swrast: silence a bunch of MSVC warnings
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:38 -07:00
Brian Paul
ccbb479f40 mesa: use GLbitfield64 when copying program inputs
Note: This is a candidate for the 9.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:38 -07:00
Brian Paul
701a0f6a76 mesa: add some casts to silence MSVC warnings
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:38 -07:00
Brian Paul
ddb774ddf1 mesa: add casts in _mesa_GetTexParameterfv() to silence warnings
There are other similar int->float casts elsewhere in the function.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-25 15:41:38 -07:00
Matt Turner
9aadc3a6cc i965: Enable ARB_shading_language_packing
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-01-25 14:10:24 -08:00
Matt Turner
64dbc51b49 i965: Assert that the 4x8 pack/unpack operations have been lowered
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-01-25 14:10:23 -08:00
Matt Turner
96220111dd i965: Lower the 4x8 pack/unpack operations
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-01-25 14:10:23 -08:00
Matt Turner
321555fb41 glsl: Add support for lowering 4x8 pack/unpack operations
Lower them to arithmetic and bit manipulation expressions.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-01-25 14:10:23 -08:00
Matt Turner
1ef674f215 glsl: Evaluate constant pack/unpack 4x8 expressions
That is, evaluate constant expressions for the following functions:
  packSnorm4x8, unpackSnorm4x8
  packUnorm4x8, unpackUnorm4x8

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-01-25 14:10:23 -08:00
Matt Turner
b64b174b0a glsl: Extend ir_expression_operation for ARB_shading_language_packing
For each function {pack,unpack}{Snorm,Unorm}4x8, add a corresponding
opcode to enum ir_expression_operation. Validate the new opcodes in
ir_validate.cpp.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-01-25 14:10:23 -08:00
Matt Turner
b0239ce960 glsl: Add IR lisp for ARB_shading_language_packing
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-01-25 14:10:23 -08:00
Matt Turner
12aa2fec5b glsl: Add infrastructure for ARB_shading_language_packing
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-01-25 14:10:23 -08:00
Tom Stellard
7a850c5851 configure.ac: Don't set LLVM_LIBS when llvm is disabled 2013-01-25 22:05:00 +00:00
Tom Stellard
264e6dad28 r600g: Don't build llvm_wrapper.cpp when we aren't using LLVM
We were using the NEED_RADEON_GALLIUM conditional to decide whether or not
to build llvm_wrapper.cpp, which is required for using the LLVM backend.
llvm_wrapper.cpp needs to be linked against the LLVM IPO libary
and this library is only added to LLVM_LIBS if either opencl or the
r600-llvm-compiler is enabled.

The NEED_RADEON_GALLIUM conditional is set to true when enabling the
radeonsi driver, so if the radeonsi and r600 drivers are enabled without
also enabling opencl or r600-llvm-compiler, llvm_wrapper.cpp will be
built, but the IPO library won't be added to LLVM_LIBS.  This was
causing unresolved symbol errors when buiding with this configuration.

https://bugs.freedesktop.org/show_bug.cgi?id=59831

Tested-by: Alex Deucher <alexander.deucher@amd.com>
2013-01-25 22:05:00 +00:00
Eric Anholt
1a316af034 i965: Pass in the glarray to get_surface_type.
Dereffing all the values in the two callers was just pointless, and
the function isn't inlined so there was actual code impact.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:41:04 -08:00
Eric Anholt
80aeda2784 i965: Remove nonsense comment.
vb.inputs_read has never been a thing, even in the initial import.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:40:59 -08:00
Eric Anholt
23e5503348 i965: Remove NDEBUG undef that was snuck in.
If you want debug, set --enable-debug in your config flags.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:40:54 -08:00
Eric Anholt
8fe43b6dc9 i965: reuse _mesa_sizeof_type for index buffer types.
The core Mesa code has just one more case than this (GL_BITMAP), so I
don't see any cause to special-case it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:40:49 -08:00
Eric Anholt
b859a12f21 i965: Reuse precalculated ib_type_size value.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:40:44 -08:00
Eric Anholt
9aa02a205d i965: Drop debug check for knowing the size of a type.
This was added in b93684f5f3, but there's
no need for it -- get_size has to succeed, and it has an assert for us
in debug builds.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:40:39 -08:00
Eric Anholt
5ae3c20791 i965: Stop worrying about alignment of vertex data.
For our current types, the required alignment is actually just 1 byte.
When we get doubles, we have to worry (those have to be aligned to the
natural size), but we don't have doubles yet and they'll just be a
special case.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:40:33 -08:00
Eric Anholt
2a7a5062c9 i965: Use the glarray _ElementSize that Mesa tracks for us.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:40:22 -08:00
Eric Anholt
f6191e09aa mesa: Print more informative debug for _mesa_do_init_remap_table().
This is the same logic from _mesa_map_function_array().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:36:43 -08:00
Ian Romanick
22233da1ee glsl: Remove ir_variable::uniform_block
v2: A previous patch contained a spurious hunk that removed an
assignment to ir_variable::uniform_block.  That hunk was moved to this
patch.  Suggested by Carl Worth.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:36 -05:00
Ian Romanick
f09d77b2af glsl: Allow dereferencing fields of an interface instance
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-25 09:07:36 -05:00
Ian Romanick
32f3229255 glsl: Allow elimination of uniform block members
glGetActiveUniform is not supposed to report block members that are not
active even if they are included in the layout of the block.  The block
layout is determined from the GLSL_TYPE_INTERFACE that defines the
block, so eliminating the ir_variables that correspond to the individual
fields is safe.

Fixes gles3conform test
uniform_buffer_object_getuniformindices_for_for_nonexistent_or_not_active_uniform_names.

This also fixes the assertion failures (added in the previous commit) in
gles3conform uniform_buffer_object_index_of_not_active_block,
uniform_buffer_object_inherit_and_override_layouts, and
uniform_buffer_object_repeat_global_scope_layouts.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-25 09:07:36 -05:00
Ian Romanick
514f8c7ec7 glsl: Calculate UBO data at link-time
Use the function added in the previous commit.

This temporarily causes gles3conform
uniform_buffer_object_index_of_not_active_block,
uniform_buffer_object_inherit_and_override_layouts, and
uniform_buffer_object_repeat_global_scope_layouts to assertion fail.
This is fixed in the next commit.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-25 09:07:36 -05:00
Ian Romanick
0ab7399822 glsl: Add link_uniform_blocks to calculate all UBO data at link-time
Calculate all of the block member offsets, the IndexNames, and
everything else to do with every UBO.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-25 09:07:35 -05:00
Ian Romanick
681df909e3 glsl: Add a visitor to determine whether a uniform block is ever used
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-25 09:07:35 -05:00
Ian Romanick
d1b4960f9b glsl: Lower UBO references using link-time data instead of compile-time data
Pretty much all of the compile-time, per-compilation unit block data is
about to get the axe.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-25 09:07:35 -05:00
Ian Romanick
90b1dd03e5 glsl: Add gl_uniform_buffer_variable::IndexName field
glGetUniformIndices requires that the block instance index not be
present in the name of queried uniforms.  However,
gl_uniform_buffer_variable::Name will include the instance index.  The
IndexName field is added to handle this difference.

Note that currently IndexName will always point to the same string as
Name.  This will change soon.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
2013-01-25 09:07:35 -05:00
Ian Romanick
11d42de681 glsl: Make the align function available elsewhere in the linker
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
2013-01-25 09:07:35 -05:00
Ian Romanick
e2c95cd674 glsl: Calculate link-time uniform block data without using compile-time block data
Pretty much all of the compile-time, per-compilation unit block data is
about to get the axe.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-25 09:07:35 -05:00
Ian Romanick
bd963e12ef glsl: Assert that interfaces, like structures, are not seen as leaf types
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:35 -05:00
Ian Romanick
99b8935ce2 glsl: Add new uniform_field_visitor::process variant
This flavor takes a type and a base name.  It will be used to handle
cases where the block name (instead of the instance name) is used for an
interface block.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:35 -05:00
Ian Romanick
007de494d2 glsl: Recurse into uniform blocks just like uniform structures
v2: Inspite of the spell checker, spell recurse correctly.  Suggested by
Carl Worth.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:35 -05:00
Ian Romanick
25e75b0a13 glsl: Handle instance array declarations
v2: Add a comment and an assertion about the array size in the
non-instance name case.  Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:34 -05:00
Ian Romanick
5383661092 glsl: Track blocks in the symbol table using the glsl_type instead of the gl_uniform_block
Eventually the gl_uniform_block information won't be calculated until
linking.  Block names need to be checked for name clashes during
compiling, so we have to track it differently.

v2: Update the commit message.  Suggested by Carl Worth.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:34 -05:00
Ian Romanick
9a204bb9f6 glsl: Add new uniform_field_visitor::visit_field variant
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:34 -05:00
Ian Romanick
141e9d42f5 glsl: Modify uniform_field_visitor::visit_field to take a row_major parameter
Not used yet, but the UBO layout visitor will use this.

v2: Remove a spruious hunk.  This is moved to the patch "glsl: Remove
ir_variable::uniform_block".  Suggested by Carl Worth.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:34 -05:00
Ian Romanick
6a0c1bc163 glsl: Modify uniform_field_visitor::recursion to take a row_major parameter
Not used yet, but the UBO layout visitor will use this.

v2: Add some commentary as to why row_major is always set to false in
process.  Suggesed by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:34 -05:00
Ian Romanick
23b7ce3a82 glsl: Add a predicate to determine whether a variable is an interface block
For the first declaration below, there will be an ir_variable named
"instance" whose type and whose instance_type will be the same
glsl_type.  For the second declaration, there will be an ir_variable
named "f" whose type is float and whose instance_type is B2.

"instance" is an interface instance variable, but "f" is not.

uniform B1 {
    float f;
} instance;

uniform B2 {
    float f;
};

v2: Copy the comment message documentation into the code.  Suggested by
Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:34 -05:00
Ian Romanick
3b09603dda glsl: Require that indices into uniform block arrays be constants
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:34 -05:00
Ian Romanick
7a7b44b329 glsl: Add ir_variable::interface_type field
For variables that are in an interface block or are an instance of an
interface block, this is the GLSL_TYPE_INTERFACE type for that block.

Convert the ir_variable::is_in_uniform_block method added in the
previous commit to use this field instead of ir_variable::uniform_block.

v2: Fix the place-holder comment on ir_variable::interface_type.
Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:34 -05:00
Ian Romanick
13be1f4a10 glsl: Add ir_variable::is_in_uniform_block predicate
The way a variable is tested for this property is about to change, and
this makes the code easier to modify.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:34 -05:00
Ian Romanick
17e6f19044 glsl: Generate an interface type for uniform blocks
If the block has an instance name, add the instance name to the symbol
table instead of the individual fields.

Fixes the piglit test interface-name-access-without-interface-name.vert
for real.

v2: Update the comment before the assertion that interface block
definitions won't generate instructions.  Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-01-25 09:07:33 -05:00
Ian Romanick
491364e1f3 glsl: Add GLSL_TYPE_INTERFACE
Interfaces are structurally identical to structures from the compiler's
point of view.  They have some additional restrictions, and generally
GPUs use different instructions to access them.  Using a different base
type should make this a bit easier.

This commit also adds the glsl_type::interface_packing fields.  For
GLSL_TYPE_INTERFACE types, this will track the specified packing mode.
It is analogous to gl_uniform_buffer::_Packing.

v2: Add serveral missing GLSL_TYPE_INTERFACE cases in switch-statements.

v3: Add information about glsl_type::interface_packing.  Move row_major
checking in glsl_type::record_key_compare from this patch to the
previous patch.  Both suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:33 -05:00
Ian Romanick
7f96a8471e glsl: Add row_major field to glsl_struct_field
For now, this will always be false.  In the near future, an "interface"
type will be added that shares a lot of infrastructure with structures.

v2: Move row_major checking in glsl_type::record_key_compare from the
next patch to this patch.  Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:33 -05:00
Ian Romanick
51f740cd5a glsl: Refactor out processing of structure fields
This will soon also be used for processing interface block fields.

v2: Add a comment explaining the interface of
ast_process_structure_or_interface_block.  Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:33 -05:00
Ian Romanick
a39a70c8d4 glsl: Parse interface array size
The size is parsed and stored in the AST, but it is not used yet.
Processing of the array size is added in the patch "glsl: Handle
instance array declarations"

v2: Update the commit message (suggested by Carl Worth).  Add a comment
to ast_uniform_block::array_size (suggested by Paul Berry).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:33 -05:00
Kenneth Graunke
34f966bdcb glsl: Parse non-array uniform block instance names in GLSL ES 3.00.
In GLSL ES 3.00 (and GLSL 1.50), uniform blocks can have an associated
"instance name", which essentially namespaces the variables inside.

This patch adds basic parsing for this new feature, but doesn't yet hook
it up to actually do anything yet.

It does not support for arrays of interface blocks; a later commit will
take care of that.

This change temporarily regresses the piglit test
interface-name-access-without-interface-name.vert.  This shader failed
to compile before (the expected result), but it failed to compile for
the wrong reason.  This is not a real regression.

v2: Add some comments to ast_uniform_block::instance_name.  Suggested by
Paul Berry.

Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:33 -05:00
Kenneth Graunke
0d2e6336a2 glsl: Refactor uniform block parser rules.
The existing code has a lot of duplication; the only difference between
the two cases is whether we merge in an additional layout qualifier.

Apparently creating a layout_qualifieropt rule that can be empty causes
a lot of conflicts and confusion.  However, refactoring out the guts of
the ast_uniform_block creation works fine.

Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:33 -05:00
Ian Romanick
b226a058db linker: Refactor intra-stage block compatabililty testing
Also slightly change the compatibility test.  Instead of comparing the
offsets of the block variables, compare the packing mode of the blocks.
Ideally we don't want to assign the offsets until a later stage of
linking.

This is put in a new file called link_uniform_blocks.cpp.  Some new
functions related to uniform blocks are going to live in that file as
well.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:33 -05:00
Ian Romanick
9a971ab695 mesa: Track the packing mode of a UBO in gl_uniform_buffer
This allows the next patch to verify that two uniform blocks match
without first calculating the locations of the fields.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:33 -05:00
Ian Romanick
ecfb404e8d glsl: Replace most default cases in switches on GLSL type
This makes it easier to find switch-statements that need to be updated
after a new GLSL_TYPE_* is added because the compiler will generate a
warning.

Switch-statements that only had a small number of cases (e.g.,
everything in ir_constant_expression.cpp) were not modified.  I may
regret that decision when we eventually add support for doubles.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-25 09:07:32 -05:00
Eric Anholt
416326e337 i965: Correct gen6+ guardband calculation.
Too much attention was paid to the first paragraphs, and not enough to
the last little note that "oh, by the way, the rendered things
themselves still have to be clipped to just 8192 wide/high".

Fixes GTF's clip.c test with 4096 or higher width on ivb, where one of
the triangles got the upper half of its pixels dropped.

Tested-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-25 09:04:52 -05:00
Kenneth Graunke
9db2098d18 i965: Use GL_RED for DEPTH_TEXTURE_MODE in ES 3.0 for unsized formats.
Khronos has apparently decided that depth textures with sized formats
(allowed with ARB_internalformat_query or ES 3.0) should be treated as
GL_RED, while unsized formats (an existing feature) should be treated
as GL_INTENSITY for compatibility with ES 2.0.

Ian is proposing changes to ARB_internalformat_query which will make
this actually legal and consistent.

A similar problem exists with GL 4.2, but we're going to ignore that
for the time being.

Tested on Ivybridge: no Piglit regressions; fixes 4 es3conform tests:
- depth_texture_fbo
- depth_texture_fbo_clear
- depth_texture_teximage
- depth_texture_texsubimage

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-25 09:04:25 -05:00
Chad Versace
7638ede4ce i965: Bump maximum supported ES2 context version to 3.0
Since patch "i965: Validate requested GLES context version in
brwCreateContext", we have been able to create ES 3.0 contexts due to the
max version check.  So...bump the max version.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-25 08:30:40 -05:00
Paul Berry
e4f661afc8 i965/Gen6+: Enable ARB_ES3_compatibility extension
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-25 08:30:40 -05:00
Ian Romanick
1d0e8c109c mesa/es3: Enable ES 3.0 API and shading language version
v2: Add ARB_internalformat_query to the list of required extensions.

v3: Add OES_depth_texture_cube_map to the list of required extensions.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-25 08:30:40 -05:00
Vinson Lee
07e215f4ec scons: Add imports.c to builtin_compiler build.
Fixes build regression introduced by commit
eac030e38e.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59835
2013-01-24 22:36:27 -08:00
Chad Versace
0974031f88 i965/fs/gen7: Fix fatal typo in unpackHalf2x16
s/src/src_w/

That little typo, which sneaked into v4 of the previous patch, generates
incorrect fs code.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:51:06 -08:00
Chad Versace
20dfa501b3 i965/fs/gen7: Emit code for GLSL 3.00 pack/unpack operations (v4)
v2: Remove lewd comment. [for idr]
v3: - Optimize away tmp register for packHalf2x16. [for anholt, paul]
    - Improve comments. [for anholt, paul]
    - Reduce near-duplicate code by removing vec4_visitor emit_pack/unpack
      methods. [for chadv]
v4: Factor our UD/W register conversion into helper function. [for anholt]

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v2)
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:31:06 -08:00
Chad Versace
203c12b18f i965/vs/gen7: Emit code for GLSL ES 3.00 pack/unpack operations (v3)
FIXME: This patch emits VS code that violates documented hardware
restrictions and then relies on undocumented behavior that results from
that violation.  This patch passes all tests, but should be fixed ASAP to
conform to the hardware documentation.

v2: Explain undocumented hardware behavior. Improve comments.
v3: Use ALU1 helper methods F32TO16() and F16TO32(). [for anholt]

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:11 -08:00
Chad Versace
7093558b31 i965: Quote the PRM on a HorzStride subtlety
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:11 -08:00
Chad Versace
7e21910f23 i965: Add opcodes for F32TO16 and F16TO32
The GLSL ES 3.00 operations packHalf2x16 and unpackHalf2x16 will emit
these opcodes.

- Define the opcodes BRW_OPCODE_{F32TO16,F16TO32}.
- Add the opcodes to the brw_disasm table.
- Define convenience functions brw_{F32TO16,F16TO32}.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
ee0ed52d69 i965: Lower the GLSL ES 3.00 pack/unpack operations (v2)
On gen < 7, we fully lower all operations to arithmetic and bitwise
operations.

On gen >= 7, we fully lower the Snorm2x16 and Unorm2x16 operations, and
partially lower the Half2x16 operations.

v2:
  - Comment that scalarization is needed only for SOA code [for idr].
  - Replace switch-statement with if-statement [for idr].
  - Remove misplaced hunk from previous patch [found by idr].

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Tuner <mattst88@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
b9f56ea923 glsl: Add lowering pass for GLSL ES 3.00 pack/unpack operations (v4)
Lower them to arithmetic and bit manipulation expressions.

v2: Rewrite using ir_builder [for idr].
v3: Comment typos. [for mattst88]
v4: Fix arithmetic error in comments.
    Factor out a shift instruction.
    Don't heap allocate factory.instructions.
    [for paul]

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v2)
Reviewed-by: Matt Tuner <mattst88@gmail.com> (v3)
Reviewed-by: Paul Berry <stereotype441@gmail.com> (v4)
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
9d7931ddf0 glsl: Fix type-deduction for and/or/xor expressions
In ir_expression's constructor, the cases for {bit,logic}_{and,or,xor}
failed to handle the case when both operands were vectors.

Note: This is a candidate for the stable branches.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
ccf87f2199 glsl: Reformat and/or/xor cases in ir_expression ctor
Replace tabs with spaces. According to docs/devinfo.html, Mesa's
indetation style is:
  indent -br -i3 -npcs --no-tabs infile.c -o outfile.c

This patch prevents whitespace weirdness in the next patch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
f859e4fbd1 glsl/ir_builder: Add helpers for making if-statements
Add two overloaded variants of
    ir_if *if_tree()

The new functions allow one to chain together if-trees within a single C++
expression that resembles a real if-statement.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
a32bc53029 glsl/ir_builder: Add enum writemask
Using this enum improves the readibility of calls to assign(), whose third
argument is a writemask.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
a6479ef968 glsl/ir_factory: Add helper method for making an ir_constant
Add method ir_factory::constant.  This little method constructs an
ir_constant using the factory's mem_ctx.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
5790174e37 glsl/ir_builder: Add more helpers for constructing expressions
Add the following functions, each of which construct the similarly named
ir expression:
    div, round_even, clamp

    equal, less, greater, lequal, gequal

    logic_not, logic_and, logic_or

    bit_not, bit_or, bit_and, lshift, rshift

    f2i, i2f, f2u, u2f, i2u, u2i

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
fafcbf52b7 glsl/ir_factory: Initialize members to NULL in constructor
This eliminates unexpected behavior due to unitialized values.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
542c7a3022 glsl: Evaluate constant GLSL ES 3.00 pack/unpack expressions (v3)
That is, evaluate constant expressions of the following functions:
  packSnorm2x16  unpackSnorm2x16
  packUnorm2x16  unpackUnorm2x16
  packHalf2x16   unpackHalf2x16

v2: Reuse _mesa_pack_float_to_half and its inverse to evaluate
    pack/unpackHalf2x16. [for idr]
v3: Whitespace fixes. [for mattst88]
    Don't cast neg floats directly to uint16; use an intermediate cast to
    int16. [for paul]

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v2)
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Matt Tuner <mattst88@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
529b6d1f3d mesa: Remove rounding bias in _mesa_float_to_half()
Not all float32 values can be exactly represented as a float16.
_mesa_float_to_half() rounded such intermediate float32 values to zero by
truncating unrepresentable bits in the mantissa.

This patch improves _mesa_float_to_half() by rounding intermediate float32
values to the nearest float16; when the float32 is exactly between two
float16 values we round to the one with an even mantissa. This behavior is
preferred over the old behavior because:
  - It has reduced bias relative to the old behavior.

  - It reproduces the behavior of real hardware: opcode F32TO16 in
    Intel's GPU ISA.

  - By reproducing the behavior of the GPU (at least on Intel hardware),
    compile-time evaluation of constant packHalf2x16 GLSL expressions will
    result in the same value as if the expression were executed on the GPU.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:10 -08:00
Chad Versace
eac030e38e mesa,glsl: Move round_to_even() from glsl to mesa/main (v2)
Move round_to_even's definition to mesa/main so that _mesa_float_to_half()
can use it in order to eliminate rounding bias.

In additon to moving the fuction definition, prefix its name with "_mesa",
just as all other functions in mesa/main are prefixed.

v2: Fix Android build.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:24:07 -08:00
Chad Versace
1fafd00839 glsl/standalone_scaffolding: Add stub for _mesa_warning()
A subsequent patch will add mesa/main/imports.c as a dependency to the
compiler, which in turn requires that _mesa_warning() be defined.

The real definition of _mesa_warning() is in mesa/main/errors.c, but to
pull that file into the standalone scaffolding would require transitively
pulling in the dispatch tables.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:11:41 -08:00
Chad Versace
ee5921ad0d glsl: Extend ir_expression_operation for GLSL 3.00 pack/unpack functions (v2)
For each function {pack,unpack}{Snorm,Unorm,Half}2x16, add a corresponding
opcode to enum ir_expression_operation.  Validate the new opcodes in
ir_validate.cpp.

Also, add opcodes for scalarized variants of the Half2x16 functions.  (The
code generator for the i965 fragment shader requires that all vector
operations be scalarized.  A lowering pass, to be added later, will
scalarize the Half2x16 functions).

v2: Fix assertion message in ir_to_mesa [for idr].

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Tuner <mattst88@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:11:41 -08:00
Chad Versace
3a88d71d35 glsl: Add IR lisp for GLSL ES 3.00 pack/unpack functions
For each of the following functions, add a declaration to
builtins/profiles/300es.glsl and create new file
builtins/ir/${funcname}.ir:

  packSnorm2x16  unpackSnorm2x16
  packUnorm2x16  unpackUnorm2x16
  packHalf2x16   unpackHalf2x16

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Tuner <mattst88@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:11:41 -08:00
Chad Versace
6f8f919a53 glsl: Fix typo in comment
s/num_operands()/get_num_operands()/

Discovered because Eclipse failed to resolve the false reference.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:11:41 -08:00
Chad Versace
ca7d332253 i965/disasm: Fix horizontal stride of dest registers
The bug: The printed horizontal stride was the numerical value of the
  BRW_HORIZONTAL_$N enum.
The fix: Translate the enum before printing.

Note: This is a candidate for the stable releases.
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-24 21:10:46 -08:00
Paul Berry
d1f2e9699f intel: Fix glCopyTexSubImage on buffers whose width >= 32kbytes
When possible, glCopyTexSubImage calls are performed using the
hardware blitter.  However, according to the Ivy Bridge PRM, Vol1
Part4, section 1.2.1.2 (Graphics Data Size Limitations):

    The BLT engine is capable of transferring very large quantities of
    graphics data. Any graphics data read from and written to the
    destination is permitted to represent a number of pixels that
    occupies up to 65,536 scan lines and up to 32,768 bytes per scan
    line at the destination. The maximum number of pixels that may be
    represented per scan line’s worth of graphics data depends on the
    color depth.

With an RGBA32F color buffer (which has 16 bytes per pixel) this
imposes a maximum width of 2048 pixels.  Other pixel formats have
accordingly larger limits.

To make matters worse, if the pitch of the buffer is 32k or greater,
intel_copy_texsubimage's call to intelEmitCopyBlit will overflow
intelEmitCopyBlit's src_pitch and dst_pitch parameters (which are
16-bit signed integers).

We can conveniently avoid both problems by avoiding use of the blitter
when the miptree's pitch is >= 32k.

Fixes gles3conform "framebuffer_blit_functionality_magnifying_blit"
tests when the buffer width is equal to 8192.

Note: this is very similar to the recent patch "intel: Fix ReadPixels
on buffers whose width >= 32kbytes" except that it applies to
glCopyTexSubImage instead of glReadPixels.  In a future patch it would
be nice to refactor the code so that (a) overflow is avoided, and (b)
intelEmitCopyBlit is responsible for checking whether the blitter can
handle the width, so that all callers of intelEmitCopyBlit work
properly, rather than just these two.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-24 18:35:08 -08:00
Paul Berry
c6a50ddfcb glsl: Allow varying structs in GLSL ES 3.00 and GLSL 1.50.
Previously I thought that varying structs had been added to GLSL ES
3.00 by mistake, because chapter 11 of the GLSL ES 3.00 spec
("Counting of Inputs and Outputs") failed to mention how structs
should be handled.  Khronos has clarified
(https://cvs.khronos.org/bugzilla/show_bug.cgi?id=9828) that varying
structs are indeed required, and that chapter 11 will be modified to
indicate that the minimal reference packing algorithm flattens varying
structs to their individual components.

Mesa doesn't flatten varying structs to their individual components,
but this is ok, since it packs varyings of all kinds with no wasted
space at all (except where this is impossible due to differing
interpolation modes), so it will outperform the minimal reference
packing algorithm in all but the most pathological cases.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-24 16:30:49 -08:00
Paul Berry
cd53457ffa glsl: Disable transform feedback of varying structs.
It is not clear from the GLSL ES 3.00 spec how transform feedback is
supposed to apply to varying structs:

- There is no specification for how the structure is to be packed when
  it is recorded into the transform feedback buffer.

- There is no reasonable value for GetTransformFeedbackVarying to
  return as the "type" of the variable.

We currently have a Khronos bug requesting clarification on how this
feature is supposed to work
(https://cvs.khronos.org/bugzilla/show_bug.cgi?id=9856).

This patch just disables transform feedback of varying structs for
now; we can implement the proper behaviour once we find out from
Khronos what it is.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-24 16:30:46 -08:00
Paul Berry
1ecd23dea9 glsl: Update lower_packed_varyings to handle varying structs.
This patch adds code to lower_packed_varyings to handle varyings of
type struct.  Varying structs are currently packed in the most naive
possible way (in declaration order, with no gaps), so there is a
potential loss of runtime efficiency.  In a later patch it would be
nice to replace this with a "flattening" approach (wherein a varying
struct is flattened to individual varyings corresponding to each of
its structure elements), so that the linker can align each structure
element independently.  However, that would require a significantly
more complex implementation.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-24 16:30:43 -08:00
Paul Berry
88e4bfde26 glsl: Generalize compute_packing_order for varying structs.
This patch paves the way for allowing varying structs by generalizing
varying_matches::compute_packing_order to handle any type of varying.
Previously, we packed in the order (vec4, vec2, float, vec3), with
matrices being packed according to the size of their columns.  Now, we
pack everything according to its number of components mod 4, in the
order (0, 2, 1, 3).

There is no behavioural change for vectors.  Matrices are now packed
slightly differently:

- mat2x2 gets assigned PACKING_ORDER_VEC4 instead of
  PACKING_ORDER_VEC2.  This is slightly better, because it guarantees
  that the matrix occupies a single varying slot.

- mat2x3 gets assigned PACKING_ORDER_VEC2 instead of
  PACKING_ORDER_VEC3.  This is kind of a wash.  Previously, mat2x3 had
  a 25% chance of having neither of its columns double parked, a 50%
  chance of having exactly one of its columns double parked, and a 25%
  chance of having both of its columns double parked.  Now it always
  has exactly one of its columns double parked.

- mat3x3 gets assigned PACKING_ORDER_SCALAR instead of
  PACKING_ORDER_VEC3.  This doesn't affect much, since in both cases
  there is no guarantee of how the matrix will be aligned.

- mat4x2 gets assigned PACKING_ORDER_VEC4 instead of
  PACKING_ORDER_VEC2.  This is slightly better for the same reason as
  in mat2x2.

- mat4x3 gets assigned PACKING_ORDER_VEC4 instead of
  PACKING_ORDER_VEC3.  This is slightly better for the same reason as
  in mat2x2.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-24 16:30:40 -08:00
Paul Berry
3680864c0b glsl: Disable structure splitting for shader ins/outs.
Previously, it didn't matter whether structure splitting tried to
split shader ins/outs, because structs were prohibited from being used
for shader ins/outs.  However, GLSL 3.00 ES supports varying structs.
In order for varying structs to work, we need to make sure that
structure splitting doesn't get applied to them, because if it does,
then the linker won't be able to match up varyings properly.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-24 16:30:37 -08:00
Paul Berry
42a29d89fd glsl: Eliminate ambiguity between function ins/outs and shader ins/outs
This patch replaces the three ir_variable_mode enums:

- ir_var_in
- ir_var_out
- ir_var_inout

with the following five:

- ir_var_shader_in
- ir_var_shader_out
- ir_var_function_in
- ir_var_function_out
- ir_var_function_inout

This eliminates a frustrating ambiguity: it used to be impossible to
tell whether an ir_var_{in,out} variable was a shader in/out or a
function in/out without seeing where the variable was declared in the
IR.  This complicated some optimization and lowering passes, and would
have become a problem for implementing varying structs.

In the lisp-style serialization of GLSL IR to strings performed by
ir_print_visitor.cpp and ir_reader.cpp, I've retained the names "in",
"out", and "inout" for function parameters, to avoid introducing code
churn to the src/glsl/builtins/ir/ directory.

Note: a couple of comments in the code seemed to indicate that we were
planning for a possible future in which geometry shaders could have
shader-scope inout variables.  Our GLSL grammar rejects shader-scope
inout variables, and I've been unable to find any evidence in the GLSL
standards documents (or extensions) that this will ever be allowed, so
I've eliminated these comments.

Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-24 16:30:30 -08:00
Paul Berry
7d51ead56e glsl: Clean up case statement in builtin_variables.cpp's add_variable.
The case statement purported to handle the addition of ir_var_const_in
and ir_var_inout builtin variables.  But no such variables exist.
This patch removes the unnecessary cases, and adds a comment
explaining why they're not needed.

Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-24 16:30:27 -08:00
Kenneth Graunke
fce9e5d41b i965/vs: Do headerless texturing for texelFetchOffset().
For texelFetchOffset(), we just add the texel offsets to the coordinate
rather than using the message header's offset fields.  So we don't
actually need a header on Gen5+.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-24 15:19:08 -08:00
Matt Turner
0412864ae8 libgl-xlib/build: Link with C++ when LLVM is used
Also link-in libX11 and libXext.

Tested-by: Brian Paul <brianp@vmware.com>
2013-01-24 14:00:27 -08:00
Paul Berry
b50c0feb2c intel: Fix ReadPixels on buffers whose width >= 32kbytes
When possible, glReadPixels calls are performed using the hardware
blitter.  However, according to the Ivy Bridge PRM, Vol1 Part4,
section 1.2.1.2 (Graphics Data Size Limitations):

    The BLT engine is capable of transferring very large quantities of
    graphics data. Any graphics data read from and written to the
    destination is permitted to represent a number of pixels that
    occupies up to 65,536 scan lines and up to 32,768 bytes per scan
    line at the destination. The maximum number of pixels that may be
    represented per scan line’s worth of graphics data depends on the
    color depth.

With an RGBA32F color buffer (which has 16 bytes per pixel) this
imposes a maximum width of 2048 pixels.

To make matters worse, if the pitch of the buffer is 32k or greater,
intel_miptree_map_blit's call to intelEmitCopyBlit will overflow
intelEmitCopyBlit's src_pitch and dst_pitch parameters (which are
16-bit signed integers).

We can conveniently avoid both problems by avoiding the readpixels
blit path when the miptree's pitch is >= 32k.

Fixes gles3conform "half_float" tests when the buffer width is greater
than 2048.

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-24 13:17:07 -08:00
Ian Romanick
ac158f8ee7 intel: callocing a 32 byte temp is silly, so don't
I believe that the size used to vary, so the dynamic allocation is
necessary.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2013-01-24 13:57:46 -05:00
Marek Olšák
7a23029b2f st/mesa: implement ARB_internalformat_query v2
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-24 18:39:28 +01:00
Marek Olšák
041234ee1e st/mesa: advertise OES_depth_texture_cube_map if GLSL 1.30 is supported
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-24 18:38:49 +01:00
Marek Olšák
4f0563a658 st/dri: disallow recursion in dri_flush
ST_FLUSH_FRONT may call driThrottle, which is implemented with dri_flush.
This prevents double flush as well as fence leaks caused by a recursion
in the middle of throttling.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58839

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-24 18:22:14 +01:00
Marek Olšák
fffe3e0908 st/dri: add null-pointer check, remove duplicated local variable
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-24 18:22:14 +01:00
Tom Stellard
0261b4ecdb Revert "Revert "targets/opencl: Link against libgallium.la instead of libgallium.a""
This reverts commit 7824ab8070.

Now that we force linking with LLVM shared libs when building clover,
we can link against libgallium.la with no problems.
2013-01-24 15:45:32 +00:00
Tom Stellard
cf69a591e1 configure.ac: Force use of LLVM shared libs with --enable-opencl v2
If we build clover with LLVM static libraries, then clover and also each
pipe_*.so driver that is built will contain their own static copy of
LLVM.  The recent automake changes have uncovered a problem where
the pipe_*.so drivers try to use clover's LLVM symbols.  This causes
LLVM's static registry objects to be initialized each time
a pipe_*.so driver is loaded by clover.  Initializing these objects
multiple times is not allowed and leads to assertion failures in the
LLVM code.

We can avoid all these problems by having clover and all the pipe_*.so
drivers link against the same LLVM shared library.

https://bugs.freedesktop.org/show_bug.cgi?id=59334
https://bugs.freedesktop.org/show_bug.cgi?id=59534

v2:
  - Fix shared library detection when LLVM is built with CMake
2013-01-24 15:45:18 +00:00
Tom Stellard
69d639ba8b configure.ac: Compute the required llvm static libraries only once
In order to determine which static LLVM libraries are needed we pass
a list of components to llvm-config and it generates the list of
library dependencies for us.  The advantage of only calling llvm-config
one time is that it can determine if two components depend on the same
library and then add it to the output list only once.  The old practice
of having each driver call llvm-config to add its own dependencies to
$(LLVM_LIBS) caused many libraries to be added to this variable multiple
times.
2013-01-24 15:44:53 +00:00
Michel Dänzer
35f0dc2cc7 radeonsi: Fall back to dummy pixel shader instead of trying indirect addressing.
Indirect addressing isn't fully handled yet.

Fixes crashes with piglit tests using indirect addressing.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-24 08:46:48 +01:00
Marek Olšák
68cebb9a8f radeonsi: make sure copying of all texture formats is accelerated
[ Cherry-picked from r600g commit 7c371f4695 ]

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-24 08:46:31 +01:00
Michel Dänzer
de4e448095 radeonsi: Handle PIPE_FORMAT_L32A32_S/UINT for rendering.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-24 08:46:31 +01:00
Michel Dänzer
d0096dfa85 radeonsi: Make sure to use float number format for packed float colour formats.
These aren't covered by UTIL_FORMAT_TYPE_FLOAT.

Fixes 15 piglit (sub)tests.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-24 08:46:31 +01:00
Ian Romanick
5bd86b26df intel: Enable S3TC extensions always
Always enable the use of pre-compressed texture data.  The ability to
perform on-line compression still requires the presence of libtxc_dxtn
or an explicit driconf over-ride.  Applications that just want to submit
precompessed data when an on-line compressor is not available can look
for the GL_EXT_texture_compression_dxt1 and
GL_ANGLE_texture_compression_dxt[35] extensions.

v2: Only enable the extensions that do not require on-line compression
by default.  The previous statement "This should not impact many (if
any) real applications." proved to be false for at least Sauerbraten.
This application mostly submits pre-compressed data, but it also can
submit uncompressed data that it asks the driver to compress.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> [v1]
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Acked-by: Eric Anholt <eric@anholt.net> [v1]
Acked-by: Lee Salzman <lsalzman@gmail.com>
2013-01-23 23:38:04 -05:00
Ian Romanick
53f8251107 mesa: Like EXT_texture_compression_dxt1, advertise ANGLE_texture_compression_dxt in all APIs
This is technically outside the ANGLE spec, but it seems unlikely to
cause any harm.

v2: Simplify the extension checks by assuming the ANGLE extension will
always be enabled by any driver that enables the EXT.  Suggested by
Eric Anholt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Lee Salzman <lsalzman@gmail.com>
2013-01-23 23:38:04 -05:00
Ian Romanick
d45c6c817d mesa: Simplify _mesa_choose_tex_format handling of compressed formats
For non-generic compressed format we assert two things:

1. The format has already been validated against the set of available
   extensions.

2. The driver only enables the extension if it supports all of the
   formats that are part of that extension.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-23 23:38:04 -05:00
Ian Romanick
a021881ccd mesa: Use a single flag for the S3TC extensions that don't require on-line compression
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Lee Salzman <lsalzman@gmail.com>
2013-01-23 23:38:04 -05:00
Carl Worth
8059c2ea90 i965: Use swizzles to force R, G, and B to 0.0 for ALPHA textures.
Similar to the previous commit, we may be using a texture with actual RGBA
storage for the GL_ALPHA format, so force the color values to 0.0.

This commit fixes the following piglit (sub) tests:

	EXT_texture_snorm/fbo-blending-formats
		GL_ALPHA16_SNORM
	        GL_ALPHA8_SNORM
		GL_ALPHA_SNORM

Note: Haswell bypasses this swizzle code, so may require an independent fix
for this bug.

Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-23 17:41:09 -08:00
Carl Worth
33599433c7 i965: Use swizzles to force alpha to 1.0 for RED, RG, or RGB textures.
We may be using a texture with actual RGBA storage for these formats, so force
the alpha value read to 1.0.

This commit fixes the following piglit (sub) tests:

	ARB_texture_float/fb-blending-formats
		GL_RGB16F_ARB
	EXT_framebuffer_object/fbo-blending-formats
                GL_RGB10
		GL_RGB12
	        GL_RGB16
	EXT_texture_snorm/fbo-blending-formats
		GL_RGB16_SNORM
		GL_RGB8_SNORM
		GL_RGB_SNORM

These test improvements depend on the previous commit as well. That commit
smashes alpha to 1.0 for the case of ReadPixels (so fixes "FBO testing" as
reported by this test), while this commit smashes alpha to 1.0 for the case of
texturing (fixed the "window testing" as reported by this test).

Note: Haswell bypasses this swizzle code, so may require an independent fix
for this bug.

Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-23 17:40:52 -08:00
Carl Worth
570ed2be7d ReadPixels: Force ALPHA to 1 while rebasing RGBA values for GL_RGB format
When performing a ReadPixels operation, we may be reading from a buffer that
stores alpha values, but that is actually representing a buffer with no alpha
channel. In this case, while rebasing the values, touch up all alpha values
read to 1.0.

This commit fixes the following piglit (sub) tests:

	ARB_texture_float/fbo-colormask-formats
		GL_RBG16F_ARB
	EXT_texture_snorm/fbo-colormask-formats
		GL_RGB16_SNORM
		GL_RGB8_SNORM
		GL_RGB_SNORM

It likely improves the results of other tests as well, but a PASS remains
elusive due to additional bugs.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2013-01-23 17:40:52 -08:00
Carl Worth
b961ba44ed i965: Examine _BaseFormat when deciding to perform xRGB_alpha fixups
The renderbuffer's Format field may have an alpha channel even when the
underlying _BaseFormat does not. This can happen when mesa chooses to use
RGBA16 for an RGB16 format, for example.

So look at _BaseFormat when deciding whether to fixup the blend factors.

This test improves the results of at least the following piglit tests:

	EXT_frambebuffer_object/fbo-blending-formats
        	{GL_RGB10, GL_RGB12, GL_RGB16}
	EXT_texture_snorm/fbo-blending-formats
		{GL_RGB16_SNORM, GLRGB8_SNORM, GL_RGB_SNORM}

But none of these actually change from FAIL to PASS yet. The R, G, and B probe
values are fixed with this commit, but the tests still fail because the alpha
values are still wrong.

Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-23 17:40:24 -08:00
José Fonseca
0642437606 scons: Fix source lists parsing on Windows.
/ vs \ mismatch was causing .objs to be put in the source tree, causing
breakeage when doing different build types in the same tree (eg., debug
vs release).

Fix this by normalizing everything to / slashes.

It's probably a good idea to purge all .objs from source tree to prevent
issues completely.
2013-01-23 12:11:53 +00:00
Matt Turner
60315e3eaf GL3.txt: i965 supports ARB_base_instance
Added in commit cdd3f549.
2013-01-22 21:34:25 -08:00
Brian Paul
bd8045d4c5 wmesa: include api_exec.h to fix compilation 2013-01-22 16:44:11 -07:00
Brian Paul
26a05b5005 draw: fix MSVC divide-by-zero compilation error
Kind of lame, but it works.
2013-01-22 16:44:11 -07:00
Kenneth Graunke
cdd3f5496a i965: Implement the GL_ARB_base_instance extension.
Thanks to Fredrik Höglund, all the hard work was already done.

Tested using a modified oglconform (that actually runs these tests on
our driver); it looks like there may be some bugs when using client
arrays.  All applicable non-compatibility tests passed.

For now, only enable it in core profiles.

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Ian Romanick <idr@freedesktop.org>
2013-01-22 15:41:30 -08:00
Matt Turner
0d108116bd glsl/build: Build libglcpp and libglslcore in builtin_compiler
And reuse them if not cross compiling.

Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-22 14:33:45 -08:00
Matt Turner
952e6e9f3b glsl/Makefile.sources: Correct BUILTIN_COMPILER_CXX_FILES
Squashed with two reverts:

Revert "android: Update for builtin_stubs.cpp move"

This reverts commit c0def90ede.

Revert "scons: Update for builtin_stubs.cpp"

This reverts commit 8ac4b82699.

Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Tested-on-Android-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-22 14:33:41 -08:00
Matt Turner
2a71054396 build: Use AX_PROG_FLEX
Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47248
2013-01-22 14:33:38 -08:00
Matt Turner
b68b85224d build: Use AX_PROG_BISON
No one tests yacc/byacc. Let's just request bison specifically.

Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46815
2013-01-22 14:33:31 -08:00
Matt Turner
3791ce05eb builtin_compiler/build: Use generated parser files
... instead of generating them again.

Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-22 14:33:28 -08:00
Matt Turner
efd201caa5 glsl/build: Build tests via the glsl Makefile
Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-22 14:33:24 -08:00
Matt Turner
86d30dea3c glsl/build: Build glcpp via the glsl Makefile
Removing the subdirectory recursion provides a small speed up.

Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-22 14:33:20 -08:00
Matt Turner
cc9f609cb9 glsl/build: Don't build builtin_compiler separately if not cross compiling
Reduces the number of times that src/glsl/ is compiled when not cross
compiling.

Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-22 14:33:16 -08:00
Matt Turner
569f0e400a glsl/build: Don't build glsl_compiler
Use glslparsertest from piglit instead.

Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-22 14:33:07 -08:00
Brian Paul
ab74fee5e1 draw: fix problem in screen-space interpolation clip code
I don't see how this could have ever worked right.

The screen-space interpolation code uses the vertex->data[pos_attr]
position which contain window coords.  But window coords are only
computed for the unclipped vertices; the clipped vertices have
undefined window coords (see draw_cliptest_tmp.h).

Use the vertex clip coords instead which are always defined.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=55476
(piglit fbo-blit-stretch failure on softpipe)

Note: This is a candidate for the 9.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-22 14:53:58 -07:00
Brian Paul
ed643d6b2f draw: improve the clipper debug/printf code
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-22 14:53:58 -07:00
Brian Paul
4a938ef713 draw: add new debug code and comments in clip code template
In debug builds, set clipped vertex window coordinates to NaN values
to help debugging.  Otherwise, we're just leaving the coordinate in clip
space and it's invalid to use it later expecting it to be a window coord.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-22 14:53:58 -07:00
Brian Paul
547a418888 swrast: fix blit code's nearest/linear coordinate arithmetic
Fixes piglit's fbo-blit-stretch test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-22 14:53:58 -07:00
Brian Paul
b70b486249 swrast: fix incorrect width for direct/nearest blit
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-22 14:53:58 -07:00
Brian Paul
728bf86a23 swrast: move resampleRow setup code in blit_nearest()
The resampleRow setup depends on pixelSize.  For color buffers,
we don't know the pixelSize until we're in the buffer loop.  Move
that code inside the loop.

Fixes: http://bugs.freedesktop.org/show_bug.cgi?id=59541

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-22 14:53:58 -07:00
Andreas Boll
0a60ea4ddc docs: import release notes for 9.0.2, add news item 2013-01-22 21:28:51 +01:00
José Fonseca
9a0973044e scons: Disable frame pointer omission for all build types except release.
In particular for checked builds, where debug_backtrace_capture relies
on it.
2013-01-22 20:19:28 +00:00
José Fonseca
de0057caa6 nouveau/build: Fix build failures when drm is not in /usr/include.
Fixes failures to include libdrm/nouveau.h when drm is not installed in
/usr/include.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2013-01-22 19:10:47 +00:00
Michel Dänzer
a56dfd99e2 radeon/llvm: Handle LP_CHAN_ALL in emit_fetch_immediate().
Fixes piglit spec/ARB_sampler_objects/sampler-incomplete and
spec/EXT_texture_swizzle/depth_texture_mode_and_swizzle.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-22 18:50:02 +01:00
Kenneth Graunke
121d19de92 build: Fix build on systems where /usr/bin/python isn't python 2.
configure.ac sets up a PYTHON2 variable, which is what we want
AX_PYTHON_MODULE to use (since we only use Python 2 for now).

NOTE: This is a candidate for the 9.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31598
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-22 09:05:32 -08:00
Ian Romanick
148fc6d537 mesa/es3: Apply stricter multisample blit rules for ES3.
Fixes gles3conform
framebuffer_blit_error_blitframebuffer_multisampled_read_buffer_different_origins.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-22 03:26:24 -05:00
Ian Romanick
d7475c7966 mesa/es3: Disallow FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE query of DEPTH_STENCIL_ATTACHMENT
This error was added in the 3.0.1 update to the OpenGL ES 3.0 spec.
Fixes the updated gles3conform packed_depth_stencil_parameters test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-22 03:26:24 -05:00
Ian Romanick
9cb64a4cb6 mesa: Don't allow blits to / from the same buffer in OpenGL ES 3.0
Fixes gles3conform test CoverageES30.  It temporarily regresses some
framebuffer_blit tests, but the failing subcases have been determined to
be invalid for OpenGL ES 3.0.

v2: Fix typo in depth (and stencil) RB checking.  Noticed by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-22 03:26:24 -05:00
Eric Anholt
85c2e99039 mesa: Remove exec thunks from the dlist.c module.
These were introduced in 2000 during a rework of the TNL module (commit
cab974cf6c), though I'm having a hard time
finding an instance there of one of these Exec functions being changed
at runtime.

Regardless, as far as I can tell now, these functions don't get changed,
by grepping for calls to SET_* to change the dispatch table (we do change
functions in GLvertexformat at runtime, but those don't overlap with
this set of functions).  Remove them and just let them be initialized to
the same functions as are in the Exec table.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:48 -08:00
Eric Anholt
ab4c549378 mesa: Initially populate the display list with the exec list.
This cuts out a ton of code to make functions not set to a save_ variant
match.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:48 -08:00
Eric Anholt
7820e2dd8d mesa: Delay display list save dispatch setup until Exec is set up.
This will let us copy from the Exec dispatch to deal with our commands that
don't get compiled into display lists.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:48 -08:00
Eric Anholt
be4b1664fb mesa: Make the drivers call a non-code-generated dispatch table setup.
I want to drive the Save dispatch table setup from this same function.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:48 -08:00
Eric Anholt
ced98f17ef mesa: Remove the size argument from _mesa_alloc_dispatch_table().
All callers are in Mesa core and all use _gloffset_COUNT, so just rely on
the already baked-in use of _gloffset_COUNT in the function.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:47 -08:00
Eric Anholt
cb49016622 mesa: Remove two of the now unused ASSERT_OUTSIDE_BEGIN_END macros.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:47 -08:00
Eric Anholt
a9754793da mesa: Drop manual checks for outside begin/end.
We now have a separate dispatch table for begin/end that prevent these
functions from being entered during that time.  The
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVALs are left because I don't want to
change any return values or introduce new error-only stubs at this
point.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:47 -08:00
Eric Anholt
c572251417 mesa: Install a minimal dispatch table during glBegin()/glEnd().
This is a step toward getting rid of ASSERT_OUTSIDE_BEGIN_END() in Mesa.

v2: Finish create_beginend_table() comment, move loopback API init into it,
    and add a const flag. (suggestions by Brian)

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
2013-01-21 21:26:47 -08:00
Eric Anholt
0aaf0445ba mesa: Remove the dead PrepareExecBegin() driver hook.
This was used in i965 for a while, but no more.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:47 -08:00
Eric Anholt
23916cae8e mesa: Use an early return to unindent most of vbo_exec_Begin/End().
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:46 -08:00
Eric Anholt
7b3c8b3747 mesa: Improve a glTexEnv error message by looking up the enum.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:46 -08:00
Eric Anholt
4d8f72f2bc mesa: Fix regression in dlist save primitive tracking.
My change 7ca4f07b5b caused errors to not
be thrown when they should, because the new if statement for ExecuteFlag
made the CurrentSavePrimitive not get set.  And on further review, we
shouldn't be validating our primitive in GL_COMPILE mode, since the
command shouldn't be executed yet.

Partially fixes piglit gl-1.0-beginend-coverage.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21 21:26:46 -08:00
Maarten Lankhorst
3a91e7955a vl: round next_msc to integer frame, and kill skew_msc
This reduces jitter slightly in a cleaner way, without desynchronizing mplayer2 as badly
when falling behind.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2013-01-21 23:49:56 +01:00
José Fonseca
71c87e42e1 scons: Fix dependencies of generated headers.
It appears that scons implicit dependency scanners fail to chain
dependencies of generated headers when these are outside the build tree.

This patch ensures generated source files are _always_ put in the build
tree. I'm not 100% this will fix all depency issues, but from my
experiments it does seem to fix this.

NOTE: For this to be effective it is necessary to clean the source tree
from generated header/source files.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-21 19:10:54 +00:00
Ian Romanick
75b7e1df13 intel: Don't expose XRGB8888 visuals any more
There really isn't any point.  There is no resource savings, and we have
to do gymnastics in the driver to make it work.

There are also bad interactions with multisampling and OpenGL ES 3.0.
In ES3, a multisample-to-singlesample blit must have identical source
and destination format.  This means a multisample RGBA8 to singlesample
RGB8 (window) blit will generate an error.  Also in ES3, RGB8 is not a
renderable format.  This means that the application CANNOT make an RGB8
multisample renderbuffer.

As a result, if an application gets an RGB8 window and wants to do
multisample FBO rendering, it will probably break.

"Fixes" gles3conform
framebuffer_blit_functionality_multisampled_to_singlesampled_blit test
on RGB8 visuals.

v2: Fix 'formats' array size.  Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
2013-01-21 13:34:34 -05:00
Ian Romanick
9bdf5bef76 i965: Enable floating-point textures always
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
2013-01-21 11:46:21 -05:00
Marek Olšák
4a1af434e6 r300g: add a workaround for the AA colorbuffer addressing bug on R500 2013-01-21 17:00:51 +01:00
Marek Olšák
7bfbf5b287 r300g: allow resolutions up to 1280x1024 with AA optimizations on 1-pipe cards
because single-pipe cards have bigger CMASK RAM
2013-01-21 17:00:51 +01:00
Marek Olšák
b7cb655298 r300g: enable AA optimizations for the RGBA16F format 2013-01-21 17:00:51 +01:00
Marek Olšák
6f6112a2b9 radeonsi: More assorted depth/stencil changes ported from r600g.
[ Squashed port of the following r600g commits: - Michel Dänzer ]

commit 428e37c2da
Author: Marek Olšák <maraeo@gmail.com>
Date:   Tue Oct 2 22:02:54 2012 +0200

    r600g: add in-place DB decompression and texturing with DB tiling

    The decompression is done in-place and only the compressed tiles are
    decompressed. Note: R6xx-R7xx can do that only with Z16 and Z32F.

    The texture unit is programmed to use non-displayable tiling and depth
    ordering of samples, so that it can fetch the texture in the native DB format.

    The latest version of the libdrm surface allocator is required for stencil
    texturing to work. The old one didn't create the mipmap tree correctly.
    We need a separate mipmap tree for stencil, because the stencil mipmap
    offsets are not really depth offsets/4.

    There are still some known bugs, but this should save some memory and it also
    improves performance a little bit in Lightsmark (especially with low
    resolutions; tested with Radeon HD 5000).

    The DB->CB copy is still used for transfers.

commit e2f623f1d6
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sat Jul 28 13:55:59 2012 +0200

    r600g: don't decompress depth or stencil if there isn't any

commit 43e226b6ef
Author: Marek Olšák <maraeo@gmail.com>
Date:   Wed Jul 18 00:32:50 2012 +0200

    r600g: optimize uploading depth textures

    Make it only copy the portion of a depth texture being uploaded and
    not the whole 2D layer.

    There is also a little code cleanup.

commit b242adbe5c
Author: Marek Olšák <maraeo@gmail.com>
Date:   Wed Jul 18 00:17:46 2012 +0200

    r600g: remove needless wrapper r600_texture_depth_flush

commit 611dd52942
Author: Marek Olšák <maraeo@gmail.com>
Date:   Wed Jul 18 00:05:14 2012 +0200

    r600g: init_flushed_depth_texture should be able to report errors

commit 80755ff563
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sat Jul 14 17:06:27 2012 +0200

    r600g: properly track which textures are depth

    This fixes the issue with have_depth_texture never being set to false.

commit fe1fd67556
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sun Jul 8 03:10:37 2012 +0200

    r600g: don't flush depth textures set as colorbuffers

    The only case a depth buffer can be set as a color buffer is when flushing.

    That wasn't always the case, but now this code isn't required anymore.

commit 5a17d8318e
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sun Jul 8 02:14:18 2012 +0200

    r600g: flush depth textures bound to vertex shaders

    This was missing/broken. There are also minor code cleanups.

commit dee58f94af
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sun Jul 8 01:54:24 2012 +0200

    r600g: do fine-grained depth texture flushing

    - maintain a mask of which mipmap levels are dirty (instead of one big flag)
    - only flush what was requested at a given point and not the whole resource
      (most often only one level and one layer has to be flushed)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-21 15:42:28 +01:00
Vadim Girlin
bc398f908f radeonsi: improve flushed depth texture handling
Use r600_resource_texture::flished_depth_texture for GPU access, and
allocate it in the VRAM. For transfers we'll allocate texture in the GTT
and store it in the r600_transfer::staging.

Improves performance when flushed depth texture is frequently used by the
GPU, e.g. in Lightsmark

[ Ported from r600g commit 3770847960 ]

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-21 15:42:28 +01:00
Marek Olšák
bfb405ceee radeonsi: Assorted depth/stencil changes ported from r600g.
[ Squashed port of the following r600g commits: - Michel Dänzer ]

commit c1e8c845ea
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sat Jul 7 19:10:00 2012 +0200

    r600g: inline r600_hw_copy_region

commit 4891c5dc64
Author: Marek Olšák <maraeo@gmail.com>
Date:   Mon Jun 25 22:53:21 2012 +0200

    r600g: inline r600_blit_push_depth and use resource_copy_region

    We are going to have a separate resource for depth texturing and transfers
    and this is just a transfer thing.

commit da98bb6fc1
Author: Marek Olšák <maraeo@gmail.com>
Date:   Mon Jun 25 12:45:32 2012 +0200

    r600g: split flushed depth texture creation and flushing

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-21 15:42:28 +01:00
Michel Dänzer
f0ffbbc9ff radeonsi: Enable 1D tiling for non-depth resources as well.
No piglit regressions anymore thanks to fixes in libdrm_radeon and here.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-21 14:10:52 +01:00
Michel Dänzer
90d919fcd0 radeonsi: Fix 1D tiling mode index for non-scanout resources.
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-21 14:10:52 +01:00
Matt Turner
a076c272e2 build: Remove dead SHARED_GLAPI variable
The static Makefiles used it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-20 20:06:46 -08:00
Matt Turner
3f276b37b1 glsl/build: Build glsl_test only on make check
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-20 20:06:44 -08:00
Matt Turner
ecbe3118c2 glsl/build: Remove dead LIBRARY_* variables
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-20 20:06:41 -08:00
Matt Turner
37f34e53e0 xmlpool/build: generate options.h via BUILT_SOURCES
Fixes missing options.h when doing 'make check' in dri/common before
'make' has been run.

Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-20 20:06:20 -08:00
Jordan Justen
6c7fa72229 fbobject: add additional fbo completeness checks for GLES
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-20 19:54:38 -08:00
Jordan Justen
f8e7aa2827 framebuffer: update allowed implementation format/type
Allow additional format/type combinations based on the
color render buffer to fix failures with gles3-gtf.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-20 19:54:38 -08:00
Jordan Justen
ffdffd834a readpix: allow implementation format/type
For GLES2/3 allow reading of pixels with format/type based on:
 * GL_IMPLEMENTATION_COLOR_READ_FORMAT
 * GL_IMPLEMENTATION_COLOR_READ_TYPE

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-20 19:54:38 -08:00
Jordan Justen
119002a648 extensions: enable EXT_color_buffer_float for ES3
[mattst88] v2: Enable only for ES3 per spec.
[mattst88] v3: Use _mesa_is_gles3 since EXT_color_buffer_float is
	       ES3-only.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-20 19:54:38 -08:00
Matt Turner
227f58695e extensions: Add ES3-only extension support
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-20 19:54:38 -08:00
Jordan Justen
ce9118c7f0 readpix: check FBO completeness before trying to access the read-buffer
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-20 19:54:38 -08:00
Jordan Justen
8b0bc9de36 readpix: add error checking for GLES3
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-20 19:54:38 -08:00
Jordan Justen
a793ffa0b8 copyteximage: update error checking for GLES3
Changes based on GTF/gles3 conformance test suite.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-20 19:54:38 -08:00
Jordan Justen
3b51d71c85 copyteximage: check that sRGB usage is valid for GLES3 / GL
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-20 19:54:38 -08:00
Ian Romanick
285fe32bd9 intel: Enable GL_OES_depth_texture_cube_map
For now I'm just enabling this on the same subset of hardware that has
OpenGL 3.0 enabled.  This same functionality is part of OpenGL 3.0, and
there is no matching desktop extension.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-20 20:56:23 -05:00
Ian Romanick
1c29d8f4ff mesa/es3: Allow unsized depth and depth-stencil formats in ES3
They're part of GL_OES_depth_texture_cube_map, and we'll always enable
that extension in ES3 contexts.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-20 20:56:20 -05:00
Ian Romanick
b3eed73c3b mesa/es2: Allow depth component cube maps in ES2 if the extension is enabled
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-20 20:56:18 -05:00
Ian Romanick
0f899c2da8 mesa: Add extension bit tracking for GL_OES_depth_texture_cube_map
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-20 20:56:01 -05:00
Adam Jackson
30530ee9ac gallium: Remove ppc asm backend
The vs part hasn't been wired up since tgsi_sse2 was disabled in:

    commit 4eb3225b38
    Author: José Fonseca <jose.r.fonseca@gmail.com>
    Date:   Tue Nov 8 00:10:47 2011 +0000

	Remove tgsi_sse2.

And it would certainly not work correctly in its current state:

draw/draw_vs_ppc.c: In function ‘draw_create_vs_ppc’:
draw/draw_vs_ppc.c:190:24: warning: assignment from incompatible pointer
type [enabled by default]

As with the sse2 backend, this should be done in llvm anyway.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-01-20 17:12:47 -05:00
Andreas Boll
410b58c7bf build: require python module libxml2
configure should warn if libxml2 is not found.
libxml2 is needed by glapi/gen.

Fixes error during build in src/mapi/glapi/gen:
ImportError: No module named libxml2

NOTE: This is a candidate for the 9.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31598
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-19 23:50:39 +01:00
Vincent Lejeune
f9f5c92f73 r600g/llvm: Fixes addressspace of basevectors for clipvertex 2013-01-19 22:28:13 +01:00
Christoph Bumiller
e264b8ef41 nv50/ir: add definitions of Target and CodeEmitter dtors
I really did build test, my compiler just doesn't seem to care.
2013-01-19 22:13:45 +01:00
Christoph Bumiller
7d2d450ea6 nouveau: fix undefined behaviour when testing sample_count
NOTE: This is a candidate for the 9.0 branch.
2013-01-19 20:54:39 +01:00
Christoph Bumiller
b0863c26d4 nv50/ir: fix a couple of warnings 2013-01-19 20:54:39 +01:00
Ian Romanick
f59a3a0fe2 mesa: Array uniform name length includes length of [0]
This is required by OpenGL ES 3.0 and desktop OpenGL 4.2.  Previous
version were ambiguous.  This also matches the behavior of NVIDIA's
closed-source driver (version 304.64).

Fixed gles3conformance test uniform_buffer_object_getactiveuniformsiv
and uniform_buffer_object_structure_and_array_element_names (on my
in-progress branch that fixes a bunch of other stuff...YMMV).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 17:35:33 -08:00
Ian Romanick
8ef3c83ffe mesa: Array uniform names are supposed to have [0] appended
This is required by OpenGL ES 3.0 and desktop OpenGL 4.2.  Previous
version were ambiguous.  This also matches the behavior of NVIDIA's
closed-source driver (version 304.64).

Fixed gles3conformance test uniform_buffer_object_getactiveuniform.

Several piglit tests expect glGetActiveUniform to *not* include the [0]
on the end.  These tests were already failing on NVIDIA, and this change
regresses them on Mesa.  Patches have been sent to the piglit mailing
list to fix the tests.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 17:35:33 -08:00
Ian Romanick
5938c7774f mesa: Refactor getting a uniform's name to a helper function
We currently have a bug in this code, and I don't want to fix it in two
places.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 17:35:33 -08:00
Ian Romanick
f26520146b glsl: Eliminate link_update_uniform_buffer_variables return value
It always returns true, so there's no point in having a return value.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 17:35:33 -08:00
Ian Romanick
bd85c75922 glsl: Remove unused loc parameter from generate_call
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 17:35:33 -08:00
Ian Romanick
56053b0a2d mesa: Remove unused field gl_uniform_buffer_variable::Buffer
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 17:35:33 -08:00
Ian Romanick
feea85da06 linker: Use helper variable sh
This looks like a copy-and-paste left over.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 17:35:32 -08:00
Ian Romanick
db718e2472 glsl: Remove stale comment
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 17:35:32 -08:00
Kenneth Graunke
4f29169913 glsl: Track UBO block names in the symbol table.
The GLSL 1.40 spec says:

    "Uniform block names and variable names declared within uniform
    blocks are scoped at the program level."

Track the block name in the symbol table and emit errors when conflicts
exist.

Fixes es3conform's uniform_buffer_object_block_name_conflict test, and
fixes the piglit block-name-clashes-with-{variable,function,struct}.vert
tests.

NOTE: This is a candidate for the 9.0 branch.

v2: Fix bad constructor initialization.  Noticed by Topi Pohjolainen.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-18 17:35:32 -08:00
Ian Romanick
bb47a4d081 glsl: Reject row_major and column_major on non-matrix types
About both row_major and column_major layout qualifiers, the GLSL spec
says:

    "It only affects the layout of matrices."

However, the OpenGL ES 3.0 conformance tests have taken this to mean it
is an error use it elsewhere.  This seems logical given that
'layout(row_major) vec4 foo' is probably not what the programmer meant.

The only catch is dealing with structures that contain matrices.  Layout
qualifiers cannot be applied directly to fields of structures, so the
only way to affect the layout of the fields is to apply a qualifier to
the structure declaration itself.  There is ongoing debate about this
within Khronos, and it seems to be settling in favor of allowing the
qualifiers on structures.  I light of this, I have chosen to allow the
qualifiers on structures but emit a warning since the usage may not be
portable.

Fixes gles3conform test
uniform_buffer_object_layouts_not_for_matrix_type and causes no
regressions.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 17:35:32 -08:00
Eric Anholt
1ec1b577f7 mesa: Skip updating texgen when not doing fixed function.
Between the previous commit and this one, improves GLBenchmark 2.1
offscreen performance by 0.48% +/- 0.24% (n=22, throttling outliers
removed).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-18 13:03:46 -08:00
Eric Anholt
078727d41c mesa: Don't bother updating ff texture state if we have a fragment shader.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-18 13:03:41 -08:00
Eric Anholt
b5788146ba mesa: Drop a comment about ff vertex shading and texturing.
It's never going to have texture fetches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-18 13:03:27 -08:00
Eric Anholt
4533a38fa8 mesa: Fix out of bounds writes when uncompressing non-block-aligned ETC1.
Fixes a crash in GLB2.1 offscreen on the glthread branch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 12:48:27 -08:00
Eric Anholt
5e529d708a i965: Add support for GL_ARB_texture_buffer_object_rgb32.
Tested with piglit ARB_texture_buffer_object/formats.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 12:48:22 -08:00
Eric Anholt
582b06c2c6 i965: Add support for MESA_FORMAT_RGB_FLOAT32 surfaces.
This is for GL_ARB_texture_buffer_object_rgb32 support, but it also
causes the format to get used for float32 rgb textures as well on
Ironlake and later.  Since that came with some surprises, separate
the change from the enable commit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 12:48:18 -08:00
Eric Anholt
60894edeef intel: Make intel_region's pitch be bytes instead of pixels.
We almost never want a stride in pixels -- if you're doing anything with
a stride, you're specifying an offset or incrementing a pointer, and in
both cases you had to multiply by cpp to get the bytes value you wanted.
But worse, on the way to creating a region from a new tiled BO, we
divided by cpp to get pitch in pixels, and for an RGB32 buffer (an
upcoming change) the pitch wouldn't divide exactly, and we'd end up with
a wrong stride in our region.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 12:48:13 -08:00
Eric Anholt
8fd62e80ae intel: Make intel_blit.c take pitches in bytes.
As we gain support for NPOT cpp, a pitch may not divide by cpp cleanly.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-18 12:48:07 -08:00
Vincent Lejeune
3b14ce2caf r600g/llvm: tgsi to llvm emits store.swizzle intrinsic for vs/fs output
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
2013-01-18 20:34:26 +00:00
Vincent Lejeune
7b20526466 r600g/llvm: tgsi to llvm emits stream output intrinsics.
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
2013-01-18 20:34:21 +00:00
Vincent Lejeune
ce34ff1ad7 r600g/llvm:translate ARL opcode to a simple cast
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
2013-01-18 20:08:10 +00:00
Vadim Girlin
7d532800d8 r600g/llvm: rework handling of the constants
Vincent Lejeune:
  - tgsi to llvm now emits pointers for constants

Tom Stellard:
  - Only use texture cache for vtx fetch with compute shaders
  - Change address space used for constant loads to match LLVM
    backend.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
2013-01-18 20:08:10 +00:00
Kenneth Graunke
1ee2880e86 mesa: Only mark textures as mipmap incomplete on MAX_LEVEL issues.
According to the OpenGL 3.2 Core Profile specification, section 3.8.12:

"For one-, two-, and three-dimensional and one-and two-dimensional array
 textures, a texture is mipmap complete if all of the following
 conditions hold true:
 - [...]
 - levelbase <= levelmax [...]

 Using the preceding definitions, a texture is complete unless any of
 the following conditions hold true:
 - [...]
 - The minification filter requires a mipmap (is neither NEAREST nor
   LINEAR), and the texture is not mipmap complete."

(This text also appears in all GL >= 3.2 specs and the ES 3.0 spec.)

From this, we see that levelbase <= levelmax should only affect mipmap
completeness, not base-level completeness.

Prior versions of GL did not have the notion of mipmap completeness,
simply calling the texture incomplete in this case.  But I don't think
we really care.

Fixes es3conform's sgis_texture_lod_basic_completeness test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
2013-01-18 11:31:27 -08:00
Kenneth Graunke
f0dbd9255b i965/vs: Store texturing results into a vec4 temporary.
The sampler appears to ignore writemasks (even when correcting the
WRITEMASK_XYZW in brw_vec4_emit.cpp to the proper writemask) and just
always writes all four values.

To cope with this, just texture into a temporary, then MOV out into a
register that has the proper number of components.

NOTE: This is a candidate for stable branches.

Fixes es3conform's shadow_execution_vert.test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
2013-01-18 11:31:27 -08:00
Kenneth Graunke
aeff9a0d98 i965/vs: Set LOD to 0 for ordinary texture() calls.
Previously it was left undefined, causing us to select a random LOD.

NOTE: This is a candidate for stable branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
2013-01-18 11:31:26 -08:00
Kenneth Graunke
56ce55d198 i965/vs: Create a 'lod_type' temporary for ir->lod_info.lod->type.
This is purely a refactor.  However, in a moment, we'll want to set
lod_type to float for ir_tex, where ir->lod_info.lod is NULL.

NOTE: This is a candidate for stable branches (for the next patch).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
2013-01-18 11:31:26 -08:00
Kenneth Graunke
613e64060c i965: Lower textureGrad() with samplerCubeShadow on pre-Haswell.
Fixes regressions since commit 899017fc54
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Fri Jan 4 07:53:09 2013 -0800

    i965: Use Haswell's sample_d_c for textureGrad with shadow samplers.

That patch assumed that all instances were lowered.  However, we weren't
lowering textureGrad() with samplerCubeShadow because I couldn't figure
out the LOD calculations.  It turns out they're easy: you just have to
use 1 for the depth.  This causes it to pass oglconform's four tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Ian Romanick <idr@freedesktop.org>
2013-01-18 10:30:54 -08:00
Roland Scheidegger
d03d9b657e llvmpipe: turn on integer texture support
Now that things mostly seem to work enable those formats.
Some formats cause crashes (notably RGB8 variants) so switch these off
(these crashes are not specific to INT/UINT variants but the state tracker
doesn't use them for UNORM etc. formats so it went unnoticed so far).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-18 09:14:52 -08:00
Roland Scheidegger
f2a87a1f5b llvmpipe: more fixes for integer color buffers
Cast back the fake floats to ints, and make sure we don't try to do scaling
in format conversion (which only makes sense with normalized values).
Also need to disable blending and alpha test (as per spec) for such buffers.
This makes fbo-blending from the piglit ext_texture_integer tests work for most
formats (some crash, and the luminance and intensity variants have the GB or
GBA channels respectively wrong).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-18 09:14:52 -08:00
Roland Scheidegger
dc6bc3b642 llvmpipe: trivial code and comment cleanup.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-18 09:14:52 -08:00
Roland Scheidegger
8c84a82383 llvmpipe: fix using wrong format with MRT in blend code
We were passing in the rt index however this was always 0 for non-independent
blend case. (The format was only actually used to decide if the color mask
covered all channels so this went unnoticed and was discovered by accident.)
Additionally, there was a second problem because we do fixups in the key based
on color buffer format we cannot use non-independent blend anyway as the fixed
up values would never get used.
So always turn non-independent blending into independent.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-18 09:14:52 -08:00
Ian Romanick
ca39c0f94a mesa/es3: Don't check dimensions in _mesa_es3_error_check_format_and_type
Filtering of DEPTH_COMPONENT and DEPTH_STENCIL for TEXTURE_3D is already
done in texture_error_check because these combinations aren't allowed on
desktop GL either.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2013-01-17 10:47:46 -08:00
Ian Romanick
311cc5d973 mesa: Don't allow DEPTH_STENCIL for 3D textures
Just like DEPTH_COMPONENT.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2013-01-17 10:47:42 -08:00
Brian Paul
57ddf1227f swrast: fix assorted bugs in software blit code
1. The loop over dest buffers in blit_linear() needed a null pointer
check.  Fixes https://bugs.freedesktop.org/show_bug.cgi?id=59499

2. The code to grab the drawRb's format needs to be inside the drawing loop.

3. An equality test was using = instead of == thus messing up a
renderbuffer attachment texture pointer.  This lead to memory
corruption and a crash at exit.

Finally, fix a capitalization error NumDrawBuffers -> numDrawBuffers
and change type to unsigned to fix signed/unsigned comparison warnings.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2013-01-17 09:38:54 -07:00
Michel Dänzer
51efb081f7 radeonsi: Actually keep track if we are using depth textures for samplers.
20-odd more piglits.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-17 16:57:21 +01:00
Michel Dänzer
3c92bfe2d2 radeonsi: Fix Z24 texture formats.
About half a dozen more piglits.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-17 16:57:21 +01:00
Michel Dänzer
1ace200b2b radeonsi: Set SPI_SHADER_COL_FORMAT to what the pixel shader actually exports.
Instead of deriving it from the colour buffer formats only.

Fixes a number of piglit tests which export depth from the pixel shader.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-17 16:57:21 +01:00
Michel Dänzer
bc5e65096d radeonsi: Use proper hardware format for stencil texturing.
Fixes piglit 'spec/ARB_depth_buffer_float/fbo-clear-formats stencil' crash.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-17 16:57:20 +01:00
Michel Dänzer
c486e3ef34 radeonsi: Enable tiling for depth/stencil resources.
Enabling it for all resources still seems to cause problems, but depth/stencil
buffers are always accessed with tiling by the DB block.

Also, stick to 1D tiling for now. Getting 2D tiling to work properly will
require substantial changes in libdrm_radeon and possibly the kernel as well.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-17 16:57:20 +01:00
Michel Dänzer
c408f0c5c4 radeonsi: Consolidate calculation of tile mode index.
Apart from the obvious cleanup, this makes sure all blocks use the same tiling
mode for accessing the resource.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-17 16:57:20 +01:00
Maarten Lankhorst
9ba7eac535 nvc0: add support for accelerated video decoding through the dedicated engines
Currently the use of external firmware is required, with kernel and
userspace firmware needed for all Fermi cards except nvd9. Kepler and nvd9
should only require kernel firmware.
2013-01-17 16:28:57 +01:00
Michel Dänzer
6eb0d3d863 radeonsi: Pass texture type to sampling intrinsics.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-17 15:47:38 +01:00
Maarten Lankhorst
edc8e8cbef nvc0: add space checks to clear functions
Thanks to calim for helping me find and fix the issue.
2013-01-17 12:37:25 +01:00
Maarten Lankhorst
5dc76c7670 nv50: add space checks to clear functions, and respect depth
Thanks to calim for helping me find and fix the issue.
2013-01-17 12:37:15 +01:00
Brian Paul
56c01d8109 st/mesa: a couple fixes for st_BlitFramebuffer()
1. Loop over multiple destination color buffers.  If we set
glDrawBuffers(GL_FRONT_AND_BACK) we need to loop over multiple color
buffers, blitting to each.

2. Add checks for null src/dst surface pointers.  This fixes a crash
in the piglit fbo-missing-attachment-blit test.
See bug http://bugs.freedesktop.org/show_bug.cgi?id=59450

Reviewed-by: Reviewed-by: Marek Olšák <maraeo@gmail.com>
2013-01-16 17:06:17 -07:00
Brian Paul
af7b4b01f1 st/mesa: simplify some src/dst surface setup in BlitFramebuffer
Use the renderbuffer attachment pointers that we grabbed earlier.

Reviewed-by: Reviewed-by: Marek Olšák <maraeo@gmail.com>
2013-01-16 17:06:17 -07:00
Brian Paul
09154c274c meta: add 'f' suffix to floats to silence some MSVC warnings 2013-01-16 17:06:17 -07:00
Brian Paul
6064810e53 mesa: add missing ASSERT_OUTSIDE_BEGIN_END() in _mesa_GetInternalformativ()
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-16 17:06:17 -07:00
Matt Turner
99629735e7 build: Make src/gtest before src/mesa
Fixes a make check problem where libgtest.la wasn't build before tests
that want to link with it.
2013-01-16 13:31:36 -08:00
Jon TURNEY
e6e73089e5 Fix mapi code generator for out-of-tree build
Use os.path.join() rather than hand-rolling it, so path is correct if
sys.argv[0] returns an absolute path.

(According to the python documentation, it's platform dependent whether
sys.argv[0] is a full pathname or not.  It probably also depends on how
the process was started...)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-16 19:53:01 +00:00
Maarten Lankhorst
4fad211502 nvc0: Add support for video buffer 2013-01-16 17:44:09 +01:00
Maarten Lankhorst
4b8af72f96 vl/video_buffer: fix up surface ordering for the interlaced case
It seems the other code expects surface[0..1] to be the luma field in interlaced case.

See for example vdpau/surface.c vlVdpVideoSurfaceClear and vlVdpVideoSurfacePutBitsYCbCr.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
2013-01-16 17:22:55 +01:00
Maarten Lankhorst
892c1fa8d8 vl/compositor: fix weave shader bugs
Writemask was XY instead of YZ (thanks to calim for spotting it).

The pixel calculation resulted in the pixel always being off by one.
If y was .5:

y' = round(y) + 0.5 = 1.5

Fixing this also means the LRP function has to swap the pixels it, since
it's now the other way around for top/bottom.

WIth these fixes only chroma for top and bottom pixel rows are wrongly interpolated
in my test program:

--- nvidia
+++ nouveau
@@ -1,4 +1,4 @@
-YCbCr[0] = 00c080
+YCbCr[0] = 00b070
 YCbCr[1] = 00b070
 YCbCr[2] = 029050
 YCbCr[3] = 207050
@@ -61,4 +61,4 @@
 YCbCr[60] = 0c5070
 YCbCr[61] = c05090
 YCbCr[62] = 0e70b0
-YCbCr[63] = e080c0
+YCbCr[63] = e070b0

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2013-01-16 17:22:45 +01:00
Brian Paul
dfcd7658c5 mesa: add new formatquery.c file to SConscript file to fix build 2013-01-16 08:18:33 -07:00
Christian König
f449948812 radeonsi/vdpau: remove nonsense state tracker dep
Added with automake conversion, but makes no sense at all.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-16 15:28:43 +01:00
Ian Romanick
1cedf7819b glapi: Remove duplicate ARB_base_instance from gl_API.xml
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 23:20:18 -08:00
Ian Romanick
3c00a52f7e intel: Enable GL_ARB_internalformat_query
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-15 21:34:45 -08:00
Ian Romanick
f5e7f12e4a mesa: Add driver method to determine the possible sample counts
Use this method in _mesa_GetInternalformativ for both GL_SAMPLES and
GL_NUM_SAMPLE_COUNTS.

v2: internalFormat may not be color renderable by the driver, so zero
can be returned as a sample count.  Require that drivers supporting the
extension provide a QuerySamplesForFormat function.  The later was
suggested by Eric Anholt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-15 21:34:45 -08:00
Ian Romanick
bda540d235 mesa: Add dispatch and extension XML for GL_ARB_internalformat_query
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-15 21:34:45 -08:00
Ian Romanick
5e4bb063f0 mesa: Add extension tracking bit for GL_ARB_internalformat_query
Though, I'm tempted to always expose this extension when
GL_ARB_framebuffer_object is exposed.  In that case, it would share the same
enable bit.

v2: Correctly sort extension names.  Suggested by Eric Anholt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-15 21:34:45 -08:00
Ian Romanick
1b468d043e mesa: Add skeleton implementation of glGetInternalformativ
This is for the GL_ARB_internalformat_query extension and GLES 3.0.

v2: Generate GL_INVALID_OPERATION if the extension is not supported.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-15 21:34:45 -08:00
Vinson Lee
780c2cb42b meta: Move loop variable declaration outside for loop.
Fixes build with MSVC.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
2013-01-15 18:03:25 -08:00
Brian Paul
7ecbbc3386 mesa: move declarations before code to fix MSVC build 2013-01-15 17:02:30 -07:00
Anuj Phogat
d0ce8d6ceb mesa: Round float param in glTexparameterf() to nearest integer
OpenGL 4.2 specification suggests rounding the float data to nearest
integer when the type of internal state is integer. Out of range floats
should be clamped to {INT_MIN, INT_MAX}. This is not specified anywhere
in gl/gles spec but below test expects this behavior.  This patch makes
gles3 conformance sgis_texture_lod_basic_getter.test pass.

A GL spec bug will be raised to include clamping of out of range floats.

V2: Round float to nearest integer for all cases where
_mesa_Texparameterf() converts float param to int. Use the same block of
float to int conversion code for GL_TEXTURE_SWIZZLE_{R,G,B,A}_EXT cases
as well.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 15:09:37 -08:00
Anuj Phogat
bed997daba mesa: Add support to allow blitting to multiple color draw buffers
This patch fixes a blitting case when drawAttachment->Texture ==
readAttachment->Texture. It was causing an assertion failure in
intel_miptree_attach_map() with gles3 conformance test case:
framebuffer_blit_functionality_minifying_blit

Number of changes in this file look scary. But most of them are caused
by introducing a big for loop to support rendering to multiple color
draw buffers.

V2: Fixed a case when number of draw buffer attachments are zero.
V3: Put a for loop in blit_nearest() and blit_linear() functions in to
    support blitting to multiple color draw buffers.
V4: Remove variable declaration in for loop to avoid MSVC compilation
    issues.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 15:09:23 -08:00
Anuj Phogat
ab36ca0614 mesa: Add error checking in _mesa_BlitFramebuffer() for MRTs
This patch adds required error checking in _mesa_BlitFramebuffer() when
blitting to multiple color render targets. It also fixes a case when
blitting to a framebuffer with renderbuffer/texture attached to
GL_COLOR_ATTACHMENT{i} (where i!=0). Earlier it skips color blitting if
nothing is found attached to GL_COLOR_ATTACHMENT0.

V2: Fixed a case when number of draw buffer attachments are zero.
V3: Do compatible_color_datatypes() and compatible_resolve_formats()
    check for all the draw renderbuffers in fbobject.c. Fix debug code
    at bottom of _mesa_BlitFramebuffer() to handle MRTs. Combine error
    checking code for linear blits with other color blit error checking.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 15:09:12 -08:00
Anuj Phogat
2f2801f876 mesa: Fix GL error generation in _mesa_GetFramebufferAttachmentParameteriv()
This allows query on default framebuffer in
glGetFramebufferAttachmentParameteriv() for gles3. Fixes unexpected GL
errors in gles3 conformance test case:
framebuffer_blit_functionality_multisampled_to_singlesampled_blit

V2: Use _mesa_is_gles3() check to restrict allowed attachment types to
specific APIs.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 15:09:03 -08:00
Anuj Phogat
b77243b9c2 intel: Support blitting to multiple color draw buffers
This patch enables blitting to multiple color attachments of a
framebuffer.  It also fixes a case when blitting to a framebuffer with
renderbuffer/texture attached to non-zero attachment point
i.e. GL_COLOR_ATTACHMENT{1, 2, ...}.  Earlier we were incorrectly
blitting to GL_COLOR_ATTACHMENT0 by default.

V2: Use intel_copy_texsubimage() for blitting only if all the color
attachments can blit using it.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 15:08:55 -08:00
Anuj Phogat
0c535ae7fc meta: Add functionality to do _mesa_meta_BlitFrameBuffer() using glsl
This patch rewrites _mesa_meta_BlitFrameBuffer() function to add support
for blitting with GLSL/GLSL ES shaders. These changes were required to
support glBlitFrameBuffer() in gles3. This patch, along with other
patches in this series, make 16 failing framebuffer_blit test cases in
gles3 conformance pass.

V2: Properly handle flipped blits for source and destination
    renderbuffer / textures. Add support for GL_TEXTURE_RECTANGLE in
    _mesa_meta_BlitFrameBuffer. Create a temp depth texture to support
    depth buffer blitting.
V3: Remove unsupported / redundant shader code. Add an assertion to make
    sure that we don't use rectangle texture in ES. Put API guard on
    glTexEnvi().
V4: For gles3: Don't use ReadPixels or CopyTexImage2D to blit depth
    buffer.  gles3 spec says for CopyTexImage2D that "color buffer
    components can be dropped during the conversion to internalformat,
    but new components cannot be added." So, use the internal format of
    read renderbuffer to create texture for color buffer blitting.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
2013-01-15 15:08:38 -08:00
Anuj Phogat
252573ae0f mesa: Fix GL error generation in glBlitFramebuffer()
V2:
If mask has GL_STENCIL_BUFFER_BIT set, the depth formats for
readRenderBuffer and drawRenderBuffer must match unless one of the two
buffers doesn't have depth, in which case it's not blitted, so the
format check should be ignored.  Same comment goes for stencil formats
in depth renderbuffers if mask has GL_DEPTH_BUFFER_BIT set.

v3 (Kayden): Refactor code to be a bit more readable.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 15:08:12 -08:00
Kenneth Graunke
f727fc6304 mesa: Make ES3 glDrawBuffers() only accept BACK/NONE for the winsys fbo.
Nothing was explicitly checking this.

v2: Update GL3 spec reference.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> [v2]
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
2013-01-15 15:04:50 -08:00
Kenneth Graunke
fd3891cbbe mesa: Handle GL_BACK correctly for ES 3.0 in glDrawBuffers().
In ES 3.0, when calling glDrawBuffers() on the window system
framebuffer, the only valid targets are GL_NONE or GL_BACK.  Since there
is no stereo rendering in ES 3.0, this is a single buffer, unlike
desktop where it may be two (and thus isn't allowed).

For single-buffered configs, GL_BACK ironically means the front (and
only) buffer.  I'm not sure that it matters, however, as ES shouldn't
have front buffer rendering in the first place.

Fixes es3conform framebuffer_blit_coverage_default_draw_buffer_binding.

v2: Update GLES3 spec reference.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> [v2]
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
2013-01-15 14:59:40 -08:00
Ian Romanick
d786bf2c2a egl/dri2: Fix typo in the previous commit
I didn't notice this due to a noobed piglit run.  It wasn't previously
noticed because the patch was only run on a driver that supported GLES3.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 14:19:04 -08:00
Rob Schneider
45575ff388 libgl-gdi: Avoid hangs on DLL_PROCESS_DETACH.
At process exit DLL_PROCESS_DETACH is signaled to DllMain(), where then
a final cleanup is triggered.  In stw_cleanup() code is triggered that
tries to communicate a shutdown to the spawned threads -- however at
that time those threads have already been terminated by the OS and so
the process hangs.

v2: skip stw_cleanup_thread() too

Signed-off-by: José Fonseca <jfonseca@vmware.com>
2013-01-15 14:16:09 -08:00
Chad Versace
eb09940e55 egl/dri2: Add plumbing for EGL_OPENGL_ES3_BIT_KHR
Fixes error EGL_BAD_ATTRIBUTE in the tests below on Intel Sandybridge:
    * piglit egl-create-context-verify-gl-flavor, testcase OpenGL ES 3.0
    * gles3conform, revision 19700, when runnning GL3Tests with -fbo

This plumbing is added in order to comply with the EGL_KHR_create_context
spec. According to the EGL_KHR_create_context spec, it is illegal to call
eglCreateContext(EGL_CONTEXT_MAJOR_VERSION_KHR=3) with a config whose
EGL_RENDERABLE_TYPE does not contain the EGL_OPENGL_ES3_BIT_KHR. The
pertinent
portion of the spec is quoted below; the key word is "respectively".

  * If <config> is not a valid EGLConfig, or does not support the
    requested client API, then an EGL_BAD_CONFIG error is generated
    (this includes requesting creation of an OpenGL ES 1.x, 2.0, or
    3.0 context when the EGL_RENDERABLE_TYPE attribute of <config>
    does not contain EGL_OPENGL_ES_BIT, EGL_OPENGL_ES2_BIT, or
    EGL_OPENGL_ES3_BIT_KHR respectively).

To create this patch, I searched for all the ES2 bit plumbing by calling
`git grep "ES2_BIT\|DRI_API_GLES2" src/egl`, and then at each location
added a case for ES3.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:45:54 -08:00
Chad Versace
26f9faa04b intel: Expose support for DRI_API_GLES3
If the hardware/driver combo supports GLES3, then set the GLES3 bit in
intel_screen's bitmask of supported DRI API's.  Neither the EGL nor GLX
layer uses the bit yet.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:45:54 -08:00
Chad Versace
e90c08e667 dri: Define enum __DRI_API_GLES3
This enum corresponds to EGL_OPENGL_ES3_BIT_KHR.
Neither the GLX nor EGL layer use the enum yet.

I don't like the GLES bits. I'd prefer that all GLES APIs be exposed
through a single API bit, as is done in GLX_EXT_create_context_es_profile.
But, we need this GLES3 enum in order to do the plumbing necessary to
correctly support EGL_OPENGL_ES3_BIT_KHR as required by the
EGL_KHR_create_context spec.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:45:53 -08:00
Chad Versace
a11fe62058 intel: Move validation of context version into intelInitContext
Each driver (i830, i915, i965) used independent but similar code to
validate the requested context version. With the rececnt arrival of GLES3,
that logic has needed an update. Rather than apply identical updates to
each drivers validation code, let's just move the validation into the
shared routine intelInitContext.

This refactor required some incidental changes to functions
i830CreateContext and intelInitContext. For each function, this patch:
    - Adds context version parameters to the signature.
    - Adds a DRI_CTX_ERROR out param to the signature.
    - Sets the DRI_CTX_ERROR at each early return.

Tested against gen6 with piglit egl-create-context-verify-gl-flavor.
Verified that this patch does not change the set of exposed EGL context
flavors.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:45:51 -08:00
Chad Versace
4945086f36 intel: Set screen's api mask according to hw capabilities (v3)
Before this patch, intelInitScreen2 set DRIScreen::api_mask with the hacky
heuristic below:

    if (gen >= 3)
        api_mask = GL | GLES1 | GLES2;
    else
        api_mask = 0;

This hack was likely broken on gen2 (i830), but I don't care enough to
properly investigate. It appears that every EGLConfig on i830 has
EGL_RENDERABLE_TYPE=0, and thus eglCreateContext will never succeed.
Anyway, moving on to living drivers...

With the arrival of EGL_OPENGL_ES3_BIT_KHR, this heuristic is now
insufficient. We must enable the GLES3 bit if and only if the driver is
capable of creating a GLES3 context. This requires us to determine the
maximum supported context version supported by the hardware/driver for
each api *during initialization of intel_screen*.

Therefore, this patch adds four new fields to intel_screen which indicate
the maximum supported context version for each api:
  max_gl_core_version
  max_gl_compat_version
  max_gl_es1_version
  max_gl_es2_version

The api mask is now correctly set as:

    api_mask = GL;
    if (max_gl_es1_version > 0)
        api_mask |= GLES1;
    if (max_gl_es2_version > 0)
        api_mask |= GLES2;

Tested against gen6 with piglit egl-create-context-verify-gl-flavor.
Verified that this patch does not change the set of exposed EGL context
flavors.

v2:
  - Replace the if-tree on gen with a switch, for Ian.
  - Unconditionally enable the DRI_API_OPENGL bit, for Ian.

v3:
  - Drop max gl version to 1.4 on gen3 if !has_occlusion_query,
    because occlusion queries entered core in 1.5. For Ian.

v4:
  - Drop ES2 version back to 2.0 due to rebase (Ian).

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick.intel.com>
2013-01-15 13:44:29 -08:00
Matt Turner
112e302481 mesa: Return INVALID_ENUM for glReadPixels(..., GL_DEPTH_*, ...) on ES 3
I'm not sure if this is the correct fix. The
_mesa_es_error_check_format_and_type function (used above in the ES 1
and 2 cases) was originally added for glTexImage checking and allows
GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8 combinations. Using it in ES 3
causes other tests to regress.

Fixes es3conform's packed_depth_stencil_error test.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:34:00 -08:00
Matt Turner
2906e2034c mesa: Return INVALID_OPERATION when type is known but not allowed
INVALID_ENUM is for when the type is simply not known.

Fixes part of es3conform's packed_depth_stencil_error test.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:34:00 -08:00
Matt Turner
c8901133a4 mesa: Allow HALF_FLOAT in glVertexAttribPointer for GLES3
Fixes es3conform's half_float_max_vertex_dimensions and
half_float_textures tests.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:34:00 -08:00
Matt Turner
cbef5371f6 mesa: Reject texture-only formats as renderbuffer formats in ES 3
ES 3 specifies some formats as texture-only (i.e., not available for
renderbuffers).

See the "Required Texture Formats" section (pg 126) of the ES 3 spec.

v2: Allow RED and RG float rendering in core profiles The check used to
be (version > 30) || (compat profile w/extensions).  Just deleting
<version > 30) broke 3.0+ core profiles.

Fixes es3conform's color_buffer_unsupported_format test.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:34:00 -08:00
Kenneth Graunke
8907b6a8e4 mesa: Fix default value of BUFFER_ACCESS_FLAGS.
According to both the GL 3.0 and ES 3.0 specifications (table 2.7 for GL
and table 2.8 for ES), the default value of BUFFER_ACCESS_FLAGS is
supposed to be zero.

Note that there are two related quantities: the obsolete BUFFER_ACCESS
enum and the new BUFFER_ACCESS_FLAGS bitfield.

BUFFER_ACCESS can only be GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE;
BUFFER_ACCESS_FLAGS can easily represent all three via GL_MAP_WRITE_BIT,
GL_MAP_READ_BIT, and their logical or.  It also supports more flags.

Thus, Mesa only stores the bitfield, and simply computes the old enum
when queried, via simplified_access_mode(bufObj->AccessFlags).

The tricky part is that, while BUFFER_ACCESS_FLAGS defaults to 0,
BUFFER_ACCESS defaults to GL_READ_WRITE for desktop [GL 3.0, table 2.8]
and GL_WRITE_ONLY_OES for ES [the GL_EXT_map_buffer_range extension].

Mesa tried to implement this by setting the default AccessFlags to
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT on desktop, and GL_MAP_WRITE_BIT on
ES.  But in all specifications, it needs to be 0.

This patch moves that logic into simplified_access_mode(): when
AccessFlags == 0, it now returns GL_READ_WRITE for desktop and
GL_WRITE_ONLY for ES 1/2.  (BUFFER_ACCESS doesn't exist on ES 3.0,
so it's irrelevant there.)

With that in place, it changes the AccessFlags default to 0.

Fixes three es3conform tsets:
- copy_buffer_defaults
- map_buffer_range_modify_indices
- pixel_buffer_object_default_parameters

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:34:00 -08:00
Kenneth Graunke
f3db20da1a mesa: Rework crazy error code rules in glDrawBuffers().
Perhaps most importantly, this patch adds comments quoting the relevant
spec paragraphs above each error condition.

It also makes three changes:
- For FBOs, GL_COLOR_ATTACHMENTm where m >= MaxDrawBuffers is supposed
  to generate INVALID_OPERATION (not INVALID_ENUM).
- Constants that refer to multiple buffers (such as FRONT, BACK, LEFT,
  RIGHT, and FRONT_AND_BACK) are supposed to generate INVALID_OPERATION,
  not INVALID_ENUM.
- In ES 3.0, for FBOs, buffers[i] must be NONE or GL_COLOR_ATTACHMENTi
  or else INVALID_OPERATION occurs.  (This is a new restriction.)

Fixes es3conform's draw-buffers-api test.

v2: The error path was missing a "return" like all the other error
paths.  Also, we may as well call it glDrawBuffers in the error message
since the ARB suffix doesn't exist in ES 3.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:34:00 -08:00
Carl Worth
d9d857e24f i965: Force even an empty query to flush all previous queries.
The specification requires that query results are processed in order, (when
one query result is returned, all previous query of the same type must also be
available). The implementation was failing this requirement in the case of
BeginQuery and EndQuery with no intervening drawing, (the result would be made
available immediately without flushing previous queries).

This fixes the following es3conform test:

	occlusion_query_query_order

as well as the following piglit test:

	occlusion_query_order

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:34:18 -08:00
Carl Worth
c0b768ffee meta: Allow meta operations to pause/resume an active occlusion query
This allows for avoiding the occlusion query erroneously accumulating results
during the meta operation. This functionality is made conditional on a new
MESA_META_OCCLUSION_QUERY bit so that meta-operations which should generate
fragments can continue to get the current behavior.

The implementation of glClear is specifically augmented to request the flag
since glClear is specified to not generate fragments.

This fixes the following es3conform tests:

	occlusion_query_draw_occluded.test
 	occlusion_query_clear
	occlusion_query_custom_framebuffer
	occlusion_query_stencil_test
	occlusion_query_discarded_fragments

As well as the following piglit test:

	occlusion_query_meta_no_fragments

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:34:18 -08:00
Carl Worth
3dd76f7168 queryobj: Add EverBound flag, making ISQuery() return false before BeginQuery()
This flag allows for the specified behavior that GenQueries reserves a name,
but does not associate an object with it until BeginQuery. We allocate the
object immediately with the new EverBound flag set to false, and then set the
flag to true at the time of BeginQuery.

This allows us to implement a conformant IsQuery function by checking the
state of the new EverBound flag.

This fixes the following es3conform tests:

	occlusion_query_genqueries
	occlusion_query_is_query_nonzero

and the following piglit test:

	occlusion_query_lifetime

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:34:01 -08:00
Carl Worth
c7df9c0e12 Update comment to specify actual text being referenced from the specification.
The reference to "correct, see spec" was a bit too vague to be useful,
(particularly since the language being referenced here changes between OpenGL
3.1 and OpenGL 4.3).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-15 13:10:58 -08:00
Brian Paul
133383f77a docs: minor updates to VMware guest driver docs
The DRM's --enable-vmwgfx-experimental-api flag isn't needed anymore.
2013-01-15 13:55:24 -07:00
Marek Olšák
7660529c44 r300g: fix and cleanup flushing before clearing CMASK, ZMASK, and HIZ 2013-01-15 21:50:34 +01:00
Marek Olšák
ca2c28859e r300g: implement MSAA compression and fast MSAA color clear
These are optimizations which make MSAA a lot faster.

The MSAA work is complete with this commit.  (except for enablement of AA
optimizations for RGBA16F, for which a patch is ready and waiting until
the kernel CS checker fix lands)

MSAA can't be made any faster as far as hw programming is concerned.

The catch is only one process and one colorbuffer can use the optimizations
at a time.  There usually is only one MSAA colorbuffer, so it shouldn't be
an issue.

Also, there is a limit on the size of MSAA colorbuffer resolution in terms
of megapixels.  If the limit is surpassed, the AA optimizations are disabled.
The limit is:
- 1 Mpix on low-end and some mid-level chipsets (1024x768 and 1280x720)
- 2 Mpix on some mid-level chipsets (1600x1200 and 1920x1080)
- 3 or 4 Mpix on high-end chipsets (2048x1536 or 2560x1600, respectively)
It corresponds to the number of raster pipes (= GB pipes) available, each pipe
can hold 1 Mpix of AA compression data.

If it's enabled, the driver prints to stdout:
  radeon: Acquired access to AA optimizations.
2013-01-15 21:48:58 +01:00
Marek Olšák
1dfe8eead9 gallium/util: add a half float array to util_color
For convenient packing into half floats.
2013-01-15 21:48:49 +01:00
Tom Stellard
7824ab8070 Revert "targets/opencl: Link against libgallium.la instead of libgallium.a"
This reverts commit 4148a29ed8.

This is a work-around for bug:
https://bugs.freedesktop.org/show_bug.cgi?id=59334

We really should be linking against libgallium.la instead of
libgallium.a, but until we can figure why linking against libgallium.la
causes runtime failures in clover we will continue to link against
libgallium.a

Acked-by: Andreas Boll <andreas.boll.dev@gmail.com>
Tested-by: Aaron Watry <awatry@gmail.com>
2013-01-15 18:04:51 +00:00
Marek Olšák
f26eb36e8b st/mesa: use a generic varying to pass the clear color to the FS
The color varying may have reduced precision or be even clamped.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 16:47:18 +01:00
Marek Olšák
355d463f73 gallium/util: fix glClear with MRT by making the FS write to all cbufs
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 16:47:18 +01:00
Marek Olšák
2cd1407d2d st/mesa: fix InternalFormat for Z24X8 window-system buffers
This probably doesn't fix anything, but it's good to be consistent.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 16:47:18 +01:00
Marek Olšák
d489c90a68 st/mesa: remove dead conditional in Clear
I think the conditional always evaluates to false.

If I understand the code in core Mesa correctly, depthBits or stencilBits
is 0 if the depth or stencil renderbuffer is NULL, respectively.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 16:47:18 +01:00
Marek Olšák
f94ea25a4a st/mesa: simplify conditionals in Clear
just check depth and stencil separately, the outcome is the same

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 16:47:18 +01:00
Marek Olšák
01b7124788 st/mesa: fix glClear with different colormask for each colorbuffer
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 16:47:18 +01:00
Marek Olšák
f04dd3d003 gallium: remove PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 16:47:18 +01:00
Marek Olšák
cabe4fbb85 st/mesa: always assume separate depth and stencil clear is supported
All drivers implement it now.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 16:47:18 +01:00
Marek Olšák
16a30e201e softpipe: implement separate depth-stencil clear
The CAP is going away.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 16:47:18 +01:00
Jon TURNEY
77dd50d020 libgl-xlib: softpipe and llvmpipe aren't mutually exclusive at link time
Since automake changes, softpipe and llvmpipe are mutually exclusive at link
time.  This doesn't make much sense to me as we can choose between them at
run-time using GALLIUM_DRIVER.

Creating library file: .libs/libGL.dll.a
.libs/xlib.o: In function `sw_screen_create_named':
/jhbuild/checkout/mesa/mesa/src/gallium/targets/libgl-xlib/../../../../src/gallium/auxiliary/target-helpers/inline_sw_helper.h:35:
undefined reference to `_softpipe_create_screen'

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 10:43:33 +00:00
Jordan Justen
8443b59a5b pack: handle GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV case
For floats, if GL_RGB is the source, then alpha should be set to
1.0F.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 20:52:19 -08:00
Jordan Justen
80784066cc glformats: allow GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV for GLES2/3
This format is allowed by the GL_EXT_texture_type_2_10_10_10_REV
extension.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 20:52:09 -08:00
Jordan Justen
ba34c1d570 copyteximage: Use Driver's AllocTextureImageBuffer instead of TexImage
Call Driver.AllocTextureImageBuffer rather than calling
Driver.TexImage with NULL data, format=GL_NONE and type=GL_NONE.

This avoids setting ctx->Unpack, which can lead to incorrectly
trying to upload data.

The GLES3 GTF program's packed_pixels_pbo test was triggering
an error for i965 with the previous code.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 20:50:31 -08:00
Jordan Justen
91ec623bd2 copyteximage: update signed vs. unsigned format matching
Fixes issues with gles3-gtf

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 20:48:14 -08:00
Jordan Justen
161a3cd9fc framebuffer: add _mesa_get_read_renderbuffer
This returns the current read renderbuffer for the specified
format type.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 20:48:14 -08:00
Matt Turner
f5a3d151b0 teximage: use _mesa_es3_error_check_format_and_type for GLES3
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 20:48:13 -08:00
Matt Turner
9cfcac4528 glformats: add _mesa_es3_error_check_format_and_type
This function checks for ES3 compatible
format/type/internalFormat/dimension combinations.

[jordan.l.justen@intel.com: additional tweaks for gles3-gtf]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 20:47:59 -08:00
Jordan Justen
cf300eaab6 fbobject: don't allow LUMINANCE/INTENSITY/ALPHA fbo on ES/Core
v2:
 * Only allow on GL Legacy contexts

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 20:47:02 -08:00
Jordan Justen
275620c4b2 fbobject: add VERBOSE=api message for renderbuffer storage
Add API debug trace message for:
 * glRenderbufferStorage
 * glRenderbufferStorageMultisample

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 20:47:02 -08:00
Jordan Justen
7f867851f5 fbobject: add VERBOSE=api message for check framebuffer status
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 20:47:02 -08:00
Brian Paul
1c9833ba70 util: add new primitive types to pipe_prim_names[] array
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-01-14 18:15:41 -07:00
Brian Paul
f5eb1b123f st/mesa: add some simple buffer/draw debug code
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-14 18:15:41 -07:00
Brian Paul
cb6ef3d112 libgl-xlib: link with -lrt
Fixes a runtime error:

glxgears: symbol lookup error: /home/brian/mesa/lib/gallium/libGL.so.1: undefined symbol: clock_gettime

v2: use $(CLOCK_LIB) and $(PTHREAD_LIBS) per Andreas Boll.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-14 18:15:41 -07:00
Carl Worth
258453716f i965: Avoid blending with destination alpha when RB format has no alpha bits
The hardware does not support a render target without an alpha channel.
So when the user creates a render buffer with no alpha channel, there actually
is storage available for alpha internally. It requires special care to
avoid these unwanted alpha bits from causing any problems.

Specifically, when blending, and when the blend factors would read the
destination alpha values, this commit coerces the blend factors to instead be
either 0 or 1 as appropriate.

A similar fix was made for pre-gen6 hardware in commit eadd9b8e and this
commit shares the fixup function written by Ian then.

This commit the following es3conform test:

	rgb8_rgba8_rgb

As well as the following piglit (sub) tests:

	EXT_framebuffer_object/fbo-blending-formats/3
	EXT_framebuffer_object/fbo-blending-formats/GL_RGB
	EXT_framebuffer_object/fbo-blending-formats/GL_RGB8

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-14 15:35:37 -08:00
Kristian Høgsberg
6d4d4b00dd egl/wayland: Implement EGL_EXT_buffer_age
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2013-01-14 16:39:15 -05:00
Kristian Høgsberg
90804e886d egl/wayland: Pull color buffers from dri2_surf->color_buffers pool
We used to keep the color buffers in the dri_buffers array and
swap __DRI_BUFFER_BACK_LEFT and __DRI_BUFFER_FRONT_LEFT around there
and swap third_buffer in in case we needed to triple buffer.  That
gets a little fidgety with all the swaps, so lets use the
color_buffers pool like the gbm platform does.  We track the color buffers,
their corresponding wl_buffer and locked status here and just plug
a free one into dri2_surf->buffers when we need to.

This is a nice clean-up in itself, but it also sets us up to track
buffer age in the color_buffers structs.

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2013-01-14 16:39:15 -05:00
Johannes Obermayr
dc473c5f0a gallium/svga: Make sure -std=gnu99 is set.
This is a work-around until configure.ac stops touching CFLAGS.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2013-01-14 13:32:13 -08:00
Damien Lespiau
164a04ed1b build: Fix the documented default value of --with-gallium-drivers
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-14 09:11:44 -08:00
Marek Olšák
e3e1ffb252 r300g: set a dummy vertex buffer in context_create
so that the driver doesn't crash if an app doesn't set any vertex buffers.
2013-01-14 05:58:06 +01:00
Marek Olšák
5330c5a248 r300g: fix MSAA resolve to an untiled texture
RB3D_DEBUG_CTL doesn't help, so I resolve to a tiled temporary texture and
then blitting it to the destination one, which we also do in other situations.
2013-01-14 03:12:01 +01:00
Marek Olšák
e102b665e6 r300g: advertise MSAA support for the RGB10_A2 format on r500
It seems to be working just fine.
2013-01-14 03:12:01 +01:00
Marek Olšák
5fc83101fb r300g: allow separate depth and stencil clear
The handling of the CAP is broken in st/mesa anyway. Let's just kill it.

This commit pretty much enables fast Z clear for FBOs with Z24S8.
The driver falls back to clearing with a quad if the fast clear cannot be
used. It can still do fast color clear, for example.
2013-01-14 03:11:43 +01:00
Marek Olšák
e93a5c2b86 r300g: if both Z and stencil are present, they must be fast-cleared together 2013-01-14 03:11:42 +01:00
Marek Olšák
631c631cbf r300g: allow HiZ with a 16-bit zbuffer 2013-01-14 03:11:42 +01:00
Marek Olšák
3f584c211a r300g: random hyperz cleanups 2013-01-14 03:11:42 +01:00
Marek Olšák
4d6faf5175 r300g: kill the X.Org state tracker target
This won't ever be made default and we don't need it anyway.

We should also consider doing this for other drivers.
2013-01-14 03:11:41 +01:00
Johannes Obermayr
6acef6c5f7 xmlpool: Fix out-of-tree builds.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-13 12:38:50 +01:00
Johannes Obermayr
40a9b0f5d2 gtest: Build it only for 'make check'.
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-13 12:38:44 +01:00
Johannes Obermayr
ebcabb88cf tests: AM_CPPFLAGS must include $(top_srcdir) instead of $(top_builddir).
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-13 12:38:38 +01:00
Adam Jackson
06f3a1f792 r200: Fix probable thinko in r200EmitArrays
Effectively this path would always assert.  Move the break statement to
the (probable) intended place.

Note: This is a candidate for the stable branches.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2013-01-13 12:38:31 +01:00
Nathan Schulte
1b8adabe2e target/dri-swrast: fix for nonstandard LLVM prefix
Include LLVM_LDFLAGS when building with LLVM.  Fixes the following build
errors:
  CXXLD  swrast_dri.la
  /usr/bin/ld: cannot find -lLLVMR600CodeGen
  /usr/bin/ld: cannot find -lLLVMR600Desc
  /usr/bin/ld: cannot find -lLLVMR600Info
  /usr/bin/ld: cannot find -lLLVMR600AsmPrinter

Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-13 12:22:15 +01:00
Andreas Boll
9da454f295 targets/dri-r600: Force c++ linker in all cases
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59282
2013-01-13 12:19:29 +01:00
Andreas Boll
e09a5846cd glapi/gen: remove an obsolete comment from Makefile.am
Glapi gets generated at build time.

See commit:
0ce0f7c0c8
mesa: Remove the generated glapi from source control, and just build it.
2013-01-13 00:55:37 +01:00
Matt Turner
92ce9c38fd Remove hacks for static Makefiles
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - don't remove compatibility with scripts for the old build system

v3: Andreas Boll <andreas.boll.dev@gmail.com>
    - remove more obsolete hacks

v4: Andreas Boll <andreas.boll.dev@gmail.com>
    - add a previously removed TOP variable to fix vgapi build
2013-01-13 00:55:37 +01:00
Kenneth Graunke
8c80bdc4a8 i965: Move program_id to intel_screen instead of brw_context.
According to bug #54524, I regressed oglconform's multicontext test
when I reenabled the fragment shader precompile.

However, these test cases only passed by miraculous coincedence.  We
assign each fragment program a unique ID (brw_fragment_program::id which
becomes brw_wm_prog_key::program_string_id) which we obtain by storing a
per-context counter.

The test case uses GLX context sharing to access the same fragment
program from two different contexts.  This means that we share a program
cache.  Before the precompile, if both contexts happened to use the same
shaders in the same order, we'd obtain the same program_string_ids (by
virtue of doing the same computation twice).  However, the more likely
scenario is that they completely disagree on program_string_id.

This meant that we'd have two completely different fragment shaders in
the cache with the same ID, tricking us to think they were the same
(aside from NOS), so we'd render using the wrong program.

This patch implements a simple fix suggested by Eric: it moves the
global counter out of brw_context and into intel_screen, which is shared
across all contexts.  A mutex protects it from concurrent access.

This is also the first direct usage of pthreads in the i965 driver.

Fixes 10 subcases of oglconform's multicontext test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54524
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-12 15:36:21 -08:00
Kenneth Graunke
2c4ad502ce i965: Fix build error with clang.
Technically, variable sized arrays are a required feature of C99,
redacted to be optional in C11, and not actually part of C++ whatsoever.

Gcc allows using them in C++ unless you specify -pedantic, and Clang
appears to allow them for simple/POD types.

exec_list is arguably POD, since it doesn't have virtual methods, but I
can see why Clang would be like "meh, it's a C++ struct, say no", seeing as
it's meant to support C99.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58970
Reviewed-by: Matt Turner <mattst88@gmail.com>
2013-01-12 15:35:40 -08:00
Kenneth Graunke
fea648db08 i965/fs: Don't mix integer/float immediates in i2b handling.
The simulator gets very angry about our i2b code:

cmp.ne(16)      g3<1>D          g2<0,1,0>D      0F

We can't mix integer DWord and float types.  The only reason to use 0F
here was to share code with f2b.  Split it and use 0D instead.

While we don't believe anything bad will actually happen because of
this, it's nice to fix the warnings and easy enough to do.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-12 15:35:38 -08:00
Kenneth Graunke
4a6753926f i965: Add an INTEL_DEBUG=no16 option.
Often when debugging, I don't want to see SIMD16 shaders.  It makes
INTEL_DEBUG=vs/fs output much easier to read, especially when a program
dumps many shaders.  Plus, I also want to verify that SIMD8 works before
even considering SIMD16.

v2: Fix the likeliness check (caught by Chris and Eric).

Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-12 15:35:38 -08:00
Alexandre Demers
67ef755908 configure.ac: Fixing common dri dependency when using dri state tracker
Fixes a regression caused by b587a7595e

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59261
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-13 00:13:16 +01:00
Fredrik Höglund
ac1c2b8238 st/mesa: set ctx->Const.UniformBufferOffsetAlignment
Reviewed-by: Marek Olšák <maraeo@gmail.com>
2013-01-12 22:08:09 +01:00
José Fonseca
a3dd1ff45f scons: Update for xmlpool/options.h generation. 2013-01-12 19:00:04 +00:00
Johannes Obermayr
6bca283ad5 nv50/nvc0: Build codegen in nv50.
This is required to make libnv50 independent of libnvc0.
2013-01-12 17:14:04 +01:00
Pekka Vuorela
09a00a141f winsys/sw/wayland: Fix build to properly use wayland cflags
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59281
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-12 16:02:30 +01:00
Jordan Justen
3c3a2b51b8 texformat: use MESA_FORMAT_ARGB2101010 with GL_UNSIGNED_INT_2_10_10_10_REV
Choose MESA_FORMAT_ARGB2101010 when storing
GL_RGBA + GL_UNSIGNED_INT_2_10_10_10_REV or
GL_RGB + GL_UNSIGNED_INT_2_10_10_10_REV.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-12 01:46:12 -08:00
Jordan Justen
53e0f32efe texstore argb2101010: merge GL_RGBA and GL_RGB cases
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-12 01:46:02 -08:00
Jordan Justen
f1c5b5d15e glformats: support _mesa_bytes_per_pixel for 2101010+GL_RGB
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-12 01:45:01 -08:00
Jordan Justen
89e07ccf61 glformats: add _mesa_base_format_component_count
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-12 01:44:25 -08:00
Jordan Justen
6d63b6e503 glformats: add functions to detect signed/unsigned integer types
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-12 01:40:47 -08:00
Jordan Justen
2ace406b1f unpack: support unpacking MESA_FORMAT_ARGB2101010
Note: This is a candidate for the stable branches.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-12 01:40:01 -08:00
Ian Romanick
8af7d3ce9f mesa: Add extension tracking for {ARB,OES}_get_program_binary
The ARB_get_program_binary spec says "OpenGL 3.0 is required."  The
nearly identical OES_get_program_binary extension is available for
OpenGL ES 2.0, so I don't see how / why OpenGL 3.0 is a requirement for
the ARB version.  Let's just enable whenever GL_ARB_shader_objects is
available.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:53 -08:00
Ian Romanick
31ca0c8be3 mesa: Add GetProgramiv support for GL_PROGRAM_BINARY_LENGTH
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:53 -08:00
Ian Romanick
50c5fac4e2 mesa: Add Get support for PROGRAM_BINARY_FORMATS and NUM_PROGRAM_BINARY_FORMATS
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:53 -08:00
Ian Romanick
fefd03e16c mesa: Add tracking for GL_PROGRAM_BINARY_RETRIEVABLE_HINT state
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:53 -08:00
Ian Romanick
8e2e670007 mesa: Emit errors for geometry shader enums when ARB_gs4 is not supported
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:53 -08:00
Ian Romanick
e3f273e2f4 glapi: Emit dispatch for {ARB,OES}_get_program_binary
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:53 -08:00
Ian Romanick
11b49dbd05 glapi: Remove spurious space from end of extension name
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:52 -08:00
Ian Romanick
3fe747a0fe mesa: Add stub implementations of glGetProgramBinary and glProgramBinary
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:52 -08:00
Ian Romanick
ec41349a78 mesa: Fix the naming of _mesa_ProgramParameteriARB
After recent changes in the XML, the dispatch generators will expect
this function to be named _mesa_ProgramParameteri.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:52 -08:00
Ian Romanick
bb7f1a9ae8 glapi: Reorder and clean up some of the includes and comments
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:52 -08:00
Ian Romanick
a002902168 mesa: Fix GL_SHADER_BINARY_FORMATS query
There were two bugs here.  First, this and several other queries were
not available in a desktop GL context with GL_ARB_ES2_compatibility.
Second, GL_NUM_SHADER_BINARY_FORMATS returns zero, but
GL_SHADER_BINARY_FORMATS writes one element of data to the buffer.  If
NUM is zero, no data should be written.

Fixes piglit test 'arb_get_program_binary-overrun shader'.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 18:13:52 -08:00
Dave Airlie
4f1e037acf docs/GL3.txt: update GL3 status for r600g.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-01-12 00:19:18 +00:00
Dave Airlie
5039ad6bc5 r600g: fix warnings for htile va
This fixes a warning about mismatched types.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-01-11 23:19:11 +00:00
Dave Airlie
d23aa65001 r600g: texture buffer object + glsl 1.40 enable support (v2)
This adds TBO support to r600g, and with GLSL 1.40 enabled,
we now get 3.1 core profiles advertised for r600g.

The r600/700 implementation is a bit different from the evergreen one,
as r6/7 hw lacks vertex fetch swizzles. So we implement it by passing 5
constants per sampler to the shader, the shader uses the first 4 as masks
for each component and the 5th as the alpha value to OR in.

Now TXQ is also broken so we have to pass a constant for the buffer size,
on evergreen we just pass this, on r6/7 we pass it as the 6th element
in the const info buffer.

v1.1: drop return as DDX doesn't use a texture type
v2: add r600/700 support.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-01-11 22:31:54 +00:00
Dave Airlie
77c10225ee r600g: uniform buffer object support
This adds 12 more constant buffers for use as UBOs,
along with adding relative constant fetching for 2D indices.

This with GLSL 1.40 enabled passes all the same tests as softpipe
on my evergreen system.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-01-11 22:31:54 +00:00
Dave Airlie
199eea4a4b r600: always export a position from vertex shader
This fixes piglit glsl-1.40-tf-no-position from gpu hanging on my rv635
at least.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-01-11 22:31:54 +00:00
Carl Worth
cc5fc8bf2f glcpp: Add tests for line continuation
First we test that line continuations are honored within a comment, (as
recently changed in glcpp), then we test that line continuations can be
disabled via an option within the context. This is tested via the new support
for a test-specific command-line option passed to glcpp.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:55:41 -08:00
Carl Worth
2483039aca glcpp: Rewrite line-continuation support to act globally.
Previously, we were only supporting line-continuation backslash characters
within lines of pre-processor directives, (as per the specification). With
OpenGL 4.2 and GLES3, line continuations are now supported anywhere within a
shader.

While changing this, also fix a bug where the preprocessor was ignoring
line continuation characters when a line ended in multiple backslash
characters.

The new code is also more efficient than the old. Previously, we would
perform a ralloc copy at each newline. We now perform copies only at each
occurrence of a line-continuation.

This commit fixes the line-continuation.vert test in piglit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:55:41 -08:00
Carl Worth
63d156900f glcpp: Add --disable-line-continuations argument to standalone glcpp
This will allow testing of disabled line-continuation on a case-by-case basis,
(with the option communicated to the preprocessor via the GL context).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:55:41 -08:00
Carl Worth
409dee5eac glcpp: Allow test-specific arguments for standalone glcpp tests
This will allow the test exercising disabled line continuations to arrange
for the --disable-line-continuations argument to be passed to the standalone
glcpp.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:55:41 -08:00
Carl Worth
0206ea3751 glcpp: Honor the GL context's DisableGLSLLineContinuations option
And simply don't call into the function that removes line continuations.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:55:41 -08:00
Carl Worth
f8987f9972 glcpp: Accept pointer to GL context rather than just the API version
As the preprocessor becomes more sophisticated and gains more optional
behavior, it's easiest to just pass the GL context pointer to it so that
it can examine any fields there that it needs to (such as API version,
or the state of any driconf options, etc.).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:55:41 -08:00
Carl Worth
4b00ecebd0 drirc: Add quirk to disable GLSL line continuations for Savage2
This application is known to contain shaders that:

1. Have a stray backslash as the last line of comment lines
2. Have a declaration immediately following that line

Hence, interpreting that backslash as a line continuation causes the
declaration to be hidden and the shader fails to compile.  Fortunately, the
shaders also:

3. Do not have any other intentional line-continuation characters

So disabling line continuations entirely for the application fixes this
problem without causing any other breakage.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:55:41 -08:00
Carl Worth
c0c9c9966f driconf: Add a new option: disable_glsl_line_continuations
This is to enable a quirk for Savage2 which includes a shader with a stray '\'
at the end of a comment line. Interpreting that backslash as a line
continuation will break the compilation of the shader, so we need a way to
disable this.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:55:41 -08:00
Carl Worth
c6c575c69a driconf: Add proper dependency for compiling .mo files from .po files.
Previously this was happening unconditionally, leading to some excessive
rebuilding/relinking during builds.

Note that the .po files are not automatically updated due to changes to the
t_options.h file. Instead, translators should continue to use "make po"
manually. This is because after new strings are merged into the existing .po
file, manual work is still required by translators to ensure that the
translations are correct.
2013-01-11 13:54:54 -08:00
Carl Worth
b587a7595e driconf: Add translation-generation to build system, don't track generated files
Previously, the xmlpool directory had a lone Makefile to assist poeple in
manually invoking a deep make in order to update the translations in
options.h. We can observe that this wasn't happening in fact, (new
translations had been added to de.po without being generated into options.h,
and new options had been manually added directly to options.h rather than to
t_options.h).

Prevent both of these problems from occurring in the future by automatically
generating options.h as part of the standard build of mesa.

For this, the generated options.h is now removed from version control, (along
with Makefile in favor of Makefile.am).

[chadv: Port the Autotools changes to Android.]
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:54:54 -08:00
Carl Worth
8888c6f8e5 driconf: Fix German translations by removing a couple of bogus backslashes
As can be seen, many other translation strings already include a single
apostrophe just fine without any escaping. This strangely-escaped apostrophe
was causing a build failure ("invalid escape sequence") resulting in no "de"
translations in the final options.h file.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:54:54 -08:00
Chad Versace
ec04617fb3 driconf: Fix gen_xmlpool.py script to allow running from any directory
The gen_xmlpool.py script would work correctly only when executed from the
directory that contained the script. This shortcoming was due to some
hard-coded paths in the script.

In order to easily invoke the script from the Android build system, we
must be able to execute the script from an arbitrary directory. To enable
that, this patch replaces the two hard-coded paths with new command line
arguments.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
2013-01-11 13:54:54 -08:00
Carl Worth
11c3013610 driconf: Add some translations which have been available, but were not compiled
These translations have existed in the de.po file, but were not in the
generated options.h file. This was fixed by simply running "make options.h".

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:54:54 -08:00
Carl Worth
bc50f02bc7 driconf: Add option definitions to source file, not generated target
For the last two most-recently-added driconf options, their definition was
manually added to options.h, a file which is intended to be automatically
generated, (as part of support for translated driconf option
descriptions). This means that these options would be eliminated if the
generation step were performed again.

Fix this by correctly adding the definitions of these options to t_options.h,
(the file used as input to the generator), and not the options.h file, which
is generated.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 13:54:54 -08:00
Tom Stellard
4148a29ed8 targets/opencl: Link against libgallium.la instead of libgallium.a 2013-01-11 21:40:42 +00:00
Tom Stellard
4fc11fa3c8 drivers/radeon: Don't link against libgallium.la
This fixes several duplicate symbol errors.

libllvmradeon is a simple helper library.  If it requires symbols in
other libraries, this should be taken care of by the gallium target that
uses it (e.g. libr600.la)
2013-01-11 21:40:42 +00:00
Matt Turner
93d5fe1478 mesa: Use _mesa_lookup_enum_by_nr in tex*_error_check
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-11 11:45:10 -08:00
Ian Romanick
42ed81a7c3 mesa/es3: Add support for GL_PRIMITIVE_RESTART_FIXED_INDEX
This requires some derived state.  The cut vertex used is either the
value specified by glPrimitiveRestartIndex or it's hard-coded to ~0.
The derived state gl_array_attrib::_RestartIndex captures this value.
In addition, the derived state gl_array_attrib::_PrimitiveRestart is set
whenever either gl_array_attrib::PrimitiveRestart or
gl_array_attrib::PrimitiveRestartFixedIndex is set.

v2: Use _mesa_is_gles3.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-11 10:57:25 -08:00
Ian Romanick
00d8ad81ff i965: Add support for GL_ANY_SAMPLES_PASSED_CONSERVATIVE
We just treat this as an alias for GL_ANY_SAMPLES_PASSED.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-11 10:57:25 -08:00
Ian Romanick
886979a097 mesa/es3: Add support for GL_ANY_SAMPLES_PASSED_CONSERVATIVE query target
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-11 10:57:25 -08:00
Ian Romanick
8d47fe2960 mesa/es3: Allow transpose matrix uniforms in GLES3
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-11 10:57:25 -08:00
Matt Turner
5e918a3825 glcpp: Reject token pasting operator in GLES
The GLSL ES 3.0 spec (Section 12.17) says:
"GLSL ES 1.00 removed token pasting and other functionality."

NOTE: This is a candidate for the stable branches.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
2013-01-11 10:57:25 -08:00
Carl Worth
93e719ba4d glcpp: Make undefined macros illegal in #if and #elif for GLES3
Simply emitting a nicely-formatted error message if any undefined macro is
encountered in a parser context expecting an expression.

With this commit, the following piglit test now passes:

	spec/glsl-es-3.00/compiler/undefined-macro.vert

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-11 10:57:25 -08:00
Carl Worth
77e1bc9f1d glcpp: Add a flag to the parser state to indicate GLES.
This can be triggered either by creation of a GLES context (with
api == API_OPENGLES2) or else by a #version directive with version
value 100 or with a string of "es" following the version value.

There's no behavioral change with this commit—just preparation for ES-specific
behavior in the preprocessor in the future.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-11 10:57:25 -08:00
Andreas Boll
100440d1b1 glcpp: Add back tests/*.out to .gitignore
Accidentally removed in ac2793cf3e
2013-01-11 11:49:33 +01:00
Knut Andre Tidemann
8da2dab31d targets/egl-static: fix link failure to libwayland-drm
Fixes the following build error:
  CXXLD    egl_gallium.la
g++: error: ../../../../src/egl/wayland/wayland-drm/.libs/.libs/libwayland-drm.a: No
such file or directory

Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2013-01-11 10:56:36 +01:00
Johannes Obermayr
d98716233e targets/dri-swrast: Force c++ linker in all cases.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=59226

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
2013-01-11 10:20:42 +01:00
Roland Scheidegger
babab28760 llvmpipe: fix clearing integer color buffers
We get int/uint clear color value in this case, and util_pack_color can't
handle these formats at all (even if it could, float input color isn't what
we want).
Pass through the color union appropriately and handle the packing ourselves
(as I couldn't think of a good generic util solution).
This gets piglit fbo_integer_precision_clear and
fbo_integer_readpixels_sint_uint from the ext_texture_integer test group from
segfault to pass (which only leaves fbo-blending from that group not working).

v2: fix up comments
2013-01-10 18:10:20 -08:00
Roland Scheidegger
5785f22d23 gallivm: fix border color for integer textures
Need to bitcast the float border color (luckily we already get
the color as int just disguised as float).
Fixes piglit texwrap GL_EXT_texture_integer bordercolor.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-10 18:02:01 -08:00
Roland Scheidegger
31884946b5 gallivm: more integer texture format fetch fixes
Change the texel type to int/uint instead of float throughout the sampling
code which makes it easier to catch errors (as llvm will complain about wrong
types if we mistakenly treat these values as real floats somewhere).
This should also get things like e.g. sampler swizzles (for unused channels)
right.
This fixes piglit texture_integer_glsl130 test.
Border color not working (crashing) yet.
(These formats are not exposed yet in llvmpipe.)

v2: couple cleanups according to José's comments

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-01-10 18:02:01 -08:00
Matt Turner
5eeedb852b build: mapi/glapi/gen: Use BUILT_SOURCES 2013-01-10 22:01:31 +01:00
Matt Turner
ac2793cf3e Clean up .gitignore files 2013-01-10 22:01:31 +01:00
Matt Turner
3ed95dc073 Remove MESA_PIC_FLAGS macro 2013-01-10 22:01:31 +01:00
Matt Turner
f1d229ee94 Remove installmesa 2013-01-10 22:01:31 +01:00
Matt Turner
b585c0059c Remove minstall 2013-01-10 22:01:31 +01:00
Matt Turner
424f200881 Remove checking for makedepend 2013-01-10 22:01:31 +01:00
Matt Turner
c977e61fe2 Remove gallium's unused Makefile.template 2013-01-10 22:01:31 +01:00
Matt Turner
74d105174b Remove gbm's unused Makefile.template 2013-01-10 22:01:31 +01:00
Matt Turner
ae352ccb90 Remove gallium targets' Makefile.{dri,vdpau,xorg,xvmc} 2013-01-10 22:01:31 +01:00
Matt Turner
8f8e85e703 Remove mklib 2013-01-10 22:01:31 +01:00
Matt Turner
41349a4253 Remove unused glsl Makefile.template 2013-01-10 22:01:31 +01:00
Matt Turner
c87474089d Remove configs/{current,default} 2013-01-10 22:01:30 +01:00
Andreas Boll
cb4d5021c6 gallium/tests/unit: Convert to automake 2013-01-10 22:01:30 +01:00
Andreas Boll
59088a2c2c gallium/tests/trivial: Convert to automake 2013-01-10 22:01:30 +01:00
Matt Turner
45270fb0fd targets/pipe-loader: Convert to automake
C++ linking (controlled by the nodist_EXTRA idiom) is needed

unconditionally for:
	nouveau (uses C++ in the driver)
	r300 (since LLVM is always required)
	radeonsi (since LLVM is always required)
	swrast (if builting LLVM pipe)

and conditionally (depends whether LLVM is enabled) for
	i915
	r600
	vmwgfx

and never needed for swrast (softpipe).

Unfortunately, automake seems to *always* link with C++ if nodist_EXTRA
is specified, even inside a false conditional. Not sure if this is a
bug, but it does seem to be weird behavior.

v2: Johannes Obermayr <johannesobermayr@gmx.de>
    - Fix some undefined symbols.

v3: Johannes Obermayr <johannesobermayr@gmx.de>
    - Install pipe_* to $(libdir)/gallium-pipe.

v4: Johannes Obermayr <johannesobermayr@gmx.de>
    - Build it only once on --enable-gallium-gbm / --enable-opencl.
2013-01-10 22:01:30 +01:00
Matt Turner
53c62d3fb0 targets/gbm: Convert to automake 2013-01-10 22:01:30 +01:00
Matt Turner
cdee0e8084 targets/egl-static: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
    - Add missing Automake.inc

v3: Johannes Obermayr <johannesobermayr@gmx.de>
    - Fix linking.

v4: Andreas Boll <andreas.boll.dev@gmail.com>
    - Port changes from ff574d653b
	  gallium/egl-static: Fix unresolved symbol 'clock_gettime'
2013-01-10 22:01:28 +01:00
Matt Turner
d53901c67c targets/xa-vmwgfx: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:11 +01:00
Matt Turner
af6a2e4f82 targets/xvmc-softpipe: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - add missing xvmc state tracker to _LIBADD variable

v3: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:11 +01:00
Matt Turner
45bf6aa617 targets/xvmc-r600: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Add missing xvmc state tracker to _LIBADD variable

v3: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:11 +01:00
Matt Turner
c2371ccdac targets/xvmc-r300: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Add missing xvmc state tracker to _LIBADD variable

v3: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:11 +01:00
Matt Turner
b173b16cba targets/xvmc-nouveau: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Add missing xvmc state tracker to _LIBADD variable

v3: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:11 +01:00
Matt Turner
0b132df3ad build: AC_SUBST XVMC_MAJOR/MINOR 2013-01-10 22:01:11 +01:00
Matt Turner
f2bf0cdf72 targets/xorg-radeonsi: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:11 +01:00
Matt Turner
ff5ab73d53 targets/xorg-r600: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
7d451ba83a targets/xorg-r300: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
f984d128c5 targets/xorg-nouveau: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
1a4349125b targets/xorg-i915: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
7f24483e3d targets/vdpau-softpipe: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Add missing vdpau state tracker to _LIBADD variable

v3: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
e3b2160a1f targets/vdpau-radeonsi: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Add missing vdpau state tracker to _LIBADD variable

v3: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
98c051355f targets/vdpau-r600: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Add missing vdpau state tracker to _LIBADD variable

v3: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
7e0d6ff6d7 targets/vdpau-r300: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Add missing vdpau state tracker to _LIBADD variable

v3: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
d0df9e82c7 targets/vdpau-nouveau: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Add missing vdpau state tracker to _LIBADD variable

v3: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
184b2f0f68 build: AC_SUBST VDPAU_MAJOR/MINOR 2013-01-10 22:01:10 +01:00
Matt Turner
0470fb4efe targets/libgl-xlib: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
c14c801a03 targets/dri-vmwgfx: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
b3068d87cb targets/dri-swrast: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
dd65729057 targets/dri-radeonsi: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
ab07ae05a3 targets/dri-r600: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:10 +01:00
Matt Turner
b570f1fc31 targets/dri-r300: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:09 +01:00
Matt Turner
6ed9f9f232 targets/dri-nouveau: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:09 +01:00
Matt Turner
2cd5bf7536 targets/dri-i915: Convert to automake
v2: Andreas Boll <andreas.boll.dev@gmail.com>
    - Provide compatibility with scripts for the old Mesa build system
2013-01-10 22:01:09 +01:00
Matt Turner
880063f5bc build: Update drivers/Makefile.am to use LTLIBRARIES 2013-01-10 22:01:09 +01:00
Matt Turner
c236fa82c2 state_trackers/xvmc/test: Convert to automake 2013-01-10 22:01:09 +01:00
Matt Turner
984562d630 state_trackers/xvmc: Convert to automake 2013-01-10 22:01:09 +01:00
Matt Turner
69089ef5b0 Remove xvmc hack 2013-01-10 22:01:09 +01:00
Matt Turner
405a9dabe2 state_trackers/xorg: Convert to automake 2013-01-10 22:01:09 +01:00
Matt Turner
2ad2603467 state_trackers/xa: Convert to automake 2013-01-10 22:01:09 +01:00
Matt Turner
68c0311996 state_trackers/vega: Convert to automake 2013-01-10 22:01:09 +01:00
Matt Turner
d2ca32e332 state_trackers/vdpau: Convert to automake 2013-01-10 22:01:09 +01:00
Matt Turner
1ba5d8ac40 Remove vdpau hack 2013-01-10 22:01:09 +01:00
Matt Turner
083dcdf809 state_trackers/glx: Convert to automake 2013-01-10 22:01:09 +01:00
Matt Turner
c0b9081dc5 state_trackers/gbm: Convert to automake 2013-01-10 22:01:09 +01:00
Matt Turner
8443efdf2c state_trackers/egl: Convert to automake 2013-01-10 22:01:09 +01:00
Matt Turner
9b35758926 state_trackers: Convert to automake 2013-01-10 22:01:08 +01:00
Matt Turner
5089072419 Remove state_tracker/Makefile
Unneeded and unnecessary.
2013-01-10 22:01:08 +01:00
Matt Turner
9f38a1c871 build: Don't build pipebuffer
It's already built by src/gallium/auxiliary.
2013-01-10 22:01:08 +01:00
Tom Stellard
0dcb9ae0d9 radeon/llvm: Convert to Automake
v2: Johannes Obermayr <johannesobermayr@gmx.de>
    Fix some undefined symbols.

v3: Johannes Obermayr <johannesobermayr@gmx.de>
    Build it -shared to fix egl_gallium.so on r600/radeonsi builds.
2013-01-10 22:01:08 +01:00
Matt Turner
2cbb94b3ce build: Add automake conditionals for gallium drivers 2013-01-10 22:01:08 +01:00
Matt Turner
f4b1f2807f state_trackers/dri/sw: Convert to automake 2013-01-10 22:01:08 +01:00
Matt Turner
d988481d58 state_trackers/dri/drm: Convert to automake 2013-01-10 22:01:08 +01:00
Matt Turner
2ff51cd639 state_trackers/dri: Convert to automake 2013-01-10 22:01:08 +01:00
Matt Turner
44653c0a0e winsys/sw/xlib: Convert to automake 2013-01-10 22:01:08 +01:00
Matt Turner
24c2fe94a2 winsys/sw/wrapper: Convert to automake 2013-01-10 22:01:08 +01:00
Matt Turner
1d0ef53e7b winsys/sw/wayland: Convert to automake 2013-01-10 22:01:08 +01:00
Matt Turner
1c9fb3c5b5 winsys/sw/null: Convert to automake 2013-01-10 22:01:08 +01:00
Matt Turner
5c4ade53a4 winsys/sw/fbdev: Convert to automake 2013-01-10 22:01:08 +01:00
Matt Turner
a6b3cd1349 winsys/sw/dri: Convert to automake 2013-01-10 22:01:08 +01:00
Matt Turner
b4beea6418 winsys/sw: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
2b5a1c0299 svga/winsys/drm: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
77fc30b57d nouveau/winsys/drm: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
da2d98fac7 radeonsi: Convert to automake
Can't use LTLIBRARIES here yet, since libradeon isn't converted.
2013-01-10 22:01:07 +01:00
Matt Turner
c35cddd134 nvc0: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
2a28353ca0 nv50: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
36066770bf nv30: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
1cf66321f9 nouveau: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
0a42131f3b svga: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
f781d4c60d softpipe: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
960cbd8b78 llvmpipe: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
b51cdfa64b rbug: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
3bfe7c2111 i915/winsys/sw: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
266d639b91 i915/winsys/drm: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
7d5496ab3b i915g: Convert to automake 2013-01-10 22:01:07 +01:00
Matt Turner
533130a5bb r600g: Use gallium automake include file 2013-01-10 22:01:06 +01:00
Tom Stellard
80d290d47a libgallium: Convert to automake 2013-01-10 22:01:06 +01:00
Tom Stellard
047fe04750 trace: Convert to automake 2013-01-10 22:01:06 +01:00
Tom Stellard
34a6150188 radeon/winsys: Convert to automake 2013-01-10 22:01:06 +01:00
Matt Turner
8dc4048b3b r300g: Link ralloc.c and register_allocate.c into separate library 2013-01-10 22:01:06 +01:00
Tom Stellard
e04413cbb0 r300g: Build a libtool archive 2013-01-10 22:01:06 +01:00
Tom Stellard
c07c2696c7 r300g: Use gallium automake include file
[mattst88] v2: Remove ARCH_FLAGS/OPT_FLAGS
2013-01-10 22:01:06 +01:00
Tom Stellard
c040fe102c gallium: Add common automake include file
v2: Matt Turner <mattst88@gmail.com>
    Remove ARCH_FLAGS/OPT_FLAGS

v3: Johannes Obermayr <johannesobermayr@gmx.de>
    Add -I$(top_srcdir)/include to GALLIUM_CFLAGS
2013-01-10 22:01:06 +01:00
Matt Turner
9bf0d49abe automake: Convert Gallium target and winsys 2013-01-10 22:01:06 +01:00
Kristian Høgsberg
4e42e569dd egl/gbm: Implement EGL_EXT_buffer_age
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-10 15:58:05 -05:00
Matt Turner
0ae81b8422 mesa: Rename and wire-up GetInteger64i_v
The function was named badly and wasn't in the dispatch table,
making it hard to find.

Fixes transform_feedback2_states and gets a few other transform
feedback tests closer to working in es3conform.

Reviewed-by Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
1a3ffbf378 mesa: Correct glGet{Boolean,Integer}i_v names
Reviewed-by Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
ec8ee91923 mesa: Allow GL_DEPTH_STENCIL_ATTACHMENT in ES 3
Fixes framebuffer_srgb_default_encoding_fbo and 5 packed_depth_stencil
tests from es3conform.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-10 10:57:51 -08:00
Chad Versace
75b963c095 mesa: Support more glGet enums for ES3
For glGetIntegerv, add support for the following in an OpenGL ES 3.0
context:
    GL_MAJOR_VERSION
    GL_MINOR_VERSION
    GL_NUM_EXTENSIONS

See Table 6.29 of the OpenGL ES 3.0 spec.

Fixes error GL_INVALID_ENUM in piglit egl-create-context-verify-gl-flavor,
testcase for OpenGL ES 3.0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
532e05a9d0 mesa: Support querying GL_MAX_ELEMENT_INDEX in ES 3
The ES 3 spec says that the minumum allowable value is 2^24-1, but the
GL 4.3 and ARB_ES3_compatibility specs require 2^32-1, so return 2^32-1.

Fixes es3conform's element_index_uint_constants test.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
92855727f1 mesa: De-duplicate ES2 queries
From GL/GLES/GL_CORE and GLES2 -> GL/GL_CORE/GLES2.

Yes, we really were exposing ES2_compatibility queries on ES 1.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
5bb1827d95 mesa: Allow glGet* queries on EXT_texture_lod_bias data in ES 3
Fixes the remaining 4 texture_lod_bias failures in es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
e895d368e1 mesa: Allow glGet* queries on EXT_framebuffer_blit data in ES 3
Fixes 2 framebuffer_blit es3conform tests.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
d9948e49d3 mesa: Allow glGet* queries on ARB_fragment/vertex_shader data in ES 3
Fixes uniform_buffer_object_implementation_dependent_limits in
es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
d93c1b62f8 mesa: Allow glGet* queries on ARB_framebuffer_object data in ES 3
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
914415a63f mesa: Allow glGet* queries on ARB_transform_feedback2 data in ES 3
Fixes the transform_feedback2_init_defaults test from es3conform.

The ES 3 spec lists these as TRANSFORM_FEEDBACK_PAUSED and
TRANSFORM_FEEDBACK_ACTIVE.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
3d0e4eb134 mesa: Allow glGet* queries on EXT_transform_feedback data in ES 3
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
3f1217607a mesa: Allow glGet* queries on ARB_sync data in ES 3
Fixes the sync_coverage_max_server_wait_timeout test in es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
0a8866e751 mesa: Allow glGet* queries of EXT_pbo data in ES 3
Fixes pixel_buffer_object_default_binding and gets other tests in
es3conform closer to passing.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
be68dae374 mesa: Allow glGet* queries of select ARB_ubo data in ES 3
Fixes 5 uniform_buffer_object tests in es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:51 -08:00
Matt Turner
0cc018526f Add ES 3 handling to get.c and get_hash_generator.py
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:50 -08:00
Matt Turner
57616159aa glapi: Move ARB_base_instance to the correct location
It's #107, it shouldn't be added after the #116 comment.

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:50 -08:00
Matt Turner
a5ed966069 mesa/tests: Add ARB_ES3_compatibility enums
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:50 -08:00
Matt Turner
910a0bfe5b glapi: Add enums for ARB_ES3_compatibility
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-10 10:57:50 -08:00
Quentin Glidic
c5e9396424 mesa/program: Fix both Classic and Gallium build
Follow-up for 9078441072 and
3a5ad21cd3

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57044
Tested-by: Fabio Pedretti <fabio.ped@libero.it>
Tested-by: Brad King <brad.king@kitware.com>
2013-01-10 10:34:56 -08:00
Andreas Boll
f416b382d6 configure.ac: fix typo in error message 2013-01-10 18:41:53 +01:00
Marek Olšák
2f89949b66 r300g: don't set sample positions to the pixel center if MSAA is disabled
but an MSAA resource is bound. This effectively makes the MSAA disable switch
not affect rasterization, but it still affects the alpha-to-one and
alpha-to-coverage states. This hardware just lacks a proper MSAA disable
switch.

This fixes graphics corruption in sauerbraten.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59194
2013-01-10 15:37:10 +01:00
Paul Berry
9a07b6bd74 intel: Clean up confusion between logical and physical surface dimensions.
In most cases, the width, height, and depth of the physical surface
used by the driver to implement a texture or renderbuffer is equal to
the logical width, height, and depth exposed to the client through
functions such as glTexImage3D().  However, there are two exceptions:
cube maps (which have a physical depth of 6 but a logical depth of 1)
and multisampled renderbuffers (which have larger physical dimensions
than logical dimensions to allow multiple samples per pixel).

Previous to this patch, we accounted for the difference between
physical and logical surface dimensions at inconsistent places in the
call graph (multisampling was accounted for in
intel_miptree_create_for_renderbuffer(), and cubemaps were accounted
for in intel_miptree_create_internal()).  As a result, it wasn't
always clear, when calling a miptree creation function, whether
physical or logical dimensions were needed.  Also, we weren't
consistent about storing logical dimensions in the intel_mipmap_tree
structure (we only did so in the
intel_miptree_create_for_renderbuffer() code path, and we did not
store depth).

This patch refactors things so that intel_miptree_create_internal() is
responsible for converting logical to physical dimensions and for
storing both the physical and logical dimensions in the
intel_mipmap_tree structure.  As a result, all miptree creation
functions interpret their arguments as logical dimensions, and both
physical and logical dimensions are always available to functions that
work with intel_mipmap_trees.

In addition, it renames the fields in intel_mipmap_tree used to store
the dimensions, so that it is clear from the name whether physical or
logical dimensions are being referred to.

This should fix the following bugs:

- When creating a separate stencil surface for a depthstencil cubemap,
  we would erroneously try to convert the depth from 1 to 6 twice,
  resulting in an assertion failure.

- When creating an MCS buffer for compressed multisampling, we used
  physical dimensions instead of logical dimensions, resulting in
  wasted memory.

In addition, this should considerably simplify the implementation of
ARB_texture_multisample, because it moves the code to compute the
physical size of multisampled surfaces out of renderbuffer-only code.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-09 13:10:47 -08:00
Paul Berry
a5f87e8843 intel: Add a force_y_tiling parameter to intel_miptree_create().
This allows intel_miptree_alloc_mcs() to force Y tiling for the MCS
buffer.  Previously we accomplished this by the hack of passing
INTEL_MSAA_LAYOUT_CMS as the msaa_layout parameter, but that parameter
is going to be going away soon.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-09 13:10:30 -08:00
Paul Berry
8f15f19696 intel: Move compute_msaa_layout earlier in file.
No functional change.  This patch moves the compute_msaa_layout()
function earlier in intel_mipmap_tree.c so that it can be used by
other functions in that file.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-09 13:10:14 -08:00
Vinson Lee
b37930f309 r600g: Fix memory leak in r600_bytecode_add_vtx.
Fixes resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
2013-01-09 11:11:46 -05:00
Marek Olšák
f8651dea4e r300g: optionally log MSAA resources to stderr
Set: RADEON_DEBUG=msaa
2013-01-09 16:47:10 +01:00
Marek Olšák
1385c353cf r300g: fix the GPU name in the renderer string
Broken by ca474f98f2.
2013-01-09 16:40:37 +01:00
Marek Olšák
4f2d9a8f52 r300g: fix CS checker errors caused by emit_dsa_state
size is 10 on r500 and 8 on r300
2013-01-09 16:40:37 +01:00
Johannes Obermayr
959e83d650 clover: Adapt libclc's INCLUDEDIR and LIBEXECDIR to make use of the new introduced libclc.pc.
Tom Stellard:
  -Keep --with-libclc-path and mark it deprecated.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
2013-01-08 20:32:47 -05:00
Ian Romanick
ed3f237e09 glsl: Don't add structure fields to the symbol table
I erroneously added this back in January 2011 in commit 88421589.
Looking at the commit message, I have no idea why I added it.  It only
added non-array structure fields to the symbol table, so array structure
fields are treated correctly.

Fixes piglit tests structure-and-field-have-same-name.vert and
structure-and-field-have-same-name-nested.vert.  It should also fix
WebGL conformance tests shader-with-non-reserved-words.

NOTE: This is a candidate for the stable release branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57622
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-08 13:09:31 -08:00
Kenneth Graunke
a5265f7536 i965/fs: Fix struct vs. class in acp_entry definitions. 2013-01-08 13:09:31 -08:00
Marek Olšák
a70e5e2b94 r600g: implement buffer copying using CP DMA for R7xx, Evergreen, Cayman
R6xx doesn't work - the issue seems to be with flushing (sometimes
the destination buffer contains garbage). There are no hangs, so we're good.

R7xx doesn't seem to have any alignment restriction despite our initial
thinking. Everything just works.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-01-08 21:58:28 +01:00
Marek Olšák
2d3d0d3a5a st/mesa: fix possible MSVC build error v2
https://bugs.freedesktop.org/show_bug.cgi?id=59143

Using GLubyte as per Brian's suggestion.
2013-01-08 21:53:13 +01:00
Paul Berry
c35abcd1b0 glsl: Pack flat "varyings" of mixed types together.
This patch enhances the varying packing code so that flat varyings of
uint, int, and float types can be packed together.

We accomplish this in lower_packed_varyings.cpp by making the type of
all flat varyings ivec4, and then using information-preserving type
conversions (e.g. ir_unop_bitcast_f2i) to convert all other types to
ints.

The varying_matches::compute_packing_class() function is updated to
reflect the fact that varying packing no longer needs to segregate
varyings of different base types.

Fixes piglit test varying-packing-mixed-types.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

v2: Split lower_packed_varyings_visitor::bitwise_assign into
pack/unpack variants.
2013-01-08 09:18:14 -08:00
Paul Berry
18720555dd glsl: Prohibit structs and bools from being used as "varyings".
The GLSL 1.30 spec only allows vertex shader outputs and fragment
shader inputs ("varyings" in pre-GLSL-1.30 parlance) to be of type
int, uint, float, or vectors, matrices, or arrays thereof.  Bools,
bvec's, and structs are prohibited.  (Integral varyings were
prohibited prior to GLSL 1.30).

Previously, Mesa only performed this check on variables declared with
the "varying" keyword, and it always performed the check according to
the pre-GLSL-1.30 rules.  As a result, bools and structs were allowed
to slip through, provided they were declared using the new in/out
syntax.

This patch modifies the error check so that it occurs after "varying"
is converted to "in/out", and corrects it to properly account for GLSL
version.

Fixes piglit tests:
  in-bool-prohibited.frag
  in-bvec2-prohibited.frag
  in-bvec3-prohibited.frag
  in-bvec4-prohibited.frag
  in-struct-prohibited.frag
  out-bool-prohibited.vert
  out-bvec2-prohibited.vert
  out-bvec3-prohibited.vert
  out-bvec4-prohibited.vert
  out-struct-prohibited.vert

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-08 09:09:21 -08:00
Paul Berry
c33be485c5 glsl: Plumb through is_parameter to apply_type_qualifier_to_variable()
This patch adds logic to allow the ast_to_hir function
apply_type_qualifier_to_variable() to tell whether it is acting on a
variable declaration or a function parameter.  This will allow it to
correctly interpret the meaning of "out" and "in" keywords (which have
different meanings in those two contexts).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-08 09:09:18 -08:00
Paul Berry
4b11b57ab4 glsl: Separate varying linking code to its own file.
linker.cpp is getting pretty big, and we're about to add even more
varying packing code, so split out the linker code that concerns
varyings to its own file.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-08 09:09:09 -08:00
Paul Berry
8706395f25 mesa: Add ALIGN() macro to main/macros.h.
Previously this macro existed in 3 separate places, some inside the
intel driver and some outside of it.  It makes more sense to have it
in main/macros.h

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-08 09:08:57 -08:00
Paul Berry
09df6bb96d glsl: Fix loop bounds detection.
When analyzing a loop where the loop condition is expressed in the
non-standard order (e.g. "4 > i" instead of "i < 4"), we were
reversing the condition incorrectly, leading to a loop bound that was
off by 1.

Fixes piglit tests {vs,fs}-loop-bounds-unrolled.shader_test.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-08 09:08:53 -08:00
Marek Olšák
844d14ebee winsys/radeon: bump the size of relocation hashlist
This should reduce the number of hash collisions in ETQW.
2013-01-08 16:41:57 +01:00
Christoph Bumiller
18f3f7b958 nvc0: catch too high GENERIC indices to prevent GRAPH traps 2013-01-08 16:13:52 +01:00
Christoph Bumiller
b9c8a98e21 nvc0: use correct resource target to select blit shader 2013-01-08 16:13:52 +01:00
Christoph Bumiller
41e105d5be nvc0: add missing call to map edge flag in push_vbo
Note: this is a candidate for the 9.0 stable branch.
2013-01-08 16:13:52 +01:00
Christoph Bumiller
be75a9373a nv50/ir: wrap assertion using typeid in #ifndef NDEBUG
Note: this is a candidate for the 9.0 stable branch.
2013-01-08 16:13:52 +01:00
Christoph Bumiller
076f4ced8b nvc0: fix out of bounds writes for unaligned sizes in push_data 2013-01-08 16:13:51 +01:00
Christoph Bumiller
39fe03e2de nouveau: increase max order of suballocated buffers by 1
This is really a hack to make TF2 (considerably, up to 20 -> 70 fps
at low res) faster.
2013-01-08 16:13:51 +01:00
Christoph Bumiller
48a45ec24a nouveau: improve buffer transfers
Save double memcpy on uploads to VRAM in most cases.
Properly handle FLUSH_EXPLICIT.
Reallocate on DISCARD_WHOLE_RESOURCE to avoid sync.
2013-01-08 16:13:51 +01:00
Marek Olšák
a75ddfd55d r300g: fix assertion failure in emit_dsa_state
Broken by 8ed6b1400b.
2013-01-08 14:33:18 +01:00
Kenneth Graunke
a60c567fcf i965: Support GL_FIXED and packed vertex formats natively on Haswell+.
Haswell and later support the GL_FIXED and 2_10_10_10_rev vertex formats
natively, and don't need shader workarounds.

Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-07 16:48:02 -08:00
Kenneth Graunke
e219764fde i965: Add #defines for GL_FIXED vertex formats.
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-07 16:48:02 -08:00
Kenneth Graunke
f3840b1632 i965: Add remaining #defines for packed vertex formats.
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-07 16:48:02 -08:00
Kenneth Graunke
899017fc54 i965: Use Haswell's sample_d_c for textureGrad with shadow samplers.
The new hardware actually just supports this now.

Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-07 16:48:02 -08:00
Kenneth Graunke
30f8f58c20 i965/fs: Remove dead code from generate_uniform_pull_constant_load_gen7.
generate_uniform_pull_constant_load_gen7() is only called on Gen7+, so
the gen < 6 code is dead.

Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-07 16:48:02 -08:00
Alexander von Gluck IV
23595aa427 mesa: Drop mmx optimizations on Haiku
* Prevents compatibility problems. As Haiku
  doesn't use rtasm anymore, it's kind of
  pointless.
2013-01-07 17:39:49 -06:00
Alexander von Gluck IV
b9227b3e15 mesa: Don't use rtasm for Haiku swrast
* We have a symbol conflict as rtasm in
  Mesa collides with rtasm in gallium.
* As us linking gallium and mesa together
  is an edge case, lets just omit the rtasm
  code from Mesa as we should be going
  llvmpipe soon :)
2013-01-07 17:39:49 -06:00
Alex Deucher
4332f6fc18 r600g: set the virtual address for the htile buffer
Fixes cayman and TN with htile enabled.  Should fix:
https://bugs.freedesktop.org/show_bug.cgi?id=59089
https://bugs.freedesktop.org/show_bug.cgi?id=58667
Possibly others.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-01-07 15:21:46 -05:00
Jerome Glisse
ca474f98f2 radeon/winsys: move radeon family/class identification to winsys
Upcoming async dma support rely on winsys knowing about GPU families.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
2013-01-07 11:06:07 -05:00
Jerome Glisse
d499ff98cd r600g/radeon/winsys: indentation cleanup
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
2013-01-07 11:06:02 -05:00
Marek Olšák
afec10df37 r600g: flush FMASK and CMASK at the end of CS 2013-01-06 22:06:34 +01:00
Marek Olšák
8ed6b1400b r300g: implement MSAA
This is not as optimized as r600g - the MSAA compression is missing,
so r300g needs a lot of bandwidth (more than r600g to do the same thing).
However, if the bandwidth is not an issue for you, you can enjoy this
unoptimized MSAA support.
The only other missing optimization for MSAA is the fast color clear.

MSAA is enabled on r500 only, because that's the only GPU family I tested.
That said, MSAA should work on r300 and r400 as well (but you must set
RADEON_MSAA=1 to allow it, then turn MSAA on in your app or set GALLIUM_MSAA=n,
n >= 2, n <= 6)
I will enable the support by default on r300-r400 once someone (other than me)
tests those chipsets with piglit.

The supported modes are 2x, 4x, 6x.

The supported MSAA formats are RGBA8, BGRA8, and RGBA16F (r500 only).
Those 3 formats are used for all GL internal formats.

Tested with piglit. (I have ported all MSAA tests to GL2.1)
2013-01-06 14:44:12 +01:00
Marek Olšák
cc030da428 r300g: simplify DSA state, add ability to patch FG_ALPHA_FUNC while emitting
Preparation for MSAA and alpha-to-coverage.
2013-01-06 14:44:12 +01:00
Marek Olšák
25b3c0a52c r300g/compiler: add shader emulation for the alpha_to_one state 2013-01-06 14:44:12 +01:00
Vinson Lee
2f358feda3 configure.ac: Remove space after indent -T flag.
Fixes this build error on platforms not using GNU indent.

indent: Command line: ``-T'' requires a parameter

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
2013-01-04 19:10:48 -08:00
Ian Romanick
d299ef3ad0 intel: Fix copy-and-paste bug setting gl_constants::MaxSamples
gl_constants::MaxSamples is an integer, so setting it to 1.0 is just
silly.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-04 17:39:05 -08:00
Ian Romanick
a86d629799 mesa: Disallow R, RG, or RGB integer and unsigned formats in OpenGL ES 3.0
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-04 17:39:05 -08:00
Ian Romanick
2aae3abd77 mesa: Disallow SNORM formats for renderbuffers in OpenGL ES
v2: Move {RED,RG,RGB,RGBA}_SNORM changes from the previous commit to
this commit.  Based on suggestions from Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-04 17:39:05 -08:00
Ian Romanick
4b92379da2 mesa: Disallow deprecated SNORM formats for renderbuffers
The OpenGL 3.2 core profile spec says:

    "The following base internal formats from table 3.11 are
    color-renderable: RED, RG, RGB, and RGBA. The sized internal formats
    from table 3.12 that have a color-renderable base internal format
    are also color-renderable. No other formats, including compressed
    internal formats, are color-renderable."

The OpenGL 3.2 compatibility profile spec says (only ALPHA is added):

    "The following base internal formats from table 3.16 are
    color-renderable: ALPHA, RED, RG, RGB, and RGBA. The sized internal formats
    from table 3.17 that have a color-renderable base internal format
    are also color-renderable. No other formats, including compressed
    internal formats, are color-renderable."

Table 3.12 in the core profile spec and table 3.17 in the compatibility
profile spec list SNORM formats as having a base internal format of RED,
RG, RGB, or RGBA.  From this we infer that they should also be color
renderable.

The OpenGL ES 3.0 spec says:

    "An internal format is color-renderable if it is one of the formats
    from table 3.12 noted as color-renderable or if it is unsized format
    RGBA or RGB. No other formats, including compressed internal
    formats, are color-renderable."

In the OpenGL ES 3.0 spec, none of the SNORM formats have "color-
renderable" marked in table 3.12.  The RGB I and UI formats also are not
color-renderable in ES3, but we'll save that change for another patch.

Both NVIDIA's closed-source driver (version 304.64) and AMD's
closed-source driver (Catalyst 12.6 on HD 3650) reject *all* SNORM
formats for renderbuffers in OpenGL 3.3 compatibility profiles.

v2: Move {RED,RG,RGB,RGBA}_SNORM changes from the this commit to the
next commit.  Based on suggestions from Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-01-04 17:39:05 -08:00
760 changed files with 24017 additions and 17426 deletions

6
.gitignore vendored
View File

@@ -4,6 +4,7 @@
*.ilk
*.la
*.lo
*.log
*.o
*.obj
*.os
@@ -17,6 +18,7 @@
*.tar
*.tar.bz2
*.tar.gz
*.trs
*.zip
*~
depend
@@ -36,9 +38,9 @@ config.py
build
libtool
manifest.txt
Makefile.in
.dir-locals.el
.deps/
.dirstamp
.libs/
/Makefile
Makefile
Makefile.in

View File

@@ -30,31 +30,13 @@ check-local:
$(MAKE) -C src/mapi/glapi/tests check
$(MAKE) -C src/mapi/shared-glapi/tests check
$(MAKE) -C src/mesa/main/tests check
$(MAKE) -C src/glsl/tests check
$(MAKE) -C src/glx/tests check
clean-local:
-@touch $(top_builddir)/configs/current
-@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) clean) ; \
fi \
done
-@test -s $(top_builddir)/configs/current || rm -f $(top_builddir)/configs/current
distclean-local:
-rm -rf lib*
-rm -f $(top_builddir)/configs/current
-find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \
-name depend -o -name depend.bak ')' -exec rm -f '{}' ';'
.PHONY: doxygen
# Rules for making release tarballs
PACKAGE_VERSION=9.1-devel
PACKAGE_VERSION=9.1
PACKAGE_DIR = Mesa-$(PACKAGE_VERSION)
PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)
@@ -70,9 +52,9 @@ EXTRA_FILES = \
bin/ltmain.sh \
bin/missing \
bin/ylwrap \
src/glsl/glsl_parser.cc \
src/glsl/glsl_parser.cpp \
src/glsl/glsl_parser.h \
src/glsl/glsl_lexer.cc \
src/glsl/glsl_lexer.cpp \
src/glsl/glcpp/glcpp-lex.c \
src/glsl/glcpp/glcpp-parse.c \
src/glsl/glcpp/glcpp-parse.h \
@@ -93,9 +75,7 @@ IGNORE_FILES = \
parsers: configure
-@touch $(top_builddir)/configs/current
$(MAKE) -C src/glsl glsl_parser.cc glsl_parser.h glsl_lexer.cc
$(MAKE) -C src/glsl/glcpp glcpp-lex.c glcpp-parse.c glcpp-parse.h
$(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp glcpp/glcpp-lex.c glcpp/glcpp-parse.c glcpp/glcpp-parse.h
$(MAKE) -C src/mesa/program lex.yy.c program_parse.tab.c program_parse.tab.h
# Everything for new a Mesa release:

View File

@@ -1,119 +0,0 @@
# A few convenience macros for Mesa, mostly to keep all the platform
# specifics out of configure.ac.
# MESA_PIC_FLAGS()
#
# Find out whether to build PIC code using the option --enable-pic and
# the configure enable_static/enable_shared settings. If PIC is needed,
# figure out the necessary flags for the platform and compiler.
#
# The platform checks have been shamelessly taken from libtool and
# stripped down to just what's needed for Mesa. See _LT_COMPILER_PIC in
# /usr/share/aclocal/libtool.m4 or
# http://git.savannah.gnu.org/gitweb/?p=libtool.git;a=blob;f=libltdl/m4/libtool.m4;hb=HEAD
#
AC_DEFUN([MESA_PIC_FLAGS],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_ARG_VAR([PIC_FLAGS], [compiler flags for PIC code])
AC_ARG_ENABLE([pic],
[AS_HELP_STRING([--disable-pic],
[don't compile PIC objects @<:@default=enabled for shared builds
on supported platforms@:>@])],
[enable_pic="$enableval"
test "x$enable_pic" = x && enable_pic=auto],
[enable_pic=auto])
# disable PIC by default for static builds
if test "$enable_pic" = auto && test "$enable_static" = yes; then
enable_pic=no
fi
# if PIC hasn't been explicitly disabled, try to figure out the flags
if test "$enable_pic" != no; then
AC_MSG_CHECKING([for $CC option to produce PIC])
# allow the user's flags to override
if test "x$PIC_FLAGS" = x; then
# see if we're using GCC
if test "x$GCC" = xyes; then
case "$host_os" in
aix*|beos*|cygwin*|irix5*|irix6*|osf3*|osf4*|osf5*)
# PIC is the default for these OSes.
;;
mingw*|os2*|pw32*)
# This hack is so that the source file can tell whether
# it is being built for inclusion in a dll (and should
# export symbols for example).
PIC_FLAGS="-DDLL_EXPORT"
;;
darwin*|rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
PIC_FLAGS="-fno-common"
;;
hpux*)
# PIC is the default for IA64 HP-UX and 64-bit HP-UX,
# but not for PA HP-UX.
case $host_cpu in
hppa*64*|ia64*)
;;
*)
PIC_FLAGS="-fPIC"
;;
esac
;;
*)
# Everyone else on GCC uses -fPIC
PIC_FLAGS="-fPIC"
;;
esac
else # !GCC
case "$host_os" in
hpux9*|hpux10*|hpux11*)
# PIC is the default for IA64 HP-UX and 64-bit HP-UX,
# but not for PA HP-UX.
case "$host_cpu" in
hppa*64*|ia64*)
# +Z the default
;;
*)
PIC_FLAGS="+Z"
;;
esac
;;
linux*|k*bsd*-gnu)
case `basename "$CC"` in
icc*|ecc*|ifort*)
PIC_FLAGS="-KPIC"
;;
pgcc*|pgf77*|pgf90*|pgf95*)
# Portland Group compilers (*not* the Pentium gcc
# compiler, which looks to be a dead project)
PIC_FLAGS="-fpic"
;;
ccc*)
# All Alpha code is PIC.
;;
xl*)
# IBM XL C 8.0/Fortran 10.1 on PPC
PIC_FLAGS="-qpic"
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*|*Sun\ F*)
# Sun C 5.9 or Sun Fortran
PIC_FLAGS="-KPIC"
;;
esac
esac
;;
solaris*)
PIC_FLAGS="-KPIC"
;;
sunos4*)
PIC_FLAGS="-PIC"
;;
esac
fi # GCC
fi # PIC_FLAGS
AC_MSG_RESULT([$PIC_FLAGS])
fi
AC_SUBST([PIC_FLAGS])
])# MESA_PIC_FLAGS

3
bin/.cherry-ignore Normal file
View File

@@ -0,0 +1,3 @@
d60da27273d2cdb68bc32cae2ca66718dab15f27 st/mesa: set ctx->Const.MaxSamples = 0, not 1
5c86a728d4f688c0fe7fbf9f4b8f88060b65c4ee r600g: fix htile buffer leak
496928a442cec980b534bc5da2523b3632b21b61 CopyTexImage: Don't check sRGB vs LINEAR for desktop GL

View File

@@ -1,74 +0,0 @@
#!/bin/sh
#
# Simple shell script for installing Mesa's header and library files.
# If the copy commands below don't work on a particular system (i.e. the
# -f or -d flags), we may need to branch on `uname` to do the right thing.
#
TOP=.
INCLUDE_DIR="/usr/local/include"
LIB_DIR="/usr/local/lib"
if [ "x$#" = "x0" ] ; then
echo
echo "***** Mesa installation - You may need root privileges to do this *****"
echo
echo "Default directory for header files is:" ${INCLUDE_DIR}
echo "Enter new directory or press <Enter> to accept this default."
read INPUT
if [ "x${INPUT}" != "x" ] ; then
INCLUDE_DIR=${INPUT}
fi
echo
echo "Default directory for library files is:" ${LIB_DIR}
echo "Enter new directory or press <Enter> to accept this default."
read INPUT
if [ "x${INPUT}" != "x" ] ; then
LIB_DIR=${INPUT}
fi
echo
echo "About to install Mesa header files (GL/*.h) in: " ${INCLUDE_DIR}/GL
echo "and Mesa library files (libGL.*, etc) in: " ${LIB_DIR}
echo "Press <Enter> to continue, or <ctrl>-C to abort."
read INPUT
else
INCLUDE_DIR=$1/include
LIB_DIR=$1/lib
fi
# flags:
# -f = force
# -d = preserve symlinks (does not work on BSD)
if [ `uname` = "FreeBSD" ] ; then
CP_FLAGS="-f"
elif [ `uname` = "Darwin" ] ; then
CP_FLAGS="-f"
elif [ `uname` = "AIX" ] ; then
CP_FLAGS="-fh"
else
CP_FLAGS="-fd"
fi
set -v
mkdir -p ${INCLUDE_DIR}
mkdir -p ${INCLUDE_DIR}/GL
# NOT YET: mkdir -p ${INCLUDE_DIR}/GLES
mkdir -p ${LIB_DIR}
cp -f ${TOP}/include/GL/*.h ${INCLUDE_DIR}/GL
cp -f ${TOP}/src/glw/*.h ${INCLUDE_DIR}/GL
# NOT YET: cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES
cp ${CP_FLAGS} ${TOP}/lib*/lib* ${LIB_DIR}
echo "Done."

View File

@@ -1,112 +0,0 @@
#!/bin/sh
# A minimal replacement for 'install' that supports installing symbolic links.
# Only a limited number of options are supported:
# -d dir Create a directory
# -m mode Sets a file's mode when installing
# If these commands aren't portable, we'll need some "if (arch)" type stuff
SYMLINK="ln -s"
MKDIR="mkdir -p"
RM="rm -f"
MODE=""
if [ "$1" = "-d" ] ; then
# make a directory path
$MKDIR "$2"
exit 0
fi
if [ "$1" = "-m" ] ; then
# set file mode
MODE=$2
shift 2
fi
# install file(s) into destination
if [ $# -ge 2 ] ; then
# Last cmd line arg is the dest dir
for FILE in $@ ; do
DESTDIR="$FILE"
done
# Loop over args, moving them to DEST directory
I=1
for FILE in $@ ; do
if [ $I = $# ] ; then
# stop, don't want to install $DEST into $DEST
exit 0
fi
DEST=$DESTDIR
# On CYGWIN, because DLLs are loaded by the native Win32 loader,
# they are installed in the executable path. Stub libraries used
# only for linking are installed in the library path
case `uname` in
CYGWIN*)
case $FILE in
*.dll)
DEST="$DEST/../bin"
;;
*)
;;
esac
;;
*)
;;
esac
PWDSAVE=`pwd`
# determine file's type
if [ -h "$FILE" ] ; then
#echo $FILE is a symlink
# Unfortunately, cp -d isn't universal so we have to
# use a work-around.
# Use ls -l to find the target that the link points to
LL=`ls -l "$FILE"`
for L in $LL ; do
TARGET=$L
done
#echo $FILE is a symlink pointing to $TARGET
FILE=`basename "$FILE"`
# Go to $DEST and make the link
cd "$DEST" # pushd
$RM "$FILE"
$SYMLINK "$TARGET" "$FILE"
cd "$PWDSAVE" # popd
elif [ -f "$FILE" ] ; then
#echo "$FILE" is a regular file
# Only copy if the files differ
if ! cmp -s $FILE $DEST/`basename $FILE`; then
$RM "$DEST/`basename $FILE`"
cp "$FILE" "$DEST"
fi
if [ $MODE ] ; then
FILE=`basename "$FILE"`
chmod $MODE "$DEST/$FILE"
fi
else
echo "Unknown type of argument: " "$FILE"
exit 1
fi
I=`expr $I + 1`
done
exit 0
fi
# If we get here, we didn't find anything to do
echo "Usage:"
echo " install -d dir Create named directory"
echo " install [-m mode] file [...] dest Install files in destination"

1043
bin/mklib

File diff suppressed because it is too large Load Diff

2
configs/.gitignore vendored
View File

@@ -1,2 +0,0 @@
current
autoconf

View File

@@ -1,222 +0,0 @@
# Autoconf configuration
# Pull in the defaults
include $(TOP)/configs/default
# This is generated by configure
CONFIG_NAME = autoconf
# Compiler and flags
CC = @CC@
CXX = @CXX@
PIC_FLAGS = @PIC_FLAGS@
DEFINES = @DEFINES@
API_DEFINES = @API_DEFINES@
SHARED_GLAPI = @SHARED_GLAPI@
CFLAGS_NOVISIBILITY = @CPPFLAGS@ @CFLAGS@ \
$(PIC_FLAGS) $(DEFINES)
CXXFLAGS_NOVISIBILITY = @CPPFLAGS@ @CXXFLAGS@ \
$(PIC_FLAGS) $(DEFINES)
CFLAGS = $(CFLAGS_NOVISIBILITY) @VISIBILITY_CFLAGS@
CXXFLAGS = $(CXXFLAGS_NOVISIBILITY) @VISIBILITY_CXXFLAGS@
LDFLAGS = @LDFLAGS@
RADEON_CFLAGS = @RADEON_CFLAGS@
RADEON_LIBS = @RADEON_LIBS@
NOUVEAU_CFLAGS = @NOUVEAU_CFLAGS@
NOUVEAU_LIBS = @NOUVEAU_LIBS@
INTEL_LIBS = @INTEL_LIBS@
INTEL_CFLAGS = @INTEL_CFLAGS@
X11_LIBS = @X11_LIBS@
X11_CFLAGS = @X11_CFLAGS@
LLVM_BINDIR = @LLVM_BINDIR@
LLVM_CFLAGS = @LLVM_CFLAGS@
LLVM_CPPFLAGS = @LLVM_CPPFLAGS@
LLVM_CXXFLAGS = @LLVM_CXXFLAGS@
LLVM_LDFLAGS = @LLVM_LDFLAGS@
LLVM_LIBDIR = @LLVM_LIBDIR@
LLVM_LIBS = @LLVM_LIBS@
LLVM_INCLUDEDIR = @LLVM_INCLUDEDIR@
GLW_CFLAGS = @GLW_CFLAGS@
GLX_TLS = @GLX_TLS@
# dlopen
DLOPEN_LIBS = @DLOPEN_LIBS@
CLOCK_LIB = @CLOCK_LIB@
# Source selection
MESA_ASM_FILES = @MESA_ASM_FILES@
# Misc tools and flags
MAKE = @MAKE@
SHELL = @SHELL@
MKLIB_OPTIONS = @MKLIB_OPTIONS@
MKDEP = @MKDEP@
MKDEP_OPTIONS = @MKDEP_OPTIONS@
INSTALL = @INSTALL@
AWK = @AWK@
GREP = @GREP@
NM = @NM@
# Perl
PERL = @PERL@
# Indent (used for generating dispatch tables)
INDENT = @INDENT@
INDENT_FLAGS = @INDENT_FLAGS@
# Python and flags (generally only needed by the developers)
PYTHON2 = @PYTHON2@
PYTHON_FLAGS = -t -O -O
# Flex and Bison for GLSL compiler
FLEX = @LEX@
BISON = @YACC@
# Library names (base name)
GL_LIB = @GL_LIB@
GLU_LIB = @GLU_LIB@
GLW_LIB = GLw
OSMESA_LIB = @OSMESA_LIB@
GLESv1_CM_LIB = GLESv1_CM
GLESv2_LIB = GLESv2
VG_LIB = OpenVG
GLAPI_LIB = glapi
# Library names (actual file names)
GL_LIB_NAME = @GL_LIB_NAME@
GLU_LIB_NAME = @GLU_LIB_NAME@
GLW_LIB_NAME = @GLW_LIB_NAME@
OSMESA_LIB_NAME = @OSMESA_LIB_NAME@
EGL_LIB_NAME = @EGL_LIB_NAME@
GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@
GLESv2_LIB_NAME = @GLESv2_LIB_NAME@
VG_LIB_NAME = @VG_LIB_NAME@
GLAPI_LIB_NAME = @GLAPI_LIB_NAME@
# Globs used to install the lib and all symlinks
GL_LIB_GLOB = @GL_LIB_GLOB@
GLU_LIB_GLOB = @GLU_LIB_GLOB@
GLW_LIB_GLOB = @GLW_LIB_GLOB@
EGL_LIB_GLOB = @EGL_LIB_GLOB@
GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@
GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@
VG_LIB_GLOB = @VG_LIB_GLOB@
GLAPI_LIB_GLOB = @GLAPI_LIB_GLOB@
# Directories to build
LIB_DIR = @LIB_DIR@
SRC_DIRS = @SRC_DIRS@
DRIVER_DIRS = @DRIVER_DIRS@
GALLIUM_DIRS = @GALLIUM_DIRS@
GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@
GALLIUM_WINSYS_DIRS = @GALLIUM_WINSYS_DIRS@
GALLIUM_TARGET_DIRS = @GALLIUM_TARGET_DIRS@
GALLIUM_STATE_TRACKERS_DIRS = @GALLIUM_STATE_TRACKERS_DIRS@
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
# Driver specific build vars
DRI_DIRS = @DRI_DIRS@
EGL_PLATFORMS = @EGL_PLATFORMS@
EGL_CLIENT_APIS = @EGL_CLIENT_APIS@
# Dependencies
X11_INCLUDES = @X11_INCLUDES@
# GLw motif setup
GLW_SOURCES = @GLW_SOURCES@
MOTIF_CFLAGS = @MOTIF_CFLAGS@
# Library/program dependencies
GL_LIB_DEPS = @GL_LIB_DEPS@
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \
@OSMESA_LIB_DEPS@
EGL_LIB_DEPS = @EGL_LIB_DEPS@
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLU_MESA_DEPS@ \
@GLU_LIB_DEPS@
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \
@GLW_LIB_DEPS@
GLESv1_CM_LIB_DEPS = @GLESv1_CM_LIB_DEPS@
GLESv2_LIB_DEPS = @GLESv2_LIB_DEPS@
VG_LIB_DEPS = @VG_LIB_DEPS@
GLAPI_LIB_DEPS = @GLAPI_LIB_DEPS@
# DRI dependencies
DRI_LIB_DEPS = @DRI_LIB_DEPS@
GALLIUM_DRI_LIB_DEPS = @GALLIUM_DRI_LIB_DEPS@
LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
LIBDRM_LIBS = @LIBDRM_LIBS@
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
GLPROTO_CFLAGS = @GLPROTO_CFLAGS@
EXPAT_INCLUDES = @EXPAT_INCLUDES@
# Autoconf directories
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
includedir = @includedir@
# Installation directories (for make install)
INSTALL_DIR = $(prefix)
INSTALL_LIB_DIR = $(libdir)
INSTALL_INC_DIR = $(includedir)
# DRI installation directories
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
# Where libGL will look for DRI hardware drivers
DRI_DRIVER_SEARCH_DIR = @DRI_DRIVER_SEARCH_DIR@
# EGL driver install directory
EGL_DRIVER_INSTALL_DIR = @EGL_DRIVER_INSTALL_DIR@
# XVMC library install directory
XVMC_LIB_INSTALL_DIR=@XVMC_LIB_INSTALL_DIR@
# VDPAU library install directory
VDPAU_LIB_INSTALL_DIR=@VDPAU_LIB_INSTALL_DIR@
# VA library install directory
VA_LIB_INSTALL_DIR=@VA_LIB_INSTALL_DIR@
# Xorg driver install directory (for xorg state-tracker)
XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@
# Path to OpenCL C library libclc
LIBCLC_PATH = @LIBCLC_PATH@
# pkg-config substitutions
GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@
GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@
GL_PC_CFLAGS = @GL_PC_CFLAGS@
DRI_PC_REQ_PRIV = @DRI_PC_REQ_PRIV@
GLU_PC_REQ = @GLU_PC_REQ@
GLU_PC_REQ_PRIV = @GLU_PC_REQ_PRIV@
GLU_PC_LIB_PRIV = @GLU_PC_LIB_PRIV@
GLU_PC_CFLAGS = @GLU_PC_CFLAGS@
GLW_PC_REQ_PRIV = @GLW_PC_REQ_PRIV@
GLW_PC_LIB_PRIV = @GLW_PC_LIB_PRIV@
GLW_PC_CFLAGS = @GLW_PC_CFLAGS@
OSMESA_PC_REQ = @OSMESA_PC_REQ@
OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@
GLESv1_CM_PC_LIB_PRIV = @GLESv1_CM_PC_LIB_PRIV@
GLESv2_PC_LIB_PRIV = @GLESv2_PC_LIB_PRIV@
EGL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@
EGL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@
EGL_PC_CFLAGS = @GL_PC_CFLAGS@
XCB_DRI2_CFLAGS = @XCB_DRI2_CFLAGS@
XCB_DRI2_LIBS = @XCB_DRI2_LIBS@
LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@
LIBUDEV_LIBS = @LIBUDEV_LIBS@
WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
WAYLAND_LIBS = @WAYLAND_LIBS@
MESA_LLVM = @MESA_LLVM@
LLVM_VERSION = @LLVM_VERSION@
HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@
GALLIUM_PIPE_LOADER_DEFINES = @GALLIUM_PIPE_LOADER_DEFINES@
GALLIUM_PIPE_LOADER_LIBS = @GALLIUM_PIPE_LOADER_LIBS@

View File

@@ -1,180 +0,0 @@
# Default/template configuration
# This is included by other config files which may override some
# of these variables.
# Think of this as a base class from which configs are derived.
CONFIG_NAME = default
# Version info
MESA_MAJOR=9
MESA_MINOR=1
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
# external projects. This should be useless now that we use libdrm.
DRM_SOURCE_PATH=$(TOP)/../drm
# Compiler and flags
CC = cc
CXX = CC
CFLAGS = -O
CXXFLAGS = -O
LDFLAGS =
GLU_CFLAGS =
GLX_TLS = no
# Compiler for building demos/tests/etc
APP_CC = $(CC)
APP_CXX = $(CXX)
# Misc tools and flags
SHELL = /bin/sh
MKLIB = $(SHELL) $(TOP)/bin/mklib
MKLIB_OPTIONS =
MKDEP = makedepend
MKDEP_OPTIONS = -fdepend
MAKE = make
FLEX = flex
BISON = bison
PKG_CONFIG = pkg-config
# Use MINSTALL for installing libraries, INSTALL for everything else
MINSTALL = $(SHELL) $(TOP)/bin/minstall
INSTALL = $(MINSTALL)
# Tools for regenerating glapi (generally only needed by the developers)
PYTHON2 = python
PYTHON_FLAGS = -t -O -O
INDENT = indent
INDENT_FLAGS = -i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool
# Library names (base name)
GL_LIB = GL
GLU_LIB = GLU
GLW_LIB = GLw
OSMESA_LIB = OSMesa
EGL_LIB = EGL
GLESv1_CM_LIB = GLESv1_CM
GLESv2_LIB = GLESv2
VG_LIB = OpenVG
GLAPI_LIB = glapi
# Library names (actual file names)
GL_LIB_NAME = lib$(GL_LIB).so
GLU_LIB_NAME = lib$(GLU_LIB).so
GLW_LIB_NAME = lib$(GLW_LIB).so
OSMESA_LIB_NAME = lib$(OSMESA_LIB).so
EGL_LIB_NAME = lib$(EGL_LIB).so
GLESv1_CM_LIB_NAME = lib$(GLESv1_CM_LIB).so
GLESv2_LIB_NAME = lib$(GLESv2_LIB).so
VG_LIB_NAME = lib$(VG_LIB).so
GLAPI_LIB_NAME = lib$(GLAPI_LIB).so
# globs used to install the lib and all symlinks
GL_LIB_GLOB = $(GL_LIB_NAME)*
GLU_LIB_GLOB = $(GLU_LIB_NAME)*
GLW_LIB_GLOB = $(GLW_LIB_NAME)*
EGL_LIB_GLOB = $(EGL_LIB_NAME)*
GLESv1_CM_LIB_GLOB = $(GLESv1_CM_LIB_NAME)*
GLESv2_LIB_GLOB = $(GLESv2_LIB_NAME)*
VG_LIB_GLOB = $(VG_LIB_NAME)*
GLAPI_LIB_GLOB = $(GLAPI_LIB_NAME)*
# Optional assembly language optimization files for libGL
MESA_ASM_FILES =
# GLw widget sources (Append "GLwMDrawA.c" here and add -lXm to GLW_LIB_DEPS in
# order to build the Motif widget too)
GLW_SOURCES = GLwDrawA.c
MOTIF_CFLAGS = -I/usr/include/Motif1.2
# Directories to build
LIB_DIR = lib
SRC_DIRS = glsl mapi/glapi mapi/vgapi mesa \
gallium egl gallium/winsys gallium/targets
DRIVER_DIRS = x11 osmesa
# Gallium directories and
GALLIUM_DIRS = auxiliary drivers state_trackers
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
GALLIUM_DRIVERS_DIRS = softpipe trace rbug noop identity galahad i915 svga r300 nvfx nv50
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
GALLIUM_WINSYS_DIRS = sw sw/xlib
GALLIUM_TARGET_DIRS = libgl-xlib
GALLIUM_STATE_TRACKERS_DIRS = glx vega
# native platforms EGL should support
EGL_PLATFORMS = x11
EGL_CLIENT_APIS = $(GL_LIB)
# Library dependencies
#EXTRA_LIB_PATH ?=
GL_LIB_DEPS = -lX11 -lXext -lm -lpthread
EGL_LIB_DEPS = -ldl -lpthread
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXt -lX11
GLESv1_CM_LIB_DEPS = -lpthread
GLESv2_LIB_DEPS = -lpthread
VG_LIB_DEPS = -lpthread
GLAPI_LIB_DEPS = -lpthread
# Program dependencies - specific GL libraries added in Makefiles
X11_LIBS = -lX11
DLOPEN_LIBS = -ldl
# Installation directories (for make install)
INSTALL_DIR = /usr/local
INSTALL_LIB_DIR = $(INSTALL_DIR)/$(LIB_DIR)
INSTALL_INC_DIR = $(INSTALL_DIR)/include
DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri
# Where libGL will look for DRI hardware drivers
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
# EGL driver install directory
EGL_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/egl
# Xorg driver install directory (for xorg state-tracker)
XORG_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/xorg/modules/drivers
# pkg-config substitutions
GL_PC_REQ_PRIV =
GL_PC_LIB_PRIV =
GL_PC_CFLAGS =
DRI_PC_REQ_PRIV =
GLU_PC_REQ = gl
GLU_PC_REQ_PRIV =
GLU_PC_LIB_PRIV =
GLU_PC_CFLAGS =
GLW_PC_REQ_PRIV =
GLW_PC_LIB_PRIV =
GLW_PC_CFLAGS =
OSMESA_PC_REQ =
OSMESA_PC_LIB_PRIV =
GLESv1_CM_PC_REQ_PRIV =
GLESv1_CM_PC_LIB_PRIV =
GLESv1_CM_PC_CFLAGS =
GLESv2_PC_REQ_PRIV =
GLESv2_PC_LIB_PRIV =
GLESv2_PC_CFLAGS =
VG_PC_REQ_PRIV =
VG_PC_LIB_PRIV =
VG_PC_CFLAGS =
# default targets
# this helps reduce the mismatch between our automake Makefiles and the old
# custom Makefiles while we transition.
all: default
am--refresh:
distclean: clean
check:
test:

View File

@@ -20,7 +20,8 @@ echo \#buildapi-variable-no-builddir >/dev/null
# Support silent build rules, requires at least automake-1.11. Disable
# by either passing --disable-silent-rules to configure or passing V=1
# to make
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
@@ -30,10 +31,10 @@ AC_SUBST([OSMESA_VERSION])
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.4.24
LIBDRM_RADEON_REQUIRED=2.4.40
LIBDRM_RADEON_REQUIRED=2.4.42
LIBDRM_INTEL_REQUIRED=2.4.38
LIBDRM_NVVIEUX_REQUIRED=2.4.33
LIBDRM_NOUVEAU_REQUIRED=2.4.33
LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41"
DRI2PROTO_REQUIRED=2.6
GLPROTO_REQUIRED=1.4.14
LIBDRM_XORG_REQUIRED=2.4.24
@@ -49,37 +50,28 @@ AM_PROG_CC_C_O
AM_PROG_AS
AC_CHECK_PROGS([MAKE], [gmake make])
AC_CHECK_PROGS([PYTHON2], [python2 python])
AX_PYTHON_MODULE([libxml2], [needed])
AC_PROG_SED
AC_PROG_MKDIR_P
AC_PATH_PROG([MKDEP], [makedepend])
LT_PREREQ([2.2])
LT_INIT([disable-static])
if test "x$MKDEP" = "x"; then
AC_MSG_ERROR([makedepend is required to build Mesa])
fi
AC_PROG_YACC
AC_PATH_PROG([YACC_INST], $YACC)
if test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"; then
if test -z "$YACC_INST"; then
AC_MSG_ERROR([yacc not found - unable to compile glcpp-parse.y])
fi
fi
AC_PROG_LEX
AX_PROG_BISON([],
AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"],
[AC_MSG_ERROR([bison not found - unable to compile glcpp-parse.y])]))
AX_PROG_FLEX([],
AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-lex.c"],
[AC_MSG_ERROR([flex not found - unable to compile glcpp-lex.l])]))
AC_PATH_PROG([PERL], [perl])
AC_CHECK_PROG(INDENT, indent, indent, cat)
if test "x$INDENT" != "xcat"; then
AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool')
AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool')
fi
dnl Our fallback install-sh is a symlink to minstall. Use the existing
dnl configuration in that case.
AC_PROG_INSTALL
test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
dnl We need a POSIX shell for parts of the build. Assume we have one
dnl in most cases.
@@ -126,21 +118,6 @@ if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
fi
fi
MKDEP_OPTIONS=-fdepend
dnl Ask gcc where it's keeping its secret headers
if test "x$GCC" = xyes; then
for dir in include include-fixed; do
GCC_INCLUDES=`$CC -print-file-name=$dir`
if test "x$GCC_INCLUDES" != x && \
test "$GCC_INCLUDES" != "$dir" && \
test -d "$GCC_INCLUDES"; then
MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
fi
done
fi
AC_SUBST([MKDEP_OPTIONS])
dnl Make sure the pkg-config macros are defined
m4_ifndef([PKG_PROG_PKG_CONFIG],
[m4_fatal([Could not locate the pkg-config autoconf macros.
@@ -320,15 +297,6 @@ esac
AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
dnl
dnl mklib options
dnl
AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
if test "$enable_static" = yes; then
MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
fi
AC_SUBST([MKLIB_OPTIONS])
dnl
dnl other compiler options
dnl
@@ -525,9 +493,6 @@ if test "x$enable_asm" = xyes; then
fi
AC_SUBST([MESA_ASM_FILES])
dnl PIC code macro
MESA_PIC_FLAGS
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
@@ -644,8 +609,10 @@ AC_ARG_ENABLE([vdpau],
[enable_vdpau=auto])
AC_ARG_ENABLE([opencl],
[AS_HELP_STRING([--enable-opencl],
[enable OpenCL library @<:@default=no@:>@])],
[enable_opencl="$enableval"],
[enable OpenCL library NOTE: Enabling this option will also enable
--with-llvm-shared-libs
@<:@default=no@:>@])],
[],
[enable_opencl=no])
AC_ARG_ENABLE([xlib_glx],
[AS_HELP_STRING([--enable-xlib-glx],
@@ -680,13 +647,15 @@ AC_ARG_ENABLE([gallium_tests],
[enable_gallium_tests=no])
# Option for Gallium drivers
# Keep this in sync with the --with-gallium-drivers help string default value
GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
AC_ARG_WITH([gallium-drivers],
[AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
[comma delimited Gallium drivers list, e.g.
"i915,nouveau,r300,r600,radeonsi,svga,swrast"
@<:@default=r300,r600,swrast@:>@])],
@<:@default=r300,r600,svga,swrast@:>@])],
[with_gallium_drivers="$withval"],
[with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
@@ -733,6 +702,16 @@ if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
fi
if test "x$enable_opengl$enable_xlib_glx" = xnoyes; then
AC_MSG_ERROR([Xlib-GLX cannot be built without OpenGL])
fi
# Disable GLX if OpenGL is not enabled
if test "x$enable_glx$enable_opengl" = xyesno; then
AC_MSG_WARN([OpenGL not enabled, disabling GLX])
enable_glx=no
fi
# Disable GLX if DRI and Xlib-GLX are not enabled
if test "x$enable_glx" = xyes -a \
"x$enable_dri" = xno -a \
@@ -757,22 +736,17 @@ if test "x$enable_dri" = xno; then
enable_shared_glapi=no
fi
# TODO: Get rid of SHARED_GLAPI variable
SHARED_GLAPI="0"
if test "x$enable_shared_glapi" = xyes; then
SHARED_GLAPI="1"
# libGL will use libglapi for function lookups (IN_DRI_DRIVER means to use
# the remap table)
DEFINES="$DEFINES -DIN_DRI_DRIVER"
CORE_DIRS="mapi/shared-glapi"
fi
AC_SUBST([SHARED_GLAPI])
AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
dnl
dnl Driver specific build directories
dnl
SRC_DIRS="gtest"
GALLIUM_DIRS="auxiliary drivers state_trackers"
GALLIUM_TARGET_DIRS=""
GALLIUM_WINSYS_DIRS="sw"
@@ -797,7 +771,7 @@ fi
# build glsl and mesa if OpenGL or OpenGL ES is enabled
case "x$enable_opengl$enable_gles1$enable_gles2" in
x*yes*)
CORE_DIRS="mapi/glapi/gen $CORE_DIRS glsl mesa"
CORE_DIRS="mapi/glapi/gen $CORE_DIRS gtest glsl mesa"
;;
esac
@@ -1114,8 +1088,8 @@ if test "x$enable_dri" = xyes; then
LIBS="$save_LIBS"
fi
# if we are building any dri driver other than swrast ...
if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast; then
# if we are building any dri driver other than swrast or using the dri state tracker ...
if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast || test "x$enable_dri" = xyes; then
# ... libdrm is required
if test "x$have_libdrm" != xyes; then
AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
@@ -1398,6 +1372,7 @@ if test "x$enable_openvg" = xyes; then
VG_PC_LIB_PRIV="-lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
AC_SUBST([VG_PC_LIB_PRIV])
fi
AM_CONDITIONAL(HAVE_OPENVG, test "x$enable_openvg" = xyes)
dnl
dnl D3D1X configuration
@@ -1452,17 +1427,27 @@ dnl
AC_ARG_WITH([libclc-path],
[AS_HELP_STRING([--with-libclc-path],
[Path to libclc builtins library. Example: --with-libclc-path=\$HOME/libclc/])],
[DEPRECATED: See http://dri.freedesktop.org/wiki/GalliumCompute#How_to_Install])],
[LIBCLC_PATH="$withval"],
[LIBCLC_PATH=""])
if test "x$LIBCLC_PATH" != x; then
AC_MSG_ERROR([The --with-libclc-path option has been deprecated.
Please review the updated build instructions for clover:
http://dri.freedesktop.org/wiki/GalliumCompute])
fi
AC_ARG_WITH([clang-libdir],
[AS_HELP_STRING([--with-clang-libdir],
[Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
[CLANG_LIBDIR="$withval"],
[CLANG_LIBDIR=""])
AC_SUBST([LIBCLC_PATH])
LIBCLC_INCLUDEDIR=`pkg-config --variable=includedir libclc`
LIBCLC_LIBEXECDIR=`pkg-config --variable=libexecdir libclc`
AC_SUBST([LIBCLC_INCLUDEDIR])
AC_SUBST([LIBCLC_LIBEXECDIR])
if test "x$enable_opencl" = xyes; then
if test "x$with_gallium_drivers" = x; then
@@ -1473,11 +1458,19 @@ if test "x$enable_opencl" = xyes; then
AC_MSG_ERROR([gcc >= 4.6 is required to build clover])
fi
if test "x$LIBCLC_INCLUDEDIR" == x || test "x$LIBCLC_LIBEXECDIR" == x; then
AC_MSG_ERROR([pkg-config cannot use libclc.pc which is required to build clover])
fi
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS clover"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS opencl"
enable_gallium_loader=yes
fi
if test "x$enable_gallium_gbm" = xyes || test "x$enable_opencl" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS pipe-loader"
fi
dnl
dnl Gallium configuration
dnl
@@ -1500,8 +1493,10 @@ AC_SUBST([CLANG_RESOURCE_DIR])
case "x$enable_opengl$enable_gles1$enable_gles2" in
x*yes*)
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
HAVE_OPENGL=yes
;;
esac
AM_CONDITIONAL(HAVE_OPENGL, test "x$HAVE_OPENGL" = xyes)
AC_SUBST([VG_LIB_DEPS])
AC_SUBST([EGL_CLIENT_APIS])
@@ -1635,8 +1630,13 @@ AC_ARG_ENABLE([gallium-llvm],
AC_ARG_WITH([llvm-shared-libs],
[AS_HELP_STRING([--with-llvm-shared-libs],
[link with LLVM shared libraries @<:@default=disabled@:>@])],
[with_llvm_shared_libs=yes],
[],
[with_llvm_shared_libs=no])
AS_IF([test x$enable_opencl = xyes],
[
AC_MSG_WARN([OpenCL required, forcing LLVM shared libraries])
with_llvm_shared_libs=yes
])
AC_ARG_WITH([llvm-prefix],
[AS_HELP_STRING([--with-llvm-prefix],
@@ -1678,20 +1678,14 @@ if test "x$enable_gallium_llvm" = xyes; then
if test "x$LLVM_CONFIG" != xno; then
LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
if test "x$with_llvm_shared_libs" = xyes; then
dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
LLVM_LIBS="-lLLVM-`$LLVM_CONFIG --version`"
else
LLVM_COMPONENTS="engine bitwriter"
if $LLVM_CONFIG --components | grep -q '\<mcjit\>'; then
LLVM_COMPONENTS="${LLVM_COMPONENTS} mcjit"
fi
LLVM_COMPONENTS="engine bitwriter"
if $LLVM_CONFIG --components | grep -q '\<mcjit\>'; then
LLVM_COMPONENTS="${LLVM_COMPONENTS} mcjit"
fi
if test "x$enable_opencl" = xyes; then
LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker instrumentation"
fi
LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
fi
if test "x$enable_opencl" = xyes; then
LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker instrumentation"
fi
LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
LLVM_BINDIR=`$LLVM_CONFIG --bindir`
LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
@@ -1699,7 +1693,7 @@ if test "x$enable_gallium_llvm" = xyes; then
LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
DEFINES="${DEFINES} -DHAVE_LLVM=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/0x0\10\2/g'`"
DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT"
MESA_LLVM=1
dnl Check for Clang interanl headers
@@ -1713,9 +1707,11 @@ if test "x$enable_gallium_llvm" = xyes; then
fi
else
MESA_LLVM=0
LLVM_VERSION_INT=0
fi
else
MESA_LLVM=0
LLVM_VERSION_INT=0
fi
dnl Directory for XVMC libs
@@ -1730,7 +1726,7 @@ dnl
dnl Gallium Tests
dnl
if test "x$enable_gallium_tests" = xyes; then
SRC_DIRS="$SRC_DIRS gallium/tests/trivial"
SRC_DIRS="$SRC_DIRS gallium/tests/trivial gallium/tests/unit"
enable_gallium_loader=yes
fi
@@ -1790,7 +1786,7 @@ gallium_require_llvm() {
gallium_require_drm_loader() {
if test "x$enable_gallium_loader" = xyes; then
PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
AC_MSG_ERROR([Gallium drm loader requrires libudev]))
AC_MSG_ERROR([Gallium drm loader requires libudev]))
if test "x$have_libdrm" != xyes; then
AC_MSG_ERROR([Gallium drm loader requires libdrm >= $LIBDRM_REQUIRED])
fi
@@ -1813,7 +1809,7 @@ radeon_llvm_check() {
configure flag])
fi
AC_MSG_WARN([Please ensure you use the latest llvm tree from git://people.freedesktop.org/~tstellar/llvm master before submitting a bug])
LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs r600`"
LLVM_COMPONENTS="${LLVM_COMPONENTS} r600"
}
dnl Gallium drivers
@@ -1823,10 +1819,12 @@ if test "x$with_gallium_drivers" != x; then
for driver in $gallium_drivers; do
case "x$driver" in
xsvga)
HAVE_GALLIUM_SVGA=yes
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
gallium_check_st "svga/drm" "dri-vmwgfx" "" "xa-vmwgfx"
;;
xi915)
HAVE_GALLIUM_I915=yes
PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 softpipe"
if test "x$MESA_LLVM" = x1; then
@@ -1836,28 +1834,33 @@ if test "x$with_gallium_drivers" != x; then
gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
;;
xr300)
HAVE_GALLIUM_R300=yes
PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
gallium_require_llvm "Gallium R300"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "dri-r300" "xorg-r300" "" "xvmc-r300" "vdpau-r300"
gallium_check_st "radeon/drm" "dri-r300" "" "" "xvmc-r300" "vdpau-r300"
;;
xr600)
HAVE_GALLIUM_R600=yes
PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then
radeon_llvm_check
NEED_RADEON_GALLIUM=yes;
R600_NEED_RADEON_GALLIUM=yes;
LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo bitreader asmparser"
fi
if test "x$enable_r600_llvm" = xyes; then
USE_R600_LLVM_COMPILER=yes;
fi
if test "x$enable_opencl" = xyes -a "x$with_llvm_shared_libs" = xno; then
LLVM_LIBS="${LLVM_LIBS} `$LLVM_CONFIG --libs bitreader asmparser`"
if test "x$enable_opencl" = xyes; then
LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
fi
gallium_check_st "radeon/drm" "dri-r600" "xorg-r600" "" "xvmc-r600" "vdpau-r600"
;;
xradeonsi)
HAVE_GALLIUM_RADEONSI=yes
PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
@@ -1866,14 +1869,17 @@ if test "x$with_gallium_drivers" != x; then
gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi" "" "" "vdpau-radeonsi" ""
;;
xnouveau)
HAVE_GALLIUM_NOUVEAU=yes
PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv30 nv50 nvc0"
gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "" "xvmc-nouveau" "vdpau-nouveau"
;;
xswrast)
HAVE_GALLIUM_SOFTPIPE=yes
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS softpipe"
if test "x$MESA_LLVM" = x1; then
HAVE_GALLIUM_LLVMPIPE=yes
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
fi
@@ -1900,15 +1906,67 @@ if test "x$with_gallium_drivers" != x; then
done
fi
dnl Set LLVM_LIBS - This is done after the driver configuration so
dnl that drivers can add additonal components to LLVM_COMPONENTS.
dnl Previously, gallium drivers were updating LLVM_LIBS directly
dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
dnl this was causing the same libraries to be appear multiple times
dnl in LLVM_LIBS.
if test "x$MESA_LLVM" != x0; then
LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
if test "x$with_llvm_shared_libs" = xyes; then
dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
AC_CHECK_FILE("$LLVM_LIBDIR/lib$LLVM_SO_NAME.so", llvm_have_one_so=yes,)
if test "x$llvm_have_one_so" = xyes; then
dnl LLVM was built using auto*, so there is only one shared object.
LLVM_LIBS="-l$LLVM_SO_NAME"
else
dnl If LLVM was built with CMake, there will be one shared object per
dnl component.
AC_CHECK_FILE("$LLVM_LIBDIR/libLLVMTarget.so",,
AC_MSG_ERROR([Could not find llvm shared libraries:
Please make sure you have built llvm with the --enable-shared option
and that your llvm libraries are installed in $LLVM_LIBDIR
If you have installed your llvm libraries to a different directory you
can use the --with-llvm-prefix= configure flag to specify this directory.
NOTE: Mesa is attempting to use llvm shared libraries because you have
passed one of the following options to configure:
--with-llvm-shared-libs
--enable-opencl
If you do not want to build with llvm shared libraries and instead want to
use llvm static libraries then remove these options from your configure
invocation and reconfigure.]))
dnl We don't need to update LLVM_LIBS in this case because the LLVM
dnl install uses a shared object for each compoenent and we have
dnl already added all of these objects to LLVM_LIBS.
fi
fi
fi
AM_CONDITIONAL(HAVE_GALLIUM_SVGA, test "x$HAVE_GALLIUM_SVGA" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_I915, test "x$HAVE_GALLIUM_I915" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
if test "x$enable_gallium_loader" = xyes; then
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null"
GALLIUM_PIPE_LOADER_DEFINES="-DHAVE_PIPE_LOADER_SW"
GALLIUM_PIPE_LOADER_LIBS="\$(TOP)/src/gallium/auxiliary/pipe-loader/libpipe_loader.a"
GALLIUM_PIPE_LOADER_LIBS="$GALLIUM_PIPE_LOADER_LIBS \$(TOP)/src/gallium/winsys/sw/null/libws_null.a"
GALLIUM_PIPE_LOADER_LIBS="\$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la"
GALLIUM_PIPE_LOADER_LIBS="$GALLIUM_PIPE_LOADER_LIBS \$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la"
if test "x$HAVE_WINSYS_XLIB" = xyes; then
GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_XLIB"
GALLIUM_PIPE_LOADER_LIBS="$GALLIUM_PIPE_LOADER_LIBS \$(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a"
GALLIUM_PIPE_LOADER_LIBS="$GALLIUM_PIPE_LOADER_LIBS \$(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la"
fi
if test "x$enable_gallium_drm_loader" = xyes; then
@@ -1947,18 +2005,38 @@ AM_CONDITIONAL(HAVE_GALAHAD_GALLIUM, test x$HAVE_GALAHAD_GALLIUM = xyes)
AM_CONDITIONAL(HAVE_IDENTITY_GALLIUM, test x$HAVE_IDENTITY_GALLIUM = xyes)
AM_CONDITIONAL(HAVE_NOOP_GALLIUM, test x$HAVE_NOOP_GALLIUM = xyes)
AM_CONDITIONAL(NEED_RADEON_GALLIUM, test x$NEED_RADEON_GALLIUM = xyes)
AM_CONDITIONAL(R600_NEED_RADEON_GALLIUM, test x$R600_NEED_RADEON_GALLIUM = xyes)
AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
AM_CONDITIONAL(LLVM_NEEDS_FNORTTI, test $LLVM_VERSION_INT -ge 302)
AC_SUBST([GALLIUM_MAKE_DIRS])
AM_CONDITIONAL(NEED_LIBPROGRAM, test "x$with_gallium_drivers" != x -o \
"x$enable_xlib_glx" = xyes -o \
"x$enable_osmesa" = xyes)
AM_CONDITIONAL(HAVE_X11_DRIVER, echo "$DRIVER_DIRS" | grep 'x11' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 2>&1)
AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
AC_SUBST([VDPAU_MAJOR], 1)
AC_SUBST([VDPAU_MINOR], 0)
AC_SUBST([XVMC_MAJOR], 1)
AC_SUBST([XVMC_MINOR], 0)
AC_SUBST([XA_MAJOR], 1)
AC_SUBST([XA_MINOR], 0)
AC_SUBST([XA_TINY], 0)
AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
dnl prepend CORE_DIRS to SRC_DIRS
SRC_DIRS="$CORE_DIRS $SRC_DIRS"
@@ -1971,8 +2049,7 @@ CFLAGS="$CFLAGS $USER_CFLAGS"
CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
dnl Substitute the config
AC_CONFIG_FILES([configs/current
Makefile
AC_CONFIG_FILES([Makefile
src/Makefile
src/egl/Makefile
src/egl/drivers/Makefile
@@ -1985,18 +2062,83 @@ AC_CONFIG_FILES([configs/current
src/egl/wayland/wayland-egl/Makefile
src/egl/wayland/wayland-egl/wayland-egl.pc
src/gallium/Makefile
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/pipe-loader/Makefile
src/gallium/drivers/Makefile
src/gallium/drivers/i915/Makefile
src/gallium/drivers/llvmpipe/Makefile
src/gallium/drivers/nouveau/Makefile
src/gallium/drivers/nv30/Makefile
src/gallium/drivers/nv50/Makefile
src/gallium/drivers/nvc0/Makefile
src/gallium/drivers/r300/Makefile
src/gallium/drivers/r600/Makefile
src/gallium/drivers/radeon/Makefile
src/gallium/drivers/radeonsi/Makefile
src/gallium/drivers/rbug/Makefile
src/gallium/drivers/softpipe/Makefile
src/gallium/drivers/svga/Makefile
src/gallium/drivers/trace/Makefile
src/gallium/state_trackers/Makefile
src/gallium/state_trackers/clover/Makefile
src/gallium/state_trackers/dri/Makefile
src/gallium/state_trackers/dri/drm/Makefile
src/gallium/state_trackers/dri/sw/Makefile
src/gallium/state_trackers/egl/Makefile
src/gallium/state_trackers/gbm/Makefile
src/gallium/state_trackers/glx/Makefile
src/gallium/state_trackers/vdpau/Makefile
src/gallium/state_trackers/vega/Makefile
src/gallium/state_trackers/xa/Makefile
src/gallium/state_trackers/xorg/Makefile
src/gallium/state_trackers/xvmc/Makefile
src/gallium/targets/Makefile
src/gallium/targets/dri-i915/Makefile
src/gallium/targets/dri-nouveau/Makefile
src/gallium/targets/dri-r300/Makefile
src/gallium/targets/dri-r600/Makefile
src/gallium/targets/dri-radeonsi/Makefile
src/gallium/targets/dri-swrast/Makefile
src/gallium/targets/dri-vmwgfx/Makefile
src/gallium/targets/egl-static/Makefile
src/gallium/targets/gbm/Makefile
src/gallium/targets/opencl/Makefile
src/gallium/targets/pipe-loader/Makefile
src/gallium/targets/libgl-xlib/Makefile
src/gallium/targets/vdpau-nouveau/Makefile
src/gallium/targets/vdpau-r300/Makefile
src/gallium/targets/vdpau-r600/Makefile
src/gallium/targets/vdpau-radeonsi/Makefile
src/gallium/targets/vdpau-softpipe/Makefile
src/gallium/targets/xa-vmwgfx/Makefile
src/gallium/targets/xa-vmwgfx/xatracker.pc
src/gallium/targets/xorg-i915/Makefile
src/gallium/targets/xorg-nouveau/Makefile
src/gallium/targets/xorg-r600/Makefile
src/gallium/targets/xorg-radeonsi/Makefile
src/gallium/targets/xvmc-nouveau/Makefile
src/gallium/targets/xvmc-r300/Makefile
src/gallium/targets/xvmc-r600/Makefile
src/gallium/targets/xvmc-softpipe/Makefile
src/gallium/tests/trivial/Makefile
src/gallium/tests/unit/Makefile
src/gallium/winsys/Makefile
src/gallium/winsys/i915/drm/Makefile
src/gallium/winsys/i915/sw/Makefile
src/gallium/winsys/nouveau/drm/Makefile
src/gallium/winsys/radeon/drm/Makefile
src/gallium/winsys/svga/drm/Makefile
src/gallium/winsys/sw/Makefile
src/gallium/winsys/sw/dri/Makefile
src/gallium/winsys/sw/fbdev/Makefile
src/gallium/winsys/sw/null/Makefile
src/gallium/winsys/sw/wayland/Makefile
src/gallium/winsys/sw/wrapper/Makefile
src/gallium/winsys/sw/xlib/Makefile
src/gbm/Makefile
src/gbm/main/gbm.pc
src/glsl/Makefile
src/glsl/builtin_compiler/Makefile
src/glsl/glcpp/Makefile
src/glsl/tests/Makefile
src/glx/Makefile
src/glx/tests/Makefile
src/gtest/Makefile
@@ -2016,6 +2158,7 @@ AC_CONFIG_FILES([configs/current
src/mesa/drivers/Makefile
src/mesa/drivers/dri/dri.pc
src/mesa/drivers/dri/common/Makefile
src/mesa/drivers/dri/common/xmlpool/Makefile
src/mesa/drivers/dri/i915/Makefile
src/mesa/drivers/dri/i965/Makefile
src/mesa/drivers/dri/Makefile
@@ -2139,9 +2282,9 @@ echo " Shared-glapi: $enable_shared_glapi"
dnl Compiler options
# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
cflags=`echo $CFLAGS $PIC_FLAGS | \
cflags=`echo $CFLAGS | \
$SED 's/^ *//;s/ */ /;s/ *$//'`
cxxflags=`echo $CXXFLAGS $PIC_FLAGS | \
cxxflags=`echo $CXXFLAGS | \
$SED 's/^ *//;s/ */ /;s/ *$//'`
defines=`echo $DEFINES | $SED 's/^ *//;s/ */ /;s/ *$//'`
echo ""

View File

@@ -41,15 +41,15 @@ GLX_ARB_create_context (GLX 1.4 is required) DONE
GL 3.1:
GLSL 1.40 DONE (i965)
Forward compatibile context support/deprecations DONE (i965)
GLSL 1.40 DONE (i965, r600)
Forward compatibile context support/deprecations DONE (i965, r600)
Instanced drawing (GL_ARB_draw_instanced) DONE (i965, gallium, swrast)
Buffer copying (GL_ARB_copy_buffer) DONE (i965, r300, r600, swrast)
Primitive restart (GL_NV_primitive_restart) DONE (i965, r600)
16 vertex texture image units DONE
Texture buffer objs (GL_ARB_texture_buffer_object) DONE for OpenGL 3.1 contexts (i965)
Texture buffer objs (GL_ARB_texture_buffer_object) DONE for OpenGL 3.1 contexts (i965, r600)
Rectangular textures (GL_ARB_texture_rectangle) DONE (i965, r300, r600, swrast)
Uniform buffer objs (GL_ARB_uniform_buffer_object) DONE (i965)
Uniform buffer objs (GL_ARB_uniform_buffer_object) DONE (i965, r600, swrast)
Signed normalized textures (GL_EXT_texture_snorm) DONE (i965, r300, r600)
@@ -95,7 +95,7 @@ GL_ARB_gpu_shader_fp64 not started
GL_ARB_sample_shading not started
GL_ARB_shader_subroutine not started
GL_ARB_tessellation_shader not started
GL_ARB_texture_buffer_object_rgb32 DONE (softpipe)
GL_ARB_texture_buffer_object_rgb32 DONE (i965, softpipe)
GL_ARB_texture_cube_map_array DONE (i965, softpipe)
GL_ARB_texture_gather not started
GL_ARB_transform_feedback2 DONE
@@ -121,7 +121,7 @@ GL_ARB_compressed_texture_pixel_storage not started
GL_ARB_shader_atomic_counters not started
GL_ARB_texture_storage DONE (r300, r600, swrast, gallium)
GL_ARB_transform_feedback_instanced DONE
GL_ARB_base_instance DONE (nv50, nvc0, r600, radeonsi)
GL_ARB_base_instance DONE (i965, nv50, nvc0, r600, radeonsi)
GL_ARB_shader_image_load_store not started
GL_ARB_conservative_depth DONE (softpipe)
GL_ARB_shading_language_420pack not started

View File

@@ -196,8 +196,6 @@ branch is relevant.
<h3>Verify and update version info</h3>
<dl>
<dt>configs/default</dt>
<dd>MESA_MAJOR, MESA_MINOR and MESA_TINY</dd>
<dt>Makefile.am</dt>
<dd>PACKAGE_VERSION</dd>
<dt>configure.ac</dt>

View File

@@ -16,6 +16,14 @@
<h1>News</h1>
<h2>January 22, 2013</h2>
<p>
<a href="relnotes-9.0.2.html">Mesa 9.0.2</a> is released.
This is a bug fix release.
</p>
<h2>November 16, 2012</h2>
<p>

290
docs/relnotes-9.0.2.html Normal file
View File

@@ -0,0 +1,290 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Mesa Release Notes</title>
<link rel="stylesheet" type="text/css" href="mesa.css">
</head>
<body>
<div class="header">
<h1>The Mesa 3D Graphics Library</h1>
</div>
<iframe src="contents.html"></iframe>
<div class="content">
<h1>Mesa 9.0.2 Release Notes / January 22th, 2013</h1>
<p>
Mesa 9.0.2 is a bug fix release which fixes bugs found since the 9.0.1 release.
</p>
<p>
Mesa 9.0 implements the OpenGL 3.1 API, but the version reported by
glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 3.1. OpenGL
3.1 is <strong>only</strong> available if requested at context creation
because GL_ARB_compatibility is not supported.
</p>
<h2>MD5 checksums</h2>
<pre>
5ae216ca9fecfa349f14ecb83aa3f124 MesaLib-9.0.2.tar.gz
dc45d1192203e418163e0017640e1cfc MesaLib-9.0.2.tar.bz2
93d40ec77d656dd04b561ba203ffbb91 MesaLib-9.0.2.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=22576">Bug 22576</a> - [KMS] mesa demo spectex broken on rv280</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26809">Bug 26809</a> - KMS/R200: Bad shading in NWN since Mesa rewrite</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45877">Bug 45877</a> - [bisected regression] Oglc fbo(negative.invalidParams3) Segmentation fault</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=54402">Bug 54402</a> - st_glsl_to_tgsi.cpp:4006:dst_register: Assertion `index &lt; VERT_RESULT_MAX' failed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=55175">Bug 55175</a> - Memoryleak with glPopAttrib only on Intel GM45</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=56442">Bug 56442</a> - glcpp accepts junk after #else/#elif/#endif tokens</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=56706">Bug 56706</a> - EGL sets error to EGL_SUCCESS when DRI driver fails to create context</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=57622">Bug 57622</a> - Webgl conformance shader-with-non-reserved-words crash.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=57842">Bug 57842</a> - r200: Culling is broken when rendering to an FBO</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=57984">Bug 57984</a> - r300g: blend sfactor=GL_DST_COLOR fails with FBOs</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=58545">Bug 58545</a> - [llvmpipe] src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:75:analyse_src: Assertion `src-&gt;Index &lt; (sizeof(ctx-&gt;imm)/sizeof((ctx-&gt;imm)[0]))' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=59383">Bug 59383</a> - src/glsl/tests/Makefile.am missing $(top_srcdir)/include</li>
<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </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-9.0.1..mesa-9.0.2
</pre>
<p>Abdiel Janulgue (1):</p>
<ul>
<li>mesa: Fix a crash in update_texture_state() for external texture type</li>
</ul>
<p>Adam Jackson (4):</p>
<ul>
<li>glcpp: Fix visibility CFLAGS in automake</li>
<li>glcpp: Typo fix.</li>
<li>galahad, noop: Fix visibility CFLAGS in automake</li>
<li>r300g: Fix visibility CFLAGS in automake</li>
</ul>
<p>Alex Deucher (2):</p>
<ul>
<li>radeonsi: add some new SI pci ids</li>
<li>radeonsi: add a new SI pci id</li>
</ul>
<p>Ander Conselvan de Oliveira (2):</p>
<ul>
<li>egl/wayland: Don't invalidate drawable on swap buffers</li>
<li>egl/wayland: Dispatch the event queue before get_buffers</li>
<li>egl/wayland: Destroy the pending buffer callback with the egl surface</li>
</ul>
<p>Andreas Boll (9):</p>
<ul>
<li>docs: fix release date of 9.0.1</li>
<li>docs: add news item for 9.0.1 release</li>
<li>Add .dirstamp to toplevel .gitignore</li>
<li>build: use git ls-files for adding all Makefile.in into the release tarball</li>
<li>build: Fix GLES linkage without libglapi</li>
<li>Revert "r600g: try to fix streamout for the cases where BURST_COUNT &gt; 0"</li>
<li>mesa: update .cherry-ignore list</li>
<li>mesa: Bump version to 9.0.2</li>
<li>docs: Add 9.0.2 release notes</li>
</ul>
<p>Anuj Phogat (2):</p>
<ul>
<li>mesa: Generate invalid operation in glGenerateMipMap for integer textures</li>
<li>meta: Remove redundant code in _mesa_meta_GenerateMipmap</li>
</ul>
<p>Ben Skeggs (3):</p>
<ul>
<li>nvc0: fix missing permanent bo reference on poly cache</li>
<li>nvc0: point vertex runout at a valid address</li>
<li>nv50: point vertex runout at a valid address</li>
</ul>
<p>Brian Paul (5):</p>
<ul>
<li>svga: don't use uninitialized framebuffer state</li>
<li>st/mesa: replace REALLOC() with realloc()</li>
<li>st/mesa: free TGSI tokens with ureg_free_tokens()</li>
<li>util: added pipe_surface_release() function</li>
<li>gallivm: support more immediates in lp_build_tgsi_info()</li>
</ul>
<p>Bryan Cain (1):</p>
<ul>
<li>glsl_to_tgsi: set correct register type for array and structure elements</li>
</ul>
<p>Chad Versace (2):</p>
<ul>
<li>i965: Validate requested GLES context version in brwCreateContext</li>
<li>egl/dri2: Set error code when dri2CreateContextAttribs fails</li>
</ul>
<p>Chris Fester (1):</p>
<ul>
<li>util: null-out the node's prev/next pointers in list_del()</li>
</ul>
<p>Christoph Bumiller (5):</p>
<ul>
<li>nv50/ir/tgsi: fix srcMask for TXP with SHADOW1D</li>
<li>nvc0: add missing call to map edge flag in push_vbo</li>
<li>nv50/ir: wrap assertion using typeid in #ifndef NDEBUG</li>
<li>nouveau: fix undefined behaviour when testing sample_count</li>
<li>nv50/ir: restore use of long immediate encodings</li>
</ul>
<p>Dave Airlie (5):</p>
<ul>
<li>r600g: fix lod bias/explicit lod with cube maps.</li>
<li>glsl_to_tgsi: fix dst register for texturing fetches.</li>
<li>glsl: fix cut-n-paste error in error handling. (v2)</li>
<li>glsl: initialise killed_all field.</li>
<li>glsl: fix uninitialised variable from constructor</li>
</ul>
<p>Eric Anholt (4):</p>
<ul>
<li>mesa: Fix the core GL genned-name handling for glBindBufferBase()/Range().</li>
<li>mesa: Fix core GL genned-name handling for glBeginQuery().</li>
<li>mesa: Fix segfault on reading from a missing color read buffer.</li>
<li>i965/gen4: Fix memory leak each time compile_gs_prog() is called.</li>
</ul>
<p>Ian Romanick (2):</p>
<ul>
<li>docs: Add 9.0.1 release md5sums</li>
<li>glsl: Don't add structure fields to the symbol table</li>
</ul>
<p>Johannes Obermayr (4):</p>
<ul>
<li>clover: Install CL headers.</li>
<li>gallium/auxiliary: Add -fno-rtti to CXXFLAGS on LLVM &gt;= 3.2.</li>
<li>clover: Adapt libclc's INCLUDEDIR and LIBEXECDIR to make use of the new introduced libclc.pc.</li>
<li>tests: AM_CPPFLAGS must include $(top_srcdir) instead of $(top_builddir).</li>
</ul>
<p>Jonas Ådahl (1):</p>
<ul>
<li>wayland: Don't cancel a roundtrip when any event is received</li>
</ul>
<p>José Fonseca (1):</p>
<ul>
<li>llvmpipe: Obey back writemask.</li>
</ul>
<p>Kenneth Graunke (8):</p>
<ul>
<li>i965/vs: Fix unit mismatch in scratch base_offset parameter.</li>
<li>i965/vs: Implement register spilling.</li>
<li>mesa: Don't flatten IF statements by default.</li>
<li>glcpp: Don't use infinite lookhead for #define differentiation.</li>
<li>i965/vs: Don't lose the MRF writemask when doing compute-to-MRF.</li>
<li>i965/vs: Preserve the type when copy propagating into an instruction.</li>
<li>mesa: Fix glGetVertexAttribI[u]iv now that we have real integer attribs.</li>
<li>i965: Fix AA Line Distance Mode in 3DSTATE_SF on Ivybridge.</li>
</ul>
<p>Kristian Høgsberg (1):</p>
<ul>
<li>egl/wayland: Add invalidate back in eglSwapBuffers()</li>
</ul>
<p>Maarten Lankhorst (2):</p>
<ul>
<li>makefiles: use configured name for -ldrm* where possible</li>
<li>automake: strip LLVM_CXXFLAGS and LLVM_CPPFLAGS too</li>
</ul>
<p>Marek Olšák (17):</p>
<ul>
<li>st/mesa: fix integer texture border color for some formats (v2)</li>
<li>r300g: fix texture border color for sRGB formats</li>
<li>mesa: bump MAX_VARYING to 32</li>
<li>draw: fix assertion failure in draw_emit_vertex_attr</li>
<li>vbo: fix glVertexAttribI* functions</li>
<li>mesa: add MaxNumLevels to gl_texture_image, remove MaxLog2</li>
<li>mesa: fix error checking of TexStorage(levels) for array and rect textures</li>
<li>st/mesa: fix guessing the base level size</li>
<li>st/mesa: fix computation of last_level during texture creation</li>
<li>st/mesa: fix computation of last_level in GenerateMipmap</li>
<li>r600g: fix streamout on RS780 and RS880</li>
<li>r600g: advertise 32 streamout vec4 outputs</li>
<li>r600g: fix broken streamout if streamout_begin caused a context flush</li>
<li>mesa: fix BlitFramebuffer between linear and sRGB formats</li>
<li>r600g: try to fix streamout for the cases where BURST_COUNT &gt; 0</li>
<li>r600g: always use a tiled resource as the destination of MSAA resolve</li>
<li>mesa: add MaxNumLevels to gl_texture_image, remove MaxLog2</li>
</ul>
<p>Mario Kleiner (1):</p>
<ul>
<li>mesa: Don't glPopAttrib() GL_POINT_SPRITE_COORD_ORIGIN on &lt; OpenGL-2.0</li>
</ul>
<p>Matt Turner (1):</p>
<ul>
<li>glcpp: Reject garbage after #else and #endif tokens</li>
</ul>
<p>Stefan Dösinger (1):</p>
<ul>
<li>r300: Don't disable destination read if the src blend factor needs it</li>
</ul>
<p>Tapani Pälli (1):</p>
<ul>
<li>android: generate matching remap_helper to dispatch table</li>
</ul>
<p>Tom Stellard (1):</p>
<ul>
<li>r600g: Use LOOP_START_DX10 for loops</li>
</ul>
<p>Vinson Lee (1):</p>
<ul>
<li>i915: Fix wrong sizeof argument in i915_update_tex_unit.</li>
</ul>
<p>smoki (2):</p>
<ul>
<li>r200: fix broken tcl lighting</li>
<li>radeon/r200: Fix tcl culling</li>
</ul>
</div>
</body>
</html>

View File

@@ -14,7 +14,7 @@
<iframe src="contents.html"></iframe>
<div class="content">
<h1>Mesa 9.1 Release Notes / date TBD</h1>
<h1>Mesa 9.1 Release Notes / date February 22, 2013</h1>
<p>
Mesa 9.1 is a new development release.
@@ -44,9 +44,19 @@ Note: some of the new features are only available with certain drivers.
</p>
<ul>
<li>GL_ANGLE_texture_compression_dxt3</li>
<li>GL_ANGLE_texture_compression_dxt5</li>
<li>GL_ARB_ES3_compatibility</li>
<li>GL_ARB_internalformat_query</li>
<li>GL_ARB_map_buffer_alignment</li>
<li>GL_ARB_texture_cube_map_array</li>
<li>GL_ARB_shading_language_packing</li>
<li>GL_ARB_texture_buffer_object_rgb32</li>
<li>GL_ARB_texture_cube_map_array</li>
<li>GL_EXT_color_buffer_float</li>
<li>GL_OES_depth_texture_cube_map</li>
<li>OpenGL 3.1 core profile support on Radeon HD2000 up to HD6000 series </li>
<li>Multisample anti-aliasing support on Radeon X1000 series</li>
<li>OpenGL ES 3.0 support on Intel HD Graphics 2000, 2500, 3000, and 4000</li>
</ul>
@@ -63,6 +73,7 @@ Note: some of the new features are only available with certain drivers.
<li>Removed swrast support for GL_NV_vertex_program</li>
<li>Removed swrast support for GL_NV_fragment_program</li>
<li>Removed OpenVMS support (unmaintained and broken)</li>
<li>Removed makedepend build dependency</li>
</ul>
</div>

View File

@@ -22,6 +22,7 @@ The release notes summarize what's new or changed in each Mesa release.
<ul>
<li><a href="relnotes-9.1.html">9.1 release notes</a>
<li><a href="relnotes-9.0.2.html">9.0.2 release notes</a>
<li><a href="relnotes-9.0.1.html">9.0.1 release notes</a>
<li><a href="relnotes-9.0.html">9.0 release notes</a>
<li><a href="relnotes-8.0.5.html">8.0.5 release notes</a>

View File

@@ -98,8 +98,9 @@ Begin by saving your current directory location:
<pre>
git clone git://anongit.freedesktop.org/git/mesa/vmwgfx
</pre>
<li>libdrm, A user-space library that interfaces with drm. Most distros ship with this driver. Safest bet is really to replace the system one. Optionally you can point LIBDRM_CFLAGS and LIBDRM_LIBS to the libdrm-2.4.22 package in toolchain. But here, we replace:
<li>libdrm, a user-space library that interfaces with drm.
Most distros ship with this but it's safest to install a newer version.
To get the latest code from git:
<pre>
git clone git://anongit.freedesktop.org/git/mesa/drm
</pre>
@@ -116,7 +117,7 @@ Begin by saving your current directory location:
<li>Build libdrm: If you're on a 32-bit system, you should skip the --libdir configure option. Note also the comment about toolchain libdrm above.
<pre>
cd $TOP/drm
./autogen.sh --prefix=/usr --enable-vmwgfx-experimental-api --libdir=/usr/lib64
./autogen.sh --prefix=/usr --libdir=/usr/lib64
make
sudo make install
</pre>

View File

@@ -11,8 +11,8 @@ PROJECT_NAME = "Mesa GLSL module"
#---------------------------------------------------------------------------
INPUT = ../src/glsl/
RECURSIVE = NO
EXCLUDE = ../src/glsl/glsl_lexer.cc \
../src/glsl/glsl_parser.cc \
EXCLUDE = ../src/glsl/glsl_lexer.cpp \
../src/glsl/glsl_parser.cpp \
../src/glsl/glsl_parser.h
EXCLUDE_PATTERNS =
#---------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
#define __gl3_h_
/*
* gl3.h last updated on $Date: 2012-09-12 10:13:02 -0700 (Wed, 12 Sep 2012) $
* gl3.h last updated on $Date: 2012-10-03 07:52:40 -0700 (Wed, 03 Oct 2012) $
*/
#include <GLES3/gl3platform.h>
@@ -796,7 +796,7 @@ typedef struct __GLsync *GLsync;
#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
#define GL_MAX_ELEMENT_INDEX 0x8D6B
#define GL_NUM_SAMPLE_COUNTS 0x9380
#define GL_TEXTURE_IMMUTABLE_LEVELS 0x8D63
#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
/*-------------------------------------------------------------------------
* Entrypoint definitions

View File

@@ -46,3 +46,17 @@ CHIPSET(0x6839, VERDE_6839, VERDE)
CHIPSET(0x683B, VERDE_683B, VERDE)
CHIPSET(0x683D, VERDE_683D, VERDE)
CHIPSET(0x683F, VERDE_683F, VERDE)
CHIPSET(0x6600, OLAND_6600, OLAND)
CHIPSET(0x6601, OLAND_6601, OLAND)
CHIPSET(0x6602, OLAND_6602, OLAND)
CHIPSET(0x6603, OLAND_6603, OLAND)
CHIPSET(0x6606, OLAND_6606, OLAND)
CHIPSET(0x6607, OLAND_6607, OLAND)
CHIPSET(0x6610, OLAND_6610, OLAND)
CHIPSET(0x6611, OLAND_6611, OLAND)
CHIPSET(0x6613, OLAND_6613, OLAND)
CHIPSET(0x6620, OLAND_6620, OLAND)
CHIPSET(0x6621, OLAND_6621, OLAND)
CHIPSET(0x6623, OLAND_6623, OLAND)
CHIPSET(0x6631, OLAND_6631, OLAND)

71
m4/ax_prog_bison.m4 Normal file
View File

@@ -0,0 +1,71 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_prog_bison.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PROG_BISON(ACTION-IF-TRUE,ACTION-IF-FALSE)
#
# DESCRIPTION
#
# Check whether bison is the parser generator. Run ACTION-IF-TRUE if
# successful, ACTION-IF-FALSE otherwise
#
# LICENSE
#
# Copyright (c) 2009 Francesco Salvestrini <salvestrini@users.sourceforge.net>
# Copyright (c) 2010 Diego Elio Petteno` <flameeyes@gmail.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 9
# mattst88:
# Modified YACC assignment to remove -o y.tab.c since we're writing
# our own .y/.yy rules.
#
# Replaced m4_ifnblank(...) with m4_ifval(m4_normalize(...), ...)
# since m4_ifnblank requires autoconf-2.64.
AC_DEFUN([AX_PROG_BISON], [
AC_REQUIRE([AC_PROG_YACC])
AC_REQUIRE([AC_PROG_EGREP])
AC_CACHE_CHECK([if bison is the parser generator],[ax_cv_prog_bison],[
AS_IF([$YACC --version 2>/dev/null | $EGREP -q '^bison '],
[ax_cv_prog_bison=yes], [ax_cv_prog_bison=no])
])
AS_IF([test "$ax_cv_prog_bison" = "yes"], [
dnl replace the yacc-compatible compiler with the real bison, as
dnl otherwise autoconf limits us to the POSIX yacc.
dnl We also change the generated filename to the old one, so that
dnl automake's ylwrap can deal with it.
YACC="${YACC% -y}"
] m4_ifval(m4_normalize([$1]), [[$1]]),
m4_ifval(m4_normalize([$2]), [[$2]])
)
])

63
m4/ax_prog_flex.m4 Normal file
View File

@@ -0,0 +1,63 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_prog_flex.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PROG_FLEX(ACTION-IF-TRUE,ACTION-IF-FALSE)
#
# DESCRIPTION
#
# Check whether flex is the scanner generator. Run ACTION-IF-TRUE if
# successful, ACTION-IF-FALSE otherwise
#
# LICENSE
#
# Copyright (c) 2009 Francesco Salvestrini <salvestrini@users.sourceforge.net>
# Copyright (c) 2010 Diego Elio Petteno` <flameeyes@gmail.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 9
# mattst88:
# Replaced m4_ifnblank(...) with m4_ifval(m4_normalize(...), ...)
# since m4_ifnblank requires autoconf-2.64.
AC_DEFUN([AX_PROG_FLEX], [
AC_REQUIRE([AM_PROG_LEX])
AC_REQUIRE([AC_PROG_EGREP])
AC_CACHE_CHECK([if flex is the lexer generator],[ax_cv_prog_flex],[
AS_IF([$LEX --version 2>/dev/null | $EGREP -q '^flex '],
[ax_cv_prog_flex=yes], [ax_cv_prog_flex=no])
])
AS_IF([test "$ax_cv_prog_flex" = "yes"],
m4_ifval(m4_normalize([$1]), [[$1]]),
m4_ifval(m4_normalize([$2]), [[$2]])
)
])

49
m4/ax_python_module.m4 Normal file
View File

@@ -0,0 +1,49 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_python_module.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PYTHON_MODULE(modname[, fatal])
#
# DESCRIPTION
#
# Checks for Python module.
#
# If fatal is non-empty then absence of a module will trigger an error.
#
# LICENSE
#
# Copyright (c) 2008 Andrew Collier
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 6
AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
AC_DEFUN([AX_PYTHON_MODULE],[
if test -z $PYTHON2;
then
PYTHON2="python"
fi
PYTHON_NAME=`basename $PYTHON2`
AC_MSG_CHECKING($PYTHON_NAME module: $1)
$PYTHON2 -c "import $1" 2>/dev/null
if test $? -eq 0;
then
AC_MSG_RESULT(yes)
eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
else
AC_MSG_RESULT(no)
eval AS_TR_CPP(HAVE_PYMOD_$1)=no
#
if test -n "$2"
then
AC_MSG_ERROR(failed to find required module $1)
exit 1
fi
fi
])

View File

@@ -240,6 +240,11 @@ def parse_source_list(env, filename, names=None):
top_srcdir = env.Dir('#').abspath
top_builddir = os.path.join(top_srcdir, env['build_dir'])
# Normalize everything to / slashes
cur_srcdir = cur_srcdir.replace('\\', '/')
top_srcdir = top_srcdir.replace('\\', '/')
top_builddir = top_builddir.replace('\\', '/')
# Populate the symbol table of the Makefile parser.
parser.add_symbol('top_srcdir', top_srcdir)
parser.add_symbol('top_builddir', top_builddir)
@@ -263,8 +268,8 @@ def parse_source_list(env, filename, names=None):
if f:
# Process source paths
if f.startswith(top_builddir + '/src'):
# Automake puts build output on a `src` subdirectory, bue
# SCons does no, so strip it here.
# Automake puts build output on a `src` subdirectory, but
# SCons does not, so strip it here.
f = top_builddir + f[len(top_builddir + '/src'):]
if f.startswith(cur_srcdir + '/'):
# Prefer relative source paths, as absolute files tend to

View File

@@ -361,8 +361,7 @@ def generate(env):
ccflags += [
'-mstackrealign', # ensure stack is aligned
'-march=i586', # Haiku target is Pentium
'-mtune=i686', # use i686 where we can
'-mmmx' # use mmx math where we can
'-mtune=i686' # use i686 where we can
]
if env['machine'] == 'x86_64':
ccflags += ['-m64']
@@ -400,7 +399,6 @@ def generate(env):
ccflags += [
'/Od', # disable optimizations
'/Oi', # enable intrinsic functions
'/Oy-', # disable frame pointer omission
]
else:
ccflags += [
@@ -412,6 +410,7 @@ def generate(env):
]
else:
ccflags += [
'/Oy-', # disable frame pointer omission
'/GL-', # disable whole program optimization
]
ccflags += [
@@ -531,7 +530,7 @@ def generate(env):
env.PkgCheckModules('XF86VIDMODE', ['xxf86vm'])
env.PkgCheckModules('DRM', ['libdrm >= 2.4.24'])
env.PkgCheckModules('DRM_INTEL', ['libdrm_intel >= 2.4.30'])
env.PkgCheckModules('DRM_RADEON', ['libdrm_radeon >= 2.4.40'])
env.PkgCheckModules('DRM_RADEON', ['libdrm_radeon >= 2.4.42'])
env.PkgCheckModules('XORG', ['xorg-server >= 1.6.0'])
env.PkgCheckModules('KMS', ['libkms >= 2.4.24'])
env.PkgCheckModules('UDEV', ['libudev > 150'])

3
src/.gitignore vendored
View File

@@ -1,3 +0,0 @@
/Makefile
*.trs
*.log

1
src/egl/.gitignore vendored
View File

@@ -1 +0,0 @@
/Makefile

View File

@@ -1 +0,0 @@
Makefile

View File

@@ -742,7 +742,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
api = __DRI_API_GLES;
break;
case 2:
api = __DRI_API_GLES3;
api = __DRI_API_GLES2;
break;
case 3:
api = __DRI_API_GLES3;

View File

@@ -172,27 +172,29 @@ struct dri2_egl_surface
#ifdef HAVE_WAYLAND_PLATFORM
struct wl_egl_window *wl_win;
struct wl_egl_pixmap *wl_pix;
struct wl_buffer *wl_drm_buffer[WL_BUFFER_COUNT];
int wl_buffer_lock[WL_BUFFER_COUNT];
int dx;
int dy;
__DRIbuffer *dri_buffers[__DRI_BUFFER_COUNT];
__DRIbuffer *third_buffer;
__DRIbuffer *pending_buffer;
struct wl_callback *frame_callback;
int format;
#endif
#ifdef HAVE_DRM_PLATFORM
struct gbm_dri_surface *gbm_surf;
struct {
struct gbm_bo *bo;
int locked;
} color_buffers[3], *back, *current;
#ifndef HAVE_WAYLAND_PLATFORM
__DRIbuffer *dri_buffers[__DRI_BUFFER_COUNT];
#endif
#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM)
__DRIbuffer *dri_buffers[__DRI_BUFFER_COUNT];
struct {
#ifdef HAVE_WAYLAND_PLATFORM
struct wl_buffer *wl_buffer;
__DRIbuffer *dri_buffer;
#endif
#ifdef HAVE_DRM_PLATFORM
struct gbm_bo *bo;
#endif
int locked;
int age;
} color_buffers[3], *back, *current;
#endif
#ifdef HAVE_ANDROID_PLATFORM

View File

@@ -324,11 +324,16 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
int i;
if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
if (dri2_surf->current)
_eglError(EGL_BAD_SURFACE, "dri2_swap_buffers");
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
if (dri2_surf->color_buffers[i].age > 0)
dri2_surf->color_buffers[i].age++;
dri2_surf->current = dri2_surf->back;
dri2_surf->current->age = 1;
dri2_surf->back = NULL;
}
@@ -338,6 +343,21 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
return EGL_TRUE;
}
static EGLint
dri2_query_buffer_age(_EGLDriver *drv,
_EGLDisplay *disp, _EGLSurface *surface)
{
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
__DRIbuffer buffer;
if (get_back_bo(dri2_surf, &buffer) < 0) {
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
return 0;
}
return dri2_surf->back->age;
}
static _EGLImage *
dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer buffer, const EGLint *attr_list)
@@ -464,6 +484,9 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
drv->API.DestroySurface = dri2_destroy_surface;
drv->API.SwapBuffers = dri2_swap_buffers;
drv->API.CreateImageKHR = dri2_drm_create_image_khr;
drv->API.QueryBufferAge = dri2_query_buffer_age;
disp->Extensions.EXT_buffer_age = EGL_TRUE;
#ifdef HAVE_WAYLAND_PLATFORM
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2011 Intel Corporation
* Copyright © 2011-2012 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -82,18 +82,16 @@ wl_buffer_release(void *data, struct wl_buffer *buffer)
struct dri2_egl_surface *dri2_surf = data;
int i;
for (i = 0; i < WL_BUFFER_COUNT; ++i)
if (dri2_surf->wl_drm_buffer[i] == buffer)
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); ++i)
if (dri2_surf->color_buffers[i].wl_buffer == buffer)
break;
assert(i <= WL_BUFFER_COUNT);
/* not found? */
if (i == WL_BUFFER_COUNT)
if (i == ARRAY_SIZE(dri2_surf->color_buffers)) {
wl_buffer_destroy(buffer);
return;
}
dri2_surf->wl_buffer_lock[i] = 0;
dri2_surf->color_buffers[i].locked = 0;
}
static struct wl_buffer_listener wl_buffer_listener = {
@@ -121,7 +119,6 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
struct dri2_egl_surface *dri2_surf;
int i;
(void) drv;
@@ -131,21 +128,10 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
return NULL;
}
memset(dri2_surf, 0, sizeof *dri2_surf);
if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list))
goto cleanup_surf;
for (i = 0; i < WL_BUFFER_COUNT; ++i) {
dri2_surf->wl_drm_buffer[i] = NULL;
dri2_surf->wl_buffer_lock[i] = 0;
}
for (i = 0; i < __DRI_BUFFER_COUNT; ++i)
dri2_surf->dri_buffers[i] = NULL;
dri2_surf->pending_buffer = NULL;
dri2_surf->third_buffer = NULL;
dri2_surf->frame_callback = NULL;
if (conf->AlphaSize == 0)
dri2_surf->format = WL_DRM_FORMAT_XRGB8888;
else
@@ -215,24 +201,23 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
(*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable);
for (i = 0; i < WL_BUFFER_COUNT; ++i)
if (dri2_surf->wl_drm_buffer[i])
wl_buffer_destroy(dri2_surf->wl_drm_buffer[i]);
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
if (dri2_surf->color_buffers[i].wl_buffer)
wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer);
if (dri2_surf->color_buffers[i].dri_buffer)
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->color_buffers[i].dri_buffer);
}
for (i = 0; i < __DRI_BUFFER_COUNT; ++i)
if (dri2_surf->dri_buffers[i])
for (i = 0; i < __DRI_BUFFER_COUNT; i++)
if (dri2_surf->dri_buffers[i] &&
dri2_surf->dri_buffers[i]->attachment != __DRI_BUFFER_BACK_LEFT)
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->dri_buffers[i]);
if (dri2_surf->third_buffer) {
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->third_buffer);
}
if (dri2_surf->frame_callback)
wl_callback_destroy(dri2_surf->frame_callback);
if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
dri2_surf->wl_win->private = NULL;
dri2_surf->wl_win->resize_callback = NULL;
@@ -243,173 +228,96 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
return EGL_TRUE;
}
static struct wl_buffer *
wayland_create_buffer(struct dri2_egl_surface *dri2_surf,
__DRIbuffer *buffer)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
struct wl_buffer *buf;
buf = wl_drm_create_buffer(dri2_dpy->wl_drm, buffer->name,
dri2_surf->base.Width, dri2_surf->base.Height,
buffer->pitch, dri2_surf->format);
wl_buffer_add_listener(buf, &wl_buffer_listener, dri2_surf);
return buf;
}
static void
dri2_process_back_buffer(struct dri2_egl_surface *dri2_surf, unsigned format)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
(void) format;
switch (dri2_surf->base.Type) {
case EGL_WINDOW_BIT:
/* allocate a front buffer for our double-buffered window*/
if (dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT] != NULL)
break;
dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT] =
dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen,
__DRI_BUFFER_FRONT_LEFT, format,
dri2_surf->base.Width, dri2_surf->base.Height);
break;
default:
break;
}
}
static void
dri2_release_pending_buffer(void *data,
struct wl_callback *callback, uint32_t time)
{
struct dri2_egl_surface *dri2_surf = data;
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
/* FIXME: print internal error */
if (!dri2_surf->pending_buffer)
return;
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->pending_buffer);
dri2_surf->pending_buffer = NULL;
wl_callback_destroy(callback);
}
static const struct wl_callback_listener release_buffer_listener = {
dri2_release_pending_buffer
};
static void
dri2_release_buffers(struct dri2_egl_surface *dri2_surf)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
struct wl_callback *callback;
int i;
if (dri2_surf->third_buffer) {
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->third_buffer);
dri2_surf->third_buffer = NULL;
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
if (dri2_surf->color_buffers[i].wl_buffer &&
!dri2_surf->color_buffers[i].locked)
wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer);
if (dri2_surf->color_buffers[i].dri_buffer)
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->color_buffers[i].dri_buffer);
dri2_surf->color_buffers[i].wl_buffer = NULL;
dri2_surf->color_buffers[i].dri_buffer = NULL;
dri2_surf->color_buffers[i].locked = 0;
}
for (i = 0; i < __DRI_BUFFER_COUNT; ++i) {
if (dri2_surf->dri_buffers[i]) {
switch (i) {
case __DRI_BUFFER_FRONT_LEFT:
if (dri2_surf->pending_buffer)
roundtrip(dri2_dpy);
dri2_surf->pending_buffer = dri2_surf->dri_buffers[i];
callback = wl_display_sync(dri2_dpy->wl_dpy);
wl_callback_add_listener(callback,
&release_buffer_listener, dri2_surf);
wl_proxy_set_queue((struct wl_proxy *) callback,
dri2_dpy->wl_queue);
break;
default:
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->dri_buffers[i]);
break;
}
dri2_surf->dri_buffers[i] = NULL;
}
}
for (i = 0; i < __DRI_BUFFER_COUNT; i++)
if (dri2_surf->dri_buffers[i] &&
dri2_surf->dri_buffers[i]->attachment != __DRI_BUFFER_BACK_LEFT)
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->dri_buffers[i]);
}
static inline void
pointer_swap(const void **p1, const void **p2)
{
const void *tmp = *p1;
*p1 = *p2;
*p2 = tmp;
}
static void
destroy_third_buffer(struct dri2_egl_surface *dri2_surf)
static int
get_back_bo(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
int i;
if (dri2_surf->third_buffer == NULL)
return;
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->third_buffer);
dri2_surf->third_buffer = NULL;
if (dri2_surf->wl_drm_buffer[WL_BUFFER_THIRD])
wl_buffer_destroy(dri2_surf->wl_drm_buffer[WL_BUFFER_THIRD]);
dri2_surf->wl_drm_buffer[WL_BUFFER_THIRD] = NULL;
dri2_surf->wl_buffer_lock[WL_BUFFER_THIRD] = 0;
}
static void
swap_wl_buffers(struct dri2_egl_surface *dri2_surf,
enum wayland_buffer_type a, enum wayland_buffer_type b)
{
int tmp;
tmp = dri2_surf->wl_buffer_lock[a];
dri2_surf->wl_buffer_lock[a] = dri2_surf->wl_buffer_lock[b];
dri2_surf->wl_buffer_lock[b] = tmp;
pointer_swap((const void **) &dri2_surf->wl_drm_buffer[a],
(const void **) &dri2_surf->wl_drm_buffer[b]);
}
static void
swap_back_and_third(struct dri2_egl_surface *dri2_surf)
{
if (dri2_surf->wl_buffer_lock[WL_BUFFER_THIRD])
destroy_third_buffer(dri2_surf);
pointer_swap((const void **) &dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT],
(const void **) &dri2_surf->third_buffer);
swap_wl_buffers(dri2_surf, WL_BUFFER_BACK, WL_BUFFER_THIRD);
}
static void
dri2_prior_buffer_creation(struct dri2_egl_surface *dri2_surf,
unsigned int type)
{
switch (type) {
case __DRI_BUFFER_BACK_LEFT:
if (dri2_surf->wl_buffer_lock[WL_BUFFER_BACK])
swap_back_and_third(dri2_surf);
else if (dri2_surf->third_buffer)
destroy_third_buffer(dri2_surf);
break;
default:
break;
/* There might be a buffer release already queued that wasn't processed */
wl_display_dispatch_queue_pending(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
if (dri2_surf->back == NULL) {
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
/* Get an unlocked buffer, preferrably one with a dri_buffer already
* allocated. */
if (dri2_surf->color_buffers[i].locked)
continue;
if (dri2_surf->back == NULL)
dri2_surf->back = &dri2_surf->color_buffers[i];
else if (dri2_surf->back->dri_buffer == NULL)
dri2_surf->back = &dri2_surf->color_buffers[i];
}
}
if (dri2_surf->back == NULL)
return -1;
if (dri2_surf->back->dri_buffer == NULL) {
dri2_surf->back->dri_buffer =
dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen,
__DRI_BUFFER_BACK_LEFT, 32,
dri2_surf->base.Width,
dri2_surf->base.Height);
dri2_surf->back->age = 0;
}
if (dri2_surf->back->dri_buffer == NULL)
return -1;
dri2_surf->back->locked = 1;
memcpy(buffer, dri2_surf->back->dri_buffer, sizeof *buffer);
return 0;
}
static int
get_aux_bo(struct dri2_egl_surface *dri2_surf,
unsigned int attachment, unsigned int format, __DRIbuffer *buffer)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
__DRIbuffer *b = dri2_surf->dri_buffers[attachment];
if (b == NULL) {
b = dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen,
attachment, format,
dri2_surf->base.Width,
dri2_surf->base.Height);
dri2_surf->dri_buffers[attachment] = b;
}
if (b == NULL)
return -1;
memcpy(buffer, b, sizeof *buffer);
return 0;
}
static __DRIbuffer *
@@ -421,10 +329,7 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
struct dri2_egl_surface *dri2_surf = loaderPrivate;
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
int i;
/* There might be a buffer release already queued that wasn't processed */
wl_display_dispatch_queue_pending(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
int i, j;
if (dri2_surf->base.Type == EGL_WINDOW_BIT &&
(dri2_surf->base.Width != dri2_surf->wl_win->width ||
@@ -436,47 +341,42 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
dri2_surf->base.Height = dri2_surf->wl_win->height;
dri2_surf->dx = dri2_surf->wl_win->dx;
dri2_surf->dy = dri2_surf->wl_win->dy;
}
for (i = 0; i < WL_BUFFER_COUNT; ++i) {
if (dri2_surf->wl_drm_buffer[i])
wl_buffer_destroy(dri2_surf->wl_drm_buffer[i]);
dri2_surf->wl_drm_buffer[i] = NULL;
dri2_surf->wl_buffer_lock[i] = 0;
for (i = 0, j = 0; i < 2 * count; i += 2, j++) {
switch (attachments[i]) {
case __DRI_BUFFER_BACK_LEFT:
if (get_back_bo(dri2_surf, &dri2_surf->buffers[j]) < 0) {
_eglError(EGL_BAD_ALLOC, "failed to allocate color buffer");
return NULL;
}
break;
default:
if (get_aux_bo(dri2_surf, attachments[i], attachments[i + 1],
&dri2_surf->buffers[j]) < 0) {
_eglError(EGL_BAD_ALLOC, "failed to allocate aux buffer");
return NULL;
}
break;
}
}
dri2_surf->buffer_count = 0;
for (i = 0; i < 2*count; i+=2) {
assert(attachments[i] < __DRI_BUFFER_COUNT);
assert(dri2_surf->buffer_count < 5);
dri2_prior_buffer_creation(dri2_surf, attachments[i]);
if (dri2_surf->dri_buffers[attachments[i]] == NULL) {
dri2_surf->dri_buffers[attachments[i]] =
dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen,
attachments[i], attachments[i+1],
dri2_surf->base.Width, dri2_surf->base.Height);
if (!dri2_surf->dri_buffers[attachments[i]])
continue;
if (attachments[i] == __DRI_BUFFER_BACK_LEFT)
dri2_process_back_buffer(dri2_surf, attachments[i+1]);
/* If we have an extra unlocked buffer at this point, we had to do triple
* buffering for a while, but now can go back to just double buffering.
* That means we can free any unlocked buffer now. */
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
if (!dri2_surf->color_buffers[i].locked &&
dri2_surf->color_buffers[i].wl_buffer) {
wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer);
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->color_buffers[i].dri_buffer);
dri2_surf->color_buffers[i].wl_buffer = NULL;
dri2_surf->color_buffers[i].dri_buffer = NULL;
}
memcpy(&dri2_surf->buffers[dri2_surf->buffer_count],
dri2_surf->dri_buffers[attachments[i]],
sizeof(__DRIbuffer));
dri2_surf->buffer_count++;
}
assert(dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]);
*out_count = dri2_surf->buffer_count;
if (dri2_surf->buffer_count == 0)
*out_count = j;
if (j == 0)
return NULL;
*width = dri2_surf->base.Width;
@@ -546,7 +446,8 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
int ret = 0;
__DRIbuffer buffer;
int i, ret = 0;
while (dri2_surf->frame_callback && ret != -1)
ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
@@ -559,46 +460,71 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
wl_proxy_set_queue((struct wl_proxy *) dri2_surf->frame_callback,
dri2_dpy->wl_queue);
if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
pointer_swap(
(const void **) &dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT],
(const void **) &dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]);
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
if (dri2_surf->color_buffers[i].age > 0)
dri2_surf->color_buffers[i].age++;
dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT]->attachment =
__DRI_BUFFER_FRONT_LEFT;
dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]->attachment =
__DRI_BUFFER_BACK_LEFT;
swap_wl_buffers(dri2_surf, WL_BUFFER_FRONT, WL_BUFFER_BACK);
if (!dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT])
dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT] =
wayland_create_buffer(dri2_surf,
dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT]);
wl_surface_attach(dri2_surf->wl_win->surface,
dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT],
dri2_surf->dx, dri2_surf->dy);
dri2_surf->wl_buffer_lock[WL_BUFFER_FRONT] = 1;
dri2_surf->wl_win->attached_width = dri2_surf->base.Width;
dri2_surf->wl_win->attached_height = dri2_surf->base.Height;
/* reset resize growing parameters */
dri2_surf->dx = 0;
dri2_surf->dy = 0;
wl_surface_damage(dri2_surf->wl_win->surface, 0, 0,
dri2_surf->base.Width, dri2_surf->base.Height);
wl_surface_commit(dri2_surf->wl_win->surface);
/* Make sure we have a back buffer in case we're swapping without ever
* rendering. */
if (get_back_bo(dri2_surf, &buffer) < 0) {
_eglError(EGL_BAD_ALLOC, "dri2_swap_buffers");
return EGL_FALSE;
}
dri2_surf->back->age = 1;
dri2_surf->current = dri2_surf->back;
dri2_surf->back = NULL;
if (dri2_surf->current->wl_buffer == NULL) {
dri2_surf->current->wl_buffer =
wl_drm_create_buffer(dri2_dpy->wl_drm,
dri2_surf->current->dri_buffer->name,
dri2_surf->base.Width,
dri2_surf->base.Height,
dri2_surf->current->dri_buffer->pitch,
dri2_surf->format);
wl_proxy_set_queue((struct wl_proxy *) dri2_surf->current->wl_buffer,
dri2_dpy->wl_queue);
wl_buffer_add_listener(dri2_surf->current->wl_buffer,
&wl_buffer_listener, dri2_surf);
}
wl_surface_attach(dri2_surf->wl_win->surface,
dri2_surf->current->wl_buffer,
dri2_surf->dx, dri2_surf->dy);
dri2_surf->wl_win->attached_width = dri2_surf->base.Width;
dri2_surf->wl_win->attached_height = dri2_surf->base.Height;
/* reset resize growing parameters */
dri2_surf->dx = 0;
dri2_surf->dy = 0;
wl_surface_damage(dri2_surf->wl_win->surface, 0, 0,
dri2_surf->base.Width, dri2_surf->base.Height);
wl_surface_commit(dri2_surf->wl_win->surface);
(*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);
return EGL_TRUE;
}
static EGLint
dri2_query_buffer_age(_EGLDriver *drv,
_EGLDisplay *disp, _EGLSurface *surface)
{
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
__DRIbuffer buffer;
if (get_back_bo(dri2_surf, &buffer) < 0) {
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
return 0;
}
return dri2_surf->back->age;
}
static int
dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
{
@@ -736,6 +662,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
drv->API.DestroySurface = dri2_destroy_surface;
drv->API.SwapBuffers = dri2_swap_buffers;
drv->API.Terminate = dri2_terminate;
drv->API.QueryBufferAge = dri2_query_buffer_age;
dri2_dpy = calloc(1, sizeof *dri2_dpy);
if (!dri2_dpy)
@@ -800,6 +727,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
}
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
disp->Extensions.EXT_buffer_age = EGL_TRUE;
dri2_dpy->authenticate = dri2_wayland_authenticate;
/* we're supporting EGL 1.4 */

View File

@@ -1 +0,0 @@
Makefile

View File

@@ -1,4 +1,3 @@
Makefile
wayland-drm-client-protocol.h
wayland-drm-server-protocol.h
wayland-drm-protocol.c

View File

@@ -1 +0,0 @@
/Makefile

5
src/gallium/Automake.inc Normal file
View File

@@ -0,0 +1,5 @@
GALLIUM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/gallium/include \
-I$(top_srcdir)/src/gallium/auxiliary \
$(DEFINES)

View File

@@ -1,73 +0,0 @@
# src/gallium/Makefile.template
# Template makefile for gallium libraries.
#
# Usage:
# The minimum that the including makefile needs to define
# is TOP, LIBNAME and one of of the *_SOURCES.
#
# Optional defines:
# LIBRARY_INCLUDES are appended to the list of includes directories.
# LIBRARY_DEFINES is not used for makedepend, but for compilation.
### Basic defines ###
OBJECTS = $(C_SOURCES:.c=.o) \
$(CPP_SOURCES:.cpp=.o) \
$(ASM_SOURCES:.S=.o)
INCLUDES = \
-I. \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/auxiliary \
-I$(TOP)/src/gallium/drivers \
$(LIBRARY_INCLUDES)
ifeq ($(MESA_LLVM),1)
LIBRARY_DEFINES += $(LLVM_CFLAGS)
endif
##### TARGETS #####
default: depend lib$(LIBNAME).a $(PROGS)
lib$(LIBNAME).a: $(OBJECTS) $(EXTRA_OBJECTS) Makefile $(TOP)/src/gallium/Makefile.template
$(MKLIB) -o $(LIBNAME) -static $(OBJECTS) $(EXTRA_OBJECTS)
depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES)
rm -f depend
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2> /dev/null
$(PROGS): % : %.o $(PROGS_DEPS)
$(LD) $(LDFLAGS) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group
# Emacs tags
tags:
etags `find . -name \*.[ch]` `find $(TOP)/src/gallium/include -name \*.h`
# Remove .o and backup files
clean:
rm -f $(OBJECTS) $(GENERATED_SOURCES) $(PROGS) lib$(LIBNAME).a depend depend.bak $(CLEAN_EXTRA)
# Dummy target
install:
@echo -n ""
##### RULES #####
%.s: %.c
$(CC) -S $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@
%.o: %.c
$(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@
%.o: %.cpp
$(CXX) -c $(INCLUDES) $(CXXFLAGS) $(LIBRARY_DEFINES) $< -o $@
%.o: %.S
$(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@
sinclude depend

View File

@@ -1,47 +0,0 @@
TOP = ../../..
include $(TOP)/configs/current
LIBNAME = gallium
# get source lists
include Makefile.sources
C_SOURCES += $(GENERATED_SOURCES)
ifeq ($(MESA_LLVM),1)
C_SOURCES += \
$(GALLIVM_SOURCES)
CPP_SOURCES += \
$(GALLIVM_CPP_SOURCES)
# LLVM >= 3.2 requires -fno-rtti
ifeq ($(shell expr `echo $(LLVM_VERSION) | sed -e 's/\([0-9]\)\.\([0-9]\)/\10\2/g'` \>= 302),1)
CXXFLAGS += -fno-rtti
endif
endif
include ../Makefile.template
default install clean: %: subdirs-%
subdirs-%:
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE) $*) || exit 1; \
fi \
done
indices/u_indices_gen.c: indices/u_indices_gen.py
$(PYTHON2) $< > $@
indices/u_unfilled_gen.c: indices/u_unfilled_gen.py
$(PYTHON2) $< > $@
util/u_format_srgb.c: util/u_format_srgb.py
$(PYTHON2) $< > $@
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 > $@
# DO NOT DELETE

View File

@@ -0,0 +1,47 @@
AUTOMAKE_OPTIONS = subdir-objects
include Makefile.sources
include $(top_srcdir)/src/gallium/Automake.inc
noinst_LTLIBRARIES = libgallium.la
AM_CFLAGS = \
-I$(top_srcdir)/src/gallium/auxiliary/util \
$(GALLIUM_CFLAGS)
libgallium_la_SOURCES = \
$(C_SOURCES) \
$(GENERATED_SOURCES)
if HAVE_MESA_LLVM
AM_CFLAGS += \
$(LLVM_CFLAGS)
AM_CXXFLAGS = \
$(GALLIUM_CFLAGS) \
$(LLVM_CXXFLAGS)
if LLVM_NEEDS_FNORTTI
AM_CXXFLAGS += -fno-rtti
endif
libgallium_la_SOURCES += \
$(GALLIVM_SOURCES) \
$(GALLIVM_CPP_SOURCES)
endif
indices/u_indices_gen.c: $(srcdir)/indices/u_indices_gen.py
$(AM_V_GEN) $(PYTHON2) $< > $@
indices/u_unfilled_gen.c: $(srcdir)/indices/u_unfilled_gen.py
$(AM_V_GEN) $(PYTHON2) $< > $@
util/u_format_srgb.c: $(srcdir)/util/u_format_srgb.py
$(AM_V_GEN) $(PYTHON2) $< > $@
util/u_format_table.c: $(srcdir)/util/u_format_table.py $(srcdir)/util/u_format_pack.py $(srcdir)/util/u_format_parse.py $(srcdir)/util/u_format.csv
$(AM_V_GEN) $(PYTHON2) $(srcdir)/util/u_format_table.py $(srcdir)/util/u_format.csv > $@

View File

@@ -36,7 +36,6 @@ C_SOURCES := \
draw/draw_vertex.c \
draw/draw_vs.c \
draw/draw_vs_exec.c \
draw/draw_vs_ppc.c \
draw/draw_vs_variant.c \
os/os_misc.c \
os/os_time.c \
@@ -64,7 +63,6 @@ C_SOURCES := \
rbug/rbug_shader.c \
rtasm/rtasm_cpu.c \
rtasm/rtasm_execmem.c \
rtasm/rtasm_ppc.c \
rtasm/rtasm_x86sse.c \
tgsi/tgsi_build.c \
tgsi/tgsi_dump.c \
@@ -72,7 +70,6 @@ C_SOURCES := \
tgsi/tgsi_info.c \
tgsi/tgsi_iterate.c \
tgsi/tgsi_parse.c \
tgsi/tgsi_ppc.c \
tgsi/tgsi_sanity.c \
tgsi/tgsi_scan.c \
tgsi/tgsi_strings.c \

View File

@@ -129,6 +129,10 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
need_pipeline |= out->clipmask;
}
/*
* Transform the vertex position from clip coords to window coords,
* if the vertex is unclipped.
*/
if ((flags & DO_VIEWPORT) && mask == 0)
{
/* divide by w */
@@ -140,6 +144,18 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
position[2] = position[2] * w * scale[2] + trans[2];
position[3] = w;
}
#ifdef DEBUG
/* For debug builds, set the clipped vertex's window coordinate
* to NaN to help catch potential errors later.
*/
else {
float zero = 0.0f;
position[0] =
position[1] =
position[2] =
position[3] = zero / zero; /* MSVC doesn't accept 0.0 / 0.0 */
}
#endif
if ((flags & DO_EDGEFLAG) && ef) {
const float *edgeflag = out->data[ef];

View File

@@ -762,11 +762,11 @@ draw_set_sampler_views(struct draw_context *draw,
unsigned i;
debug_assert(shader_stage < PIPE_SHADER_TYPES);
debug_assert(num <= PIPE_MAX_SAMPLERS);
debug_assert(num <= PIPE_MAX_SHADER_SAMPLER_VIEWS);
for (i = 0; i < num; ++i)
draw->sampler_views[shader_stage][i] = views[i];
for (i = num; i < PIPE_MAX_SAMPLERS; ++i)
for (i = num; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; ++i)
draw->sampler_views[shader_stage][i] = NULL;
draw->num_sampler_views[shader_stage] = num;

View File

@@ -85,11 +85,6 @@ create_jit_texture_type(struct gallivm_state *gallivm, const char *struct_name)
elem_types[DRAW_JIT_TEXTURE_IMG_STRIDE] =
elem_types[DRAW_JIT_TEXTURE_MIP_OFFSETS] =
LLVMArrayType(int32_type, PIPE_MAX_TEXTURE_LEVELS);
elem_types[DRAW_JIT_TEXTURE_MIN_LOD] =
elem_types[DRAW_JIT_TEXTURE_MAX_LOD] =
elem_types[DRAW_JIT_TEXTURE_LOD_BIAS] = LLVMFloatTypeInContext(gallivm->context);
elem_types[DRAW_JIT_TEXTURE_BORDER_COLOR] =
LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
texture_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
@@ -130,18 +125,6 @@ create_jit_texture_type(struct gallivm_state *gallivm, const char *struct_name)
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, mip_offsets,
target, texture_type,
DRAW_JIT_TEXTURE_MIP_OFFSETS);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, min_lod,
target, texture_type,
DRAW_JIT_TEXTURE_MIN_LOD);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, max_lod,
target, texture_type,
DRAW_JIT_TEXTURE_MAX_LOD);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, lod_bias,
target, texture_type,
DRAW_JIT_TEXTURE_LOD_BIAS);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, border_color,
target, texture_type,
DRAW_JIT_TEXTURE_BORDER_COLOR);
LP_CHECK_STRUCT_SIZE(struct draw_jit_texture, target, texture_type);
@@ -150,15 +133,63 @@ create_jit_texture_type(struct gallivm_state *gallivm, const char *struct_name)
/**
* Create LLVM type for struct draw_jit_texture
* Create LLVM type for struct draw_jit_sampler
*/
static LLVMTypeRef
create_jit_sampler_type(struct gallivm_state *gallivm, const char *struct_name)
{
LLVMTargetDataRef target = gallivm->target;
LLVMTypeRef sampler_type;
LLVMTypeRef elem_types[DRAW_JIT_SAMPLER_NUM_FIELDS];
elem_types[DRAW_JIT_SAMPLER_MIN_LOD] =
elem_types[DRAW_JIT_SAMPLER_MAX_LOD] =
elem_types[DRAW_JIT_SAMPLER_LOD_BIAS] = LLVMFloatTypeInContext(gallivm->context);
elem_types[DRAW_JIT_SAMPLER_BORDER_COLOR] =
LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
sampler_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
#if HAVE_LLVM < 0x0300
LLVMAddTypeName(gallivm->module, struct_name, sampler_type);
/* Make sure the target's struct layout cache doesn't return
* stale/invalid data.
*/
LLVMInvalidateStructLayout(gallivm->target, sampler_type);
#endif
LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, min_lod,
target, sampler_type,
DRAW_JIT_SAMPLER_MIN_LOD);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, max_lod,
target, sampler_type,
DRAW_JIT_SAMPLER_MAX_LOD);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, lod_bias,
target, sampler_type,
DRAW_JIT_SAMPLER_LOD_BIAS);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, border_color,
target, sampler_type,
DRAW_JIT_SAMPLER_BORDER_COLOR);
LP_CHECK_STRUCT_SIZE(struct draw_jit_sampler, target, sampler_type);
return sampler_type;
}
/**
* Create LLVM type for struct draw_jit_context
*/
static LLVMTypeRef
create_jit_context_type(struct gallivm_state *gallivm,
LLVMTypeRef texture_type, const char *struct_name)
LLVMTypeRef texture_type, LLVMTypeRef sampler_type,
const char *struct_name)
{
LLVMTargetDataRef target = gallivm->target;
LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
LLVMTypeRef elem_types[5];
LLVMTypeRef elem_types[6];
LLVMTypeRef context_type;
elem_types[0] = LLVMArrayType(LLVMPointerType(float_type, 0), /* vs_constants */
@@ -168,7 +199,9 @@ create_jit_context_type(struct gallivm_state *gallivm,
DRAW_TOTAL_CLIP_PLANES), 0);
elem_types[3] = LLVMPointerType(float_type, 0); /* viewport */
elem_types[4] = LLVMArrayType(texture_type,
PIPE_MAX_SAMPLERS); /* textures */
PIPE_MAX_SHADER_SAMPLER_VIEWS); /* textures */
elem_types[5] = LLVMArrayType(sampler_type,
PIPE_MAX_SAMPLERS); /* samplers */
context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
#if HAVE_LLVM < 0x0300
@@ -183,9 +216,14 @@ create_jit_context_type(struct gallivm_state *gallivm,
target, context_type, 1);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, planes,
target, context_type, 2);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, viewport,
target, context_type, 3);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, textures,
target, context_type,
DRAW_JIT_CTX_TEXTURES);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, samplers,
target, context_type,
DRAW_JIT_CTX_SAMPLERS);
LP_CHECK_STRUCT_SIZE(struct draw_jit_context,
target, context_type);
@@ -291,11 +329,13 @@ static void
create_jit_types(struct draw_llvm_variant *variant)
{
struct gallivm_state *gallivm = variant->gallivm;
LLVMTypeRef texture_type, context_type, buffer_type, vb_type;
LLVMTypeRef texture_type, sampler_type, context_type, buffer_type, vb_type;
texture_type = create_jit_texture_type(gallivm, "texture");
sampler_type = create_jit_sampler_type(gallivm, "sampler");
context_type = create_jit_context_type(gallivm, texture_type, "draw_jit_context");
context_type = create_jit_context_type(gallivm, texture_type, sampler_type,
"draw_jit_context");
variant->context_ptr_type = LLVMPointerType(context_type, 0);
buffer_type = LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 8), 0);
@@ -1319,7 +1359,7 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
{
unsigned i;
struct draw_llvm_variant_key *key;
struct lp_sampler_static_state *sampler;
struct draw_sampler_static_state *draw_sampler;
key = (struct draw_llvm_variant_key *)store;
@@ -1345,19 +1385,29 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
* sampler array.
*/
key->nr_samplers = llvm->draw->vs.vertex_shader->info.file_max[TGSI_FILE_SAMPLER] + 1;
if (llvm->draw->vs.vertex_shader->info.file_max[TGSI_FILE_SAMPLER_VIEW] != -1) {
key->nr_sampler_views =
llvm->draw->vs.vertex_shader->info.file_max[TGSI_FILE_SAMPLER_VIEW] + 1;
}
else {
key->nr_sampler_views = key->nr_samplers;
}
sampler = draw_llvm_variant_key_samplers(key);
draw_sampler = draw_llvm_variant_key_samplers(key);
memcpy(key->vertex_element,
llvm->draw->pt.vertex_element,
sizeof(struct pipe_vertex_element) * key->nr_vertex_elements);
memset(sampler, 0, key->nr_samplers * sizeof *sampler);
memset(draw_sampler, 0, MAX2(key->nr_samplers, key->nr_sampler_views) * sizeof *draw_sampler);
for (i = 0 ; i < key->nr_samplers; i++) {
lp_sampler_static_state(&sampler[i],
llvm->draw->sampler_views[PIPE_SHADER_VERTEX][i],
llvm->draw->samplers[PIPE_SHADER_VERTEX][i]);
lp_sampler_static_sampler_state(&draw_sampler[i].sampler_state,
llvm->draw->samplers[PIPE_SHADER_VERTEX][i]);
}
for (i = 0 ; i < key->nr_sampler_views; i++) {
lp_sampler_static_texture_state(&draw_sampler[i].texture_state,
llvm->draw->sampler_views[PIPE_SHADER_VERTEX][i]);
}
return key;
@@ -1368,7 +1418,7 @@ void
draw_llvm_dump_variant_key(struct draw_llvm_variant_key *key)
{
unsigned i;
struct lp_sampler_static_state *sampler = draw_llvm_variant_key_samplers(key);
struct draw_sampler_static_state *sampler = draw_llvm_variant_key_samplers(key);
debug_printf("clamp_vertex_color = %u\n", key->clamp_vertex_color);
debug_printf("clip_xy = %u\n", key->clip_xy);
@@ -1386,8 +1436,8 @@ draw_llvm_dump_variant_key(struct draw_llvm_variant_key *key)
debug_printf("vertex_element[%i].src_format = %s\n", i, util_format_name(key->vertex_element[i].src_format));
}
for (i = 0 ; i < key->nr_samplers; i++) {
debug_printf("sampler[%i].src_format = %s\n", i, util_format_name(sampler[i].format));
for (i = 0 ; i < key->nr_sampler_views; i++) {
debug_printf("sampler[%i].src_format = %s\n", i, util_format_name(sampler[i].texture_state.format));
}
}
@@ -1430,15 +1480,15 @@ draw_llvm_set_sampler_state(struct draw_context *draw)
unsigned i;
for (i = 0; i < draw->num_samplers[PIPE_SHADER_VERTEX]; i++) {
struct draw_jit_texture *jit_tex = &draw->llvm->jit_context.textures[i];
struct draw_jit_sampler *jit_sam = &draw->llvm->jit_context.samplers[i];
if (draw->samplers[i]) {
const struct pipe_sampler_state *s
= draw->samplers[PIPE_SHADER_VERTEX][i];
jit_tex->min_lod = s->min_lod;
jit_tex->max_lod = s->max_lod;
jit_tex->lod_bias = s->lod_bias;
COPY_4V(jit_tex->border_color, s->border_color.f);
jit_sam->min_lod = s->min_lod;
jit_sam->max_lod = s->max_lod;
jit_sam->lod_bias = s->lod_bias;
COPY_4V(jit_sam->border_color, s->border_color.f);
}
}
}

View File

@@ -52,12 +52,30 @@ struct draw_jit_texture
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS];
};
struct draw_sampler_static_state
{
/*
* These attributes are effectively interleaved for more sane key handling.
* However, there might be lots of null space if the amount of samplers and
* textures isn't the same.
*/
struct lp_static_sampler_state sampler_state;
struct lp_static_texture_state texture_state;
};
struct draw_jit_sampler
{
float min_lod;
float max_lod;
float lod_bias;
float border_color[4];
};
enum {
DRAW_JIT_TEXTURE_WIDTH = 0,
DRAW_JIT_TEXTURE_HEIGHT,
@@ -68,13 +86,19 @@ enum {
DRAW_JIT_TEXTURE_ROW_STRIDE,
DRAW_JIT_TEXTURE_IMG_STRIDE,
DRAW_JIT_TEXTURE_MIP_OFFSETS,
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 */
};
enum {
DRAW_JIT_SAMPLER_MIN_LOD,
DRAW_JIT_SAMPLER_MAX_LOD,
DRAW_JIT_SAMPLER_LOD_BIAS,
DRAW_JIT_SAMPLER_BORDER_COLOR,
DRAW_JIT_SAMPLER_NUM_FIELDS /* number of fields above */
};
enum {
DRAW_JIT_VERTEX_VERTEX_ID = 0,
DRAW_JIT_VERTEX_CLIP,
@@ -82,6 +106,9 @@ enum {
DRAW_JIT_VERTEX_DATA
};
#define DRAW_JIT_CTX_TEXTURES 4
#define DRAW_JIT_CTX_SAMPLERS 5
/**
* This structure is passed directly to the generated vertex shader.
*
@@ -100,7 +127,8 @@ struct draw_jit_context
float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
float *viewport;
struct draw_jit_texture textures[PIPE_MAX_SAMPLERS];
struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
};
@@ -117,10 +145,14 @@ struct draw_jit_context
lp_build_struct_get(_gallivm, _ptr, 3, "viewport")
#define DRAW_JIT_CTX_TEXTURES 4
#define DRAW_JIT_CTX_SAMPLERS 5
#define draw_jit_context_textures(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_TEXTURES, "textures")
#define draw_jit_context_samplers(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_SAMPLERS, "samplers")
#define draw_jit_header_id(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_VERTEX_VERTEX_ID, "id")
@@ -166,6 +198,7 @@ struct draw_llvm_variant_key
{
unsigned nr_vertex_elements:8;
unsigned nr_samplers:8;
unsigned nr_sampler_views:8;
unsigned clamp_vertex_color:1;
unsigned clip_xy:1;
unsigned clip_z:1;
@@ -174,7 +207,7 @@ struct draw_llvm_variant_key
unsigned bypass_viewport:1;
unsigned need_edgeflags:1;
unsigned ucp_enable:PIPE_MAX_CLIP_PLANES;
unsigned pad:9-PIPE_MAX_CLIP_PLANES;
unsigned pad:33-PIPE_MAX_CLIP_PLANES;
/* Variable number of vertex elements:
*/
@@ -182,34 +215,33 @@ struct draw_llvm_variant_key
/* Followed by variable number of samplers:
*/
/* struct lp_sampler_static_state sampler; */
/* struct draw_sampler_static_state sampler; */
};
#define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \
(sizeof(struct draw_llvm_variant_key) + \
PIPE_MAX_SAMPLERS * sizeof(struct lp_sampler_static_state) + \
PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state) + \
(PIPE_MAX_ATTRIBS-1) * sizeof(struct pipe_vertex_element))
static INLINE size_t
draw_llvm_variant_key_size(unsigned nr_vertex_elements,
unsigned nr_samplers)
unsigned nr_samplers)
{
return (sizeof(struct draw_llvm_variant_key) +
nr_samplers * sizeof(struct lp_sampler_static_state) +
(nr_vertex_elements - 1) * sizeof(struct pipe_vertex_element));
nr_samplers * sizeof(struct draw_sampler_static_state) +
(nr_vertex_elements - 1) * sizeof(struct pipe_vertex_element));
}
static INLINE struct lp_sampler_static_state *
static INLINE struct draw_sampler_static_state *
draw_llvm_variant_key_samplers(struct draw_llvm_variant_key *key)
{
return (struct lp_sampler_static_state *)
return (struct draw_sampler_static_state *)
&key->vertex_element[key->nr_vertex_elements];
}
struct draw_llvm_variant_list_item
{
struct draw_llvm_variant *base;
@@ -275,8 +307,8 @@ draw_llvm_destroy(struct draw_llvm *llvm);
struct draw_llvm_variant *
draw_llvm_create_variant(struct draw_llvm *llvm,
unsigned num_vertex_header_attribs,
const struct draw_llvm_variant_key *key);
unsigned num_vertex_header_attribs,
const struct draw_llvm_variant_key *key);
void
draw_llvm_destroy_variant(struct draw_llvm_variant *variant);
@@ -288,7 +320,7 @@ void
draw_llvm_dump_variant_key(struct draw_llvm_variant_key *key);
struct lp_build_sampler_soa *
draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state,
LLVMValueRef context_ptr);
void

View File

@@ -58,7 +58,7 @@ struct draw_llvm_sampler_dynamic_state
{
struct lp_sampler_dynamic_state base;
const struct lp_sampler_static_state *static_state;
const struct draw_sampler_static_state *static_state;
LLVMValueRef context_ptr;
};
@@ -86,7 +86,7 @@ struct draw_llvm_sampler_soa
static LLVMValueRef
draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
struct gallivm_state *gallivm,
unsigned unit,
unsigned texture_unit,
unsigned member_index,
const char *member_name,
boolean emit_load)
@@ -98,14 +98,14 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
LLVMValueRef ptr;
LLVMValueRef res;
debug_assert(unit < PIPE_MAX_SAMPLERS);
debug_assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
/* context[0] */
indices[0] = lp_build_const_int32(gallivm, 0);
/* context[0].textures */
indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_TEXTURES);
/* context[0].textures[unit] */
indices[2] = lp_build_const_int32(gallivm, unit);
indices[2] = lp_build_const_int32(gallivm, texture_unit);
/* context[0].textures[unit].member */
indices[3] = lp_build_const_int32(gallivm, member_index);
@@ -116,7 +116,54 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
else
res = ptr;
lp_build_name(res, "context.texture%u.%s", unit, member_name);
lp_build_name(res, "context.texture%u.%s", texture_unit, member_name);
return res;
}
/**
* Fetch the specified member of the lp_jit_sampler structure.
* \param emit_load if TRUE, emit the LLVM load instruction to actually
* fetch the field's value. Otherwise, just emit the
* GEP code to address the field.
*
* @sa http://llvm.org/docs/GetElementPtr.html
*/
static LLVMValueRef
draw_llvm_sampler_member(const struct lp_sampler_dynamic_state *base,
struct gallivm_state *gallivm,
unsigned sampler_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];
LLVMValueRef ptr;
LLVMValueRef res;
debug_assert(sampler_unit < PIPE_MAX_SAMPLERS);
/* context[0] */
indices[0] = lp_build_const_int32(gallivm, 0);
/* context[0].samplers */
indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_SAMPLERS);
/* context[0].samplers[unit] */
indices[2] = lp_build_const_int32(gallivm, sampler_unit);
/* context[0].samplers[unit].member */
indices[3] = lp_build_const_int32(gallivm, member_index);
ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), "");
if (emit_load)
res = LLVMBuildLoad(builder, ptr, "");
else
res = ptr;
lp_build_name(res, "context.sampler%u.%s", sampler_unit, member_name);
return res;
}
@@ -135,9 +182,9 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
static LLVMValueRef \
draw_llvm_texture_##_name( const struct lp_sampler_dynamic_state *base, \
struct gallivm_state *gallivm, \
unsigned unit) \
unsigned texture_unit) \
{ \
return draw_llvm_texture_member(base, gallivm, unit, _index, #_name, _emit_load ); \
return draw_llvm_texture_member(base, gallivm, texture_unit, _index, #_name, _emit_load ); \
}
@@ -150,10 +197,22 @@ DRAW_LLVM_TEXTURE_MEMBER(base_ptr, DRAW_JIT_TEXTURE_BASE, 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(mip_offsets, DRAW_JIT_TEXTURE_MIP_OFFSETS, 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)
#define DRAW_LLVM_SAMPLER_MEMBER(_name, _index, _emit_load) \
static LLVMValueRef \
draw_llvm_sampler_##_name( const struct lp_sampler_dynamic_state *base, \
struct gallivm_state *gallivm, \
unsigned sampler_unit) \
{ \
return draw_llvm_sampler_member(base, gallivm, sampler_unit, _index, #_name, _emit_load ); \
}
DRAW_LLVM_SAMPLER_MEMBER(min_lod, DRAW_JIT_SAMPLER_MIN_LOD, TRUE)
DRAW_LLVM_SAMPLER_MEMBER(max_lod, DRAW_JIT_SAMPLER_MAX_LOD, TRUE)
DRAW_LLVM_SAMPLER_MEMBER(lod_bias, DRAW_JIT_SAMPLER_LOD_BIAS, TRUE)
DRAW_LLVM_SAMPLER_MEMBER(border_color, DRAW_JIT_SAMPLER_BORDER_COLOR, FALSE)
static void
@@ -172,7 +231,8 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
struct gallivm_state *gallivm,
struct lp_type type,
boolean is_fetch,
unsigned unit,
unsigned texture_index,
unsigned sampler_index,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,
@@ -182,14 +242,17 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
{
struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base;
assert(unit < PIPE_MAX_SAMPLERS);
assert(texture_index < PIPE_MAX_SHADER_SAMPLER_VIEWS);
assert(sampler_index < PIPE_MAX_SAMPLERS);
lp_build_sample_soa(gallivm,
&sampler->dynamic_state.static_state[unit],
&sampler->dynamic_state.static_state[texture_index].texture_state,
&sampler->dynamic_state.static_state[sampler_index].sampler_state,
&sampler->dynamic_state.base,
type,
is_fetch,
unit,
texture_index,
sampler_index,
coords,
offsets,
derivs,
@@ -205,25 +268,25 @@ static void
draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
struct gallivm_state *gallivm,
struct lp_type type,
unsigned unit,
unsigned texture_unit,
LLVMValueRef explicit_lod, /* optional */
LLVMValueRef *sizes_out)
{
struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base;
assert(unit < PIPE_MAX_SAMPLERS);
assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
lp_build_size_query_soa(gallivm,
&sampler->dynamic_state.static_state[unit],
&sampler->dynamic_state.static_state[texture_unit].texture_state,
&sampler->dynamic_state.base,
type,
unit,
texture_unit,
explicit_lod,
sizes_out);
}
struct lp_build_sampler_soa *
draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state,
LLVMValueRef context_ptr)
{
struct draw_llvm_sampler_soa *sampler;
@@ -244,10 +307,10 @@ draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
sampler->dynamic_state.base.img_stride = draw_llvm_texture_img_stride;
sampler->dynamic_state.base.base_ptr = draw_llvm_texture_base_ptr;
sampler->dynamic_state.base.mip_offsets = draw_llvm_texture_mip_offsets;
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.base.min_lod = draw_llvm_sampler_min_lod;
sampler->dynamic_state.base.max_lod = draw_llvm_sampler_max_lod;
sampler->dynamic_state.base.lod_bias = draw_llvm_sampler_lod_bias;
sampler->dynamic_state.base.border_color = draw_llvm_sampler_border_color;
sampler->dynamic_state.static_state = static_state;
sampler->dynamic_state.context_ptr = context_ptr;

View File

@@ -42,6 +42,10 @@
#include "draw_fs.h"
/** Set to 1 to enable printing of coords before/after clipping */
#define DEBUG_CLIP 0
#ifndef IS_NEGATIVE
#define IS_NEGATIVE(X) ((X) < 0.0)
#endif
@@ -164,9 +168,9 @@ static void interp( const struct clip_stage *clip,
int k;
t_nopersp = t;
for (k = 0; k < 2; k++)
if (in->data[pos_attr][k] != out->data[pos_attr][k]) {
t_nopersp = (dst->data[pos_attr][k] - out->data[pos_attr][k]) /
(in->data[pos_attr][k] - out->data[pos_attr][k]);
if (in->clip[k] != out->clip[k]) {
t_nopersp = (dst->clip[k] - out->clip[k]) /
(in->clip[k] - out->clip[k]);
break;
}
}
@@ -237,12 +241,17 @@ static void emit_poly( struct draw_stage *stage,
if (i == n - 1 && edgeflags[i])
header.flags |= edge_last;
if (0) {
if (DEBUG_CLIP) {
const struct draw_vertex_shader *vs = stage->draw->vs.vertex_shader;
uint j, k;
debug_printf("Clipped tri: (flat-shade-first = %d)\n",
stage->draw->rasterizer->flatshade_first);
for (j = 0; j < 3; j++) {
debug_printf(" Vert %d: clip: %f %f %f %f\n", j,
header.v[j]->clip[0],
header.v[j]->clip[1],
header.v[j]->clip[2],
header.v[j]->clip[3]);
for (k = 0; k < vs->info.num_outputs; k++) {
debug_printf(" Vert %d: Attr %d: %f %f %f %f\n", j, k,
header.v[j]->data[k][0],
@@ -315,6 +324,16 @@ do_clip_tri( struct draw_stage *stage,
inlist[1] = header->v[1];
inlist[2] = header->v[2];
if (DEBUG_CLIP) {
const float *v0 = header->v[0]->clip;
const float *v1 = header->v[1]->clip;
const float *v2 = header->v[2]->clip;
debug_printf("Clip triangle:\n");
debug_printf(" %f, %f, %f, %f\n", v0[0], v0[1], v0[2], v0[3]);
debug_printf(" %f, %f, %f, %f\n", v1[0], v1[1], v1[2], v1[3]);
debug_printf(" %f, %f, %f, %f\n", v2[0], v2[1], v2[2], v2[3]);
}
/*
* Note: at this point we can't just use the per-vertex edge flags.
* We have to observe the edge flag bits set in header->flags which

View File

@@ -310,7 +310,7 @@ struct draw_context
* we only handle vertex and geometry shaders in the draw module, but
* there may be more in the future (ex: hull and tessellation).
*/
struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS];
unsigned num_sampler_views[PIPE_SHADER_TYPES];
const struct pipe_sampler_state *samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
unsigned num_samplers[PIPE_SHADER_TYPES];

View File

@@ -159,11 +159,6 @@ struct draw_vertex_shader *
draw_create_vs_exec(struct draw_context *draw,
const struct pipe_shader_state *templ);
struct draw_vertex_shader *
draw_create_vs_ppc(struct draw_context *draw,
const struct pipe_shader_state *templ);
struct draw_vs_variant_key;
struct draw_vertex_shader;

View File

@@ -1,240 +0,0 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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 TUNGSTEN GRAPHICS 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.
*
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
* Brian Paul
*/
#include "util/u_math.h"
#include "util/u_memory.h"
#include "pipe/p_config.h"
#include "draw_vs.h"
#if defined(PIPE_ARCH_PPC)
#include "pipe/p_shader_tokens.h"
#include "draw_private.h"
#include "draw_context.h"
#include "rtasm/rtasm_cpu.h"
#include "rtasm/rtasm_ppc.h"
#include "tgsi/tgsi_ppc.h"
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_exec.h"
typedef void (PIPE_CDECL *codegen_function) (float (*inputs)[4][4],
float (*outputs)[4][4],
float (*temps)[4][4],
float (*immeds)[4],
float (*consts)[4],
const float *builtins);
struct draw_ppc_vertex_shader {
struct draw_vertex_shader base;
struct ppc_function ppc_program;
codegen_function func;
};
static void
vs_ppc_prepare( struct draw_vertex_shader *base,
struct draw_context *draw )
{
/* nothing */
}
/**
* Simplified vertex shader interface for the pt paths. Given the
* complexity of code-generating all the above operations together,
* it's time to try doing all the other stuff separately.
*/
static void
vs_ppc_run_linear( struct draw_vertex_shader *base,
const float (*input)[4],
float (*output)[4],
const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
unsigned count,
unsigned input_stride,
unsigned output_stride )
{
struct draw_ppc_vertex_shader *shader = (struct draw_ppc_vertex_shader *)base;
unsigned int i;
#define MAX_VERTICES 4
/* loop over verts */
for (i = 0; i < count; i += MAX_VERTICES) {
const uint max_vertices = MIN2(MAX_VERTICES, count - i);
PIPE_ALIGN_VAR(16) float inputs_soa[PIPE_MAX_SHADER_INPUTS][4][4];
PIPE_ALIGN_VAR(16) float outputs_soa[PIPE_MAX_SHADER_OUTPUTS][4][4];
PIPE_ALIGN_VAR(16) float temps_soa[TGSI_EXEC_NUM_TEMPS][4][4];
uint attr;
/* convert (up to) four input verts to SoA format */
for (attr = 0; attr < base->info.num_inputs; attr++) {
const float *vIn = (const float *) input;
uint vert;
for (vert = 0; vert < max_vertices; vert++) {
#if 0
if (attr==0)
printf("Input v%d a%d: %f %f %f %f\n",
vert, attr, vIn[0], vIn[1], vIn[2], vIn[3]);
#endif
inputs_soa[attr][0][vert] = vIn[attr * 4 + 0];
inputs_soa[attr][1][vert] = vIn[attr * 4 + 1];
inputs_soa[attr][2][vert] = vIn[attr * 4 + 2];
inputs_soa[attr][3][vert] = vIn[attr * 4 + 3];
vIn += input_stride / 4;
}
}
/* run compiled shader
*/
shader->func(inputs_soa, outputs_soa, temps_soa,
(float (*)[4]) shader->base.immediates,
(float (*)[4])constants[0],
ppc_builtin_constants);
/* convert (up to) four output verts from SoA back to AoS format */
for (attr = 0; attr < base->info.num_outputs; attr++) {
float *vOut = (float *) output;
uint vert;
for (vert = 0; vert < max_vertices; vert++) {
vOut[attr * 4 + 0] = outputs_soa[attr][0][vert];
vOut[attr * 4 + 1] = outputs_soa[attr][1][vert];
vOut[attr * 4 + 2] = outputs_soa[attr][2][vert];
vOut[attr * 4 + 3] = outputs_soa[attr][3][vert];
#if 0
if (attr==0)
printf("Output v%d a%d: %f %f %f %f\n",
vert, attr, vOut[0], vOut[1], vOut[2], vOut[3]);
#endif
vOut += output_stride / 4;
}
}
/* advance to next group of four input/output verts */
input = (const float (*)[4])((const char *)input + input_stride * max_vertices);
output = (float (*)[4])((char *)output + output_stride * max_vertices);
}
}
static void
vs_ppc_delete( struct draw_vertex_shader *base )
{
struct draw_ppc_vertex_shader *shader = (struct draw_ppc_vertex_shader *)base;
ppc_release_func( &shader->ppc_program );
align_free( (void *) shader->base.immediates );
FREE( (void*) shader->base.state.tokens );
FREE( shader );
}
struct draw_vertex_shader *
draw_create_vs_ppc(struct draw_context *draw,
const struct pipe_shader_state *templ)
{
struct draw_ppc_vertex_shader *vs;
vs = CALLOC_STRUCT( draw_ppc_vertex_shader );
if (vs == NULL)
return NULL;
/* we make a private copy of the tokens */
vs->base.state.tokens = tgsi_dup_tokens(templ->tokens);
if (!vs->base.state.tokens)
goto fail;
tgsi_scan_shader(templ->tokens, &vs->base.info);
vs->base.draw = draw;
vs->base.create_variant = draw_vs_create_variant_generic;
vs->base.prepare = vs_ppc_prepare;
vs->base.run_linear = vs_ppc_run_linear;
vs->base.delete = vs_ppc_delete;
vs->base.immediates = align_malloc(TGSI_EXEC_NUM_IMMEDIATES * 4 *
sizeof(float), 16);
ppc_init_func( &vs->ppc_program );
#if 0
ppc_print_code(&vs->ppc_program, TRUE);
ppc_indent(&vs->ppc_program, 8);
#endif
if (!tgsi_emit_ppc( (struct tgsi_token *) vs->base.state.tokens,
&vs->ppc_program,
(float (*)[4]) vs->base.immediates,
TRUE ))
goto fail;
vs->func = (codegen_function) ppc_get_func( &vs->ppc_program );
if (!vs->func) {
goto fail;
}
return &vs->base;
fail:
/*
debug_error("tgsi_emit_ppc() failed, falling back to interpreter\n");
*/
ppc_release_func( &vs->ppc_program );
FREE(vs);
return NULL;
}
#else /* PIPE_ARCH_PPC */
struct draw_vertex_shader *
draw_create_vs_ppc( struct draw_context *draw,
const struct pipe_shader_state *templ )
{
return (void *) 0;
}
#endif /* PIPE_ARCH_PPC */

View File

@@ -93,7 +93,7 @@ lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
LLVMValueRef rgba_out[4]);
void
lp_build_rgba8_to_f32_soa(struct gallivm_state *gallivm,
lp_build_rgba8_to_fi32_soa(struct gallivm_state *gallivm,
struct lp_type dst_type,
LLVMValueRef packed,
LLVMValueRef *rgba);

View File

@@ -710,6 +710,8 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm,
return res;
}
assert(!util_format_is_pure_integer(format_desc->format));
assert(0);
return lp_build_undef(gallivm, type);
}

View File

@@ -148,7 +148,7 @@ lp_build_fetch_rgba_aos_array(struct gallivm_state *gallivm,
tmp_type = dst_type;
if (pure_integer) {
assert(dst_type.floating);
/* some callers expect (fake) floats other real ints. */
tmp_type.floating = 0;
tmp_type.sign = src_type.sign;
}
@@ -160,8 +160,8 @@ lp_build_fetch_rgba_aos_array(struct gallivm_state *gallivm,
lp_build_context_init(&bld, gallivm, tmp_type);
res = lp_build_format_swizzle_aos(format_desc, &bld, res);
/* Bitcast to floats (for pure integers) */
if (pure_integer) {
/* Bitcast to floats (for pure integers) when requested */
if (pure_integer && dst_type.floating) {
res = LLVMBuildBitCast(builder, res, lp_build_vec_type(gallivm, dst_type), "");
}

View File

@@ -114,7 +114,6 @@ lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
assert(format_desc->block.height == 1);
assert(format_desc->block.bits <= type.width);
/* FIXME: Support more output types */
assert(type.floating);
assert(type.width == 32);
lp_build_context_init(&bld, gallivm, type);
@@ -162,10 +161,11 @@ lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
input = LLVMBuildSIToFP(builder, input,
lp_build_vec_type(gallivm, type), "");
}
else {
/* FIXME */
assert(0);
input = lp_build_undef(gallivm, type);
else if (format_desc->channel[chan].pure_integer) {
/* Nothing to do */
} else {
/* FIXME */
assert(0);
}
break;
@@ -203,10 +203,11 @@ lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
input = LLVMBuildFMul(builder, input, scale_val, "");
}
}
else {
/* FIXME */
assert(0);
input = lp_build_undef(gallivm, type);
else if (format_desc->channel[chan].pure_integer) {
/* Nothing to do */
} else {
/* FIXME */
assert(0);
}
break;
@@ -254,16 +255,28 @@ lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
}
/**
* Convert a vector of rgba8 values into 32bit wide SoA vectors.
*
* \param dst_type The desired return type. For pure integer formats
* this should be a 32bit wide int or uint vector type,
* otherwise a float vector type.
*
* \param packed The rgba8 values to pack.
*
* \param rgba The 4 SoA return vectors.
*/
void
lp_build_rgba8_to_f32_soa(struct gallivm_state *gallivm,
struct lp_type dst_type,
LLVMValueRef packed,
LLVMValueRef *rgba)
lp_build_rgba8_to_fi32_soa(struct gallivm_state *gallivm,
struct lp_type dst_type,
LLVMValueRef packed,
LLVMValueRef *rgba)
{
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef mask = lp_build_const_int_vec(gallivm, dst_type, 0xff);
unsigned chan;
/* XXX technically shouldn't use that for uint dst_type */
packed = LLVMBuildBitCast(builder, packed,
lp_build_int_vec_type(gallivm, dst_type), "");
@@ -282,7 +295,8 @@ lp_build_rgba8_to_f32_soa(struct gallivm_state *gallivm,
if (stop < 32)
input = LLVMBuildAnd(builder, input, mask, "");
input = lp_build_unsigned_norm_to_float(gallivm, 8, dst_type, input);
if (dst_type.floating)
input = lp_build_unsigned_norm_to_float(gallivm, 8, dst_type, input);
rgba[chan] = input;
}
@@ -372,7 +386,7 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm,
tmp = lp_build_fetch_rgba_aos(gallivm, format_desc, tmp_type,
base_ptr, offset, i, j);
lp_build_rgba8_to_f32_soa(gallivm,
lp_build_rgba8_to_fi32_soa(gallivm,
type,
tmp,
rgba_out);

View File

@@ -87,24 +87,54 @@ lp_sampler_wrap_mode_uses_border_color(unsigned mode,
/**
* Initialize lp_sampler_static_state object with the gallium sampler
* and texture state.
* The former is considered to be static and the later dynamic.
* Initialize lp_sampler_static_texture_state object with the gallium
* texture/sampler_view state (this contains the parts which are
* considered static).
*/
void
lp_sampler_static_state(struct lp_sampler_static_state *state,
const struct pipe_sampler_view *view,
const struct pipe_sampler_state *sampler)
lp_sampler_static_texture_state(struct lp_static_texture_state *state,
const struct pipe_sampler_view *view)
{
const struct pipe_resource *texture;
memset(state, 0, sizeof *state);
if (!sampler || !view || !view->texture)
if (!view || !view->texture)
return;
texture = view->texture;
state->format = view->format;
state->swizzle_r = view->swizzle_r;
state->swizzle_g = view->swizzle_g;
state->swizzle_b = view->swizzle_b;
state->swizzle_a = view->swizzle_a;
state->target = texture->target;
state->pot_width = util_is_power_of_two(texture->width0);
state->pot_height = util_is_power_of_two(texture->height0);
state->pot_depth = util_is_power_of_two(texture->depth0);
state->level_zero_only = !view->u.tex.last_level;
/*
* FIXME: Handle the remainder of pipe_sampler_view.
*/
}
/**
* Initialize lp_sampler_static_sampler_state object with the gallium sampler
* state (this contains the parts which are considered static).
*/
void
lp_sampler_static_sampler_state(struct lp_static_sampler_state *state,
const struct pipe_sampler_state *sampler)
{
memset(state, 0, sizeof *state);
if (!sampler)
return;
/*
* We don't copy sampler state over unless it is actually enabled, to avoid
* spurious recompiles, as the sampler static state is part of the shader
@@ -117,24 +147,13 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
* regarding 1D/2D/3D/CUBE textures, wrap modes, etc.
*/
state->format = view->format;
state->swizzle_r = view->swizzle_r;
state->swizzle_g = view->swizzle_g;
state->swizzle_b = view->swizzle_b;
state->swizzle_a = view->swizzle_a;
state->target = texture->target;
state->pot_width = util_is_power_of_two(texture->width0);
state->pot_height = util_is_power_of_two(texture->height0);
state->pot_depth = util_is_power_of_two(texture->depth0);
state->wrap_s = sampler->wrap_s;
state->wrap_t = sampler->wrap_t;
state->wrap_r = sampler->wrap_r;
state->min_img_filter = sampler->min_img_filter;
state->mag_img_filter = sampler->mag_img_filter;
if (view->u.tex.last_level && sampler->max_lod > 0.0f) {
if (sampler->max_lod > 0.0f) {
state->min_mip_filter = sampler->min_mip_filter;
} else {
state->min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
@@ -155,7 +174,11 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
state->apply_min_lod = 1;
}
if (sampler->max_lod < (float)view->u.tex.last_level) {
/*
* XXX this won't do anything with the mesa state tracker which always
* sets max_lod to not more than actually present mip maps...
*/
if (sampler->max_lod < (PIPE_MAX_TEXTURE_LEVELS - 1)) {
state->apply_max_lod = 1;
}
}
@@ -167,10 +190,6 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
}
state->normalized_coords = sampler->normalized_coords;
/*
* FIXME: Handle the remainder of pipe_sampler_view.
*/
}
@@ -182,7 +201,7 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
*/
static LLVMValueRef
lp_build_rho(struct lp_build_sample_context *bld,
unsigned unit,
unsigned texture_unit,
const struct lp_derivatives *derivs)
{
struct gallivm_state *gallivm = bld->gallivm;
@@ -264,7 +283,7 @@ lp_build_rho(struct lp_build_sample_context *bld,
rho_vec = lp_build_max(coord_bld, rho_xvec, rho_yvec);
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
bld->gallivm, texture_unit);
first_level_vec = lp_build_broadcast_scalar(int_size_bld, first_level);
int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec);
float_size = lp_build_int_to_float(float_size_bld, int_size);
@@ -489,7 +508,8 @@ lp_build_brilinear_rho(struct lp_build_context *bld,
*/
void
lp_build_lod_selector(struct lp_build_sample_context *bld,
unsigned unit,
unsigned texture_unit,
unsigned sampler_unit,
const struct lp_derivatives *derivs,
LLVMValueRef lod_bias, /* optional */
LLVMValueRef explicit_lod, /* optional */
@@ -505,12 +525,13 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
*out_lod_ipart = bld->perquadi_bld.zero;
*out_lod_fpart = perquadf_bld->zero;
if (bld->static_state->min_max_lod_equal) {
if (bld->static_sampler_state->min_max_lod_equal) {
/* User is forcing sampling from a particular mipmap level.
* This is hit during mipmap generation.
*/
LLVMValueRef min_lod =
bld->dynamic_state->min_lod(bld->dynamic_state, bld->gallivm, unit);
bld->dynamic_state->min_lod(bld->dynamic_state,
bld->gallivm, sampler_unit);
lod = lp_build_broadcast_scalar(perquadf_bld, min_lod);
}
@@ -522,16 +543,16 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
else {
LLVMValueRef rho;
rho = lp_build_rho(bld, unit, derivs);
rho = lp_build_rho(bld, texture_unit, derivs);
/*
* Compute lod = log2(rho)
*/
if (!lod_bias &&
!bld->static_state->lod_bias_non_zero &&
!bld->static_state->apply_max_lod &&
!bld->static_state->apply_min_lod) {
!bld->static_sampler_state->lod_bias_non_zero &&
!bld->static_sampler_state->apply_max_lod &&
!bld->static_sampler_state->apply_min_lod) {
/*
* Special case when there are no post-log2 adjustments, which
* saves instructions but keeping the integer and fractional lod
@@ -568,25 +589,28 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
}
/* add sampler lod bias */
if (bld->static_state->lod_bias_non_zero) {
if (bld->static_sampler_state->lod_bias_non_zero) {
LLVMValueRef sampler_lod_bias =
bld->dynamic_state->lod_bias(bld->dynamic_state, bld->gallivm, unit);
bld->dynamic_state->lod_bias(bld->dynamic_state,
bld->gallivm, sampler_unit);
sampler_lod_bias = lp_build_broadcast_scalar(perquadf_bld,
sampler_lod_bias);
lod = LLVMBuildFAdd(builder, lod, sampler_lod_bias, "sampler_lod_bias");
}
/* clamp lod */
if (bld->static_state->apply_max_lod) {
if (bld->static_sampler_state->apply_max_lod) {
LLVMValueRef max_lod =
bld->dynamic_state->max_lod(bld->dynamic_state, bld->gallivm, unit);
bld->dynamic_state->max_lod(bld->dynamic_state,
bld->gallivm, sampler_unit);
max_lod = lp_build_broadcast_scalar(perquadf_bld, max_lod);
lod = lp_build_min(perquadf_bld, lod, max_lod);
}
if (bld->static_state->apply_min_lod) {
if (bld->static_sampler_state->apply_min_lod) {
LLVMValueRef min_lod =
bld->dynamic_state->min_lod(bld->dynamic_state, bld->gallivm, unit);
bld->dynamic_state->min_lod(bld->dynamic_state,
bld->gallivm, sampler_unit);
min_lod = lp_build_broadcast_scalar(perquadf_bld, min_lod);
lod = lp_build_max(perquadf_bld, lod, min_lod);
@@ -623,7 +647,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
*/
void
lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
unsigned unit,
unsigned texture_unit,
LLVMValueRef lod_ipart,
LLVMValueRef *level_out)
{
@@ -631,9 +655,9 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
LLVMValueRef first_level, last_level, level;
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
bld->gallivm, texture_unit);
last_level = bld->dynamic_state->last_level(bld->dynamic_state,
bld->gallivm, unit);
bld->gallivm, texture_unit);
first_level = lp_build_broadcast_scalar(perquadi_bld, first_level);
last_level = lp_build_broadcast_scalar(perquadi_bld, last_level);
@@ -651,7 +675,7 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
*/
void
lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
unsigned unit,
unsigned texture_unit,
LLVMValueRef lod_ipart,
LLVMValueRef *lod_fpart_inout,
LLVMValueRef *level0_out,
@@ -665,9 +689,9 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
LLVMValueRef clamp_max;
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
bld->gallivm, texture_unit);
last_level = bld->dynamic_state->last_level(bld->dynamic_state,
bld->gallivm, unit);
bld->gallivm, texture_unit);
first_level = lp_build_broadcast_scalar(perquadi_bld, first_level);
last_level = lp_build_broadcast_scalar(perquadi_bld, last_level);
@@ -717,9 +741,9 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
*lod_fpart_inout = LLVMBuildSelect(builder, clamp_max,
perquadf_bld->zero, *lod_fpart_inout, "");
lp_build_name(*level0_out, "sampler%u_miplevel0", unit);
lp_build_name(*level1_out, "sampler%u_miplevel1", unit);
lp_build_name(*lod_fpart_inout, "sampler%u_mipweight", unit);
lp_build_name(*level0_out, "texture%u_miplevel0", texture_unit);
lp_build_name(*level1_out, "texture%u_miplevel1", texture_unit);
lp_build_name(*lod_fpart_inout, "texture%u_mipweight", texture_unit);
}
@@ -988,9 +1012,9 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
ilevel);
}
if (dims == 3 ||
bld->static_state->target == PIPE_TEXTURE_CUBE ||
bld->static_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_state->target == PIPE_TEXTURE_2D_ARRAY) {
bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
*img_stride_vec = lp_build_get_level_stride_vec(bld,
bld->img_stride_array,
ilevel);

View File

@@ -61,12 +61,12 @@ struct lp_derivatives
/**
* Sampler static state.
* Texture static state.
*
* These are the bits of state from pipe_resource and pipe_sampler_state that
* These are the bits of state from pipe_resource/pipe_sampler_view that
* are embedded in the generated code.
*/
struct lp_sampler_static_state
struct lp_static_texture_state
{
/* pipe_sampler_view's state */
enum pipe_format format;
@@ -80,7 +80,18 @@ struct lp_sampler_static_state
unsigned pot_width:1; /**< is the width a power of two? */
unsigned pot_height:1;
unsigned pot_depth:1;
unsigned level_zero_only:1;
};
/**
* Sampler static state.
*
* These are the bits of state from pipe_sampler_state that
* are embedded in the generated code.
*/
struct lp_static_sampler_state
{
/* pipe_sampler_state's state */
unsigned wrap_s:3;
unsigned wrap_t:3;
@@ -105,8 +116,8 @@ struct lp_sampler_static_state
/**
* Sampler dynamic state.
*
* These are the bits of state from pipe_resource and pipe_sampler_state that
* are computed in runtime.
* These are the bits of state from pipe_resource/pipe_sampler_view
* as well as from sampler state that are computed at runtime.
*
* There are obtained through callbacks, as we don't want to tie the texture
* sampling code generation logic to any particular texture layout or pipe
@@ -114,80 +125,83 @@ struct lp_sampler_static_state
*/
struct lp_sampler_dynamic_state
{
/* First callbacks for sampler view state */
/** Obtain the base texture width (returns int32) */
LLVMValueRef
(*width)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
unsigned texture_unit);
/** Obtain the base texture height (returns int32) */
LLVMValueRef
(*height)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
unsigned texture_unit);
/** Obtain the base texture depth (returns int32) */
LLVMValueRef
(*depth)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
unsigned texture_unit);
/** Obtain the first mipmap level (base level) (returns int32) */
LLVMValueRef
(*first_level)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
unsigned texture_unit);
/** Obtain the number of mipmap levels minus one (returns int32) */
LLVMValueRef
(*last_level)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
unsigned texture_unit);
/** Obtain stride in bytes between image rows/blocks (returns int32) */
LLVMValueRef
(*row_stride)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
unsigned texture_unit);
/** Obtain stride in bytes between image slices (returns int32) */
LLVMValueRef
(*img_stride)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
unsigned texture_unit);
/** Obtain pointer to base of texture */
LLVMValueRef
(*base_ptr)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
unsigned texture_unit);
/** Obtain pointer to array of mipmap offsets */
LLVMValueRef
(*mip_offsets)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
unsigned texture_unit);
/* These are callbacks for sampler state */
/** Obtain texture min lod (returns float) */
LLVMValueRef
(*min_lod)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm, unsigned unit);
struct gallivm_state *gallivm, unsigned sampler_unit);
/** Obtain texture max lod (returns float) */
LLVMValueRef
(*max_lod)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm, unsigned unit);
struct gallivm_state *gallivm, unsigned sampler_unit);
/** Obtain texture lod bias (returns float) */
LLVMValueRef
(*lod_bias)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm, unsigned unit);
struct gallivm_state *gallivm, unsigned sampler_unit);
/** Obtain texture border color (returns ptr to float[4]) */
LLVMValueRef
(*border_color)(const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm, unsigned unit);
struct gallivm_state *gallivm, unsigned sampler_unit);
};
@@ -198,7 +212,8 @@ struct lp_build_sample_context
{
struct gallivm_state *gallivm;
const struct lp_sampler_static_state *static_state;
const struct lp_static_texture_state *static_texture_state;
const struct lp_static_sampler_state *static_sampler_state;
struct lp_sampler_dynamic_state *dynamic_state;
@@ -295,10 +310,10 @@ apply_sampler_swizzle(struct lp_build_sample_context *bld,
{
unsigned char swizzles[4];
swizzles[0] = bld->static_state->swizzle_r;
swizzles[1] = bld->static_state->swizzle_g;
swizzles[2] = bld->static_state->swizzle_b;
swizzles[3] = bld->static_state->swizzle_a;
swizzles[0] = bld->static_texture_state->swizzle_r;
swizzles[1] = bld->static_texture_state->swizzle_g;
swizzles[2] = bld->static_texture_state->swizzle_b;
swizzles[3] = bld->static_texture_state->swizzle_a;
lp_build_swizzle_soa_inplace(&bld->texel_bld, texel, swizzles);
}
@@ -338,14 +353,19 @@ lp_sampler_wrap_mode_uses_border_color(unsigned mode,
* Derive the sampler static state.
*/
void
lp_sampler_static_state(struct lp_sampler_static_state *state,
const struct pipe_sampler_view *view,
const struct pipe_sampler_state *sampler);
lp_sampler_static_sampler_state(struct lp_static_sampler_state *state,
const struct pipe_sampler_state *sampler);
void
lp_sampler_static_texture_state(struct lp_static_texture_state *state,
const struct pipe_sampler_view *view);
void
lp_build_lod_selector(struct lp_build_sample_context *bld,
unsigned unit,
unsigned texture_index,
unsigned sampler_index,
const struct lp_derivatives *derivs,
LLVMValueRef lod_bias, /* optional */
LLVMValueRef explicit_lod, /* optional */
@@ -355,13 +375,13 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
void
lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
unsigned unit,
unsigned texture_unit,
LLVMValueRef lod,
LLVMValueRef *level_out);
void
lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
unsigned unit,
unsigned texture_unit,
LLVMValueRef lod_ipart,
LLVMValueRef *lod_fpart_inout,
LLVMValueRef *level0_out,
@@ -437,11 +457,13 @@ lp_build_sample_offset(struct lp_build_context *bld,
void
lp_build_sample_soa(struct gallivm_state *gallivm,
const struct lp_sampler_static_state *static_state,
struct lp_sampler_dynamic_state *dynamic_state,
const struct lp_static_texture_state *static_texture_state,
const struct lp_static_sampler_state *static_sampler_state,
struct lp_sampler_dynamic_state *dynamic_texture_state,
struct lp_type fp_type,
boolean is_fetch,
unsigned unit,
unsigned texture_index,
unsigned sampler_index,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,
@@ -461,10 +483,10 @@ lp_build_coord_repeat_npot_linear(struct lp_build_sample_context *bld,
void
lp_build_size_query_soa(struct gallivm_state *gallivm,
const struct lp_sampler_static_state *static_state,
const struct lp_static_texture_state *static_state,
struct lp_sampler_dynamic_state *dynamic_state,
struct lp_type int_type,
unsigned unit,
unsigned texture_unit,
LLVMValueRef explicit_lod,
LLVMValueRef *sizes_out);

View File

@@ -152,7 +152,7 @@ lp_build_sample_wrap_nearest_float(struct lp_build_sample_context *bld,
break;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
length_minus_one = lp_build_sub(coord_bld, length, coord_bld->one);
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length);
}
@@ -407,7 +407,7 @@ lp_build_sample_wrap_linear_float(struct lp_build_sample_context *bld,
}
break;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* mul by tex size */
coord = lp_build_mul(coord_bld, coord, length);
}
@@ -549,7 +549,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
s_float = s; t_float = t; r_float = r;
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
LLVMValueRef scaled_size;
LLVMValueRef flt_size;
@@ -594,8 +594,8 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
bld->format_desc->block.width,
s_ipart, s_float,
width_vec, x_stride,
bld->static_state->pot_width,
bld->static_state->wrap_s,
bld->static_texture_state->pot_width,
bld->static_sampler_state->wrap_s,
&x_offset, &x_subcoord);
offset = x_offset;
if (dims >= 2) {
@@ -604,8 +604,8 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
bld->format_desc->block.height,
t_ipart, t_float,
height_vec, row_stride_vec,
bld->static_state->pot_height,
bld->static_state->wrap_t,
bld->static_texture_state->pot_height,
bld->static_sampler_state->wrap_t,
&y_offset, &y_subcoord);
offset = lp_build_add(&bld->int_coord_bld, offset, y_offset);
if (dims >= 3) {
@@ -614,15 +614,15 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
1, /* block length (depth) */
r_ipart, r_float,
depth_vec, img_stride_vec,
bld->static_state->pot_depth,
bld->static_state->wrap_r,
bld->static_texture_state->pot_depth,
bld->static_sampler_state->wrap_r,
&z_offset, &z_subcoord);
offset = lp_build_add(&bld->int_coord_bld, offset, z_offset);
}
}
if (bld->static_state->target == PIPE_TEXTURE_CUBE ||
bld->static_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_state->target == PIPE_TEXTURE_2D_ARRAY) {
if (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
LLVMValueRef z_offset;
/* The r coord is the cube face in [0,5] or array layer */
z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
@@ -678,28 +678,28 @@ lp_build_sample_image_nearest_afloat(struct lp_build_sample_context *bld,
/* Do texcoord wrapping */
lp_build_sample_wrap_nearest_float(bld,
s, width_vec,
bld->static_state->pot_width,
bld->static_state->wrap_s,
bld->static_texture_state->pot_width,
bld->static_sampler_state->wrap_s,
&x_icoord);
if (dims >= 2) {
lp_build_sample_wrap_nearest_float(bld,
t, height_vec,
bld->static_state->pot_height,
bld->static_state->wrap_t,
bld->static_texture_state->pot_height,
bld->static_sampler_state->wrap_t,
&y_icoord);
if (dims >= 3) {
lp_build_sample_wrap_nearest_float(bld,
r, depth_vec,
bld->static_state->pot_depth,
bld->static_state->wrap_r,
bld->static_texture_state->pot_depth,
bld->static_sampler_state->wrap_r,
&z_icoord);
}
}
if (bld->static_state->target == PIPE_TEXTURE_CUBE ||
bld->static_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_state->target == PIPE_TEXTURE_2D_ARRAY) {
if (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
z_icoord = r;
}
@@ -885,7 +885,7 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld,
/*
* Linear interpolation with 8.8 fixed point.
*/
if (bld->static_state->force_nearest_s) {
if (bld->static_sampler_state->force_nearest_s) {
/* special case 1-D lerp */
packed_lo = lp_build_lerp(&h16,
t_fpart_lo,
@@ -897,7 +897,7 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld,
neighbors_hi[0][1][0],
neighbors_hi[0][1][0]);
}
else if (bld->static_state->force_nearest_t) {
else if (bld->static_sampler_state->force_nearest_t) {
/* special case 1-D lerp */
packed_lo = lp_build_lerp(&h16,
s_fpart_lo,
@@ -1016,7 +1016,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
s_float = s; t_float = t; r_float = r;
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
LLVMValueRef scaled_size;
LLVMValueRef flt_size;
@@ -1045,10 +1045,10 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
/* subtract 0.5 (add -128) */
i32_c128 = lp_build_const_int_vec(bld->gallivm, i32.type, -128);
if (!bld->static_state->force_nearest_s) {
if (!bld->static_sampler_state->force_nearest_s) {
s = LLVMBuildAdd(builder, s, i32_c128, "");
}
if (dims >= 2 && !bld->static_state->force_nearest_t) {
if (dims >= 2 && !bld->static_sampler_state->force_nearest_t) {
t = LLVMBuildAdd(builder, t, i32_c128, "");
}
if (dims >= 3) {
@@ -1082,15 +1082,15 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
bld->format_desc->block.width,
s_ipart, &s_fpart, s_float,
width_vec, x_stride,
bld->static_state->pot_width,
bld->static_state->wrap_s,
bld->static_texture_state->pot_width,
bld->static_sampler_state->wrap_s,
&x_offset0, &x_offset1,
&x_subcoord[0], &x_subcoord[1]);
/* add potential cube/array/mip offsets now as they are constant per pixel */
if (bld->static_state->target == PIPE_TEXTURE_CUBE ||
bld->static_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_state->target == PIPE_TEXTURE_2D_ARRAY) {
if (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
LLVMValueRef z_offset;
z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
/* The r coord is the cube face in [0,5] or array layer */
@@ -1114,8 +1114,8 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
bld->format_desc->block.height,
t_ipart, &t_fpart, t_float,
height_vec, y_stride,
bld->static_state->pot_height,
bld->static_state->wrap_t,
bld->static_texture_state->pot_height,
bld->static_sampler_state->wrap_t,
&y_offset0, &y_offset1,
&y_subcoord[0], &y_subcoord[1]);
@@ -1134,8 +1134,8 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
bld->format_desc->block.height,
r_ipart, &r_fpart, r_float,
depth_vec, z_stride,
bld->static_state->pot_depth,
bld->static_state->wrap_r,
bld->static_texture_state->pot_depth,
bld->static_sampler_state->wrap_r,
&z_offset0, &z_offset1,
&z_subcoord[0], &z_subcoord[1]);
for (y = 0; y < 2; y++) {
@@ -1205,28 +1205,28 @@ lp_build_sample_image_linear_afloat(struct lp_build_sample_context *bld,
lp_build_sample_wrap_linear_float(bld,
bld->format_desc->block.width,
s, width_vec,
bld->static_state->pot_width,
bld->static_state->wrap_s,
bld->static_texture_state->pot_width,
bld->static_sampler_state->wrap_s,
&x_icoord0, &x_icoord1,
&s_fpart,
bld->static_state->force_nearest_s);
bld->static_sampler_state->force_nearest_s);
if (dims >= 2) {
lp_build_sample_wrap_linear_float(bld,
bld->format_desc->block.height,
t, height_vec,
bld->static_state->pot_height,
bld->static_state->wrap_t,
bld->static_texture_state->pot_height,
bld->static_sampler_state->wrap_t,
&y_icoord0, &y_icoord1,
&t_fpart,
bld->static_state->force_nearest_t);
bld->static_sampler_state->force_nearest_t);
if (dims >= 3) {
lp_build_sample_wrap_linear_float(bld,
bld->format_desc->block.height,
r, depth_vec,
bld->static_state->pot_depth,
bld->static_state->wrap_r,
bld->static_texture_state->pot_depth,
bld->static_sampler_state->wrap_r,
&z_icoord0, &z_icoord1,
&r_fpart, 0);
}
@@ -1259,9 +1259,9 @@ lp_build_sample_image_linear_afloat(struct lp_build_sample_context *bld,
&x_offset1, &x_subcoord[1]);
/* add potential cube/array/mip offsets now as they are constant per pixel */
if (bld->static_state->target == PIPE_TEXTURE_CUBE ||
bld->static_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_state->target == PIPE_TEXTURE_2D_ARRAY) {
if (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
LLVMValueRef z_offset;
z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
/* The r coord is the cube face in [0,5] or array layer */
@@ -1570,7 +1570,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
*/
void
lp_build_sample_aos(struct lp_build_sample_context *bld,
unsigned unit,
unsigned sampler_unit,
LLVMValueRef s,
LLVMValueRef t,
LLVMValueRef r,
@@ -1582,20 +1582,20 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
{
struct lp_build_context *int_bld = &bld->int_bld;
LLVMBuilderRef builder = bld->gallivm->builder;
const unsigned mip_filter = bld->static_state->min_mip_filter;
const unsigned min_filter = bld->static_state->min_img_filter;
const unsigned mag_filter = bld->static_state->mag_img_filter;
const unsigned mip_filter = bld->static_sampler_state->min_mip_filter;
const unsigned min_filter = bld->static_sampler_state->min_img_filter;
const unsigned mag_filter = bld->static_sampler_state->mag_img_filter;
const unsigned dims = bld->dims;
LLVMValueRef packed, packed_lo, packed_hi;
LLVMValueRef unswizzled[4];
struct lp_build_context h16_bld;
/* we only support the common/simple wrap modes at this time */
assert(lp_is_simple_wrap_mode(bld->static_state->wrap_s));
assert(lp_is_simple_wrap_mode(bld->static_sampler_state->wrap_s));
if (dims >= 2)
assert(lp_is_simple_wrap_mode(bld->static_state->wrap_t));
assert(lp_is_simple_wrap_mode(bld->static_sampler_state->wrap_t));
if (dims >= 3)
assert(lp_is_simple_wrap_mode(bld->static_state->wrap_r));
assert(lp_is_simple_wrap_mode(bld->static_sampler_state->wrap_r));
/* make 16-bit fixed-pt builder context */
@@ -1673,7 +1673,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
/*
* Convert to SoA and swizzle.
*/
lp_build_rgba8_to_f32_soa(bld->gallivm,
lp_build_rgba8_to_fi32_soa(bld->gallivm,
bld->texel_type,
packed, unswizzled);

View File

@@ -42,7 +42,7 @@
void
lp_build_sample_aos(struct lp_build_sample_context *bld,
unsigned unit,
unsigned sampler_unit,
LLVMValueRef s,
LLVMValueRef t,
LLVMValueRef r,

View File

@@ -72,7 +72,7 @@
*/
static void
lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
unsigned unit,
unsigned sampler_unit,
LLVMValueRef width,
LLVMValueRef height,
LLVMValueRef depth,
@@ -85,7 +85,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
LLVMValueRef mipoffsets,
LLVMValueRef texel_out[4])
{
const struct lp_sampler_static_state *static_state = bld->static_state;
const struct lp_static_sampler_state *static_state = bld->static_sampler_state;
const unsigned dims = bld->dims;
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
LLVMBuilderRef builder = bld->gallivm->builder;
@@ -182,7 +182,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
/* select texel color or border color depending on use_border */
LLVMValueRef border_color_ptr =
bld->dynamic_state->border_color(bld->dynamic_state,
bld->gallivm, unit);
bld->gallivm, sampler_unit);
int chan;
for (chan = 0; chan < 4; chan++) {
LLVMValueRef border_chan =
@@ -190,6 +190,11 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
lp_build_const_int32(bld->gallivm, chan));
LLVMValueRef border_chan_vec =
lp_build_broadcast_scalar(&bld->float_vec_bld, border_chan);
if (!bld->texel_type.floating) {
border_chan_vec = LLVMBuildBitCast(builder, border_chan_vec,
bld->texel_bld.vec_type, "");
}
texel_out[chan] = lp_build_select(&bld->texel_bld, use_border,
border_chan_vec, texel_out[chan]);
}
@@ -312,7 +317,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
break;
case PIPE_TEX_WRAP_CLAMP:
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length_f);
}
@@ -332,7 +337,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
struct lp_build_context abs_coord_bld = bld->coord_bld;
abs_coord_bld.type.sign = FALSE;
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* mul by tex size */
coord = lp_build_mul(coord_bld, coord, length_f);
}
@@ -351,7 +356,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
}
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length_f);
}
@@ -384,7 +389,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
case PIPE_TEX_WRAP_MIRROR_CLAMP:
coord = lp_build_abs(coord_bld, coord);
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length_f);
}
@@ -406,7 +411,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
abs_coord_bld.type.sign = FALSE;
coord = lp_build_abs(coord_bld, coord);
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length_f);
}
@@ -428,7 +433,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
{
coord = lp_build_abs(coord_bld, coord);
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length_f);
}
@@ -495,7 +500,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
case PIPE_TEX_WRAP_CLAMP:
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length_f);
}
@@ -510,7 +515,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
break;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length_f);
}
@@ -523,7 +528,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
coord = lp_build_coord_mirror(bld, coord);
/* scale coord to length */
assert(bld->static_state->normalized_coords);
assert(bld->static_sampler_state->normalized_coords);
coord = lp_build_mul(coord_bld, coord, length_f);
/* itrunc == ifloor here */
@@ -537,7 +542,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
coord = lp_build_abs(coord_bld, coord);
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length_f);
}
@@ -552,7 +557,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
coord = lp_build_abs(coord_bld, coord);
if (bld->static_state->normalized_coords) {
if (bld->static_sampler_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length_f);
}
@@ -576,7 +581,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
*/
static void
lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
unsigned unit,
unsigned sampler_unit,
LLVMValueRef size,
LLVMValueRef row_stride_vec,
LLVMValueRef img_stride_vec,
@@ -615,26 +620,26 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
* Compute integer texcoords.
*/
x = lp_build_sample_wrap_nearest(bld, s, width_vec, flt_width_vec,
bld->static_state->pot_width,
bld->static_state->wrap_s);
bld->static_texture_state->pot_width,
bld->static_sampler_state->wrap_s);
lp_build_name(x, "tex.x.wrapped");
if (dims >= 2) {
y = lp_build_sample_wrap_nearest(bld, t, height_vec, flt_height_vec,
bld->static_state->pot_height,
bld->static_state->wrap_t);
bld->static_texture_state->pot_height,
bld->static_sampler_state->wrap_t);
lp_build_name(y, "tex.y.wrapped");
if (dims == 3) {
z = lp_build_sample_wrap_nearest(bld, r, depth_vec, flt_depth_vec,
bld->static_state->pot_depth,
bld->static_state->wrap_r);
bld->static_texture_state->pot_depth,
bld->static_sampler_state->wrap_r);
lp_build_name(z, "tex.z.wrapped");
}
}
if (bld->static_state->target == PIPE_TEXTURE_CUBE ||
bld->static_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_state->target == PIPE_TEXTURE_2D_ARRAY) {
if (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
z = r;
lp_build_name(z, "tex.z.layer");
}
@@ -642,7 +647,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
/*
* Get texture colors.
*/
lp_build_sample_texel_soa(bld, unit,
lp_build_sample_texel_soa(bld, sampler_unit,
width_vec, height_vec, depth_vec,
x, y, z,
row_stride_vec, img_stride_vec,
@@ -656,7 +661,7 @@ lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
*/
static void
lp_build_sample_image_linear(struct lp_build_sample_context *bld,
unsigned unit,
unsigned sampler_unit,
LLVMValueRef size,
LLVMValueRef row_stride_vec,
LLVMValueRef img_stride_vec,
@@ -698,32 +703,32 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
* Compute integer texcoords.
*/
lp_build_sample_wrap_linear(bld, s, width_vec, flt_width_vec,
bld->static_state->pot_width,
bld->static_state->wrap_s,
bld->static_texture_state->pot_width,
bld->static_sampler_state->wrap_s,
&x0, &x1, &s_fpart);
lp_build_name(x0, "tex.x0.wrapped");
lp_build_name(x1, "tex.x1.wrapped");
if (dims >= 2) {
lp_build_sample_wrap_linear(bld, t, height_vec, flt_height_vec,
bld->static_state->pot_height,
bld->static_state->wrap_t,
bld->static_texture_state->pot_height,
bld->static_sampler_state->wrap_t,
&y0, &y1, &t_fpart);
lp_build_name(y0, "tex.y0.wrapped");
lp_build_name(y1, "tex.y1.wrapped");
if (dims == 3) {
lp_build_sample_wrap_linear(bld, r, depth_vec, flt_depth_vec,
bld->static_state->pot_depth,
bld->static_state->wrap_r,
bld->static_texture_state->pot_depth,
bld->static_sampler_state->wrap_r,
&z0, &z1, &r_fpart);
lp_build_name(z0, "tex.z0.wrapped");
lp_build_name(z1, "tex.z1.wrapped");
}
}
if (bld->static_state->target == PIPE_TEXTURE_CUBE ||
bld->static_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_state->target == PIPE_TEXTURE_2D_ARRAY) {
if (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
z0 = z1 = r; /* cube face or array layer */
lp_build_name(z0, "tex.z0.layer");
lp_build_name(z1, "tex.z1.layer");
@@ -734,12 +739,12 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
* Get texture colors.
*/
/* get x0/x1 texels */
lp_build_sample_texel_soa(bld, unit,
lp_build_sample_texel_soa(bld, sampler_unit,
width_vec, height_vec, depth_vec,
x0, y0, z0,
row_stride_vec, img_stride_vec,
data_ptr, mipoffsets, neighbors[0][0]);
lp_build_sample_texel_soa(bld, unit,
lp_build_sample_texel_soa(bld, sampler_unit,
width_vec, height_vec, depth_vec,
x1, y0, z0,
row_stride_vec, img_stride_vec,
@@ -758,12 +763,12 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
LLVMValueRef colors0[4];
/* get x0/x1 texels at y1 */
lp_build_sample_texel_soa(bld, unit,
lp_build_sample_texel_soa(bld, sampler_unit,
width_vec, height_vec, depth_vec,
x0, y1, z0,
row_stride_vec, img_stride_vec,
data_ptr, mipoffsets, neighbors[1][0]);
lp_build_sample_texel_soa(bld, unit,
lp_build_sample_texel_soa(bld, sampler_unit,
width_vec, height_vec, depth_vec,
x1, y1, z0,
row_stride_vec, img_stride_vec,
@@ -784,22 +789,22 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
LLVMValueRef colors1[4];
/* get x0/x1/y0/y1 texels at z1 */
lp_build_sample_texel_soa(bld, unit,
lp_build_sample_texel_soa(bld, sampler_unit,
width_vec, height_vec, depth_vec,
x0, y0, z1,
row_stride_vec, img_stride_vec,
data_ptr, mipoffsets, neighbors1[0][0]);
lp_build_sample_texel_soa(bld, unit,
lp_build_sample_texel_soa(bld, sampler_unit,
width_vec, height_vec, depth_vec,
x1, y0, z1,
row_stride_vec, img_stride_vec,
data_ptr, mipoffsets, neighbors1[0][1]);
lp_build_sample_texel_soa(bld, unit,
lp_build_sample_texel_soa(bld, sampler_unit,
width_vec, height_vec, depth_vec,
x0, y1, z1,
row_stride_vec, img_stride_vec,
data_ptr, mipoffsets, neighbors1[1][0]);
lp_build_sample_texel_soa(bld, unit,
lp_build_sample_texel_soa(bld, sampler_unit,
width_vec, height_vec, depth_vec,
x1, y1, z1,
row_stride_vec, img_stride_vec,
@@ -840,7 +845,7 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
*/
static void
lp_build_sample_mipmap(struct lp_build_sample_context *bld,
unsigned unit,
unsigned sampler_unit,
unsigned img_filter,
unsigned mip_filter,
LLVMValueRef s,
@@ -878,7 +883,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
mipoff0 = lp_build_get_mip_offsets(bld, ilevel0);
}
if (img_filter == PIPE_TEX_FILTER_NEAREST) {
lp_build_sample_image_nearest(bld, unit,
lp_build_sample_image_nearest(bld, sampler_unit,
size0,
row_stride0_vec, img_stride0_vec,
data_ptr0, mipoff0, s, t, r,
@@ -886,7 +891,7 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
}
else {
assert(img_filter == PIPE_TEX_FILTER_LINEAR);
lp_build_sample_image_linear(bld, unit,
lp_build_sample_image_linear(bld, sampler_unit,
size0,
row_stride0_vec, img_stride0_vec,
data_ptr0, mipoff0, s, t, r,
@@ -942,14 +947,14 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
mipoff1 = lp_build_get_mip_offsets(bld, ilevel1);
}
if (img_filter == PIPE_TEX_FILTER_NEAREST) {
lp_build_sample_image_nearest(bld, unit,
lp_build_sample_image_nearest(bld, sampler_unit,
size1,
row_stride1_vec, img_stride1_vec,
data_ptr1, mipoff1, s, t, r,
colors1);
}
else {
lp_build_sample_image_linear(bld, unit,
lp_build_sample_image_linear(bld, sampler_unit,
size1,
row_stride1_vec, img_stride1_vec,
data_ptr1, mipoff1, s, t, r,
@@ -979,13 +984,13 @@ lp_build_sample_mipmap(struct lp_build_sample_context *bld,
*/
static LLVMValueRef
lp_build_layer_coord(struct lp_build_sample_context *bld,
unsigned unit,
unsigned texture_unit,
LLVMValueRef layer)
{
LLVMValueRef maxlayer;
maxlayer = bld->dynamic_state->depth(bld->dynamic_state,
bld->gallivm, unit);
bld->gallivm, texture_unit);
maxlayer = lp_build_sub(&bld->int_bld, maxlayer, bld->int_bld.one);
maxlayer = lp_build_broadcast_scalar(&bld->int_coord_bld, maxlayer);
return lp_build_clamp(&bld->int_coord_bld, layer,
@@ -999,7 +1004,8 @@ lp_build_layer_coord(struct lp_build_sample_context *bld,
*/
static void
lp_build_sample_common(struct lp_build_sample_context *bld,
unsigned unit,
unsigned texture_index,
unsigned sampler_index,
LLVMValueRef *s,
LLVMValueRef *t,
LLVMValueRef *r,
@@ -1011,10 +1017,10 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
LLVMValueRef *ilevel0,
LLVMValueRef *ilevel1)
{
const unsigned mip_filter = bld->static_state->min_mip_filter;
const unsigned min_filter = bld->static_state->min_img_filter;
const unsigned mag_filter = bld->static_state->mag_img_filter;
const unsigned target = bld->static_state->target;
const unsigned mip_filter = bld->static_sampler_state->min_mip_filter;
const unsigned min_filter = bld->static_sampler_state->min_img_filter;
const unsigned mag_filter = bld->static_sampler_state->mag_img_filter;
const unsigned target = bld->static_texture_state->target;
LLVMValueRef first_level;
struct lp_derivatives face_derivs;
@@ -1041,11 +1047,11 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
}
else if (target == PIPE_TEXTURE_1D_ARRAY) {
*r = lp_build_iround(&bld->coord_bld, *t);
*r = lp_build_layer_coord(bld, unit, *r);
*r = lp_build_layer_coord(bld, texture_index, *r);
}
else if (target == PIPE_TEXTURE_2D_ARRAY) {
*r = lp_build_iround(&bld->coord_bld, *r);
*r = lp_build_layer_coord(bld, unit, *r);
*r = lp_build_layer_coord(bld, texture_index, *r);
}
/*
@@ -1056,8 +1062,8 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
/* Need to compute lod either to choose mipmap levels or to
* distinguish between minification/magnification with one mipmap level.
*/
lp_build_lod_selector(bld, unit, derivs,
lod_bias, explicit_lod,
lp_build_lod_selector(bld, texture_index, sampler_index,
derivs, lod_bias, explicit_lod,
mip_filter,
lod_ipart, lod_fpart);
} else {
@@ -1080,23 +1086,23 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
* XXX should probably disable that on other llvm versions.
*/
assert(*lod_ipart);
lp_build_nearest_mip_level(bld, unit, *lod_ipart, ilevel0);
lp_build_nearest_mip_level(bld, texture_index, *lod_ipart, ilevel0);
}
else {
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
bld->gallivm, texture_index);
first_level = lp_build_broadcast_scalar(&bld->perquadi_bld, first_level);
*ilevel0 = first_level;
}
break;
case PIPE_TEX_MIPFILTER_NEAREST:
assert(*lod_ipart);
lp_build_nearest_mip_level(bld, unit, *lod_ipart, ilevel0);
lp_build_nearest_mip_level(bld, texture_index, *lod_ipart, ilevel0);
break;
case PIPE_TEX_MIPFILTER_LINEAR:
assert(*lod_ipart);
assert(*lod_fpart);
lp_build_linear_mip_levels(bld, unit,
lp_build_linear_mip_levels(bld, texture_index,
*lod_ipart, lod_fpart,
ilevel0, ilevel1);
break;
@@ -1110,7 +1116,7 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
*/
static void
lp_build_sample_general(struct lp_build_sample_context *bld,
unsigned unit,
unsigned sampler_unit,
LLVMValueRef s,
LLVMValueRef t,
LLVMValueRef r,
@@ -1122,9 +1128,9 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
{
struct lp_build_context *int_bld = &bld->int_bld;
LLVMBuilderRef builder = bld->gallivm->builder;
const unsigned mip_filter = bld->static_state->min_mip_filter;
const unsigned min_filter = bld->static_state->min_img_filter;
const unsigned mag_filter = bld->static_state->mag_img_filter;
const unsigned mip_filter = bld->static_sampler_state->min_mip_filter;
const unsigned min_filter = bld->static_sampler_state->min_img_filter;
const unsigned mag_filter = bld->static_sampler_state->mag_img_filter;
LLVMValueRef texels[4];
unsigned chan;
@@ -1134,12 +1140,12 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
for (chan = 0; chan < 4; ++chan) {
texels[chan] = lp_build_alloca(bld->gallivm, bld->texel_bld.vec_type, "");
lp_build_name(texels[chan], "sampler%u_texel_%c_var", unit, "xyzw"[chan]);
lp_build_name(texels[chan], "sampler%u_texel_%c_var", sampler_unit, "xyzw"[chan]);
}
if (min_filter == mag_filter) {
/* no need to distinguish between minification and magnification */
lp_build_sample_mipmap(bld, unit,
lp_build_sample_mipmap(bld, sampler_unit,
min_filter, mip_filter,
s, t, r,
ilevel0, ilevel1, lod_fpart,
@@ -1172,7 +1178,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
lp_build_if(&if_ctx, bld->gallivm, minify);
{
/* Use the minification filter */
lp_build_sample_mipmap(bld, unit,
lp_build_sample_mipmap(bld, sampler_unit,
min_filter, mip_filter,
s, t, r,
ilevel0, ilevel1, lod_fpart,
@@ -1181,7 +1187,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
lp_build_else(&if_ctx);
{
/* Use the magnification filter */
lp_build_sample_mipmap(bld, unit,
lp_build_sample_mipmap(bld, sampler_unit,
mag_filter, PIPE_TEX_MIPFILTER_NONE,
s, t, r,
ilevel0, NULL, NULL,
@@ -1192,7 +1198,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
for (chan = 0; chan < 4; ++chan) {
colors_out[chan] = LLVMBuildLoad(builder, texels[chan], "");
lp_build_name(colors_out[chan], "sampler%u_texel_%c", unit, "xyzw"[chan]);
lp_build_name(colors_out[chan], "sampler%u_texel_%c", sampler_unit, "xyzw"[chan]);
}
}
@@ -1207,7 +1213,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
*/
static void
lp_build_fetch_texel(struct lp_build_sample_context *bld,
unsigned unit,
unsigned texture_unit,
const LLVMValueRef *coords,
LLVMValueRef explicit_lod,
const LLVMValueRef *offsets,
@@ -1216,7 +1222,7 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld,
struct lp_build_context *perquadi_bld = &bld->perquadi_bld;
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
unsigned dims = bld->dims, chan;
unsigned target = bld->static_state->target;
unsigned target = bld->static_texture_state->target;
LLVMValueRef size, ilevel;
LLVMValueRef row_stride_vec = NULL, img_stride_vec = NULL;
LLVMValueRef x = coords[0], y = coords[1], z = coords[2];
@@ -1224,10 +1230,10 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld,
LLVMValueRef offset, out_of_bounds, out1;
/* XXX just like ordinary sampling, we don't handle per-pixel lod (yet). */
if (explicit_lod && bld->static_state->target != PIPE_BUFFER) {
if (explicit_lod && bld->static_texture_state->target != PIPE_BUFFER) {
ilevel = lp_build_pack_aos_scalars(bld->gallivm, int_coord_bld->type,
perquadi_bld->type, explicit_lod, 0);
lp_build_nearest_mip_level(bld, unit, ilevel, &ilevel);
lp_build_nearest_mip_level(bld, texture_unit, ilevel, &ilevel);
}
else {
bld->num_lods = 1;
@@ -1242,10 +1248,10 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld,
if (target == PIPE_TEXTURE_1D_ARRAY ||
target == PIPE_TEXTURE_2D_ARRAY) {
if (target == PIPE_TEXTURE_1D_ARRAY) {
z = lp_build_layer_coord(bld, unit, y);
z = lp_build_layer_coord(bld, texture_unit, y);
}
else {
z = lp_build_layer_coord(bld, unit, z);
z = lp_build_layer_coord(bld, texture_unit, z);
}
}
@@ -1283,7 +1289,7 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld,
x, y, z, row_stride_vec, img_stride_vec,
&offset, &i, &j);
if (bld->static_state->target != PIPE_BUFFER) {
if (bld->static_texture_state->target != PIPE_BUFFER) {
offset = lp_build_add(int_coord_bld, offset,
lp_build_get_mip_offsets(bld, ilevel));
}
@@ -1328,11 +1334,11 @@ lp_build_sample_compare(struct lp_build_sample_context *bld,
LLVMValueRef res, p;
const unsigned chan = 0;
if (bld->static_state->compare_mode == PIPE_TEX_COMPARE_NONE)
if (bld->static_sampler_state->compare_mode == PIPE_TEX_COMPARE_NONE)
return;
if (bld->static_state->target == PIPE_TEXTURE_2D_ARRAY ||
bld->static_state->target == PIPE_TEXTURE_CUBE) {
if (bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY ||
bld->static_texture_state->target == PIPE_TEXTURE_CUBE) {
p = coords[3];
}
else {
@@ -1354,7 +1360,7 @@ lp_build_sample_compare(struct lp_build_sample_context *bld,
bld->coord_bld.one);
/* result = (p FUNC texel) ? 1 : 0 */
res = lp_build_cmp(texel_bld, bld->static_state->compare_func,
res = lp_build_cmp(texel_bld, bld->static_sampler_state->compare_func,
p, texel[chan]);
res = lp_build_select(texel_bld, res, texel_bld->one, texel_bld->zero);
@@ -1395,11 +1401,13 @@ lp_build_sample_nop(struct gallivm_state *gallivm,
*/
void
lp_build_sample_soa(struct gallivm_state *gallivm,
const struct lp_sampler_static_state *static_state,
const struct lp_static_texture_state *static_texture_state,
const struct lp_static_sampler_state *static_sampler_state,
struct lp_sampler_dynamic_state *dynamic_state,
struct lp_type type,
boolean is_fetch,
unsigned unit,
unsigned texture_index,
unsigned sampler_index,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,
@@ -1407,10 +1415,11 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
LLVMValueRef explicit_lod, /* optional */
LLVMValueRef texel_out[4])
{
unsigned dims = texture_dims(static_state->target);
unsigned dims = texture_dims(static_texture_state->target);
unsigned num_quads = type.length / 4;
unsigned mip_filter = static_state->min_mip_filter;
unsigned mip_filter;
struct lp_build_sample_context bld;
struct lp_static_sampler_state derived_sampler_state = *static_sampler_state;
LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context);
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef tex_width, tex_height, tex_depth;
@@ -1419,7 +1428,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
LLVMValueRef r;
if (0) {
enum pipe_format fmt = static_state->format;
enum pipe_format fmt = static_texture_state->format;
debug_printf("Sample from %s\n", util_format_name(fmt));
}
@@ -1428,9 +1437,10 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
/* Setup our build context */
memset(&bld, 0, sizeof bld);
bld.gallivm = gallivm;
bld.static_state = static_state;
bld.static_sampler_state = &derived_sampler_state;
bld.static_texture_state = static_texture_state;
bld.dynamic_state = dynamic_state;
bld.format_desc = util_format_description(static_state->format);
bld.format_desc = util_format_description(static_texture_state->format);
bld.dims = dims;
bld.vector_width = lp_type_width(type);
@@ -1448,11 +1458,35 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
bld.perquadf_type.length = type.length > 4 ? ((type.length + 15) / 16) * 4 : 1;
bld.perquadi_type = lp_int_type(bld.perquadf_type);
/* always using the first channel hopefully should be safe,
* if not things WILL break in other places anyway.
*/
if (bld.format_desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB &&
bld.format_desc->channel[0].pure_integer) {
if (bld.format_desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
bld.texel_type = lp_type_int_vec(type.width, type.width * type.length);
}
else if (bld.format_desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED) {
bld.texel_type = lp_type_uint_vec(type.width, type.width * type.length);
}
}
if (!static_texture_state->level_zero_only) {
derived_sampler_state.min_mip_filter = static_sampler_state->min_mip_filter;
} else {
derived_sampler_state.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
}
mip_filter = derived_sampler_state.min_mip_filter;
if (0) {
debug_printf(" .min_mip_filter = %u\n", derived_sampler_state.min_mip_filter);
}
/*
* There are other situations where at least the multiple int lods could be
* avoided like min and max lod being equal.
*/
if ((is_fetch && explicit_lod && bld.static_state->target != PIPE_BUFFER) ||
if ((is_fetch && explicit_lod && bld.static_texture_state->target != PIPE_BUFFER) ||
(!is_fetch && mip_filter != PIPE_TEX_MIPFILTER_NONE)) {
bld.num_lods = num_quads;
}
@@ -1479,13 +1513,13 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
lp_build_context_init(&bld.perquadi_bld, gallivm, bld.perquadi_type);
/* Get the dynamic state */
tex_width = dynamic_state->width(dynamic_state, gallivm, unit);
tex_height = dynamic_state->height(dynamic_state, gallivm, unit);
tex_depth = dynamic_state->depth(dynamic_state, gallivm, unit);
bld.row_stride_array = dynamic_state->row_stride(dynamic_state, gallivm, unit);
bld.img_stride_array = dynamic_state->img_stride(dynamic_state, gallivm, unit);
bld.base_ptr = dynamic_state->base_ptr(dynamic_state, gallivm, unit);
bld.mip_offsets = dynamic_state->mip_offsets(dynamic_state, gallivm, unit);
tex_width = dynamic_state->width(dynamic_state, gallivm, texture_index);
tex_height = dynamic_state->height(dynamic_state, gallivm, texture_index);
tex_depth = dynamic_state->depth(dynamic_state, gallivm, texture_index);
bld.row_stride_array = dynamic_state->row_stride(dynamic_state, gallivm, texture_index);
bld.img_stride_array = dynamic_state->img_stride(dynamic_state, gallivm, texture_index);
bld.base_ptr = dynamic_state->base_ptr(dynamic_state, gallivm, texture_index);
bld.mip_offsets = dynamic_state->mip_offsets(dynamic_state, gallivm, texture_index);
/* Note that mip_offsets is an array[level] of offsets to texture images */
s = coords[0];
@@ -1516,38 +1550,33 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
coords,
texel_out);
}
else if (is_fetch) {
lp_build_fetch_texel(&bld, texture_index, coords,
explicit_lod, offsets,
texel_out);
}
else {
LLVMValueRef lod_ipart = NULL, lod_fpart = NULL;
LLVMValueRef ilevel0 = NULL, ilevel1 = NULL;
boolean use_aos = util_format_fits_8unorm(bld.format_desc) &&
lp_is_simple_wrap_mode(static_state->wrap_s) &&
lp_is_simple_wrap_mode(static_state->wrap_t);
lp_is_simple_wrap_mode(static_sampler_state->wrap_s) &&
lp_is_simple_wrap_mode(static_sampler_state->wrap_t);
if ((gallivm_debug & GALLIVM_DEBUG_PERF) &&
!use_aos && util_format_fits_8unorm(bld.format_desc)) {
debug_printf("%s: using floating point linear filtering for %s\n",
__FUNCTION__, bld.format_desc->short_name);
debug_printf(" min_img %d mag_img %d mip %d wraps %d wrapt %d\n",
static_state->min_img_filter,
static_state->mag_img_filter,
static_state->min_mip_filter,
static_state->wrap_s,
static_state->wrap_t);
static_sampler_state->min_img_filter,
static_sampler_state->mag_img_filter,
static_sampler_state->min_mip_filter,
static_sampler_state->wrap_s,
static_sampler_state->wrap_t);
}
if (is_fetch) {
lp_build_fetch_texel(&bld, unit, coords,
explicit_lod, offsets,
texel_out);
if (static_state->target != PIPE_BUFFER) {
apply_sampler_swizzle(&bld, texel_out);
}
return;
}
lp_build_sample_common(&bld, unit,
lp_build_sample_common(&bld, texture_index, sampler_index,
&s, &t, &r,
derivs, lod_bias, explicit_lod,
&lod_ipart, &lod_fpart,
@@ -1573,7 +1602,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
}
if (use_aos) {
/* do sampling/filtering with fixed pt arithmetic */
lp_build_sample_aos(&bld, unit,
lp_build_sample_aos(&bld, sampler_index,
s, t, r,
lod_ipart, lod_fpart,
ilevel0, ilevel1,
@@ -1581,7 +1610,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
}
else {
lp_build_sample_general(&bld, unit,
lp_build_sample_general(&bld, sampler_index,
s, t, r,
lod_ipart, lod_fpart,
ilevel0, ilevel1,
@@ -1601,7 +1630,8 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
/* Setup our build context */
memset(&bld4, 0, sizeof bld4);
bld4.gallivm = bld.gallivm;
bld4.static_state = bld.static_state;
bld4.static_texture_state = bld.static_texture_state;
bld4.static_sampler_state = bld.static_sampler_state;
bld4.dynamic_state = bld.dynamic_state;
bld4.format_desc = bld.format_desc;
bld4.dims = bld.dims;
@@ -1620,7 +1650,8 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
bld4.float_size_in_type = lp_type_float(32);
bld4.float_size_in_type.length = dims > 1 ? 4 : 1;
bld4.int_size_in_type = lp_int_type(bld4.float_size_in_type);
bld4.texel_type = type4;
bld4.texel_type = bld.texel_type;
bld4.texel_type.length = 4;
bld4.perquadf_type = type4;
/* we want native vector size to be able to use our intrinsics */
bld4.perquadf_type.length = 1;
@@ -1661,7 +1692,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
if (use_aos) {
/* do sampling/filtering with fixed pt arithmetic */
lp_build_sample_aos(&bld4, unit,
lp_build_sample_aos(&bld4, sampler_index,
s4, t4, r4,
lod_iparts, lod_fparts,
ilevel0s, ilevel1s,
@@ -1669,7 +1700,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
}
else {
lp_build_sample_general(&bld4, unit,
lp_build_sample_general(&bld4, sampler_index,
s4, t4, r4,
lod_iparts, lod_fparts,
ilevel0s, ilevel1s,
@@ -1684,19 +1715,33 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
texel_out[j] = lp_build_concat(gallivm, texelouttmp[j], type4, num_quads);
}
}
lp_build_sample_compare(&bld, coords, texel_out);
}
lp_build_sample_compare(&bld, coords, texel_out);
if (static_texture_state->target != PIPE_BUFFER) {
apply_sampler_swizzle(&bld, texel_out);
}
apply_sampler_swizzle(&bld, texel_out);
/*
* texel type can be a (32bit) int/uint (for pure int formats only),
* however we are expected to always return floats (storage is untyped).
*/
if (!bld.texel_type.floating) {
unsigned chan;
for (chan = 0; chan < 4; chan++) {
texel_out[chan] = LLVMBuildBitCast(builder, texel_out[chan],
lp_build_vec_type(gallivm, type), "");
}
}
}
void
lp_build_size_query_soa(struct gallivm_state *gallivm,
const struct lp_sampler_static_state *static_state,
const struct lp_static_texture_state *static_state,
struct lp_sampler_dynamic_state *dynamic_state,
struct lp_type int_type,
unsigned unit,
unsigned texture_unit,
LLVMValueRef explicit_lod,
LLVMValueRef *sizes_out)
{
@@ -1739,7 +1784,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
if (explicit_lod) {
LLVMValueRef first_level;
lod = LLVMBuildExtractElement(gallivm->builder, explicit_lod, lp_build_const_int32(gallivm, 0), "");
first_level = dynamic_state->first_level(dynamic_state, gallivm, unit);
first_level = dynamic_state->first_level(dynamic_state, gallivm, texture_unit);
lod = lp_build_broadcast_scalar(&bld_int_vec,
LLVMBuildAdd(gallivm->builder, lod, first_level, "lod"));
@@ -1750,18 +1795,18 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
size = bld_int_vec.undef;
size = LLVMBuildInsertElement(gallivm->builder, size,
dynamic_state->width(dynamic_state, gallivm, unit),
dynamic_state->width(dynamic_state, gallivm, texture_unit),
lp_build_const_int32(gallivm, 0), "");
if (dims >= 2) {
size = LLVMBuildInsertElement(gallivm->builder, size,
dynamic_state->height(dynamic_state, gallivm, unit),
dynamic_state->height(dynamic_state, gallivm, texture_unit),
lp_build_const_int32(gallivm, 1), "");
}
if (dims >= 3) {
size = LLVMBuildInsertElement(gallivm->builder, size,
dynamic_state->depth(dynamic_state, gallivm, unit),
dynamic_state->depth(dynamic_state, gallivm, texture_unit),
lp_build_const_int32(gallivm, 2), "");
}
@@ -1769,7 +1814,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
if (has_array)
size = LLVMBuildInsertElement(gallivm->builder, size,
dynamic_state->depth(dynamic_state, gallivm, unit),
dynamic_state->depth(dynamic_state, gallivm, texture_unit),
lp_build_const_int32(gallivm, dims), "");
for (i = 0; i < dims + (has_array ? 1 : 0); i++) {

View File

@@ -173,7 +173,8 @@ struct lp_build_sampler_soa
struct gallivm_state *gallivm,
struct lp_type type,
boolean is_fetch,
unsigned unit,
unsigned texture_index,
unsigned sampler_index,
const LLVMValueRef *coords,
const LLVMValueRef *offsets,
const struct lp_derivatives *derivs,

View File

@@ -1331,7 +1331,8 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
bld->bld_base.base.gallivm,
bld->bld_base.base.type,
FALSE,
unit, coords,
unit, unit,
coords,
offsets,
&derivs,
lod_bias, explicit_lod,
@@ -1417,7 +1418,8 @@ emit_txf( struct lp_build_tgsi_soa_context *bld,
bld->bld_base.base.gallivm,
bld->bld_base.base.type,
TRUE,
unit, coords,
unit, unit,
coords,
offsets,
&derivs,
NULL, explicit_lod,

View File

@@ -1 +0,0 @@
/Makefile

View File

@@ -7,8 +7,6 @@ AM_CPPFLAGS = $(DEFINES) \
-I$(top_srcdir)/src/gallium/auxiliary \
-I$(top_srcdir)/src/gallium/winsys
AM_CFLAGS = $(PIC_FLAGS)
noinst_LTLIBRARIES =
if HAVE_LOADER_GALLIUM
@@ -22,17 +20,6 @@ libpipe_loader_la_SOURCES = \
if HAVE_DRM_LOADER_GALLIUM
libpipe_loader_la_SOURCES += pipe_loader_drm.c
AM_CFLAGS += $(LIBDRM_CFLAGS)
AM_CFLAGS = $(LIBDRM_CFLAGS)
endif
# Provide compatibility with scripts for the old Mesa build system for
# a while by putting a link to the library in the current directory.
all-local: libpipe_loader.la
ln -f .libs/libpipe_loader.a .
clean-local:
rm -f libpipe_loader.a
endif
# FIXME: Remove when the rest of Gallium is converted to automake.
default: all

View File

@@ -1,18 +0,0 @@
TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = pipebuffer
C_SOURCES = \
pb_buffer_fenced.c \
pb_buffer_malloc.c \
pb_bufmgr_alt.c \
pb_bufmgr_cache.c \
pb_bufmgr_debug.c \
pb_bufmgr_mm.c \
pb_bufmgr_ondemand.c \
pb_bufmgr_pool.c \
pb_bufmgr_slab.c \
pb_validate.c
include ../../Makefile.template

File diff suppressed because it is too large Load Diff

View File

@@ -1,342 +0,0 @@
/**************************************************************************
*
* Copyright (C) 2008 Tungsten Graphics, Inc. All Rights Reserved.
* Copyright (C) 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL 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.
*
**************************************************************************/
/**
* PPC code generation.
* \author Brian Paul
*/
#ifndef RTASM_PPC_H
#define RTASM_PPC_H
#include "pipe/p_compiler.h"
#define PPC_INST_SIZE 4 /**< 4 bytes / instruction */
#define PPC_NUM_REGS 32
#define PPC_NUM_FP_REGS 32
#define PPC_NUM_VEC_REGS 32
/** Stack pointer register */
#define PPC_REG_SP 1
/** Branch conditions */
#define BRANCH_COND_ALWAYS 0x14 /* binary 1z1zz (z=ignored) */
/** Branch hints */
#define BRANCH_HINT_SUB_RETURN 0x0 /* binary 00 */
struct ppc_function
{
uint32_t *store; /**< instruction buffer */
uint num_inst;
uint max_inst;
uint32_t reg_used; /** used/free general-purpose registers bitmask */
uint32_t fp_used; /** used/free floating point registers bitmask */
uint32_t vec_used; /** used/free vector registers bitmask */
int indent;
boolean print;
};
extern void ppc_init_func(struct ppc_function *p);
extern void ppc_release_func(struct ppc_function *p);
extern uint ppc_num_instructions(const struct ppc_function *p);
extern void (*ppc_get_func( struct ppc_function *p ))( void );
extern void ppc_dump_func(const struct ppc_function *p);
extern void ppc_print_code(struct ppc_function *p, boolean enable);
extern void ppc_indent(struct ppc_function *p, int spaces);
extern void ppc_comment(struct ppc_function *p, int rel_indent, const char *s);
extern int ppc_reserve_register(struct ppc_function *p, int reg);
extern int ppc_allocate_register(struct ppc_function *p);
extern void ppc_release_register(struct ppc_function *p, int reg);
extern int ppc_allocate_fp_register(struct ppc_function *p);
extern void ppc_release_fp_register(struct ppc_function *p, int reg);
extern int ppc_allocate_vec_register(struct ppc_function *p);
extern void ppc_release_vec_register(struct ppc_function *p, int reg);
/**
** float vector arithmetic
**/
/** vector float add */
extern void
ppc_vaddfp(struct ppc_function *p,uint vD, uint vA, uint vB);
/** vector float substract */
extern void
ppc_vsubfp(struct ppc_function *p, uint vD, uint vA, uint vB);
/** vector float min */
extern void
ppc_vminfp(struct ppc_function *p, uint vD, uint vA, uint vB);
/** vector float max */
extern void
ppc_vmaxfp(struct ppc_function *p, uint vD, uint vA, uint vB);
/** vector float mult add: vD = vA * vB + vC */
extern void
ppc_vmaddfp(struct ppc_function *p, uint vD, uint vA, uint vB, uint vC);
/** vector float negative mult subtract: vD = vA - vB * vC */
extern void
ppc_vnmsubfp(struct ppc_function *p, uint vD, uint vA, uint vB, uint vC);
/** vector float compare greater than */
extern void
ppc_vcmpgtfpx(struct ppc_function *p, uint vD, uint vA, uint vB);
/** vector float compare greater than or equal to */
extern void
ppc_vcmpgefpx(struct ppc_function *p, uint vD, uint vA, uint vB);
/** vector float compare equal */
extern void
ppc_vcmpeqfpx(struct ppc_function *p, uint vD, uint vA, uint vB);
/** vector float 2^x */
extern void
ppc_vexptefp(struct ppc_function *p, uint vD, uint vB);
/** vector float log2(x) */
extern void
ppc_vlogefp(struct ppc_function *p, uint vD, uint vB);
/** vector float reciprocol */
extern void
ppc_vrefp(struct ppc_function *p, uint vD, uint vB);
/** vector float reciprocol sqrt estimate */
extern void
ppc_vrsqrtefp(struct ppc_function *p, uint vD, uint vB);
/** vector float round to negative infinity */
extern void
ppc_vrfim(struct ppc_function *p, uint vD, uint vB);
/** vector float round to positive infinity */
extern void
ppc_vrfip(struct ppc_function *p, uint vD, uint vB);
/** vector float round to nearest int */
extern void
ppc_vrfin(struct ppc_function *p, uint vD, uint vB);
/** vector float round to int toward zero */
extern void
ppc_vrfiz(struct ppc_function *p, uint vD, uint vB);
/** vector store: store vR at mem[vA+vB] */
extern void
ppc_stvx(struct ppc_function *p, uint vR, uint vA, uint vB);
/** vector load: vR = mem[vA+vB] */
extern void
ppc_lvx(struct ppc_function *p, uint vR, uint vA, uint vB);
/** load vector element word: vR = mem_word[vA+vB] */
extern void
ppc_lvewx(struct ppc_function *p, uint vR, uint vA, uint vB);
/**
** vector bitwise operations
**/
/** vector and */
extern void
ppc_vand(struct ppc_function *p, uint vD, uint vA, uint vB);
/** vector and complement */
extern void
ppc_vandc(struct ppc_function *p, uint vD, uint vA, uint vB);
/** vector or */
extern void
ppc_vor(struct ppc_function *p, uint vD, uint vA, uint vB);
/** vector nor */
extern void
ppc_vnor(struct ppc_function *p, uint vD, uint vA, uint vB);
/** vector xor */
extern void
ppc_vxor(struct ppc_function *p, uint vD, uint vA, uint vB);
/** Pseudo-instruction: vector move */
extern void
ppc_vmove(struct ppc_function *p, uint vD, uint vA);
/** Set vector register to {0,0,0,0} */
extern void
ppc_vzero(struct ppc_function *p, uint vr);
/**
** Vector shuffle / select / splat / etc
**/
/** vector permute */
extern void
ppc_vperm(struct ppc_function *p, uint vD, uint vA, uint vB, uint vC);
/** vector select */
extern void
ppc_vsel(struct ppc_function *p, uint vD, uint vA, uint vB, uint vC);
/** vector splat byte */
extern void
ppc_vspltb(struct ppc_function *p, uint vD, uint vB, uint imm);
/** vector splat half word */
extern void
ppc_vsplthw(struct ppc_function *p, uint vD, uint vB, uint imm);
/** vector splat word */
extern void
ppc_vspltw(struct ppc_function *p, uint vD, uint vB, uint imm);
/** vector splat signed immediate word */
extern void
ppc_vspltisw(struct ppc_function *p, uint vD, int imm);
/** vector shift left word: vD[word] = vA[word] << (vB[word] & 0x1f) */
extern void
ppc_vslw(struct ppc_function *p, uint vD, uint vA, uint vB);
/**
** scalar arithmetic
**/
extern void
ppc_add(struct ppc_function *p, uint rt, uint ra, uint rb);
extern void
ppc_addi(struct ppc_function *p, uint rt, uint ra, int imm);
extern void
ppc_addis(struct ppc_function *p, uint rt, uint ra, int imm);
extern void
ppc_and(struct ppc_function *p, uint rt, uint ra, uint rb);
extern void
ppc_andi(struct ppc_function *p, uint rt, uint ra, int imm);
extern void
ppc_or(struct ppc_function *p, uint rt, uint ra, uint rb);
extern void
ppc_ori(struct ppc_function *p, uint rt, uint ra, int imm);
extern void
ppc_xor(struct ppc_function *p, uint rt, uint ra, uint rb);
extern void
ppc_xori(struct ppc_function *p, uint rt, uint ra, int imm);
extern void
ppc_mr(struct ppc_function *p, uint rt, uint ra);
extern void
ppc_li(struct ppc_function *p, uint rt, int imm);
extern void
ppc_lis(struct ppc_function *p, uint rt, int imm);
extern void
ppc_load_int(struct ppc_function *p, uint rt, int imm);
/**
** scalar load/store
**/
extern void
ppc_stwu(struct ppc_function *p, uint rs, uint ra, int d);
extern void
ppc_stw(struct ppc_function *p, uint rs, uint ra, int d);
extern void
ppc_lwz(struct ppc_function *p, uint rs, uint ra, int d);
/**
** Float (non-vector) arithmetic
**/
extern void
ppc_fadd(struct ppc_function *p, uint frt, uint fra, uint frb);
extern void
ppc_fsub(struct ppc_function *p, uint frt, uint fra, uint frb);
extern void
ppc_fctiwz(struct ppc_function *p, uint rt, uint ra);
extern void
ppc_stfs(struct ppc_function *p, uint frs, uint ra, int offset);
extern void
ppc_stfiwx(struct ppc_function *p, uint frs, uint ra, uint rb);
extern void
ppc_lfs(struct ppc_function *p, uint frt, uint ra, int offset);
/**
** branch instructions
**/
extern void
ppc_blr(struct ppc_function *p);
void
ppc_bclr(struct ppc_function *p, uint condOp, uint branchHint, uint condReg);
extern void
ppc_return(struct ppc_function *p);
#endif /* RTASM_PPC_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,51 +0,0 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* 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 TUNGSTEN GRAPHICS 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 TGSI_PPC_H
#define TGSI_PPC_H
#if defined __cplusplus
extern "C" {
#endif
struct tgsi_token;
struct ppc_function;
extern const float ppc_builtin_constants[];
boolean
tgsi_emit_ppc(const struct tgsi_token *tokens,
struct ppc_function *function,
float (*immediates)[4],
boolean do_swizzles);
#if defined __cplusplus
}
#endif
#endif /* TGSI_PPC_H */

View File

@@ -1816,7 +1816,8 @@ void util_blitter_custom_color(struct blitter_context *blitter,
blitter_disable_render_cond(ctx);
/* bind states */
pipe->bind_blend_state(pipe, custom_blend);
pipe->bind_blend_state(pipe, custom_blend ? custom_blend
: ctx->blend[PIPE_MASK_RGBA]);
pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil);
ctx->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1, FALSE));
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);

View File

@@ -232,7 +232,7 @@ debug_get_flags_option(const char *name,
unsigned long result;
const char *str;
const struct debug_named_value *orig = flags;
int namealign = 0;
unsigned namealign = 0;
str = os_get_option(name);
if(!str)
@@ -386,6 +386,10 @@ static const struct debug_named_value pipe_prim_names[] = {
DEBUG_NAMED_VALUE(PIPE_PRIM_QUADS),
DEBUG_NAMED_VALUE(PIPE_PRIM_QUAD_STRIP),
DEBUG_NAMED_VALUE(PIPE_PRIM_POLYGON),
DEBUG_NAMED_VALUE(PIPE_PRIM_LINES_ADJACENCY),
DEBUG_NAMED_VALUE(PIPE_PRIM_LINE_STRIP_ADJACENCY),
DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLES_ADJACENCY),
DEBUG_NAMED_VALUE(PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY),
#endif
DEBUG_NAMED_VALUE_END
};

View File

@@ -52,6 +52,7 @@ union util_color {
ubyte ub;
ushort us;
uint ui;
ushort h[4]; /* half float */
float f[4];
double d[4];
};
@@ -329,6 +330,8 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
/**
* Note rgba outside [0,1] will be clamped for int pixel formats.
* This will not work (and might not really be useful with float input)
* for pure integer formats (which lack the pack_rgba_float function).
*/
static INLINE void
util_pack_color(const float rgba[4], enum pipe_format format, union util_color *uc)

View File

@@ -316,13 +316,39 @@ util_make_fragment_tex_shader_writestencil(struct pipe_context *pipe,
/**
* Make simple fragment color pass-through shader.
* Make simple fragment color pass-through shader that replicates OUT[0]
* to all bound colorbuffers.
*/
void *
util_make_fragment_passthrough_shader(struct pipe_context *pipe)
util_make_fragment_passthrough_shader(struct pipe_context *pipe,
int input_semantic,
int input_interpolate)
{
return util_make_fragment_cloneinput_shader(pipe, 1, TGSI_SEMANTIC_COLOR,
TGSI_INTERPOLATE_PERSPECTIVE);
static const char shader_templ[] =
"FRAG\n"
"PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1\n"
"DCL IN[0], %s[0], %s\n"
"DCL OUT[0], COLOR[0]\n"
"MOV OUT[0], IN[0]\n"
"END\n";
char text[sizeof(shader_templ)+100];
struct tgsi_token tokens[1000];
struct pipe_shader_state state = {tokens};
sprintf(text, shader_templ, tgsi_semantic_names[input_semantic],
tgsi_interpolate_names[input_interpolate]);
if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
assert(0);
return NULL;
}
#if 0
tgsi_dump(state.tokens, 0);
#endif
return pipe->create_fs_state(pipe, &state);
}

View File

@@ -87,7 +87,9 @@ util_make_fragment_tex_shader_writestencil(struct pipe_context *pipe,
extern void *
util_make_fragment_passthrough_shader(struct pipe_context *pipe);
util_make_fragment_passthrough_shader(struct pipe_context *pipe,
int input_semantic,
int input_interpolate);
extern void *

View File

@@ -421,10 +421,10 @@ util_clear_depth_stencil(struct pipe_context *pipe,
else {
uint32_t dst_mask;
if (format == PIPE_FORMAT_Z24_UNORM_S8_UINT)
dst_mask = 0xffffff00;
dst_mask = 0x00ffffff;
else {
assert(format == PIPE_FORMAT_S8_UINT_Z24_UNORM);
dst_mask = 0xffffff;
dst_mask = 0xffffff00;
}
if (clear_flags & PIPE_CLEAR_DEPTH)
dst_mask = ~dst_mask;

View File

@@ -806,7 +806,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
for (j = 0; j < w; j++) {
/* convert 32-bit integer Z to float Z */
const double scale = 1.0 / 0xffffffffU;
pDest[j] = ptrc[j] * scale;
pDest[j] = (float) (ptrc[j] * scale);
}
pDest += pt->stride/4;
ptrc += srcStride;
@@ -820,7 +820,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
for (j = 0; j < w; j++) {
/* convert 32-bit integer Z to float Z */
const double scale = 1.0 / 0xffffffffU;
pDest[j*2] = ptrc[j] * scale;
pDest[j*2] = (float) (ptrc[j] * scale);
}
pDest += pt->stride/4;
ptrc += srcStride;

View File

@@ -45,13 +45,13 @@ struct pipe_transfer;
static INLINE boolean
u_clip_tile(uint x, uint y, uint *w, uint *h, const struct pipe_box *box)
{
if (x >= box->width)
if ((int) x >= box->width)
return TRUE;
if (y >= box->height)
if ((int) y >= box->height)
return TRUE;
if (x + *w > box->width)
if ((int) (x + *w) > box->width)
*w = box->width - x;
if (y + *h > box->height)
if ((int) (y + *h) > box->height)
*h = box->height - y;
return FALSE;
}

View File

@@ -163,6 +163,13 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
unsigned alloc_offset = align(min_out_offset, upload->alignment);
unsigned offset;
/* Init these return values here in case we fail below to make
* sure the caller doesn't get garbage values.
*/
*out_offset = ~0;
pipe_resource_reference(outbuf, NULL);
*ptr = NULL;
/* Make sure we have enough space in the upload buffer
* for the sub-allocation. */
if (MAX2(upload->offset, alloc_offset) + alloc_size > upload->size) {
@@ -182,8 +189,6 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
PIPE_TRANSFER_UNSYNCHRONIZED,
&upload->transfer);
if (!upload->map) {
pipe_resource_reference(outbuf, NULL);
*ptr = NULL;
upload->transfer = NULL;
return PIPE_ERROR_OUT_OF_MEMORY;
}

View File

@@ -323,7 +323,7 @@ void u_vbuf_destroy(struct u_vbuf *mgr)
FREE(mgr);
}
static void
static enum pipe_error
u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
unsigned vb_mask, unsigned out_vb,
int start_vertex, unsigned num_vertices,
@@ -335,6 +335,7 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
struct pipe_resource *out_buffer = NULL;
uint8_t *out_map;
unsigned out_offset, mask;
enum pipe_error err;
/* Get a translate object. */
tr = translate_cache_find(mgr->translate_cache, key);
@@ -381,6 +382,14 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
assert((ib->buffer || ib->user_buffer) && ib->index_size);
/* Create and map the output buffer. */
err = u_upload_alloc(mgr->uploader, 0,
key->output_stride * num_indices,
&out_offset, &out_buffer,
(void**)&out_map);
if (err != PIPE_OK)
return err;
if (ib->user_buffer) {
map = (uint8_t*)ib->user_buffer + offset;
} else {
@@ -389,12 +398,6 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
PIPE_TRANSFER_READ, &transfer);
}
/* Create and map the output buffer. */
u_upload_alloc(mgr->uploader, 0,
key->output_stride * num_indices,
&out_offset, &out_buffer,
(void**)&out_map);
switch (ib->index_size) {
case 4:
tr->run_elts(tr, (unsigned*)map, num_indices, 0, out_map);
@@ -412,11 +415,13 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
}
} else {
/* Create and map the output buffer. */
u_upload_alloc(mgr->uploader,
key->output_stride * start_vertex,
key->output_stride * num_vertices,
&out_offset, &out_buffer,
(void**)&out_map);
err = u_upload_alloc(mgr->uploader,
key->output_stride * start_vertex,
key->output_stride * num_vertices,
&out_offset, &out_buffer,
(void**)&out_map);
if (err != PIPE_OK)
return err;
out_offset -= key->output_stride * start_vertex;
@@ -441,6 +446,8 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
pipe_resource_reference(
&mgr->real_vertex_buffer[out_vb].buffer, NULL);
mgr->real_vertex_buffer[out_vb].buffer = out_buffer;
return PIPE_OK;
}
static boolean
@@ -588,11 +595,14 @@ u_vbuf_translate_begin(struct u_vbuf *mgr,
/* Translate buffers. */
for (type = 0; type < VB_NUM; type++) {
if (key[type].nr_elements) {
u_vbuf_translate_buffers(mgr, &key[type], mask[type],
mgr->fallback_vbs[type],
start[type], num[type],
start_index, num_indices, min_index,
unroll_indices && type == VB_VERTEX);
enum pipe_error err;
err = u_vbuf_translate_buffers(mgr, &key[type], mask[type],
mgr->fallback_vbs[type],
start[type], num[type],
start_index, num_indices, min_index,
unroll_indices && type == VB_VERTEX);
if (err != PIPE_OK)
return FALSE;
/* Fixup the stride for constant attribs. */
if (type == VB_CONST) {
@@ -884,7 +894,7 @@ void u_vbuf_set_index_buffer(struct u_vbuf *mgr,
pipe->set_index_buffer(pipe, ib);
}
static void
static enum pipe_error
u_vbuf_upload_buffers(struct u_vbuf *mgr,
int start_vertex, unsigned num_vertices,
int start_instance, unsigned num_instances)
@@ -953,6 +963,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
unsigned start, end;
struct pipe_vertex_buffer *real_vb;
const uint8_t *ptr;
enum pipe_error err;
i = u_bit_scan(&buffer_mask);
@@ -963,11 +974,15 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
real_vb = &mgr->real_vertex_buffer[i];
ptr = mgr->vertex_buffer[i].user_buffer;
u_upload_data(mgr->uploader, start, end - start, ptr + start,
&real_vb->buffer_offset, &real_vb->buffer);
err = u_upload_data(mgr->uploader, start, end - start, ptr + start,
&real_vb->buffer_offset, &real_vb->buffer);
if (err != PIPE_OK)
return err;
real_vb->buffer_offset -= start;
}
return PIPE_OK;
}
static boolean u_vbuf_need_minmax_index(struct u_vbuf *mgr)
@@ -1176,11 +1191,13 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info)
if (unroll_indices ||
incompatible_vb_mask ||
mgr->ve->incompatible_elem_mask) {
/* XXX check the return value */
u_vbuf_translate_begin(mgr, start_vertex, num_vertices,
info->start_instance, info->instance_count,
info->start, info->count, min_index,
unroll_indices);
if (!u_vbuf_translate_begin(mgr, start_vertex, num_vertices,
info->start_instance, info->instance_count,
info->start, info->count, min_index,
unroll_indices)) {
debug_warn_once("u_vbuf_translate_begin() failed");
return;
}
user_vb_mask &= ~(incompatible_vb_mask |
mgr->ve->incompatible_vb_mask_all);
@@ -1188,8 +1205,13 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info)
/* Upload user buffers. */
if (user_vb_mask) {
u_vbuf_upload_buffers(mgr, start_vertex, num_vertices,
info->start_instance, info->instance_count);
if (u_vbuf_upload_buffers(mgr, start_vertex, num_vertices,
info->start_instance,
info->instance_count) != PIPE_OK) {
debug_warn_once("u_vbuf_upload_buffers() failed");
return;
}
mgr->dirty_real_vb_mask |= user_vb_mask;
}

View File

@@ -199,13 +199,15 @@ create_frag_shader_weave(struct vl_compositor *c)
/* calculate the texture offsets
* t_tc.x = i_tc.x
* t_tc.y = (round(i_tc.y) + 0.5) / height * 2
* t_tc.y = (round(i_tc.y - 0.5) + 0.5) / height * 2
*/
for (i = 0; i < 2; ++i) {
ureg_MOV(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_X), i_tc[i]);
ureg_ROUND(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ), i_tc[i]);
ureg_SUB(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ),
i_tc[i], ureg_imm1f(shader, 0.5f));
ureg_ROUND(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ), ureg_src(t_tc[i]));
ureg_MOV(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_W),
ureg_imm1f(shader, i ? 0.75f : 0.25f));
ureg_imm1f(shader, i ? -0.25f : 0.25f));
ureg_ADD(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_YZ),
ureg_src(t_tc[i]), ureg_imm1f(shader, 0.5f));
ureg_MUL(shader, ureg_writemask(t_tc[i], TGSI_WRITEMASK_Y),
@@ -234,11 +236,11 @@ create_frag_shader_weave(struct vl_compositor *c)
ureg_ROUND(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ), i_tc[0]);
ureg_ADD(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ),
ureg_src(t_tc[0]), ureg_negate(i_tc[0]));
ureg_MUL(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_XY),
ureg_MUL(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ),
ureg_abs(ureg_src(t_tc[0])), ureg_imm1f(shader, 2.0f));
ureg_LRP(shader, t_texel[0], ureg_swizzle(ureg_src(t_tc[0]),
TGSI_SWIZZLE_Y, TGSI_SWIZZLE_Z, TGSI_SWIZZLE_Z, TGSI_SWIZZLE_Z),
ureg_src(t_texel[1]), ureg_src(t_texel[0]));
ureg_src(t_texel[0]), ureg_src(t_texel[1]));
/* and finally do colour space transformation
* fragment = csc * texel

View File

@@ -356,20 +356,20 @@ vl_video_buffer_surfaces(struct pipe_video_buffer *buffer)
pipe = buf->base.context;
depth = buffer->interlaced ? 2 : 1;
for (i = 0, surf = 0; i < depth; ++i ) {
for (j = 0; j < VL_NUM_COMPONENTS; ++j, ++surf) {
for (i = 0, surf = 0; i < VL_NUM_COMPONENTS; ++i) {
for (j = 0; j < depth; ++j, ++surf) {
assert(surf < (VL_NUM_COMPONENTS * 2));
if (!buf->resources[j]) {
if (!buf->resources[i]) {
pipe_surface_reference(&buf->surfaces[surf], NULL);
continue;
}
if (!buf->surfaces[surf]) {
memset(&surf_templ, 0, sizeof(surf_templ));
surf_templ.format = vl_video_buffer_surface_format(buf->resources[j]->format);
surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = i;
buf->surfaces[surf] = pipe->create_surface(pipe, buf->resources[j], &surf_templ);
surf_templ.format = vl_video_buffer_surface_format(buf->resources[i]->format);
surf_templ.u.tex.first_layer = surf_templ.u.tex.last_layer = j;
buf->surfaces[surf] = pipe->create_surface(pipe, buf->resources[i], &surf_templ);
if (!buf->surfaces[surf])
goto error;
}

View File

@@ -65,7 +65,7 @@ struct vl_dri_screen
xcb_dri2_wait_sbc_cookie_t wait_cookie;
xcb_dri2_get_buffers_cookie_t buffers_cookie;
int64_t last_ust, ns_frame, last_msc, next_msc, skew_msc;
int64_t last_ust, ns_frame, last_msc, next_msc;
};
static const unsigned int attachments[1] = { XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT };
@@ -81,9 +81,6 @@ vl_dri2_handle_stamps(struct vl_dri_screen* scrn,
if (scrn->last_ust && scrn->last_msc && (ust > scrn->last_ust) && (msc > scrn->last_msc))
scrn->ns_frame = (ust - scrn->last_ust) / (msc - scrn->last_msc);
if (scrn->next_msc && (scrn->next_msc < msc))
scrn->skew_msc++;
scrn->last_ust = ust;
scrn->last_msc = msc;
}
@@ -282,7 +279,7 @@ vl_screen_set_next_timestamp(struct vl_screen *vscreen, uint64_t stamp)
struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
assert(scrn);
if (stamp && scrn->last_ust && scrn->ns_frame && scrn->last_msc)
scrn->next_msc = ((int64_t)stamp - scrn->last_ust) / scrn->ns_frame + scrn->last_msc + scrn->skew_msc;
scrn->next_msc = ((int64_t)stamp - scrn->last_ust + scrn->ns_frame/2) / scrn->ns_frame + scrn->last_msc;
else
scrn->next_msc = 0;
}

View File

@@ -207,8 +207,7 @@ the framebuffer to particular RGBA, depth, or stencil values.
Currently, this does not take into account color or stencil write masks (as
used by GL), and always clears the whole surfaces (no scissoring as used by
GL clear or explicit rectangles like d3d9 uses). It can, however, also clear
only depth or stencil in a combined depth/stencil surface, if the driver
supports PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE.
only depth or stencil in a combined depth/stencil surface.
If a surface includes several layers then all layers will be cleared.
``clear_render_target`` clears a single color rendertarget with the specified

View File

@@ -61,8 +61,6 @@ The integer capabilities:
* ``PIPE_CAP_INDEP_BLEND_FUNC``: Whether per-rendertarget blend functions are
available. If 0, then the first rendertarget's blend functions affect all
MRTs.
* ``PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE``: Whether clearing only depth or only
stencil in a combined depth-stencil buffer is supported.
* ``PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS``: The maximum number of texture array
layers supported. If 0, the array textures are not supported at all and
the ARRAY texture targets are invalid.

View File

@@ -1 +0,0 @@
Makefile

View File

@@ -4,22 +4,21 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/gallium/include \
-I$(top_srcdir)/src/gallium/auxiliary \
-I$(top_srcdir)/src/gallium/drivers \
$(DEFINES) \
$(PIC_FLAGS)
$(DEFINES)
AM_CFLAGS = $(VISIBILITY_CFLAGS)
noinst_LIBRARIES =
noinst_LTLIBRARIES =
SUBDIRS =
SUBDIRS = .
################################################################################
if HAVE_GALAHAD_GALLIUM
noinst_LIBRARIES+= galahad/libgalahad.a
noinst_LTLIBRARIES += galahad/libgalahad.la
galahad_libgalahad_a_SOURCES = \
galahad_libgalahad_la_SOURCES = \
galahad/glhd_objects.c \
galahad/glhd_context.c \
galahad/glhd_screen.c
@@ -30,9 +29,9 @@ endif
if HAVE_IDENTITY_GALLIUM
noinst_LIBRARIES+= identity/libidentity.a
noinst_LTLIBRARIES += identity/libidentity.la
identity_libidentity_a_SOURCES = \
identity_libidentity_la_SOURCES = \
identity/id_objects.c \
identity/id_context.c \
identity/id_screen.c
@@ -46,9 +45,9 @@ if HAVE_NOOP_GALLIUM
# Meta-driver which combines whichever software rasterizers have been
# built into a single convenience library.
noinst_LIBRARIES+= noop/libnoop.a
noinst_LTLIBRARIES += noop/libnoop.la
noop_libnoop_a_SOURCES = \
noop_libnoop_la_SOURCES = \
noop/noop_pipe.c \
noop/noop_state.c
@@ -58,14 +57,10 @@ endif
if NEED_RADEON_GALLIUM
SUBDIRS+= radeon
SUBDIRS += radeon
endif
################################################################################
SUBDIRS+= $(GALLIUM_MAKE_DIRS)
# FIXME: Remove when the rest of Gallium is converted to automake.
default: all
SUBDIRS += $(GALLIUM_MAKE_DIRS)

View File

@@ -1,9 +0,0 @@
TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = i915
# get C_SOURCES
include Makefile.sources
include ../../Makefile.template

View File

@@ -0,0 +1,33 @@
# Copyright © 2012 Intel Corporation
#
# 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, sublicense,
# 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
# 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 SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
include Makefile.sources
include $(top_srcdir)/src/gallium/Automake.inc
noinst_LTLIBRARIES = libi915.la
AM_CPPFLAGS = \
-I$(top_srcdir)/src/gallium/drivers \
-I$(top_srcdir)/include \
$(GALLIUM_CFLAGS)
libi915_la_SOURCES = $(C_SOURCES)

View File

@@ -170,7 +170,6 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
switch (cap) {
/* Supported features (boolean caps). */
case PIPE_CAP_ANISOTROPIC_FILTER:
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
case PIPE_CAP_NPOT_TEXTURES:
case PIPE_CAP_POINT_SPRITE:
case PIPE_CAP_PRIMITIVE_RESTART: /* draw module */

View File

@@ -1,70 +0,0 @@
TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = llvmpipe
C_SOURCES = \
lp_bld_alpha.c \
lp_bld_blend.c \
lp_bld_blend_aos.c \
lp_bld_blend_logicop.c \
lp_bld_depth.c \
lp_bld_interp.c \
lp_clear.c \
lp_context.c \
lp_draw_arrays.c \
lp_fence.c \
lp_flush.c \
lp_jit.c \
lp_memory.c \
lp_perf.c \
lp_query.c \
lp_rast.c \
lp_rast_debug.c \
lp_rast_tri.c \
lp_scene.c \
lp_scene_queue.c \
lp_screen.c \
lp_setup.c \
lp_setup_line.c \
lp_setup_point.c \
lp_setup_tri.c \
lp_setup_vbuf.c \
lp_state_blend.c \
lp_state_clip.c \
lp_state_derived.c \
lp_state_fs.c \
lp_state_setup.c \
lp_state_gs.c \
lp_state_rasterizer.c \
lp_state_sampler.c \
lp_state_so.c \
lp_state_surface.c \
lp_state_vertex.c \
lp_state_vs.c \
lp_surface.c \
lp_tex_sample.c \
lp_texture.c \
lp_tile_image.c
CPP_SOURCES = \
PROGS := lp_test_format \
lp_test_arit \
lp_test_blend \
lp_test_conv \
lp_test_printf
# Need this for the lp_test_*.o files
CLEAN_EXTRA = *.o
include ../../Makefile.template
PROGS_DEPS := ../../auxiliary/libgallium.a
LDFLAGS += $(LLVM_LDFLAGS)
LIBS += -L../../auxiliary/ -lgallium libllvmpipe.a $(LLVM_LIBS) $(GL_LIB_DEPS)
LD=$(CXX)
$(PROGS): lp_test_main.o libllvmpipe.a

View File

@@ -0,0 +1,114 @@
# Copyright © 2012 Intel Corporation
#
# 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, sublicense,
# 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
# 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 SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
include $(top_srcdir)/src/gallium/Automake.inc
AM_CPPFLAGS = \
-I$(top_srcdir)/src/gallium/drivers \
-I$(top_srcdir)/include \
$(GALLIUM_CFLAGS)
AM_CFLAGS = $(LLVM_CFLAGS)
AM_CXXFLAGS= $(LLVM_CXXFLAGS)
noinst_LTLIBRARIES = libllvmpipe.la
libllvmpipe_la_SOURCES = \
lp_bld_alpha.c \
lp_bld_blend.c \
lp_bld_blend_aos.c \
lp_bld_blend_logicop.c \
lp_bld_depth.c \
lp_bld_interp.c \
lp_clear.c \
lp_context.c \
lp_draw_arrays.c \
lp_fence.c \
lp_flush.c \
lp_jit.c \
lp_memory.c \
lp_perf.c \
lp_query.c \
lp_rast.c \
lp_rast_debug.c \
lp_rast_tri.c \
lp_scene.c \
lp_scene_queue.c \
lp_screen.c \
lp_setup.c \
lp_setup_line.c \
lp_setup_point.c \
lp_setup_tri.c \
lp_setup_vbuf.c \
lp_state_blend.c \
lp_state_clip.c \
lp_state_derived.c \
lp_state_fs.c \
lp_state_setup.c \
lp_state_gs.c \
lp_state_rasterizer.c \
lp_state_sampler.c \
lp_state_so.c \
lp_state_surface.c \
lp_state_vertex.c \
lp_state_vs.c \
lp_surface.c \
lp_tex_sample.c \
lp_texture.c \
lp_tile_image.c
libllvmpipe_la_LDFLAGS = $(LLVM_LDFLAGS)
check_PROGRAMS = \
lp_test_format \
lp_test_arit \
lp_test_blend \
lp_test_conv \
lp_test_printf
TESTS = $(check_PROGRAMS)
TEST_LIBS = \
libllvmpipe.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(LLVM_LIBS) \
$(DLOPEN_LIBS) \
$(PTHREAD_LIBS)
lp_test_format_SOURCES = lp_test_format.c lp_test_main.c
lp_test_format_LDADD = $(TEST_LIBS)
nodist_EXTRA_lp_test_format_SOURCES = dummy.cpp
lp_test_arit_SOURCES = lp_test_arit.c lp_test_main.c
lp_test_arit_LDADD = $(TEST_LIBS)
nodist_EXTRA_lp_test_arit_SOURCES = dummy.cpp
lp_test_blend_SOURCES = lp_test_blend.c lp_test_main.c
lp_test_blend_LDADD = $(TEST_LIBS)
nodist_EXTRA_lp_test_blend_SOURCES = dummy.cpp
lp_test_conv_SOURCES = lp_test_conv.c lp_test_main.c
lp_test_conv_LDADD = $(TEST_LIBS)
nodist_EXTRA_lp_test_conv_SOURCES = dummy.cpp
lp_test_printf_SOURCES = lp_test_printf.c lp_test_main.c
lp_test_printf_LDADD = $(TEST_LIBS)
nodist_EXTRA_lp_test_printf_SOURCES = dummy.cpp

View File

@@ -56,7 +56,7 @@ lp_build_blend(struct lp_build_context *bld,
LLVMValueRef
lp_build_blend_aos(struct gallivm_state *gallivm,
const struct pipe_blend_state *blend,
const enum pipe_format *cbuf_format,
const enum pipe_format cbuf_format,
struct lp_type type,
unsigned rt,
LLVMValueRef src,

View File

@@ -266,7 +266,7 @@ lp_build_blend_factor(struct lp_build_blend_aos_context *bld,
* @param blend the blend state of the shader variant
* @param cbuf_format format of the colour buffer
* @param type data type of the pixel vector
* @param rt rt number
* @param rt render target index
* @param src blend src
* @param dst blend dst
* @param mask optional mask to apply to the blending result
@@ -278,7 +278,7 @@ lp_build_blend_factor(struct lp_build_blend_aos_context *bld,
LLVMValueRef
lp_build_blend_aos(struct gallivm_state *gallivm,
const struct pipe_blend_state *blend,
const enum pipe_format *cbuf_format,
const enum pipe_format cbuf_format,
struct lp_type type,
unsigned rt,
LLVMValueRef src,
@@ -298,7 +298,7 @@ lp_build_blend_aos(struct gallivm_state *gallivm,
unsigned alpha_swizzle = UTIL_FORMAT_SWIZZLE_NONE;
unsigned i;
desc = util_format_description(cbuf_format[rt]);
desc = util_format_description(cbuf_format);
/* Setup build context */
memset(&bld, 0, sizeof bld);

View File

@@ -59,5 +59,5 @@ llvmpipe_clear(struct pipe_context *pipe,
if (LP_PERF & PERF_NO_DEPTH)
buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
lp_setup_clear( llvmpipe->setup, color->f, depth, stencil, buffers );
lp_setup_clear( llvmpipe->setup, color, depth, stencil, buffers );
}

View File

@@ -76,12 +76,12 @@ struct llvmpipe_context {
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
struct pipe_index_buffer index_buffer;
struct pipe_resource *mapped_vs_tex[PIPE_MAX_SAMPLERS];
struct pipe_resource *mapped_vs_tex[PIPE_MAX_SHADER_SAMPLER_VIEWS];
unsigned num_samplers[PIPE_SHADER_TYPES];
unsigned num_sampler_views[PIPE_SHADER_TYPES];

View File

@@ -45,7 +45,7 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
{
struct gallivm_state *gallivm = lp->gallivm;
LLVMContextRef lc = gallivm->context;
LLVMTypeRef texture_type;
LLVMTypeRef texture_type, sampler_type;
/* struct lp_jit_texture */
{
@@ -61,11 +61,6 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
elem_types[LP_JIT_TEXTURE_IMG_STRIDE] =
elem_types[LP_JIT_TEXTURE_MIP_OFFSETS] =
LLVMArrayType(LLVMInt32TypeInContext(lc), LP_MAX_TEXTURE_LEVELS);
elem_types[LP_JIT_TEXTURE_MIN_LOD] =
elem_types[LP_JIT_TEXTURE_MAX_LOD] =
elem_types[LP_JIT_TEXTURE_LOD_BIAS] = LLVMFloatTypeInContext(lc);
elem_types[LP_JIT_TEXTURE_BORDER_COLOR] =
LLVMArrayType(LLVMFloatTypeInContext(lc), 4);
texture_type = LLVMStructTypeInContext(lc, elem_types,
Elements(elem_types), 0);
@@ -102,23 +97,43 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, mip_offsets,
gallivm->target, texture_type,
LP_JIT_TEXTURE_MIP_OFFSETS);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, min_lod,
gallivm->target, texture_type,
LP_JIT_TEXTURE_MIN_LOD);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, max_lod,
gallivm->target, texture_type,
LP_JIT_TEXTURE_MAX_LOD);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, lod_bias,
gallivm->target, texture_type,
LP_JIT_TEXTURE_LOD_BIAS);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, border_color,
gallivm->target, texture_type,
LP_JIT_TEXTURE_BORDER_COLOR);
LP_CHECK_STRUCT_SIZE(struct lp_jit_texture,
gallivm->target, texture_type);
}
{
/* struct lp_jit_sampler */
LLVMTypeRef elem_types[LP_JIT_SAMPLER_NUM_FIELDS];
elem_types[LP_JIT_SAMPLER_MIN_LOD] =
elem_types[LP_JIT_SAMPLER_MAX_LOD] =
elem_types[LP_JIT_SAMPLER_LOD_BIAS] = LLVMFloatTypeInContext(lc);
elem_types[LP_JIT_SAMPLER_BORDER_COLOR] =
LLVMArrayType(LLVMFloatTypeInContext(lc), 4);
sampler_type = LLVMStructTypeInContext(lc, elem_types,
Elements(elem_types), 0);
#if HAVE_LLVM < 0x0300
LLVMAddTypeName(gallivm->module, "texture", texture_type);
LLVMInvalidateStructLayout(gallivm->target, texture_type);
#endif
LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, min_lod,
gallivm->target, texture_type,
LP_JIT_SAMPLER_MIN_LOD);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, max_lod,
gallivm->target, texture_type,
LP_JIT_SAMPLER_MAX_LOD);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, lod_bias,
gallivm->target, texture_type,
LP_JIT_SAMPLER_LOD_BIAS);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, border_color,
gallivm->target, texture_type,
LP_JIT_SAMPLER_BORDER_COLOR);
LP_CHECK_STRUCT_SIZE(struct lp_jit_sampler,
gallivm->target, sampler_type);
}
/* struct lp_jit_context */
{
LLVMTypeRef elem_types[LP_JIT_CTX_COUNT];
@@ -132,6 +147,8 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
elem_types[LP_JIT_CTX_U8_BLEND_COLOR] = LLVMPointerType(LLVMInt8TypeInContext(lc), 0);
elem_types[LP_JIT_CTX_F_BLEND_COLOR] = LLVMPointerType(LLVMFloatTypeInContext(lc), 0);
elem_types[LP_JIT_CTX_TEXTURES] = LLVMArrayType(texture_type,
PIPE_MAX_SHADER_SAMPLER_VIEWS);
elem_types[LP_JIT_CTX_SAMPLERS] = LLVMArrayType(sampler_type,
PIPE_MAX_SAMPLERS);
context_type = LLVMStructTypeInContext(lc, elem_types,
@@ -164,6 +181,9 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, textures,
gallivm->target, context_type,
LP_JIT_CTX_TEXTURES);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, samplers,
gallivm->target, context_type,
LP_JIT_CTX_SAMPLERS);
LP_CHECK_STRUCT_SIZE(struct lp_jit_context,
gallivm->target, context_type);

View File

@@ -58,7 +58,11 @@ struct lp_jit_texture
uint32_t row_stride[LP_MAX_TEXTURE_LEVELS];
uint32_t img_stride[LP_MAX_TEXTURE_LEVELS];
uint32_t mip_offsets[LP_MAX_TEXTURE_LEVELS];
/* sampler state, actually */
};
struct lp_jit_sampler
{
float min_lod;
float max_lod;
float lod_bias;
@@ -76,14 +80,18 @@ enum {
LP_JIT_TEXTURE_ROW_STRIDE,
LP_JIT_TEXTURE_IMG_STRIDE,
LP_JIT_TEXTURE_MIP_OFFSETS,
LP_JIT_TEXTURE_MIN_LOD,
LP_JIT_TEXTURE_MAX_LOD,
LP_JIT_TEXTURE_LOD_BIAS,
LP_JIT_TEXTURE_BORDER_COLOR,
LP_JIT_TEXTURE_NUM_FIELDS /* number of fields above */
};
enum {
LP_JIT_SAMPLER_MIN_LOD,
LP_JIT_SAMPLER_MAX_LOD,
LP_JIT_SAMPLER_LOD_BIAS,
LP_JIT_SAMPLER_BORDER_COLOR,
LP_JIT_SAMPLER_NUM_FIELDS /* number of fields above */
};
/**
* This structure is passed directly to the generated fragment shader.
@@ -107,7 +115,8 @@ struct lp_jit_context
uint8_t *u8_blend_color;
float *f_blend_color;
struct lp_jit_texture textures[PIPE_MAX_SAMPLERS];
struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS];
};
@@ -123,6 +132,7 @@ enum {
LP_JIT_CTX_U8_BLEND_COLOR,
LP_JIT_CTX_F_BLEND_COLOR,
LP_JIT_CTX_TEXTURES,
LP_JIT_CTX_SAMPLERS,
LP_JIT_CTX_COUNT
};
@@ -148,6 +158,8 @@ enum {
#define lp_jit_context_textures(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_TEXTURES, "textures")
#define lp_jit_context_samplers(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_SAMPLERS, "samplers")
/**

View File

@@ -146,35 +146,91 @@ lp_rast_clear_color(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
const struct lp_scene *scene = task->scene;
uint8_t clear_color[4];
unsigned i;
for (i = 0; i < 4; ++i) {
clear_color[i] = float_to_ubyte(arg.clear_color[i]);
}
LP_DBG(DEBUG_RAST, "%s 0x%x,0x%x,0x%x,0x%x\n", __FUNCTION__,
clear_color[0],
clear_color[1],
clear_color[2],
clear_color[3]);
for (i = 0; i < scene->fb.nr_cbufs; i++) {
const struct lp_scene *scene = task->scene;
if (scene->fb.nr_cbufs) {
unsigned i;
union util_color uc;
util_pack_color(arg.clear_color,
scene->fb.cbufs[i]->format, &uc);
if (util_format_is_pure_integer(scene->fb.cbufs[0]->format)) {
/*
* We expect int/uint clear values here, though some APIs
* might disagree (but in any case util_pack_color()
* couldn't handle it)...
*/
LP_DBG(DEBUG_RAST, "%s pure int 0x%x,0x%x,0x%x,0x%x\n", __FUNCTION__,
arg.clear_color.ui[0],
arg.clear_color.ui[1],
arg.clear_color.ui[2],
arg.clear_color.ui[3]);
util_fill_rect(scene->cbufs[i].map,
scene->fb.cbufs[i]->format,
scene->cbufs[i].stride,
task->x,
task->y,
TILE_SIZE,
TILE_SIZE,
&uc);
for (i = 0; i < scene->fb.nr_cbufs; i++) {
enum pipe_format format = scene->fb.cbufs[i]->format;
/*
* XXX the format_write_4i/ui functions do clamping to max value
* and I'm not sure that's actually right - spec doesn't seem to
* say much about that topic. If it is should probably adjust the
* border color handling to do the same. If not and chopping off
* bits is the way to go, the write_4i and write_4ui functions
* would be identical.
*/
if (util_format_is_pure_sint(format)) {
int rgba[4];
rgba[0] = arg.clear_color.i[0];
rgba[1] = arg.clear_color.i[1];
rgba[2] = arg.clear_color.i[2];
rgba[3] = arg.clear_color.i[3];
util_format_write_4i(format, rgba, 0, &uc, 0, 0, 0, 1, 1);
}
else {
unsigned rgba[4];
rgba[0] = arg.clear_color.ui[0];
rgba[1] = arg.clear_color.ui[1];
rgba[2] = arg.clear_color.ui[2];
rgba[3] = arg.clear_color.ui[3];
assert(util_format_is_pure_uint(format));
util_format_write_4ui(format, rgba, 0, &uc, 0, 0, 0, 1, 1);
}
util_fill_rect(scene->cbufs[i].map,
scene->fb.cbufs[i]->format,
scene->cbufs[i].stride,
task->x,
task->y,
TILE_SIZE,
TILE_SIZE,
&uc);
}
}
else {
uint8_t clear_color[4];
for (i = 0; i < 4; ++i) {
clear_color[i] = float_to_ubyte(arg.clear_color.f[i]);
}
LP_DBG(DEBUG_RAST, "%s 0x%x,0x%x,0x%x,0x%x\n", __FUNCTION__,
clear_color[0],
clear_color[1],
clear_color[2],
clear_color[3]);
for (i = 0; i < scene->fb.nr_cbufs; i++) {
util_pack_color(arg.clear_color.f,
scene->fb.cbufs[i]->format, &uc);
util_fill_rect(scene->cbufs[i].map,
scene->fb.cbufs[i]->format,
scene->cbufs[i].stride,
task->x,
task->y,
TILE_SIZE,
TILE_SIZE,
&uc);
}
}
}
LP_COUNT(nr_color_tile_clear);

View File

@@ -152,7 +152,7 @@ union lp_rast_cmd_arg {
unsigned plane_mask;
} triangle;
const struct lp_rast_state *set_state;
float clear_color[4];
union pipe_color_union clear_color;
struct {
uint32_t value;
uint32_t mask;

View File

@@ -158,8 +158,6 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 0;
case PIPE_CAP_PRIMITIVE_RESTART:
return 1;
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
return 1;
case PIPE_CAP_DEPTH_CLIP_DISABLE:
return 0;
case PIPE_CAP_SHADER_STENCIL_EXPORT:
@@ -334,6 +332,20 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
if (!format_desc->is_array && !format_desc->is_bitmask)
return FALSE;
/*
* XXX refuse formats known to crash in generate_unswizzled_blend().
* These include all 3-channel 24bit RGB8 variants, plus 48bit
* (except those using floats) 3-channel RGB16 variants (the latter
* seems to be more of a llvm bug though).
* The mesa state tracker only seems to use these for SINT/UINT formats.
*/
if (format_desc->is_array && format_desc->nr_channels == 3) {
if (format_desc->block.bits == 24 || (format_desc->block.bits == 48 &&
!util_format_is_float(format))) {
return FALSE;
}
}
}
if (bind & PIPE_BIND_DISPLAY_TARGET) {
@@ -358,14 +370,10 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
}
/*
* Everything can be supported by u_format.
* Everything can be supported by u_format
* (those without fetch_rgba_float might be not but shouldn't hit that)
*/
if (format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS &&
!format_desc->fetch_rgba_float) {
return FALSE;
}
return TRUE;
}

View File

@@ -385,7 +385,7 @@ lp_setup_bind_framebuffer( struct lp_setup_context *setup,
static boolean
lp_setup_try_clear( struct lp_setup_context *setup,
const float *color,
const union pipe_color_union *color,
double depth,
unsigned stencil,
unsigned flags )
@@ -399,7 +399,7 @@ lp_setup_try_clear( struct lp_setup_context *setup,
if (flags & PIPE_CLEAR_COLOR) {
for (i = 0; i < 4; i++)
color_arg.clear_color[i] = color[i];
color_arg.clear_color.i[i] = color->i[i];
}
if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
@@ -458,7 +458,7 @@ lp_setup_try_clear( struct lp_setup_context *setup,
}
if (flags & PIPE_CLEAR_COLOR) {
memcpy(setup->clear.color.clear_color,
memcpy(&setup->clear.color.clear_color,
&color_arg,
sizeof setup->clear.color.clear_color);
}
@@ -469,7 +469,7 @@ lp_setup_try_clear( struct lp_setup_context *setup,
void
lp_setup_clear( struct lp_setup_context *setup,
const float *color,
const union pipe_color_union *color,
double depth,
unsigned stencil,
unsigned flags )
@@ -668,9 +668,9 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
assert(num <= PIPE_MAX_SAMPLERS);
assert(num <= PIPE_MAX_SHADER_SAMPLER_VIEWS);
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
for (i = 0; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
struct pipe_sampler_view *view = i < num ? views[i] : NULL;
if (view) {
@@ -780,13 +780,13 @@ lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup,
const struct pipe_sampler_state *sampler = i < num ? samplers[i] : NULL;
if (sampler) {
struct lp_jit_texture *jit_tex;
jit_tex = &setup->fs.current.jit_context.textures[i];
struct lp_jit_sampler *jit_sam;
jit_sam = &setup->fs.current.jit_context.samplers[i];
jit_tex->min_lod = sampler->min_lod;
jit_tex->max_lod = sampler->max_lod;
jit_tex->lod_bias = sampler->lod_bias;
COPY_4V(jit_tex->border_color, sampler->border_color.f);
jit_sam->min_lod = sampler->min_lod;
jit_sam->max_lod = sampler->max_lod;
jit_sam->lod_bias = sampler->lod_bias;
COPY_4V(jit_sam->border_color, sampler->border_color.f);
}
}

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