Compare commits

...

153 Commits

Author SHA1 Message Date
Ian Romanick
889cb2539b docs: Add 7.9 release date 2010-10-04 18:56:21 -07:00
Ian Romanick
242facde45 mesa: set version string to 7.9 (final) 2010-10-04 18:55:57 -07:00
Alex Deucher
73be0dfe03 Add evergreen support to release notes 2010-10-04 21:46:57 -04:00
Ian Romanick
0b300a4e3d docs: Update 7.9 release notes with one more bug fix 2010-10-04 17:43:52 -07:00
Eric Anholt
586797d7a8 i965: Fix glean/texSwizzle regression in previous commit.
Easy enough patch, who needs a full test run.  Oh, that's right.  Me.
(cherry picked from commit 14bf92ba19)
2010-10-04 17:41:56 -07:00
Eric Anholt
9b646b1fd3 i965: Set up swizzling of shadow compare results for GL_DEPTH_TEXTURE_MODE.
The brw_wm_surface_state.c handling of GL_DEPTH_TEXTURE_MODE doesn't
apply to shadow compares, which always return an intensity value.  The
texture swizzles can do the job for us.

Fixes:
glsl1-shadow2D(): 1
glsl1-shadow2D(): 3
(cherry picked from commit a7fa00dfc5)
2010-10-04 17:41:45 -07:00
Kenneth Graunke
dc8e22e4f0 i965: Fix incorrect batchbuffer size in gen6 clip state command.
FORCE_ZERO_RTAINDEX should be in the fourth (and final) dword.
(cherry picked from commit f317713432)
2010-10-04 17:41:33 -07:00
Ian Romanick
21078eef10 docs: Add list of bugs fixed in 7.9
(cherry picked from commit 7f440b3f9d76fa3a02877074d9701ab499d5de34)
2010-10-04 17:38:54 -07:00
Marek Olšák
968a9ec76e update release notes for Gallium
I am trying to be exhaustive, but still I might have missed tons of other
changes to Gallium.
2010-10-05 02:24:50 +02:00
Vinson Lee
2cdfda8851 tgsi: Remove duplicate case value.
Cherry-picked from master commit 2491258436
2010-10-04 17:31:33 +02:00
Jakob Bornecrantz
09d89dc95b tgsi: Actually care what check_soa_dependencies says
Thanks to José for the more complete list of supported opcodes.

Cherry-picked from master commit d21301675c
Also includes fix commit 4bb42a4f7e
2010-10-04 17:30:34 +02:00
José Fonseca
15ad34f012 tgsi: Don't ignore indirect registers in tgsi_check_soa_dependencies
Cherry-picked from master commit c66f0c4629
2010-10-04 17:30:00 +02:00
Alex Deucher
094fe2aa23 r600c: fix segfault in evergreen stencil code
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=30551
2010-10-01 20:15:17 -04:00
Tom Fogal
ba889a2b3e Implement x86_64 atomics for compilers w/o intrinsics.
Really old gcc's (3.3, at least) don't have support for the
intrinsics we need.  This implements a fallback for that case.
2010-10-01 17:56:02 -06:00
richard
71cc467f4c evergreen : fix z format setting, enable stencil. 2010-10-01 16:18:16 -04:00
Alex Deucher
d6e2b707ba r600c: pull over 6xx/7xx vertex fixes for evergreen 2010-10-01 00:52:36 -04:00
Alex Deucher
0ab9d8d94b r600c: add reloc for CB_COLOR0_ATTRIB
We'll need a reloc for tiling eventually,
so add it now.
2010-09-30 20:57:38 -04:00
Adam Jackson
759e9fb737 i965: Update renderer strings for sandybridge
Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 0c86e1f294)
2010-09-30 13:32:42 -07:00
Zhenyu Wang
4af00f1a5e i965: always set tiling for fbo depth buffer on sandybridge
Sandybridge requires depth buffer must be tiling.

Fix 'fbo_firecube' demo.
(cherry picked from commit 72b368ae69)
2010-09-30 13:23:38 -07:00
Zhenyu Wang
1c8795075f i965: fallback lineloop on sandybridge for now
Until we fixed GS hang issue.
(cherry picked from commit 73dab75b41)
2010-09-30 13:23:37 -07:00
Kenneth Graunke
5d43c78d03 glsl: "Copyright", not "Constantright"
Clearly this started out as ir_copy_propagation.cpp, but the search and
replace was a bit overzealous.
(cherry picked from commit 565ff67688)
2010-09-30 13:23:37 -07:00
Marek Olšák
9f076a0848 r300g: fix conditional rendering in non-wait path
NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 83278d384e)
2010-09-30 22:17:15 +02:00
Chia-I Wu
9bab8ca4f8 st/egl: Drop context argument from egl_g3d_get_egl_image.
Fix a regression since 17eace581d.
(cherry picked from commit e2b51b7c5b)
2010-09-30 23:48:34 +08:00
Chia-I Wu
f6eb5d991c mapi: Fix compiler warnings.
Do not use "void *" in arithmetics.
(cherry picked from commit ebeb4a7e8a)
2010-09-30 17:12:30 +08:00
Tom Stellard
f282d72678 r300/compiler: Don't merge instructions that write output regs and ALU result
https://bugs.freedesktop.org/show_bug.cgi?id=30415

(cherry picked from commit b27a809266)
2010-09-29 11:05:01 -07:00
Tom Stellard
e1918fd5d5 r300/compiler: Don't use rc_error() unless the error is unrecoverable
https://bugs.freedesktop.org/show_bug.cgi?id=30416

(cherry picked from commit 1b76dde0cd)
2010-09-29 11:04:12 -07:00
Tom Stellard
fcf5819945 r300/compiler: Fix segfault in error path
https://bugs.freedesktop.org/show_bug.cgi?id=30415

(cherry picked from commit d40ff5510c)
2010-09-29 11:03:02 -07:00
Brian Paul
c584318a21 Makefile: ensure Gallium's Makefile.xorg and SConscript.dri are in the tarball
Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 698893889a)
2010-09-29 09:53:02 -06:00
Kristian Høgsberg
b24238c49a glx: Only remove drawables from the hash when we actually delete them
https://bugs.freedesktop.org/show_bug.cgi?id=30457
2010-09-29 09:10:05 -04:00
Ian Romanick
5d3a4317e8 mesa: set version string to 7.9-rc2 2010-09-28 19:22:55 -07:00
Eric Anholt
836b44b2c8 glsl: Also update implicit sizes of varyings at link time.
Otherwise, we'll often end up with gl_TexCoord being 0 length, for
example.  With ir_to_mesa, things ended up working out anyway, as long
as multiple implicitly-sized arrays weren't involved.
(cherry picked from commit 586b4b500f)
2010-09-28 18:41:05 -07:00
Eric Anholt
83854a9c84 i965: Fix up part of my Sandybridge attributes support patch.
I confused the array sizing for number of files for the number of regs
in a file.
(cherry picked from commit ef8e002c75)
2010-09-28 18:40:32 -07:00
Eric Anholt
b4824096b0 i965: Fix all non-snb regression in the snb attribute interpolation commit.
This apparently had never been tested elsewhere before being merged to
master.
(cherry picked from commit f1dba03056)
2010-09-28 18:40:24 -07:00
Zhenyu Wang
71bdc82c19 i965: fallback bitmap operation on sandybridge
Need to bring back correct fb write with header to set pixel
write mask. Fallback for now.

Note: Conflicts in intel_pixel_bitmap.c due to the removal of
intel_texture_bitmap from master.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-28 18:37:20 -07:00
Zhenyu Wang
aaf7f78dfa i965: fix occlusion query on sandybridge
Fix pipe control command for depth stall and PS_DEPTH_COUNT write.
(cherry picked from commit 3074b61f64)
2010-09-28 18:36:05 -07:00
Zhenyu Wang
5c7a7d0b09 i965: fix point sprite on sandybridge
Need to set point sprite function in fixed SF state now on sandybridge.
(cherry picked from commit ec99833e92)
2010-09-28 18:36:01 -07:00
Zhenyu Wang
f736d85a5a i965: fix scissor state on sandybridge
Fix incorrect scissor rect struct and missed scissor state pointer
setting for sandybridge.
(cherry picked from commit 4b6b0bf24a)
2010-09-28 18:35:57 -07:00
Zhenyu Wang
40dc275431 i965: enable polygon offset on sandybridge
Depth offset function is moved to SF stage on sandybridge.
(cherry picked from commit 3f3059fcc0)
2010-09-28 18:35:41 -07:00
Zhenyu Wang
3dd52d51ce i965: fix pixel w interpolation on sandybridge
(cherry picked from commit 15a8e7ec90)
2010-09-28 18:35:35 -07:00
Zhenyu Wang
e00bb8732c i965: don't do calculation for delta_xy on sandybridge
Sandybridge doesn't have Xstart/Ystart in payload header.
(cherry picked from commit 85fa900b93)
2010-09-28 18:35:30 -07:00
Zhenyu Wang
11215cd535 i965: only allow SIMD8 kernel on sandybridge now
Until we fixed SIMD16 kernel, force to SIMD8 on sandybridge now.
(cherry picked from commit c58bf2cee5)
2010-09-28 18:35:26 -07:00
Zhenyu Wang
6831cf67d1 i965: sandybridge pipe control workaround before write cache flush
Must issue a pipe control with any non-zero post sync op before
write cache flush = 1 pipe control.
(cherry picked from commit 18c3b754f9)
2010-09-28 18:35:21 -07:00
Zhenyu Wang
ece465219f i965: Add all device ids for sandybridge
(cherry picked from commit c8033f1b1e)
2010-09-28 18:35:16 -07:00
Zhenyu Wang
0dc83cc437 i965: fix const register count for sandybridge
Sandybridge's PS constant buffer payload size is decided from
push const buffer command, incorrect size would cause wrong data
in payload for position and vertex attributes. This fixes coefficients
for tex2d/tex3d.
(cherry picked from commit 81aae67e58)
2010-09-28 18:35:11 -07:00
Zhenyu Wang
922d7e1025 i965: Fix sampler on sandybridge
Sandybridge has not much change on texture sampler with Ironlake.
(cherry picked from commit 956f866030)
2010-09-28 18:35:04 -07:00
Zhenyu Wang
4afb1c8451 i965: fix jump count on sandybridge
Jump count is for 64bit long each, so one instruction requires 2
like on Ironlake.
(cherry picked from commit c5a3b25bb9)
2010-09-28 18:34:58 -07:00
Zhenyu Wang
ad52c2b773 i965: VS use SPF mode on sandybridge for now
Until conditional instructions were fixed, use SPF mode instead for now.
(cherry picked from commit 9c39a9fcb2)
2010-09-28 18:34:53 -07:00
Zhenyu Wang
364b6e0709 i965: add sandybridge viewport state bo into validation list
(cherry picked from commit 7401a98e29)
2010-09-28 18:34:47 -07:00
Zhenyu Wang
32c1dc76af i965: ignore quads for GS kernel on sandybridge
Sandybridge's VF would convert quads to polygon which not required
for GS then. Current GS state still would cause hang on lineloop.
(cherry picked from commit a0b1d7b2b8)
2010-09-28 18:34:43 -07:00
Zhenyu Wang
f9ad343cf7 i965: ff sync message change for sandybridge
(cherry picked from commit 67dafa4b56)
2010-09-28 18:34:39 -07:00
Zhenyu Wang
76469d710c i965: fix point size setting in header on sandybridge
(cherry picked from commit fa589770e8)
2010-09-28 18:34:33 -07:00
Zhenyu Wang
6eec2dbfc8 i965: force zero in clipper to ignore RTAIndex on sandybridge
(cherry picked from commit 03218a0093)
2010-09-28 18:34:27 -07:00
Zhenyu Wang
a4f126beaf i965: Fix color interpolation on sandybridge
Don't double store position in vertex attribute. This makes color
interpolation right by using barycentric coordinates.
(cherry picked from commit 41c31c2ebd)
2010-09-28 18:34:22 -07:00
Zhenyu Wang
0d5400519e i965: enable accumulator update in PS kernel too on sandybridge
Accumulator update flag must be set for implicit update on sandybridge.
(cherry picked from commit 8c31a4c3cf)
2010-09-28 18:34:16 -07:00
Zhenyu Wang
36722d7673 i965: new state dump for sandybridge
Dump new state object on sandybridge for cc viewport, clip viewport,
depth stencil, cc and blend state.
(cherry picked from commit b016a78b98)
2010-09-28 18:34:11 -07:00
Zhenyu Wang
3c26f3883a i965: disasm quarter and write enable instruction control on sandybridge
(cherry picked from commit bf60f35934)
2010-09-28 18:34:01 -07:00
Eric Anholt
1975d851e8 i965: Add support for POW in gen6 FS.
Fixes glsl-algebraic-pow-2 in brw_wm_glsl.c mode.
(cherry picked from commit fe2d4a5ea0)
2010-09-28 18:33:49 -07:00
Eric Anholt
f4f1e0d108 i965: Set up inputs to the fragment shader according to FP InputsRead.
Sending down data that doesn't get read doesn't make any sense, and
would make handling things like gl_FrontFacing and gl_PointCoord
harder.
(cherry picked from commit 2f914053bc)
2010-09-28 18:33:34 -07:00
Eric Anholt
cda661fd1c i965: Add support for attribute interpolation on Sandybridge.
Things are simpler these days thanks to barycentric interpolation
parameters being handed in in the payload.
(cherry picked from commit a66e9a4d86)
2010-09-28 18:33:10 -07:00
Eric Anholt
1ab0d45c9f glsl: Fix broadcast_index of lower_variable_index_to_cond_assign.
It's trying to get an int smeared across all channels, not trying to
get a 1:1 mapping of a subset of a vector's channels.  This usually
ended up not mattering with ir_to_mesa, since it just smears floats
into every chan of a vec4.

Fixes:
glsl1-temp array with swizzled variable indexing
(cherry picked from commit 668cdbe129)
2010-09-28 18:31:05 -07:00
Dave Airlie
269dd51162 mesa/mipmap: fix warning since 1acadebd62
1acadebd62 fixed the pointer but not the cast.
(cherry picked from commit 865cf77503)
2010-09-28 18:29:17 -07:00
Eric Anholt
f60c28e083 mesa: Fix type typo in glGenerateMipmap handling of GL_UNSIGNED_INT data.
Fixes ARB_depth_texture/fbo-generatemipmap-formats.
(cherry picked from commit 1acadebd62)
2010-09-28 18:29:10 -07:00
Eric Anholt
aebd78f607 glsl: Fix copy'n'wasted ir_noop_swizzle conditions.
It considered .xyyy a noop for vec4 instead of .xyzw, and similar for vec3.
(cherry picked from commit 3ffab36768)
2010-09-28 18:26:25 -07:00
Eric Anholt
0391eaf088 glsl: Rework assignments with write_masks to have LHS chan count match RHS.
It turns out that most people new to this IR are surprised when an
assignment to (say) 3 components on the LHS takes 4 components on the
RHS.  It also makes for quite strange IR output:

(assign (constant bool (1)) (x) (var_ref color) (swiz x (var_ref v) ))
(assign (constant bool (1)) (y) (var_ref color) (swiz yy (var_ref v) ))
(assign (constant bool (1)) (z) (var_ref color) (swiz zzz (var_ref v) ))

But even worse, even we get it wrong, as shown by this line of our
current step(float, vec4):

(assign (constant bool (1)) (w)
	(var_ref t)
	(expression float b2f (expression bool >=
		    (swiz w (var_ref x))(var_ref edge))))

where we try to assign a float to the writemasked-out x channel and
don't supply anything for the actual w channel we're writing.  Drivers
right now just get lucky since ir_to_mesa spams the float value across
all the source channels of a vec4.

Instead, the RHS will now have a number of components equal to the
number of components actually being written.  Hopefully this confuses
everyone less, and it also makes codegen for a scalar target simpler.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit b39e6f33b6)
2010-09-28 18:25:57 -07:00
Marek Olšák
7436872dce configure.ac: do not build xorg-r300g by default
NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 11eb422a16)
2010-09-28 19:52:22 +02:00
Marek Olšák
7a297bd926 configure.ac: look for libdrm_radeon before building gallium/r300,r600
NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit a1aec2e2be)
2010-09-28 19:52:16 +02:00
Marek Olšák
6c3a8aeb27 r300g: fix swizzling of texture border color
NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit e4fd65e9d7)
2010-09-28 19:51:38 +02:00
Marek Olšák
5c3be43cd2 r300/compiler: fix shadow sampling with swizzled coords
Taking the W component from coords directly ignores swizzling. Instead,
take the component which is mapped to W in the TEX instruction parameter.
The same for Z.

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

Conflicts:

	src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
2010-09-28 19:51:19 +02:00
Marek Olšák
5906b9ac51 r300/compiler: do not use copy propagation if SaturateMode is used
NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit c2ea7ffb0a)
2010-09-28 19:48:31 +02:00
Marek Olšák
89ed679a9e r300/compiler: fix projective mapping of 2D NPOT textures
NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 6f747567ec)

Conflicts:

	src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c
2010-09-28 19:48:00 +02:00
Kristian Høgsberg
7d154de048 glx: Invalidate buffers after binding a drawable
If the server doesn't send invalidate events, we may miss a
resize before the rendering starts.  Invalidate the buffers now
so the driver will recheck before rendering starts.

https://bugs.freedesktop.org/show_bug.cgi?id=29984
https://bugs.freedesktop.org/show_bug.cgi?id=30155
2010-09-28 08:32:45 -04:00
Ian Romanick
2a7ed4ba96 dri: Ensure that DRI driver cpp files are in tarballs
(cherry picked from commit 5717093f15fd7259441b2ee5583432fb9833c9a1)
2010-09-27 14:13:46 -07:00
Ian Romanick
8ad0396108 Add 7.9-rc1 md5sums 2010-09-27 10:20:25 -07:00
Ian Romanick
61653b488d mesa: set version string to 7.9-rc1 2010-09-27 10:17:11 -07:00
Marek Olšák
7e62335f35 r300g: fix macrotiling on R350
MACRO_SWITCH on R350 appears to use the RV350 mode by default. Who knew?

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

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

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

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

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

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

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

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

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

See fd.o bug 29910

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

View File

@@ -180,7 +180,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.9-devel
VERSION=7.9
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
GLUT_NAME = MesaGLUT-$(VERSION)
@@ -329,6 +329,8 @@ GALLIUM_FILES = \
$(DIRECTORY)/src/gallium/Makefile.template \
$(DIRECTORY)/src/gallium/SConscript \
$(DIRECTORY)/src/gallium/targets/Makefile.dri \
$(DIRECTORY)/src/gallium/targets/Makefile.xorg \
$(DIRECTORY)/src/gallium/targets/SConscript.dri \
$(DIRECTORY)/src/gallium/*/Makefile \
$(DIRECTORY)/src/gallium/*/SConscript \
$(DIRECTORY)/src/gallium/*/*/Makefile \
@@ -356,6 +358,7 @@ DRI_FILES = \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \
$(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/dri/*/*.cpp \
$(DIRECTORY)/src/mesa/drivers/dri/*/*/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/dri/*/Makefile \
$(DIRECTORY)/src/mesa/drivers/dri/*/*/Makefile \

View File

@@ -692,6 +692,11 @@ AC_SUBST([GLESv2_PC_LIB_PRIV])
AC_SUBST([HAVE_XF86VIDMODE])
PKG_CHECK_MODULES([LIBDRM_RADEON],
[libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
HAVE_LIBDRM_RADEON=yes,
HAVE_LIBDRM_RADEON=no)
dnl
dnl More X11 setup
dnl
@@ -910,12 +915,7 @@ esac
case $DRI_DIRS in
*radeon*|*r200*|*r300*|*r600*)
PKG_CHECK_MODULES([LIBDRM_RADEON],
[libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
HAVE_LIBDRM_RADEON=yes,
HAVE_LIBDRM_RADEON=no)
if test "$HAVE_LIBDRM_RADEON" = yes; then
if test "x$HAVE_LIBDRM_RADEON" = xyes; then
RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
fi
@@ -1363,7 +1363,7 @@ fi
AC_ARG_WITH([egl-platforms],
[AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
[comma delimited native platforms libEGL supports, e.g.
"x11,kms" @<:@default=auto@:>@])],
"x11,drm" @<:@default=auto@:>@])],
[with_egl_platforms="$withval"],
[with_egl_platforms=yes])
AC_ARG_WITH([egl-displays],
@@ -1376,6 +1376,9 @@ case "$with_egl_platforms" in
yes)
if test "x$enable_egl" = xyes && test "x$mesa_driver" != xosmesa; then
EGL_PLATFORMS="x11"
if test "$mesa_driver" = dri; then
EGL_PLATFORMS="$EGL_PLATFORMS drm"
fi
fi
;;
*)
@@ -1518,18 +1521,28 @@ elif test "x$enable_gallium_i965" = xauto; then
fi
dnl
dnl Gallium Radeon configuration
dnl Gallium Radeon r300g configuration
dnl
AC_ARG_ENABLE([gallium-radeon],
[AS_HELP_STRING([--enable-gallium-radeon],
[build gallium radeon @<:@default=disabled@:>@])],
[enable_gallium_radeon="$enableval"],
[enable_gallium_radeon=auto])
if test "x$enable_gallium_radeon" = xauto; then
if test "x$HAVE_LIBDRM_RADEON" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "dri-r300"
else
AC_MSG_WARN([libdrm_radeon is missing, not building gallium-radeon (r300)])
fi
fi
if test "x$enable_gallium_radeon" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
elif test "x$enable_gallium_radeon" = xauto; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
if test "x$HAVE_LIBDRM_RADEON" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
else
AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-radeon (r300)])
fi
fi
dnl
@@ -1541,8 +1554,12 @@ AC_ARG_ENABLE([gallium-r600],
[enable_gallium_r600="$enableval"],
[enable_gallium_r600=auto])
if test "x$enable_gallium_r600" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
gallium_check_st "r600/drm" "dri-r600"
if test "x$HAVE_LIBDRM_RADEON" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
gallium_check_st "r600/drm" "dri-r600"
else
AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-r600])
fi
fi
dnl

View File

@@ -72,13 +72,13 @@ drivers will be installed to <code>${libdir}/egl</code>.</p>
<li><code>--with-egl-platforms</code>
<p>List the platforms (window systems) to support. Its argument is a comma
seprated string such as <code>--with-egl-platforms=x11,kms</code>. It decides
seprated string such as <code>--with-egl-platforms=x11,drm</code>. It decides
the platforms a driver may support. The first listed platform is also used by
the main library to decide the native platform: the platform the EGL native
types such as <code>EGLNativeDisplayType</code> or
<code>EGLNativeWindowType</code> defined for.</p>
<p>The available platforms are <code>x11</code>, <code>kms</code>,
<p>The available platforms are <code>x11</code>, <code>drm</code>,
<code>fbdev</code>, and <code>gdi</code>. The <code>gdi</code> platform can
only be built with SCons.</p>

View File

@@ -9,6 +9,9 @@
<center><h1>Mesa fbdev/DRI Drivers</h1></center>
<br>
<h1><center>NOTE: this information is obsolete and will be removed at
a future date</center></h1>
<h1>1. Introduction</h1>
<p>
@@ -22,7 +25,7 @@ Contributors to this project include Jon Smirl, Keith Whitwell and Dave Airlie.
<p>
Applications in the fbdev/DRI environment use
the <a href="http://www.nabble.com/file/p15480666/MiniGXL.html"> MiniGLX</a> interface to choose pixel
the MiniGLX interface to choose pixel
formats, create rendering contexts, etc. It's a subset of the GLX and
Xlib interfaces allowing some degree of application portability between
the X and X-less environments.
@@ -315,8 +318,7 @@ It means that the sample_server process is not running.
<h1>5.0 Programming Information</h1>
<p>
OpenGL/Mesa is interfaced to fbdev via the <a href="http://www.nabble.com/file/p15480666/MiniGLX.html">MiniGLX</a>
interface.
OpenGL/Mesa is interfaced to fbdev via the MiniGLX interface.
MiniGLX is a subset of Xlib and GLX API functions which provides just
enough functionality to setup OpenGL rendering and respond to simple
input events.
@@ -332,7 +334,7 @@ This allows some degree of flexibility for software development and testing.
However, the MiniGLX API is not binary-compatible with full Xlib/GLX.
Some of the structures are different and some macros/functions work
differently.
See the <code>GL/miniglx.h</code> header file for details.
See the GL/miniglx.h header file for details.
</p>

View File

@@ -11,6 +11,14 @@
<H1>News</H1>
<h2>September 27, 2010</h2>
<p>
<a href="relnotes-7.9.0.html">Mesa 7.9.0-rc1</a> is released. This is a
release candidate for the 7.9 development release.
</p>
<h2>June 16, 2010</h2>
<p>
@@ -1277,7 +1285,6 @@ grateful.
<p>
</p><h2>March 18, 1999</h2>
<p>The new webpages are now online. Enjoy, and let me know if you find any errors.
For an eye-candy free version you can use <a href="http://www.mesa3d.org/txt/">http://www.mesa3d.org/txt/</a>.</p>
<p>
</p><h2>February 16, 1999</h2>
<p><a href="http://www.sgi.com/">SGI</a> releases its <a href="http://www.sgi.com/software/opensource/glx/">GLX

View File

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

View File

@@ -805,7 +805,7 @@ typedef struct __DRIimageExtensionRec __DRIimageExtension;
struct __DRIimageExtensionRec {
__DRIextension base;
__DRIimage *(*createImageFromName)(__DRIcontext *context,
__DRIimage *(*createImageFromName)(__DRIscreen *screen,
int width, int height, int format,
int name, int pitch,
void *loaderPrivate);
@@ -841,7 +841,7 @@ typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension;
struct __DRIimageLookupExtensionRec {
__DRIextension base;
__DRIimage *(*lookupEGLImage)(__DRIcontext *context, void *image,
__DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image,
void *loaderPrivate);
};

View File

@@ -370,10 +370,9 @@ dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
}
static __DRIimage *
dri2_lookup_egl_image(__DRIcontext *context, void *image, void *data)
dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data)
{
struct dri2_egl_context *dri2_ctx = data;
_EGLDisplay *disp = dri2_ctx->base.Resource.Display;
_EGLDisplay *disp = data;
struct dri2_egl_image *dri2_img;
_EGLImage *img;
@@ -728,7 +727,7 @@ dri2_create_screen(_EGLDisplay *disp)
dri2_dpy = disp->DriverData;
dri2_dpy->dri_screen =
dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd, dri2_dpy->extensions,
&dri2_dpy->driver_configs, dri2_dpy);
&dri2_dpy->driver_configs, disp);
if (dri2_dpy->dri_screen == NULL) {
_eglLog(_EGL_WARNING, "DRI2: failed to create dri screen");
@@ -1509,7 +1508,6 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer buffer, const EGLint *attr_list)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
struct dri2_egl_image *dri2_img;
unsigned int attachments[1];
xcb_drawable_t drawable;
@@ -1577,7 +1575,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
stride = buffers[0].pitch / buffers[0].cpp;
dri2_img->dri_image =
dri2_dpy->image->createImageFromName(dri2_ctx->dri_context,
dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
buffers_reply->width,
buffers_reply->height,
format,
@@ -1628,7 +1626,6 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer buffer, const EGLint *attr_list)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
struct dri2_egl_image *dri2_img;
EGLint width, height, format, name, stride, pitch, i, err;
@@ -1697,7 +1694,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
}
dri2_img->dri_image =
dri2_dpy->image->createImageFromName(dri2_ctx->dri_context,
dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
width,
height,
format,

View File

@@ -57,7 +57,7 @@ EGL_NATIVE_PLATFORM=_EGL_INVALID_PLATFORM
ifeq ($(firstword $(EGL_PLATFORMS)),x11)
EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11
endif
ifeq ($(firstword $(EGL_PLATFORMS)),kms)
ifeq ($(firstword $(EGL_PLATFORMS)),drm)
EGL_NATIVE_PLATFORM=_EGL_PLATFORM_DRM
endif
ifeq ($(firstword $(EGL_PLATFORMS)),fbdev)

View File

@@ -27,7 +27,7 @@ _eglGetNativePlatformFromEnv(void)
} egl_platforms[_EGL_NUM_PLATFORMS] = {
{ _EGL_PLATFORM_WINDOWS, "gdi" },
{ _EGL_PLATFORM_X11, "x11" },
{ _EGL_PLATFORM_DRM, "kms" },
{ _EGL_PLATFORM_DRM, "drm" },
{ _EGL_PLATFORM_FBDEV, "fbdev" }
};
_EGLPlatformType plat = _EGL_INVALID_PLATFORM;

View File

@@ -263,6 +263,8 @@ do_clip_tri( struct draw_stage *stage,
clipmask &= ~(1<<plane_idx);
assert(n < MAX_CLIPPED_VERTICES);
if (n >= MAX_CLIPPED_VERTICES)
return;
inlist[n] = inlist[0]; /* prevent rotation of vertices */
for (i = 1; i <= n; i++) {
@@ -272,16 +274,22 @@ do_clip_tri( struct draw_stage *stage,
if (!IS_NEGATIVE(dp_prev)) {
assert(outcount < MAX_CLIPPED_VERTICES);
if (outcount >= MAX_CLIPPED_VERTICES)
return;
outlist[outcount++] = vert_prev;
}
if (DIFFERENT_SIGNS(dp, dp_prev)) {
struct vertex_header *new_vert;
assert(tmpnr < MAX_CLIPPED_VERTICES+1);
assert(tmpnr < MAX_CLIPPED_VERTICES + 1);
if (tmpnr >= MAX_CLIPPED_VERTICES + 1)
return;
new_vert = clipper->stage.tmp[tmpnr++];
assert(outcount < MAX_CLIPPED_VERTICES);
if (outcount >= MAX_CLIPPED_VERTICES)
return;
outlist[outcount++] = new_vert;
if (IS_NEGATIVE(dp)) {
@@ -321,27 +329,32 @@ do_clip_tri( struct draw_stage *stage,
/* If flat-shading, copy provoking vertex color to polygon vertex[0]
*/
if (clipper->flat) {
if (stage->draw->rasterizer->flatshade_first) {
if (inlist[0] != header->v[0]) {
assert(tmpnr < MAX_CLIPPED_VERTICES + 1);
inlist[0] = dup_vert(stage, inlist[0], tmpnr++);
copy_colors(stage, inlist[0], header->v[0]);
if (n >= 3) {
if (clipper->flat) {
if (stage->draw->rasterizer->flatshade_first) {
if (inlist[0] != header->v[0]) {
assert(tmpnr < MAX_CLIPPED_VERTICES + 1);
if (tmpnr >= MAX_CLIPPED_VERTICES + 1)
return;
inlist[0] = dup_vert(stage, inlist[0], tmpnr++);
copy_colors(stage, inlist[0], header->v[0]);
}
}
else {
if (inlist[0] != header->v[2]) {
assert(tmpnr < MAX_CLIPPED_VERTICES + 1);
if (tmpnr >= MAX_CLIPPED_VERTICES + 1)
return;
inlist[0] = dup_vert(stage, inlist[0], tmpnr++);
copy_colors(stage, inlist[0], header->v[2]);
}
}
}
else {
if (inlist[0] != header->v[2]) {
assert(tmpnr < MAX_CLIPPED_VERTICES + 1);
inlist[0] = dup_vert(stage, inlist[0], tmpnr++);
copy_colors(stage, inlist[0], header->v[2]);
}
}
}
/* Emit the polygon as triangles to the setup stage:
*/
if (n >= 3)
/* Emit the polygon as triangles to the setup stage:
*/
emit_poly( stage, inlist, n, header );
}
}

View File

@@ -76,11 +76,15 @@ lp_build_broadcast_scalar(struct lp_build_context *bld,
}
else {
LLVMValueRef res;
/* The shuffle vector is always made of int32 elements */
struct lp_type i32_vec_type = lp_type_int_vec(32);
i32_vec_type.length = type.length;
#if HAVE_LLVM >= 0x207
res = LLVMBuildInsertElement(bld->builder, bld->undef, scalar,
LLVMConstInt(LLVMInt32Type(), 0, 0), "");
res = LLVMBuildShuffleVector(bld->builder, res, bld->undef,
lp_build_const_int_vec(type, 0), "");
lp_build_const_int_vec(i32_vec_type, 0), "");
#else
/* XXX: The above path provokes a bug in LLVM 2.6 */
unsigned i;

View File

@@ -605,8 +605,10 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst)
for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
if ((inst->Src[i].Register.File ==
inst->Dst[0].Register.File) &&
(inst->Src[i].Register.Index ==
inst->Dst[0].Register.Index)) {
((inst->Src[i].Register.Index ==
inst->Dst[0].Register.Index) ||
inst->Src[i].Register.Indirect ||
inst->Dst[0].Register.Indirect)) {
/* loop over dest channels */
uint channelsWritten = 0x0;
FOR_EACH_ENABLED_CHANNEL(*inst, chan) {

View File

@@ -2703,8 +2703,7 @@ static void aos_to_soa( struct x86_function *func,
struct x86_reg aos_input = x86_make_reg( file_REG32, reg_BX );
struct x86_reg num_inputs = x86_make_reg( file_REG32, reg_CX );
struct x86_reg stride = x86_make_reg( file_REG32, reg_DX );
int inner_loop;
int loop_top, loop_exit_fixup;
/* Save EBX */
x86_push( func, x86_make_reg( file_REG32, reg_BX ) );
@@ -2717,8 +2716,11 @@ static void aos_to_soa( struct x86_function *func,
x86_mov( func, num_inputs, x86_fn_arg( func, arg_num ) );
x86_mov( func, stride, x86_fn_arg( func, arg_stride ) );
/* do */
inner_loop = x86_get_label( func );
/* while (num_inputs != 0) */
loop_top = x86_get_label( func );
x86_cmp_imm( func, num_inputs, 0 );
loop_exit_fixup = x86_jcc_forward( func, cc_E );
{
x86_push( func, aos_input );
sse_movlps( func, make_xmm( 0 ), x86_make_disp( aos_input, 0 ) );
@@ -2750,9 +2752,10 @@ static void aos_to_soa( struct x86_function *func,
x86_lea( func, aos_input, x86_make_disp(aos_input, 16) );
x86_lea( func, soa_input, x86_make_disp(soa_input, 64) );
}
/* while --num_inputs */
/* --num_inputs */
x86_dec( func, num_inputs );
x86_jcc( func, cc_NE, inner_loop );
x86_jmp( func, loop_top );
x86_fixup_fwd_jump( func, loop_exit_fixup );
/* Restore EBX */
x86_pop( func, x86_make_reg( file_REG32, reg_BX ) );
@@ -2827,31 +2830,52 @@ static void soa_to_aos( struct x86_function *func,
* Check if the instructions dst register is the same as any src
* register and warn if there's a posible SOA dependency.
*/
static void
static boolean
check_soa_dependencies(const struct tgsi_full_instruction *inst)
{
switch (inst->Instruction.Opcode) {
uint opcode = inst->Instruction.Opcode;
/* XXX: we only handle src/dst aliasing in a few opcodes currently.
* Need to use an additional temporay to hold the result in the
* cases where the code is too opaque to fix.
*/
switch (opcode) {
case TGSI_OPCODE_ADD:
case TGSI_OPCODE_MOV:
case TGSI_OPCODE_MUL:
case TGSI_OPCODE_RCP:
case TGSI_OPCODE_RSQ:
case TGSI_OPCODE_EXP:
case TGSI_OPCODE_LOG:
case TGSI_OPCODE_DP3:
case TGSI_OPCODE_DP4:
case TGSI_OPCODE_DP2A:
case TGSI_OPCODE_EX2:
case TGSI_OPCODE_LG2:
case TGSI_OPCODE_POW:
case TGSI_OPCODE_XPD:
case TGSI_OPCODE_DPH:
case TGSI_OPCODE_COS:
case TGSI_OPCODE_SIN:
case TGSI_OPCODE_TEX:
case TGSI_OPCODE_TXB:
case TGSI_OPCODE_TXP:
case TGSI_OPCODE_NRM:
case TGSI_OPCODE_NRM4:
case TGSI_OPCODE_DP2:
/* OK - these opcodes correctly handle SOA dependencies */
break;
return TRUE;
default:
if (tgsi_check_soa_dependencies(inst)) {
uint opcode = inst->Instruction.Opcode;
if (!tgsi_check_soa_dependencies(inst))
return TRUE;
/* XXX: we only handle src/dst aliasing in a few opcodes
* currently. Need to use an additional temporay to hold
* the result in the cases where the code is too opaque to
* fix.
*/
if (opcode != TGSI_OPCODE_MOV) {
debug_printf("Warning: src/dst aliasing in instruction"
" is not handled:\n");
tgsi_dump_instruction(inst, 1);
}
}
debug_printf("Warning: src/dst aliasing in instruction"
" is not handled:\n");
debug_printf("Warning: ");
tgsi_dump_instruction(inst, 1);
return FALSE;
}
}
@@ -2951,7 +2975,8 @@ tgsi_emit_sse2(
tgsi_get_processor_name(proc));
}
check_soa_dependencies(&parse.FullToken.FullInstruction);
if (ok)
ok = check_soa_dependencies(&parse.FullToken.FullInstruction);
break;
case TGSI_TOKEN_TYPE_IMMEDIATE:

View File

@@ -262,19 +262,20 @@ tgsi_util_get_inst_usage_mask(const struct tgsi_full_instruction *inst,
case TGSI_OPCODE_TXL:
case TGSI_OPCODE_TXP:
if (src_idx == 0) {
/* Note that the SHADOW variants use the Z component too */
switch (inst->Texture.Texture) {
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
read_mask = TGSI_WRITEMASK_X;
break;
case TGSI_TEXTURE_SHADOW1D:
read_mask = TGSI_WRITEMASK_XZ;
break;
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_RECT:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
read_mask = TGSI_WRITEMASK_XY;
break;
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
read_mask = TGSI_WRITEMASK_XYZ;

View File

@@ -29,6 +29,8 @@
#define PIPE_ATOMIC_ASM_MSVC_X86
#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86))
#define PIPE_ATOMIC_ASM_GCC_X86
#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64))
#define PIPE_ATOMIC_ASM_GCC_X86_64
#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401)
#define PIPE_ATOMIC_GCC_INTRINSIC
#else
@@ -36,6 +38,51 @@
#endif
#if defined(PIPE_ATOMIC_ASM_GCC_X86_64)
#define PIPE_ATOMIC "GCC x86_64 assembly"
#ifdef __cplusplus
extern "C" {
#endif
#define p_atomic_set(_v, _i) (*(_v) = (_i))
#define p_atomic_read(_v) (*(_v))
static INLINE boolean
p_atomic_dec_zero(int32_t *v)
{
unsigned char c;
__asm__ __volatile__("lock; decl %0; sete %1":"+m"(*v), "=qm"(c)
::"memory");
return c != 0;
}
static INLINE void
p_atomic_inc(int32_t *v)
{
__asm__ __volatile__("lock; incl %0":"+m"(*v));
}
static INLINE void
p_atomic_dec(int32_t *v)
{
__asm__ __volatile__("lock; decl %0":"+m"(*v));
}
static INLINE int32_t
p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new)
{
return __sync_val_compare_and_swap(v, old, _new);
}
#ifdef __cplusplus
}
#endif
#endif /* PIPE_ATOMIC_ASM_GCC_X86_64 */
#if defined(PIPE_ATOMIC_ASM_GCC_X86)

View File

@@ -268,7 +268,7 @@ void util_blitter_destroy(struct blitter_context *blitter)
pipe->delete_fs_state(pipe, ctx->fs_texfetch_depth[i]);
}
for (i = 0; i <= PIPE_MAX_COLOR_BUFS && ctx->fs_col[i]; i++)
for (i = 0; i <= PIPE_MAX_COLOR_BUFS; i++)
if (ctx->fs_col[i])
pipe->delete_fs_state(pipe, ctx->fs_col[i]);

View File

@@ -82,6 +82,7 @@ util_check_caps_out(struct pipe_screen *screen, const unsigned *list, int *out)
*out = i - 3;
return FALSE;
}
break;
case UTIL_CAPS_CHECK_UNIMPLEMENTED:
*out = i - 1;
return FALSE;

View File

@@ -394,7 +394,7 @@ util_pack_color(const float rgba[4], enum pipe_format format, union util_color *
return;
case PIPE_FORMAT_B4G4R4A4_UNORM:
{
uc->ub = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4);
uc->us = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4);
}
return;
case PIPE_FORMAT_A8_UNORM:

View File

@@ -46,6 +46,8 @@
do { \
(elem)->next->prev = (elem)->prev; \
(elem)->prev->next = (elem)->next; \
(elem)->next = elem; \
(elem)->prev = elem; \
} while (0)
/**

View File

@@ -332,7 +332,7 @@ util_clear_depth_stencil(struct pipe_context *pipe,
uint32_t *row = (uint32_t *)dst_map;
for (j = 0; j < width; j++) {
uint32_t tmp = *row & dst_mask;
*row++ = tmp & (zstencil & ~dst_mask);
*row++ = tmp | (zstencil & ~dst_mask);
}
dst_map += dst_stride;
}

View File

@@ -155,12 +155,9 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
draw_install_aapoint_stage(llvmpipe->draw, &llvmpipe->pipe);
draw_install_pstipple_stage(llvmpipe->draw, &llvmpipe->pipe);
/* convert points and lines into triangles:
* (otherwise, draw points and lines natively)
*/
draw_wide_point_sprites(llvmpipe->draw, FALSE);
draw_enable_point_sprites(llvmpipe->draw, FALSE);
draw_wide_point_threshold(llvmpipe->draw, 10000.0);
/* convert points/sprites into triangles. Draw non-AA lines natively */
draw_wide_point_sprites(llvmpipe->draw, TRUE);
draw_enable_point_sprites(llvmpipe->draw, TRUE);
draw_wide_line_threshold(llvmpipe->draw, 10000.0);
#if USE_DRAW_STAGE_PSTIPPLE

View File

@@ -92,8 +92,9 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
int i;
if (!pq->fence) {
assert(0); /* query not in issued state */
return FALSE;
/* no fence because there was no scene, so results is zero */
*result = 0;
return TRUE;
}
if (!lp_fence_signalled(pq->fence)) {

View File

@@ -292,6 +292,7 @@ try_setup_line( struct lp_setup_context *setup,
float x2diff;
float y2diff;
float dx, dy;
float area;
boolean draw_start;
boolean draw_end;
@@ -311,6 +312,18 @@ try_setup_line( struct lp_setup_context *setup,
dx = v1[0][0] - v2[0][0];
dy = v1[0][1] - v2[0][1];
area = (dx * dx + dy * dy);
if (area == 0) {
LP_COUNT(nr_culled_tris);
return TRUE;
}
info.oneoverarea = 1.0f / area;
info.dx = dx;
info.dy = dy;
info.v1 = v1;
info.v2 = v2;
/* X-MAJOR LINE */
if (fabsf(dx) >= fabsf(dy)) {
@@ -573,12 +586,6 @@ try_setup_line( struct lp_setup_context *setup,
line->plane[3].dcdx = y[3] - y[0];
info.oneoverarea = 1.0f / (dx * dx + dy * dy);
info.dx = dx;
info.dy = dy;
info.v1 = v1;
info.v2 = v2;
/* Setup parameter interpolants:
*/
setup_line_coefficients( setup, line, &info);

View File

@@ -447,8 +447,10 @@ do_triangle_ccw(struct lp_setup_context *setup,
static INLINE uint32_t
floor_pot(uint32_t n)
{
assert(n);
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
if (n == 0)
return 0;
__asm__("bsr %1,%0"
: "=r" (n)
: "rm" (n));

View File

@@ -39,5 +39,6 @@ EXTRA_OBJECTS = \
include ../../Makefile.template
.PHONY: $(COMPILER_ARCHIVE)
$(COMPILER_ARCHIVE):
$(MAKE) -C $(TOP)/src/mesa/drivers/dri/r300/compiler

View File

@@ -263,10 +263,6 @@ static void r300_clear(struct pipe_context* pipe,
zstex->hiz_in_use[fb->zsbuf->level])) {
r300->hyperz_state.dirty = TRUE;
}
/* XXX this flush "fixes" a hardlock in the cubestorm xscreensaver */
if (r300->flush_counter == 0)
pipe->flush(pipe, 0, NULL);
}
/* Clear a region of a color surface to a constant value. */

View File

@@ -162,7 +162,6 @@ struct r300_sampler_state {
uint32_t filter0; /* R300_TX_FILTER0: 0x4400 */
uint32_t filter1; /* R300_TX_FILTER1: 0x4440 */
uint32_t border_color; /* R300_TX_BORDER_COLOR: 0x45c0 */
/* Min/max LOD must be clamped to [0, last_level], thus
* it's dependent on a currently bound texture */
@@ -457,6 +456,7 @@ struct r300_context {
size_t draw_vbo_size;
/* Whether the VBO must not be flushed. */
boolean draw_vbo_locked;
boolean draw_first_emitted;
/* Accelerated blit support. */
struct blitter_context* blitter;

View File

@@ -158,7 +158,7 @@ static void r300_render_condition(struct pipe_context *pipe,
uint mode)
{
struct r300_context *r300 = r300_context(pipe);
uint64_t result;
uint64_t result = 0;
boolean wait;
if (query) {
@@ -167,9 +167,9 @@ static void r300_render_condition(struct pipe_context *pipe,
if (!r300_get_query_result(pipe, query, wait, &result)) {
r300->skip_rendering = FALSE;
} else {
r300->skip_rendering = result == 0;
}
r300->skip_rendering = result == 0;
} else {
r300->skip_rendering = FALSE;
}

View File

@@ -753,6 +753,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
draw_set_mapped_index_buffer(r300->draw, indices);
r300->draw_vbo_locked = TRUE;
r300->draw_first_emitted = FALSE;
draw_vbo(r300->draw, info);
draw_flush(r300->draw);
r300->draw_vbo_locked = FALSE;
@@ -907,10 +908,17 @@ static void r300_render_draw_arrays(struct vbuf_render* render,
DBG(r300, DBG_DRAW, "r300: render_draw_arrays (count: %d)\n", count);
if (!r300_emit_states(r300,
PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
NULL, 0, 0))
return;
if (r300->draw_first_emitted) {
if (!r300_prepare_for_rendering(r300,
PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
NULL, 6, 0, 0))
return;
} else {
if (!r300_emit_states(r300,
PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
NULL, 0, 0))
return;
}
/* Uncomment to dump all VBOs rendered through this interface.
* Slow and noisy!
@@ -937,6 +945,8 @@ static void r300_render_draw_arrays(struct vbuf_render* render,
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
r300render->hwprim);
END_CS;
r300->draw_first_emitted = TRUE;
}
static void r300_render_draw_elements(struct vbuf_render* render,
@@ -955,10 +965,17 @@ static void r300_render_draw_elements(struct vbuf_render* render,
CS_LOCALS(r300);
DBG(r300, DBG_DRAW, "r300: render_draw_elements (count: %d)\n", count);
if (!r300_emit_states(r300,
PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
NULL, 0, 0))
return;
if (r300->draw_first_emitted) {
if (!r300_prepare_for_rendering(r300,
PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
NULL, 256, 0, 0))
return;
} else {
if (!r300_emit_states(r300,
PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
NULL, 0, 0))
return;
}
/* Below we manage the CS space manually because there may be more
* indices than it can fit in CS. */
@@ -999,6 +1016,8 @@ static void r300_render_draw_elements(struct vbuf_render* render,
end_cs_dwords = r300_get_num_cs_end_dwords(r300);
}
}
r300->draw_first_emitted = TRUE;
}
static void r300_render_destroy(struct vbuf_render* render)

View File

@@ -1171,7 +1171,6 @@ static void*
struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state);
boolean is_r500 = r300->screen->caps.is_r500;
int lod_bias;
union util_color uc;
sampler->state = *state;
@@ -1228,9 +1227,6 @@ static void*
sampler->filter1 |= r500_anisotropy(state->max_anisotropy);
}
util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
sampler->border_color = uc.ui;
/* R500-specific fixups and optimizations */
if (r300->screen->caps.is_r500) {
sampler->filter1 |= R500_BORDER_FIX;

View File

@@ -567,6 +567,58 @@ static void r300_update_rs_block(struct r300_context *r300)
}
}
static uint32_t r300_get_border_color(enum pipe_format format,
const float border[4])
{
const struct util_format_description *desc;
float border_swizzled[4] = {
border[2],
border[1],
border[0],
border[3]
};
uint32_t r;
desc = util_format_description(format);
/* We don't use util_pack_format because it does not handle the formats
* we want, e.g. R4G4B4A4 is non-existent in Gallium. */
switch (desc->channel[0].size) {
case 4:
r = ((float_to_ubyte(border_swizzled[0]) & 0xf0) >> 4) |
((float_to_ubyte(border_swizzled[1]) & 0xf0) << 0) |
((float_to_ubyte(border_swizzled[2]) & 0xf0) << 4) |
((float_to_ubyte(border_swizzled[3]) & 0xf0) << 8);
break;
case 5:
if (desc->channel[1].size == 5) {
r = ((float_to_ubyte(border_swizzled[0]) & 0xf8) >> 3) |
((float_to_ubyte(border_swizzled[1]) & 0xf8) << 2) |
((float_to_ubyte(border_swizzled[2]) & 0xf8) << 7) |
((float_to_ubyte(border_swizzled[3]) & 0x80) << 8);
} else if (desc->channel[1].size == 6) {
r = ((float_to_ubyte(border_swizzled[0]) & 0xf8) >> 3) |
((float_to_ubyte(border_swizzled[1]) & 0xfc) << 3) |
((float_to_ubyte(border_swizzled[2]) & 0xf8) << 8);
} else {
assert(0);
}
break;
default:
/* I think the fat formats (16, 32) are specified
* as the 8-bit ones. I am not sure how compressed formats
* work here. */
r = ((float_to_ubyte(border_swizzled[0]) & 0xff) << 0) |
((float_to_ubyte(border_swizzled[1]) & 0xff) << 8) |
((float_to_ubyte(border_swizzled[2]) & 0xff) << 16) |
((float_to_ubyte(border_swizzled[3]) & 0xff) << 24);
}
return r;
}
static void r300_merge_textures_and_samplers(struct r300_context* r300)
{
struct r300_textures_state *state =
@@ -599,7 +651,11 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
texstate->format = view->format;
texstate->filter0 = sampler->filter0;
texstate->filter1 = sampler->filter1;
texstate->border_color = sampler->border_color;
/* Set the border color. */
texstate->border_color =
r300_get_border_color(view->base.format,
sampler->state.border_color);
/* determine min/max levels */
max_level = MIN3(sampler->max_lod + view->base.first_level,

View File

@@ -256,7 +256,7 @@ static void r300_setup_miptree(struct r300_screen *screen,
{
struct pipe_resource *base = &desc->b.b;
unsigned stride, size, layer_size, nblocksy, i;
boolean rv350_mode = screen->caps.is_rv350;
boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_R350;
boolean aligned_for_cbzb;
desc->size_in_bytes = 0;
@@ -351,7 +351,7 @@ static void r300_setup_tiling(struct r300_screen *screen,
{
struct r300_winsys_screen *rws = screen->rws;
enum pipe_format format = desc->b.b.format;
boolean rv350_mode = screen->caps.is_rv350;
boolean rv350_mode = screen->caps.family >= CHIP_FAMILY_R350;
boolean is_zb = util_format_is_depth_or_stencil(format);
boolean dbg_no_tiling = SCREEN_DBG_ON(screen, DBG_NO_TILING);

View File

@@ -203,7 +203,7 @@ svga_tgsi_translate( const struct svga_shader *shader,
emit.imm_start += key.vkey.num_zero_stride_vertex_elements;
}
emit.nr_hw_const = (emit.imm_start + emit.info.file_max[TGSI_FILE_IMMEDIATE] + 1);
emit.nr_hw_float_const = (emit.imm_start + emit.info.file_max[TGSI_FILE_IMMEDIATE] + 1);
emit.nr_hw_temp = emit.info.file_max[TGSI_FILE_TEMPORARY] + 1;
emit.in_main_func = TRUE;

View File

@@ -62,7 +62,8 @@ struct svga_shader_emitter
int imm_start;
int nr_hw_const;
int nr_hw_float_const;
int nr_hw_int_const;
int nr_hw_temp;
int insn_offset;

View File

@@ -197,22 +197,37 @@ translate_src_register( const struct svga_shader_emitter *emit,
break;
}
/* Indirect addressing (for coninstant buffer lookups only)
/* Indirect addressing.
*/
if (reg->Register.Indirect)
{
/* we shift the offset towards the minimum */
if (svga_arl_needs_adjustment( emit )) {
src.base.num -= svga_arl_adjustment( emit );
if (reg->Register.Indirect) {
if (emit->unit == PIPE_SHADER_FRAGMENT) {
/* Pixel shaders have only loop registers for relative
* addressing into inputs. Ignore the redundant address
* register, the contents of aL should be in sync with it.
*/
if (reg->Register.File == TGSI_FILE_INPUT) {
src.base.relAddr = 1;
src.indirect = src_token(SVGA3DREG_LOOP, 0);
}
}
src.base.relAddr = 1;
else {
/* Constant buffers only.
*/
if (reg->Register.File == TGSI_FILE_CONSTANT) {
/* we shift the offset towards the minimum */
if (svga_arl_needs_adjustment( emit )) {
src.base.num -= svga_arl_adjustment( emit );
}
src.base.relAddr = 1;
/* Not really sure what should go in the second token:
*/
src.indirect = src_token( SVGA3DREG_ADDR,
reg->Indirect.Index );
/* Not really sure what should go in the second token:
*/
src.indirect = src_token( SVGA3DREG_ADDR,
reg->Indirect.Index );
src.indirect.swizzle = SWIZZLE_XXXX;
src.indirect.swizzle = SWIZZLE_XXXX;
}
}
}
src = swizzle( src,
@@ -538,7 +553,7 @@ static boolean emit_def_const( struct svga_shader_emitter *emit,
static INLINE boolean
create_zero_immediate( struct svga_shader_emitter *emit )
{
unsigned idx = emit->nr_hw_const++;
unsigned idx = emit->nr_hw_float_const++;
if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT,
idx, 0, 0, 0, 1 ))
@@ -553,7 +568,7 @@ create_zero_immediate( struct svga_shader_emitter *emit )
static INLINE boolean
create_loop_const( struct svga_shader_emitter *emit )
{
unsigned idx = emit->nr_hw_const++;
unsigned idx = emit->nr_hw_int_const++;
if (!emit_def_const( emit, SVGA3D_CONST_TYPE_INT, idx,
255, /* iteration count */
@@ -571,7 +586,7 @@ create_loop_const( struct svga_shader_emitter *emit )
static INLINE boolean
create_sincos_consts( struct svga_shader_emitter *emit )
{
unsigned idx = emit->nr_hw_const++;
unsigned idx = emit->nr_hw_float_const++;
if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx,
-1.5500992e-006f,
@@ -581,7 +596,7 @@ create_sincos_consts( struct svga_shader_emitter *emit )
return FALSE;
emit->sincos_consts_idx = idx;
idx = emit->nr_hw_const++;
idx = emit->nr_hw_float_const++;
if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx,
-0.020833334f,
@@ -602,7 +617,7 @@ create_arl_consts( struct svga_shader_emitter *emit )
for (i = 0; i < emit->num_arl_consts; i += 4) {
int j;
unsigned idx = emit->nr_hw_const++;
unsigned idx = emit->nr_hw_float_const++;
float vals[4];
for (j = 0; j < 4 && (j + i) < emit->num_arl_consts; ++j) {
vals[j] = emit->arl_consts[i + j].number;
@@ -1593,6 +1608,14 @@ static boolean emit_arl(struct svga_shader_emitter *emit,
const struct tgsi_full_instruction *insn)
{
++emit->current_arl;
if (emit->unit == PIPE_SHADER_FRAGMENT) {
/* MOVA not present in pixel shader instruction set.
* Ignore this instruction altogether since it is
* only used for loop counters -- and for that
* we reference aL directly.
*/
return TRUE;
}
if (svga_arl_needs_adjustment( emit )) {
return emit_fake_arl( emit, insn );
} else {
@@ -2384,7 +2407,7 @@ static boolean make_immediate( struct svga_shader_emitter *emit,
float d,
struct src_register *out )
{
unsigned idx = emit->nr_hw_const++;
unsigned idx = emit->nr_hw_float_const++;
if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT,
idx, a, b, c, d ))

View File

@@ -384,7 +384,6 @@ struct st_manager
* This function is optional.
*/
boolean (*get_egl_image)(struct st_manager *smapi,
struct st_context_iface *stctx,
void *egl_image,
struct st_egl_image *out);

View File

@@ -61,9 +61,6 @@ struct dri_context
/* gallium */
struct st_api *stapi;
struct st_context_iface *st;
/* hooks filled in by dri2 & drisw */
__DRIimage * (*lookup_egl_image)(struct dri_context *ctx, void *handle);
};
static INLINE struct dri_context *

View File

@@ -287,16 +287,14 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
static boolean
dri_get_egl_image(struct st_manager *smapi,
struct st_context_iface *stctxi,
void *egl_image,
struct st_egl_image *stimg)
{
struct dri_context *ctx =
(struct dri_context *)stctxi->st_manager_private;
struct dri_screen *screen = (struct dri_screen *)smapi;
__DRIimage *img = NULL;
if (ctx->lookup_egl_image) {
img = ctx->lookup_egl_image(ctx, egl_image);
if (screen->lookup_egl_image) {
img = screen->lookup_egl_image(screen, egl_image);
}
if (!img)

View File

@@ -69,6 +69,9 @@ struct dri_screen
boolean sd_depth_bits_last;
boolean auto_fake_front;
enum pipe_texture_target target;
/* hooks filled in by dri2 & drisw */
__DRIimage * (*lookup_egl_image)(struct dri_screen *ctx, void *handle);
};
/** cast wrapper */

View File

@@ -291,25 +291,26 @@ dri2_flush_frontbuffer(struct dri_drawable *drawable,
}
static __DRIimage *
dri2_lookup_egl_image(struct dri_context *ctx, void *handle)
dri2_lookup_egl_image(struct dri_screen *screen, void *handle)
{
__DRIimageLookupExtension *loader = ctx->sPriv->dri2.image;
__DRIimageLookupExtension *loader = screen->sPriv->dri2.image;
__DRIimage *img;
if (!loader->lookupEGLImage)
return NULL;
img = loader->lookupEGLImage(ctx->cPriv, handle, ctx->cPriv->loaderPrivate);
img = loader->lookupEGLImage(screen->sPriv,
handle, screen->sPriv->loaderPrivate);
return img;
}
static __DRIimage *
dri2_create_image_from_name(__DRIcontext *context,
dri2_create_image_from_name(__DRIscreen *_screen,
int width, int height, int format,
int name, int pitch, void *loaderPrivate)
{
struct dri_screen *screen = dri_screen(context->driScreenPriv);
struct dri_screen *screen = dri_screen(_screen);
__DRIimage *img;
struct pipe_resource templ;
struct winsys_handle whandle;
@@ -537,6 +538,7 @@ dri2_init_screen(__DRIscreen * sPriv)
screen->auto_fake_front = dri_with_format(sPriv);
screen->broken_invalidate = !sPriv->dri2.useInvalidate;
screen->lookup_egl_image = dri2_lookup_egl_image;
return configs;
fail:
@@ -556,8 +558,6 @@ dri2_create_context(gl_api api, const __GLcontextModes * visual,
ctx = cPriv->driverPrivate;
ctx->lookup_egl_image = dri2_lookup_egl_image;
return TRUE;
}

View File

@@ -24,9 +24,9 @@ x11_SOURCES = $(wildcard x11/*.c) \
x11_OBJECTS = $(x11_SOURCES:.c=.o)
kms_INCLUDES = -I$(TOP)/src/gallium/winsys $(shell pkg-config --cflags-only-I libdrm)
kms_SOURCES = $(wildcard kms/*.c)
kms_OBJECTS = $(kms_SOURCES:.c=.o)
drm_INCLUDES = -I$(TOP)/src/gallium/winsys $(shell pkg-config --cflags-only-I libdrm)
drm_SOURCES = $(wildcard drm/*.c)
drm_OBJECTS = $(drm_SOURCES:.c=.o)
fbdev_INCLUDES = -I$(TOP)/src/gallium/winsys/sw
@@ -34,8 +34,8 @@ fbdev_SOURCES = $(wildcard fbdev/*.c)
fbdev_OBJECTS = $(fbdev_SOURCES:.c=.o)
ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(kms_INCLUDES) $(fbdev_INCLUDES)
ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(kms_SOURCES) $(fbdev_SOURCES)
ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(drm_INCLUDES) $(fbdev_INCLUDES)
ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(drm_SOURCES) $(fbdev_SOURCES)
EGL_OBJECTS = $(common_OBJECTS)
EGL_CPPFLAGS = $(common_INCLUDES)
@@ -45,9 +45,9 @@ ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
EGL_OBJECTS += $(x11_OBJECTS)
EGL_CPPFLAGS += -DHAVE_X11_BACKEND
endif
ifneq ($(findstring kms, $(EGL_PLATFORMS)),)
EGL_OBJECTS += $(kms_OBJECTS)
EGL_CPPFLAGS += -DHAVE_KMS_BACKEND
ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
EGL_OBJECTS += $(drm_OBJECTS)
EGL_CPPFLAGS += -DHAVE_DRM_BACKEND
endif
ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
EGL_OBJECTS += $(fbdev_OBJECTS)
@@ -87,8 +87,8 @@ $(common_OBJECTS): %.o: %.c
$(x11_OBJECTS): %.o: %.c
$(call egl-cc,x11)
$(kms_OBJECTS): %.o: %.c
$(call egl-cc,kms)
$(drm_OBJECTS): %.o: %.c
$(call egl-cc,drm)
$(fbdev_OBJECTS): %.o: %.c
$(call egl-cc,fbdev)

View File

@@ -65,8 +65,8 @@ egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat)
break;
case _EGL_PLATFORM_DRM:
plat_name = "DRM";
#ifdef HAVE_KMS_BACKEND
nplat = native_get_kms_platform();
#ifdef HAVE_DRM_BACKEND
nplat = native_get_drm_platform();
#endif
break;
case _EGL_PLATFORM_FBDEV:

View File

@@ -51,7 +51,6 @@ egl_g3d_st_manager(struct st_manager *smapi)
static boolean
egl_g3d_st_manager_get_egl_image(struct st_manager *smapi,
struct st_context_iface *stctx,
void *egl_image,
struct st_egl_image *out)
{

View File

@@ -227,7 +227,7 @@ const struct native_platform *
native_get_x11_platform(void);
const struct native_platform *
native_get_kms_platform(void);
native_get_drm_platform(void);
const struct native_platform *
native_get_fbdev_platform(void);

View File

@@ -0,0 +1,619 @@
/*
* Mesa 3-D graphics library
* Version: 7.9
*
* Copyright (C) 2010 LunarG Inc.
*
* 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
* 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.
*
* Authors:
* Chia-I Wu <olv@lunarg.com>
*/
#include "util/u_memory.h"
#include "util/u_inlines.h"
#include "egllog.h"
#include "native_drm.h"
static boolean
drm_surface_validate(struct native_surface *nsurf, uint attachment_mask,
unsigned int *seq_num, struct pipe_resource **textures,
int *width, int *height)
{
struct drm_surface *drmsurf = drm_surface(nsurf);
if (!resource_surface_add_resources(drmsurf->rsurf, attachment_mask))
return FALSE;
if (textures)
resource_surface_get_resources(drmsurf->rsurf, textures, attachment_mask);
if (seq_num)
*seq_num = drmsurf->sequence_number;
if (width)
*width = drmsurf->width;
if (height)
*height = drmsurf->height;
return TRUE;
}
/**
* Add textures as DRM framebuffers.
*/
static boolean
drm_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back)
{
struct drm_surface *drmsurf = drm_surface(nsurf);
struct drm_display *drmdpy = drmsurf->drmdpy;
int num_framebuffers = (need_back) ? 2 : 1;
int i, err;
for (i = 0; i < num_framebuffers; i++) {
struct drm_framebuffer *fb;
enum native_attachment natt;
struct winsys_handle whandle;
uint block_bits;
if (i == 0) {
fb = &drmsurf->front_fb;
natt = NATIVE_ATTACHMENT_FRONT_LEFT;
}
else {
fb = &drmsurf->back_fb;
natt = NATIVE_ATTACHMENT_BACK_LEFT;
}
if (!fb->texture) {
/* make sure the texture has been allocated */
resource_surface_add_resources(drmsurf->rsurf, 1 << natt);
fb->texture =
resource_surface_get_single_resource(drmsurf->rsurf, natt);
if (!fb->texture)
return FALSE;
}
/* already initialized */
if (fb->buffer_id)
continue;
/* TODO detect the real value */
fb->is_passive = TRUE;
memset(&whandle, 0, sizeof(whandle));
whandle.type = DRM_API_HANDLE_TYPE_KMS;
if (!drmdpy->base.screen->resource_get_handle(drmdpy->base.screen,
fb->texture, &whandle))
return FALSE;
block_bits = util_format_get_blocksizebits(drmsurf->color_format);
err = drmModeAddFB(drmdpy->fd, drmsurf->width, drmsurf->height,
block_bits, block_bits, whandle.stride, whandle.handle,
&fb->buffer_id);
if (err) {
fb->buffer_id = 0;
return FALSE;
}
}
return TRUE;
}
static boolean
drm_surface_flush_frontbuffer(struct native_surface *nsurf)
{
#ifdef DRM_MODE_FEATURE_DIRTYFB
struct drm_surface *drmsurf = drm_surface(nsurf);
struct drm_display *drmdpy = drmsurf->drmdpy;
if (drmsurf->front_fb.is_passive)
drmModeDirtyFB(drmdpy->fd, drmsurf->front_fb.buffer_id, NULL, 0);
#endif
return TRUE;
}
static boolean
drm_surface_swap_buffers(struct native_surface *nsurf)
{
struct drm_surface *drmsurf = drm_surface(nsurf);
struct drm_crtc *drmcrtc = &drmsurf->current_crtc;
struct drm_display *drmdpy = drmsurf->drmdpy;
struct drm_framebuffer tmp_fb;
int err;
if (!drmsurf->back_fb.buffer_id) {
if (!drm_surface_init_framebuffers(&drmsurf->base, TRUE))
return FALSE;
}
if (drmsurf->is_shown && drmcrtc->crtc) {
err = drmModeSetCrtc(drmdpy->fd, drmcrtc->crtc->crtc_id,
drmsurf->back_fb.buffer_id, drmcrtc->crtc->x, drmcrtc->crtc->y,
drmcrtc->connectors, drmcrtc->num_connectors, &drmcrtc->crtc->mode);
if (err)
return FALSE;
}
/* swap the buffers */
tmp_fb = drmsurf->front_fb;
drmsurf->front_fb = drmsurf->back_fb;
drmsurf->back_fb = tmp_fb;
resource_surface_swap_buffers(drmsurf->rsurf,
NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE);
/* the front/back textures are swapped */
drmsurf->sequence_number++;
drmdpy->event_handler->invalid_surface(&drmdpy->base,
&drmsurf->base, drmsurf->sequence_number);
return TRUE;
}
static void
drm_surface_wait(struct native_surface *nsurf)
{
/* no-op */
}
static void
drm_surface_destroy(struct native_surface *nsurf)
{
struct drm_surface *drmsurf = drm_surface(nsurf);
if (drmsurf->current_crtc.crtc)
drmModeFreeCrtc(drmsurf->current_crtc.crtc);
if (drmsurf->front_fb.buffer_id)
drmModeRmFB(drmsurf->drmdpy->fd, drmsurf->front_fb.buffer_id);
pipe_resource_reference(&drmsurf->front_fb.texture, NULL);
if (drmsurf->back_fb.buffer_id)
drmModeRmFB(drmsurf->drmdpy->fd, drmsurf->back_fb.buffer_id);
pipe_resource_reference(&drmsurf->back_fb.texture, NULL);
resource_surface_destroy(drmsurf->rsurf);
FREE(drmsurf);
}
static struct drm_surface *
drm_display_create_surface(struct native_display *ndpy,
const struct native_config *nconf,
uint width, uint height)
{
struct drm_display *drmdpy = drm_display(ndpy);
struct drm_config *drmconf = drm_config(nconf);
struct drm_surface *drmsurf;
drmsurf = CALLOC_STRUCT(drm_surface);
if (!drmsurf)
return NULL;
drmsurf->drmdpy = drmdpy;
drmsurf->color_format = drmconf->base.color_format;
drmsurf->width = width;
drmsurf->height = height;
drmsurf->rsurf = resource_surface_create(drmdpy->base.screen,
drmsurf->color_format,
PIPE_BIND_RENDER_TARGET |
PIPE_BIND_SAMPLER_VIEW |
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT);
if (!drmsurf->rsurf) {
FREE(drmsurf);
return NULL;
}
resource_surface_set_size(drmsurf->rsurf, drmsurf->width, drmsurf->height);
drmsurf->base.destroy = drm_surface_destroy;
drmsurf->base.swap_buffers = drm_surface_swap_buffers;
drmsurf->base.flush_frontbuffer = drm_surface_flush_frontbuffer;
drmsurf->base.validate = drm_surface_validate;
drmsurf->base.wait = drm_surface_wait;
return drmsurf;
}
/**
* Choose a CRTC that supports all given connectors.
*/
static uint32_t
drm_display_choose_crtc(struct native_display *ndpy,
uint32_t *connectors, int num_connectors)
{
struct drm_display *drmdpy = drm_display(ndpy);
int idx;
for (idx = 0; idx < drmdpy->resources->count_crtcs; idx++) {
boolean found_crtc = TRUE;
int i, j;
for (i = 0; i < num_connectors; i++) {
drmModeConnectorPtr connector;
int encoder_idx = -1;
connector = drmModeGetConnector(drmdpy->fd, connectors[i]);
if (!connector) {
found_crtc = FALSE;
break;
}
/* find an encoder the CRTC supports */
for (j = 0; j < connector->count_encoders; j++) {
drmModeEncoderPtr encoder =
drmModeGetEncoder(drmdpy->fd, connector->encoders[j]);
if (encoder->possible_crtcs & (1 << idx)) {
encoder_idx = j;
break;
}
drmModeFreeEncoder(encoder);
}
drmModeFreeConnector(connector);
if (encoder_idx < 0) {
found_crtc = FALSE;
break;
}
}
if (found_crtc)
break;
}
if (idx >= drmdpy->resources->count_crtcs) {
_eglLog(_EGL_WARNING,
"failed to find a CRTC that supports the given %d connectors",
num_connectors);
return 0;
}
return drmdpy->resources->crtcs[idx];
}
/**
* Remember the original CRTC status and set the CRTC
*/
static boolean
drm_display_set_crtc(struct native_display *ndpy, int crtc_idx,
uint32_t buffer_id, uint32_t x, uint32_t y,
uint32_t *connectors, int num_connectors,
drmModeModeInfoPtr mode)
{
struct drm_display *drmdpy = drm_display(ndpy);
struct drm_crtc *drmcrtc = &drmdpy->saved_crtcs[crtc_idx];
uint32_t crtc_id;
int err;
if (drmcrtc->crtc) {
crtc_id = drmcrtc->crtc->crtc_id;
}
else {
int count = 0, i;
/*
* Choose the CRTC once. It could be more dynamic, but let's keep it
* simple for now.
*/
crtc_id = drm_display_choose_crtc(&drmdpy->base,
connectors, num_connectors);
/* save the original CRTC status */
drmcrtc->crtc = drmModeGetCrtc(drmdpy->fd, crtc_id);
if (!drmcrtc->crtc)
return FALSE;
for (i = 0; i < drmdpy->num_connectors; i++) {
struct drm_connector *drmconn = &drmdpy->connectors[i];
drmModeConnectorPtr connector = drmconn->connector;
drmModeEncoderPtr encoder;
encoder = drmModeGetEncoder(drmdpy->fd, connector->encoder_id);
if (encoder) {
if (encoder->crtc_id == crtc_id) {
drmcrtc->connectors[count++] = connector->connector_id;
if (count >= Elements(drmcrtc->connectors))
break;
}
drmModeFreeEncoder(encoder);
}
}
drmcrtc->num_connectors = count;
}
err = drmModeSetCrtc(drmdpy->fd, crtc_id, buffer_id, x, y,
connectors, num_connectors, mode);
if (err) {
drmModeFreeCrtc(drmcrtc->crtc);
drmcrtc->crtc = NULL;
drmcrtc->num_connectors = 0;
return FALSE;
}
return TRUE;
}
static boolean
drm_display_program(struct native_display *ndpy, int crtc_idx,
struct native_surface *nsurf, uint x, uint y,
const struct native_connector **nconns, int num_nconns,
const struct native_mode *nmode)
{
struct drm_display *drmdpy = drm_display(ndpy);
struct drm_surface *drmsurf = drm_surface(nsurf);
const struct drm_mode *drmmode = drm_mode(nmode);
uint32_t connector_ids[32];
uint32_t buffer_id;
drmModeModeInfo mode_tmp, *mode;
int i;
if (num_nconns > Elements(connector_ids)) {
_eglLog(_EGL_WARNING, "too many connectors (%d)", num_nconns);
num_nconns = Elements(connector_ids);
}
if (drmsurf) {
if (!drm_surface_init_framebuffers(&drmsurf->base, FALSE))
return FALSE;
buffer_id = drmsurf->front_fb.buffer_id;
/* the mode argument of drmModeSetCrtc is not constified */
mode_tmp = drmmode->mode;
mode = &mode_tmp;
}
else {
/* disable the CRTC */
buffer_id = 0;
mode = NULL;
num_nconns = 0;
}
for (i = 0; i < num_nconns; i++) {
struct drm_connector *drmconn = drm_connector(nconns[i]);
connector_ids[i] = drmconn->connector->connector_id;
}
if (!drm_display_set_crtc(&drmdpy->base, crtc_idx, buffer_id, x, y,
connector_ids, num_nconns, mode)) {
_eglLog(_EGL_WARNING, "failed to set CRTC %d", crtc_idx);
return FALSE;
}
if (drmdpy->shown_surfaces[crtc_idx])
drmdpy->shown_surfaces[crtc_idx]->is_shown = FALSE;
drmdpy->shown_surfaces[crtc_idx] = drmsurf;
/* remember the settings for buffer swapping */
if (drmsurf) {
uint32_t crtc_id = drmdpy->saved_crtcs[crtc_idx].crtc->crtc_id;
struct drm_crtc *drmcrtc = &drmsurf->current_crtc;
if (drmcrtc->crtc)
drmModeFreeCrtc(drmcrtc->crtc);
drmcrtc->crtc = drmModeGetCrtc(drmdpy->fd, crtc_id);
assert(num_nconns < Elements(drmcrtc->connectors));
memcpy(drmcrtc->connectors, connector_ids,
sizeof(*connector_ids) * num_nconns);
drmcrtc->num_connectors = num_nconns;
drmsurf->is_shown = TRUE;
}
return TRUE;
}
static const struct native_mode **
drm_display_get_modes(struct native_display *ndpy,
const struct native_connector *nconn,
int *num_modes)
{
struct drm_display *drmdpy = drm_display(ndpy);
struct drm_connector *drmconn = drm_connector(nconn);
const struct native_mode **nmodes_return;
int count, i;
/* delete old data */
if (drmconn->connector) {
drmModeFreeConnector(drmconn->connector);
FREE(drmconn->drm_modes);
drmconn->connector = NULL;
drmconn->drm_modes = NULL;
drmconn->num_modes = 0;
}
/* detect again */
drmconn->connector = drmModeGetConnector(drmdpy->fd, drmconn->connector_id);
if (!drmconn->connector)
return NULL;
count = drmconn->connector->count_modes;
drmconn->drm_modes = CALLOC(count, sizeof(*drmconn->drm_modes));
if (!drmconn->drm_modes) {
drmModeFreeConnector(drmconn->connector);
drmconn->connector = NULL;
return NULL;
}
for (i = 0; i < count; i++) {
struct drm_mode *drmmode = &drmconn->drm_modes[i];
drmModeModeInfoPtr mode = &drmconn->connector->modes[i];
drmmode->mode = *mode;
drmmode->base.desc = drmmode->mode.name;
drmmode->base.width = drmmode->mode.hdisplay;
drmmode->base.height = drmmode->mode.vdisplay;
drmmode->base.refresh_rate = drmmode->mode.vrefresh;
/* not all kernels have vrefresh = refresh_rate * 1000 */
if (drmmode->base.refresh_rate > 1000)
drmmode->base.refresh_rate = (drmmode->base.refresh_rate + 500) / 1000;
}
nmodes_return = MALLOC(count * sizeof(*nmodes_return));
if (nmodes_return) {
for (i = 0; i < count; i++)
nmodes_return[i] = &drmconn->drm_modes[i].base;
if (num_modes)
*num_modes = count;
}
return nmodes_return;
}
static const struct native_connector **
drm_display_get_connectors(struct native_display *ndpy, int *num_connectors,
int *num_crtc)
{
struct drm_display *drmdpy = drm_display(ndpy);
const struct native_connector **connectors;
int i;
if (!drmdpy->connectors) {
drmdpy->connectors =
CALLOC(drmdpy->resources->count_connectors, sizeof(*drmdpy->connectors));
if (!drmdpy->connectors)
return NULL;
for (i = 0; i < drmdpy->resources->count_connectors; i++) {
struct drm_connector *drmconn = &drmdpy->connectors[i];
drmconn->connector_id = drmdpy->resources->connectors[i];
/* drmconn->connector is allocated when the modes are asked */
}
drmdpy->num_connectors = drmdpy->resources->count_connectors;
}
connectors = MALLOC(drmdpy->num_connectors * sizeof(*connectors));
if (connectors) {
for (i = 0; i < drmdpy->num_connectors; i++)
connectors[i] = &drmdpy->connectors[i].base;
if (num_connectors)
*num_connectors = drmdpy->num_connectors;
}
if (num_crtc)
*num_crtc = drmdpy->resources->count_crtcs;
return connectors;
}
static struct native_surface *
drm_display_create_scanout_surface(struct native_display *ndpy,
const struct native_config *nconf,
uint width, uint height)
{
struct drm_surface *drmsurf;
drmsurf = drm_display_create_surface(ndpy, nconf, width, height);
return &drmsurf->base;
}
static struct native_display_modeset drm_display_modeset = {
.get_connectors = drm_display_get_connectors,
.get_modes = drm_display_get_modes,
.create_scanout_surface = drm_display_create_scanout_surface,
.program = drm_display_program
};
void
drm_display_fini_modeset(struct native_display *ndpy)
{
struct drm_display *drmdpy = drm_display(ndpy);
int i;
if (drmdpy->connectors) {
for (i = 0; i < drmdpy->num_connectors; i++) {
struct drm_connector *drmconn = &drmdpy->connectors[i];
if (drmconn->connector) {
drmModeFreeConnector(drmconn->connector);
FREE(drmconn->drm_modes);
}
}
FREE(drmdpy->connectors);
}
if (drmdpy->shown_surfaces) {
FREE(drmdpy->shown_surfaces);
drmdpy->shown_surfaces = NULL;
}
if (drmdpy->saved_crtcs) {
for (i = 0; i < drmdpy->resources->count_crtcs; i++) {
struct drm_crtc *drmcrtc = &drmdpy->saved_crtcs[i];
if (drmcrtc->crtc) {
/* restore crtc */
drmModeSetCrtc(drmdpy->fd, drmcrtc->crtc->crtc_id,
drmcrtc->crtc->buffer_id, drmcrtc->crtc->x, drmcrtc->crtc->y,
drmcrtc->connectors, drmcrtc->num_connectors,
&drmcrtc->crtc->mode);
drmModeFreeCrtc(drmcrtc->crtc);
}
}
FREE(drmdpy->saved_crtcs);
}
if (drmdpy->resources) {
drmModeFreeResources(drmdpy->resources);
drmdpy->resources = NULL;
}
drmdpy->base.modeset = NULL;
}
boolean
drm_display_init_modeset(struct native_display *ndpy)
{
struct drm_display *drmdpy = drm_display(ndpy);
/* resources are fixed, unlike crtc, connector, or encoder */
drmdpy->resources = drmModeGetResources(drmdpy->fd);
if (!drmdpy->resources) {
_eglLog(_EGL_DEBUG, "Failed to get KMS resources. Disable modeset.");
return FALSE;
}
drmdpy->saved_crtcs =
CALLOC(drmdpy->resources->count_crtcs, sizeof(*drmdpy->saved_crtcs));
if (!drmdpy->saved_crtcs) {
drm_display_fini_modeset(&drmdpy->base);
return FALSE;
}
drmdpy->shown_surfaces =
CALLOC(drmdpy->resources->count_crtcs, sizeof(*drmdpy->shown_surfaces));
if (!drmdpy->shown_surfaces) {
drm_display_fini_modeset(&drmdpy->base);
return FALSE;
}
drmdpy->base.modeset = &drm_display_modeset;
return TRUE;
}

View File

@@ -0,0 +1,240 @@
/*
* Mesa 3-D graphics library
* Version: 7.8
*
* Copyright (C) 2010 Chia-I Wu <olv@0xlab.org>
*
* 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
* 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 <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "util/u_memory.h"
#include "egllog.h"
#include "native_drm.h"
/* see get_drm_screen_name */
#include <radeon_drm.h>
#include "radeon/drm/radeon_drm.h"
static boolean
drm_display_is_format_supported(struct native_display *ndpy,
enum pipe_format fmt, boolean is_color)
{
return ndpy->screen->is_format_supported(ndpy->screen,
fmt, PIPE_TEXTURE_2D, 0,
(is_color) ? PIPE_BIND_RENDER_TARGET :
PIPE_BIND_DEPTH_STENCIL, 0);
}
static const struct native_config **
drm_display_get_configs(struct native_display *ndpy, int *num_configs)
{
struct drm_display *drmdpy = drm_display(ndpy);
const struct native_config **configs;
/* first time */
if (!drmdpy->config) {
struct native_config *nconf;
enum pipe_format format;
drmdpy->config = CALLOC(1, sizeof(*drmdpy->config));
if (!drmdpy->config)
return NULL;
nconf = &drmdpy->config->base;
nconf->buffer_mask =
(1 << NATIVE_ATTACHMENT_FRONT_LEFT) |
(1 << NATIVE_ATTACHMENT_BACK_LEFT);
format = PIPE_FORMAT_B8G8R8A8_UNORM;
if (!drm_display_is_format_supported(&drmdpy->base, format, TRUE)) {
format = PIPE_FORMAT_A8R8G8B8_UNORM;
if (!drm_display_is_format_supported(&drmdpy->base, format, TRUE))
format = PIPE_FORMAT_NONE;
}
if (format == PIPE_FORMAT_NONE) {
FREE(drmdpy->config);
drmdpy->config = NULL;
return NULL;
}
nconf->color_format = format;
/* support KMS */
if (drmdpy->resources)
nconf->scanout_bit = TRUE;
}
configs = MALLOC(sizeof(*configs));
if (configs) {
configs[0] = &drmdpy->config->base;
if (num_configs)
*num_configs = 1;
}
return configs;
}
static int
drm_display_get_param(struct native_display *ndpy,
enum native_param_type param)
{
int val;
switch (param) {
default:
val = 0;
break;
}
return val;
}
static void
drm_display_destroy(struct native_display *ndpy)
{
struct drm_display *drmdpy = drm_display(ndpy);
if (drmdpy->config)
FREE(drmdpy->config);
drm_display_fini_modeset(&drmdpy->base);
if (drmdpy->base.screen)
drmdpy->base.screen->destroy(drmdpy->base.screen);
if (drmdpy->fd >= 0)
close(drmdpy->fd);
FREE(drmdpy);
}
static const char *
get_drm_screen_name(int fd, drmVersionPtr version)
{
const char *name = version->name;
if (name && !strcmp(name, "radeon")) {
int chip_id;
struct drm_radeon_info info;
memset(&info, 0, sizeof(info));
info.request = RADEON_INFO_DEVICE_ID;
info.value = pointer_to_intptr(&chip_id);
if (drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)) != 0)
return NULL;
name = is_r3xx(chip_id) ? "r300" : "r600";
}
return name;
}
/**
* Initialize KMS and pipe screen.
*/
static boolean
drm_display_init_screen(struct native_display *ndpy)
{
struct drm_display *drmdpy = drm_display(ndpy);
drmVersionPtr version;
const char *name;
version = drmGetVersion(drmdpy->fd);
if (!version) {
_eglLog(_EGL_WARNING, "invalid fd %d", drmdpy->fd);
return FALSE;
}
name = get_drm_screen_name(drmdpy->fd, version);
if (name) {
drmdpy->base.screen =
drmdpy->event_handler->new_drm_screen(&drmdpy->base, name, drmdpy->fd);
}
drmFreeVersion(version);
if (!drmdpy->base.screen) {
_eglLog(_EGL_WARNING, "failed to create DRM screen");
return FALSE;
}
return TRUE;
}
static struct native_display *
drm_create_display(int fd, struct native_event_handler *event_handler,
void *user_data)
{
struct drm_display *drmdpy;
drmdpy = CALLOC_STRUCT(drm_display);
if (!drmdpy)
return NULL;
drmdpy->fd = fd;
drmdpy->event_handler = event_handler;
drmdpy->base.user_data = user_data;
if (!drm_display_init_screen(&drmdpy->base)) {
drm_display_destroy(&drmdpy->base);
return NULL;
}
drmdpy->base.destroy = drm_display_destroy;
drmdpy->base.get_param = drm_display_get_param;
drmdpy->base.get_configs = drm_display_get_configs;
drm_display_init_modeset(&drmdpy->base);
return &drmdpy->base;
}
static struct native_display *
native_create_display(void *dpy, struct native_event_handler *event_handler,
void *user_data)
{
int fd;
if (dpy) {
fd = dup((int) pointer_to_intptr(dpy));
}
else {
fd = open("/dev/dri/card0", O_RDWR);
}
if (fd < 0)
return NULL;
return drm_create_display(fd, event_handler, user_data);
}
static const struct native_platform drm_platform = {
"DRM", /* name */
native_create_display
};
const struct native_platform *
native_get_drm_platform(void)
{
return &drm_platform;
}

View File

@@ -23,8 +23,8 @@
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _NATIVE_KMS_H_
#define _NATIVE_KMS_H_
#ifndef _NATIVE_DRM_H_
#define _NATIVE_DRM_H_
#include <xf86drm.h>
#include <xf86drmMode.h>
@@ -37,101 +37,110 @@
#include "common/native.h"
#include "common/native_helper.h"
struct kms_config;
struct kms_connector;
struct kms_mode;
struct drm_config;
struct drm_crtc;
struct drm_connector;
struct drm_mode;
struct drm_surface;
struct kms_crtc {
drmModeCrtcPtr crtc;
uint32_t connectors[32];
int num_connectors;
};
struct kms_display {
struct drm_display {
struct native_display base;
struct native_event_handler *event_handler;
int fd;
drmModeResPtr resources;
struct kms_config *config;
struct drm_config *config;
struct kms_connector *connectors;
/* for modesetting */
drmModeResPtr resources;
struct drm_connector *connectors;
int num_connectors;
struct kms_surface **shown_surfaces;
struct drm_surface **shown_surfaces;
/* save the original settings of the CRTCs */
struct kms_crtc *saved_crtcs;
struct drm_crtc *saved_crtcs;
};
struct kms_framebuffer {
struct drm_config {
struct native_config base;
};
struct drm_crtc {
drmModeCrtcPtr crtc;
uint32_t connectors[32];
int num_connectors;
};
struct drm_framebuffer {
struct pipe_resource *texture;
boolean is_passive;
uint32_t buffer_id;
};
struct kms_surface {
struct drm_surface {
struct native_surface base;
struct kms_display *kdpy;
struct drm_display *drmdpy;
struct resource_surface *rsurf;
enum pipe_format color_format;
int width, height;
unsigned int sequence_number;
struct kms_framebuffer front_fb, back_fb;
struct drm_framebuffer front_fb, back_fb;
boolean is_shown;
struct kms_crtc current_crtc;
struct drm_crtc current_crtc;
};
struct kms_config {
struct native_config base;
};
struct kms_connector {
struct drm_connector {
struct native_connector base;
uint32_t connector_id;
drmModeConnectorPtr connector;
struct kms_mode *kms_modes;
struct drm_mode *drm_modes;
int num_modes;
};
struct kms_mode {
struct drm_mode {
struct native_mode base;
drmModeModeInfo mode;
};
static INLINE struct kms_display *
kms_display(const struct native_display *ndpy)
static INLINE struct drm_display *
drm_display(const struct native_display *ndpy)
{
return (struct kms_display *) ndpy;
return (struct drm_display *) ndpy;
}
static INLINE struct kms_surface *
kms_surface(const struct native_surface *nsurf)
static INLINE struct drm_config *
drm_config(const struct native_config *nconf)
{
return (struct kms_surface *) nsurf;
return (struct drm_config *) nconf;
}
static INLINE struct kms_config *
kms_config(const struct native_config *nconf)
static INLINE struct drm_surface *
drm_surface(const struct native_surface *nsurf)
{
return (struct kms_config *) nconf;
return (struct drm_surface *) nsurf;
}
static INLINE struct kms_connector *
kms_connector(const struct native_connector *nconn)
static INLINE struct drm_connector *
drm_connector(const struct native_connector *nconn)
{
return (struct kms_connector *) nconn;
return (struct drm_connector *) nconn;
}
static INLINE struct kms_mode *
kms_mode(const struct native_mode *nmode)
static INLINE struct drm_mode *
drm_mode(const struct native_mode *nmode)
{
return (struct kms_mode *) nmode;
return (struct drm_mode *) nmode;
}
#endif /* _NATIVE_KMS_H_ */
boolean
drm_display_init_modeset(struct native_display *ndpy);
void
drm_display_fini_modeset(struct native_display *ndpy);
#endif /* _NATIVE_DRM_H_ */

View File

@@ -1,808 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 7.8
*
* Copyright (C) 2010 Chia-I Wu <olv@0xlab.org>
*
* 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
* 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 <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
#include "util/u_pointer.h"
#include "util/u_string.h"
#include "egllog.h"
#include "native_kms.h"
/* see get_drm_screen_name */
#include <radeon_drm.h>
#include "radeon/drm/radeon_drm.h"
static boolean
kms_surface_validate(struct native_surface *nsurf, uint attachment_mask,
unsigned int *seq_num, struct pipe_resource **textures,
int *width, int *height)
{
struct kms_surface *ksurf = kms_surface(nsurf);
if (!resource_surface_add_resources(ksurf->rsurf, attachment_mask))
return FALSE;
if (textures)
resource_surface_get_resources(ksurf->rsurf, textures, attachment_mask);
if (seq_num)
*seq_num = ksurf->sequence_number;
if (width)
*width = ksurf->width;
if (height)
*height = ksurf->height;
return TRUE;
}
/**
* Add textures as DRM framebuffers.
*/
static boolean
kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back)
{
struct kms_surface *ksurf = kms_surface(nsurf);
struct kms_display *kdpy = ksurf->kdpy;
int num_framebuffers = (need_back) ? 2 : 1;
int i, err;
for (i = 0; i < num_framebuffers; i++) {
struct kms_framebuffer *fb;
enum native_attachment natt;
struct winsys_handle whandle;
uint block_bits;
if (i == 0) {
fb = &ksurf->front_fb;
natt = NATIVE_ATTACHMENT_FRONT_LEFT;
}
else {
fb = &ksurf->back_fb;
natt = NATIVE_ATTACHMENT_BACK_LEFT;
}
if (!fb->texture) {
/* make sure the texture has been allocated */
resource_surface_add_resources(ksurf->rsurf, 1 << natt);
fb->texture =
resource_surface_get_single_resource(ksurf->rsurf, natt);
if (!fb->texture)
return FALSE;
}
/* already initialized */
if (fb->buffer_id)
continue;
/* TODO detect the real value */
fb->is_passive = TRUE;
memset(&whandle, 0, sizeof(whandle));
whandle.type = DRM_API_HANDLE_TYPE_KMS;
if (!kdpy->base.screen->resource_get_handle(kdpy->base.screen,
fb->texture, &whandle))
return FALSE;
block_bits = util_format_get_blocksizebits(ksurf->color_format);
err = drmModeAddFB(kdpy->fd, ksurf->width, ksurf->height,
block_bits, block_bits, whandle.stride, whandle.handle,
&fb->buffer_id);
if (err) {
fb->buffer_id = 0;
return FALSE;
}
}
return TRUE;
}
static boolean
kms_surface_flush_frontbuffer(struct native_surface *nsurf)
{
#ifdef DRM_MODE_FEATURE_DIRTYFB
struct kms_surface *ksurf = kms_surface(nsurf);
struct kms_display *kdpy = ksurf->kdpy;
if (ksurf->front_fb.is_passive)
drmModeDirtyFB(kdpy->fd, ksurf->front_fb.buffer_id, NULL, 0);
#endif
return TRUE;
}
static boolean
kms_surface_swap_buffers(struct native_surface *nsurf)
{
struct kms_surface *ksurf = kms_surface(nsurf);
struct kms_crtc *kcrtc = &ksurf->current_crtc;
struct kms_display *kdpy = ksurf->kdpy;
struct kms_framebuffer tmp_fb;
int err;
if (!ksurf->back_fb.buffer_id) {
if (!kms_surface_init_framebuffers(&ksurf->base, TRUE))
return FALSE;
}
if (ksurf->is_shown && kcrtc->crtc) {
err = drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id,
ksurf->back_fb.buffer_id, kcrtc->crtc->x, kcrtc->crtc->y,
kcrtc->connectors, kcrtc->num_connectors, &kcrtc->crtc->mode);
if (err)
return FALSE;
}
/* swap the buffers */
tmp_fb = ksurf->front_fb;
ksurf->front_fb = ksurf->back_fb;
ksurf->back_fb = tmp_fb;
resource_surface_swap_buffers(ksurf->rsurf,
NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE);
/* the front/back textures are swapped */
ksurf->sequence_number++;
kdpy->event_handler->invalid_surface(&kdpy->base,
&ksurf->base, ksurf->sequence_number);
return TRUE;
}
static void
kms_surface_wait(struct native_surface *nsurf)
{
/* no-op */
}
static void
kms_surface_destroy(struct native_surface *nsurf)
{
struct kms_surface *ksurf = kms_surface(nsurf);
if (ksurf->current_crtc.crtc)
drmModeFreeCrtc(ksurf->current_crtc.crtc);
if (ksurf->front_fb.buffer_id)
drmModeRmFB(ksurf->kdpy->fd, ksurf->front_fb.buffer_id);
pipe_resource_reference(&ksurf->front_fb.texture, NULL);
if (ksurf->back_fb.buffer_id)
drmModeRmFB(ksurf->kdpy->fd, ksurf->back_fb.buffer_id);
pipe_resource_reference(&ksurf->back_fb.texture, NULL);
resource_surface_destroy(ksurf->rsurf);
FREE(ksurf);
}
static struct kms_surface *
kms_display_create_surface(struct native_display *ndpy,
const struct native_config *nconf,
uint width, uint height)
{
struct kms_display *kdpy = kms_display(ndpy);
struct kms_config *kconf = kms_config(nconf);
struct kms_surface *ksurf;
ksurf = CALLOC_STRUCT(kms_surface);
if (!ksurf)
return NULL;
ksurf->kdpy = kdpy;
ksurf->color_format = kconf->base.color_format;
ksurf->width = width;
ksurf->height = height;
ksurf->rsurf = resource_surface_create(kdpy->base.screen,
ksurf->color_format,
PIPE_BIND_RENDER_TARGET |
PIPE_BIND_SAMPLER_VIEW |
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT);
if (!ksurf->rsurf) {
FREE(ksurf);
return NULL;
}
resource_surface_set_size(ksurf->rsurf, ksurf->width, ksurf->height);
ksurf->base.destroy = kms_surface_destroy;
ksurf->base.swap_buffers = kms_surface_swap_buffers;
ksurf->base.flush_frontbuffer = kms_surface_flush_frontbuffer;
ksurf->base.validate = kms_surface_validate;
ksurf->base.wait = kms_surface_wait;
return ksurf;
}
/**
* Choose a CRTC that supports all given connectors.
*/
static uint32_t
kms_display_choose_crtc(struct native_display *ndpy,
uint32_t *connectors, int num_connectors)
{
struct kms_display *kdpy = kms_display(ndpy);
int idx;
for (idx = 0; idx < kdpy->resources->count_crtcs; idx++) {
boolean found_crtc = TRUE;
int i, j;
for (i = 0; i < num_connectors; i++) {
drmModeConnectorPtr connector;
int encoder_idx = -1;
connector = drmModeGetConnector(kdpy->fd, connectors[i]);
if (!connector) {
found_crtc = FALSE;
break;
}
/* find an encoder the CRTC supports */
for (j = 0; j < connector->count_encoders; j++) {
drmModeEncoderPtr encoder =
drmModeGetEncoder(kdpy->fd, connector->encoders[j]);
if (encoder->possible_crtcs & (1 << idx)) {
encoder_idx = j;
break;
}
drmModeFreeEncoder(encoder);
}
drmModeFreeConnector(connector);
if (encoder_idx < 0) {
found_crtc = FALSE;
break;
}
}
if (found_crtc)
break;
}
if (idx >= kdpy->resources->count_crtcs) {
_eglLog(_EGL_WARNING,
"failed to find a CRTC that supports the given %d connectors",
num_connectors);
return 0;
}
return kdpy->resources->crtcs[idx];
}
/**
* Remember the original CRTC status and set the CRTC
*/
static boolean
kms_display_set_crtc(struct native_display *ndpy, int crtc_idx,
uint32_t buffer_id, uint32_t x, uint32_t y,
uint32_t *connectors, int num_connectors,
drmModeModeInfoPtr mode)
{
struct kms_display *kdpy = kms_display(ndpy);
struct kms_crtc *kcrtc = &kdpy->saved_crtcs[crtc_idx];
uint32_t crtc_id;
int err;
if (kcrtc->crtc) {
crtc_id = kcrtc->crtc->crtc_id;
}
else {
int count = 0, i;
/*
* Choose the CRTC once. It could be more dynamic, but let's keep it
* simple for now.
*/
crtc_id = kms_display_choose_crtc(&kdpy->base,
connectors, num_connectors);
/* save the original CRTC status */
kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id);
if (!kcrtc->crtc)
return FALSE;
for (i = 0; i < kdpy->num_connectors; i++) {
struct kms_connector *kconn = &kdpy->connectors[i];
drmModeConnectorPtr connector = kconn->connector;
drmModeEncoderPtr encoder;
encoder = drmModeGetEncoder(kdpy->fd, connector->encoder_id);
if (encoder) {
if (encoder->crtc_id == crtc_id) {
kcrtc->connectors[count++] = connector->connector_id;
if (count >= Elements(kcrtc->connectors))
break;
}
drmModeFreeEncoder(encoder);
}
}
kcrtc->num_connectors = count;
}
err = drmModeSetCrtc(kdpy->fd, crtc_id, buffer_id, x, y,
connectors, num_connectors, mode);
if (err) {
drmModeFreeCrtc(kcrtc->crtc);
kcrtc->crtc = NULL;
kcrtc->num_connectors = 0;
return FALSE;
}
return TRUE;
}
static boolean
kms_display_program(struct native_display *ndpy, int crtc_idx,
struct native_surface *nsurf, uint x, uint y,
const struct native_connector **nconns, int num_nconns,
const struct native_mode *nmode)
{
struct kms_display *kdpy = kms_display(ndpy);
struct kms_surface *ksurf = kms_surface(nsurf);
const struct kms_mode *kmode = kms_mode(nmode);
uint32_t connector_ids[32];
uint32_t buffer_id;
drmModeModeInfo mode_tmp, *mode;
int i;
if (num_nconns > Elements(connector_ids)) {
_eglLog(_EGL_WARNING, "too many connectors (%d)", num_nconns);
num_nconns = Elements(connector_ids);
}
if (ksurf) {
if (!kms_surface_init_framebuffers(&ksurf->base, FALSE))
return FALSE;
buffer_id = ksurf->front_fb.buffer_id;
/* the mode argument of drmModeSetCrtc is not constified */
mode_tmp = kmode->mode;
mode = &mode_tmp;
}
else {
/* disable the CRTC */
buffer_id = 0;
mode = NULL;
num_nconns = 0;
}
for (i = 0; i < num_nconns; i++) {
struct kms_connector *kconn = kms_connector(nconns[i]);
connector_ids[i] = kconn->connector->connector_id;
}
if (!kms_display_set_crtc(&kdpy->base, crtc_idx, buffer_id, x, y,
connector_ids, num_nconns, mode)) {
_eglLog(_EGL_WARNING, "failed to set CRTC %d", crtc_idx);
return FALSE;
}
if (kdpy->shown_surfaces[crtc_idx])
kdpy->shown_surfaces[crtc_idx]->is_shown = FALSE;
kdpy->shown_surfaces[crtc_idx] = ksurf;
/* remember the settings for buffer swapping */
if (ksurf) {
uint32_t crtc_id = kdpy->saved_crtcs[crtc_idx].crtc->crtc_id;
struct kms_crtc *kcrtc = &ksurf->current_crtc;
if (kcrtc->crtc)
drmModeFreeCrtc(kcrtc->crtc);
kcrtc->crtc = drmModeGetCrtc(kdpy->fd, crtc_id);
assert(num_nconns < Elements(kcrtc->connectors));
memcpy(kcrtc->connectors, connector_ids,
sizeof(*connector_ids) * num_nconns);
kcrtc->num_connectors = num_nconns;
ksurf->is_shown = TRUE;
}
return TRUE;
}
static const struct native_mode **
kms_display_get_modes(struct native_display *ndpy,
const struct native_connector *nconn,
int *num_modes)
{
struct kms_display *kdpy = kms_display(ndpy);
struct kms_connector *kconn = kms_connector(nconn);
const struct native_mode **nmodes_return;
int count, i;
/* delete old data */
if (kconn->connector) {
drmModeFreeConnector(kconn->connector);
FREE(kconn->kms_modes);
kconn->connector = NULL;
kconn->kms_modes = NULL;
kconn->num_modes = 0;
}
/* detect again */
kconn->connector = drmModeGetConnector(kdpy->fd, kconn->connector_id);
if (!kconn->connector)
return NULL;
count = kconn->connector->count_modes;
kconn->kms_modes = CALLOC(count, sizeof(*kconn->kms_modes));
if (!kconn->kms_modes) {
drmModeFreeConnector(kconn->connector);
kconn->connector = NULL;
return NULL;
}
for (i = 0; i < count; i++) {
struct kms_mode *kmode = &kconn->kms_modes[i];
drmModeModeInfoPtr mode = &kconn->connector->modes[i];
kmode->mode = *mode;
kmode->base.desc = kmode->mode.name;
kmode->base.width = kmode->mode.hdisplay;
kmode->base.height = kmode->mode.vdisplay;
kmode->base.refresh_rate = kmode->mode.vrefresh;
/* not all kernels have vrefresh = refresh_rate * 1000 */
if (kmode->base.refresh_rate > 1000)
kmode->base.refresh_rate = (kmode->base.refresh_rate + 500) / 1000;
}
nmodes_return = MALLOC(count * sizeof(*nmodes_return));
if (nmodes_return) {
for (i = 0; i < count; i++)
nmodes_return[i] = &kconn->kms_modes[i].base;
if (num_modes)
*num_modes = count;
}
return nmodes_return;
}
static const struct native_connector **
kms_display_get_connectors(struct native_display *ndpy, int *num_connectors,
int *num_crtc)
{
struct kms_display *kdpy = kms_display(ndpy);
const struct native_connector **connectors;
int i;
if (!kdpy->connectors) {
kdpy->connectors =
CALLOC(kdpy->resources->count_connectors, sizeof(*kdpy->connectors));
if (!kdpy->connectors)
return NULL;
for (i = 0; i < kdpy->resources->count_connectors; i++) {
struct kms_connector *kconn = &kdpy->connectors[i];
kconn->connector_id = kdpy->resources->connectors[i];
/* kconn->connector is allocated when the modes are asked */
}
kdpy->num_connectors = kdpy->resources->count_connectors;
}
connectors = MALLOC(kdpy->num_connectors * sizeof(*connectors));
if (connectors) {
for (i = 0; i < kdpy->num_connectors; i++)
connectors[i] = &kdpy->connectors[i].base;
if (num_connectors)
*num_connectors = kdpy->num_connectors;
}
if (num_crtc)
*num_crtc = kdpy->resources->count_crtcs;
return connectors;
}
static struct native_surface *
kms_display_create_scanout_surface(struct native_display *ndpy,
const struct native_config *nconf,
uint width, uint height)
{
struct kms_surface *ksurf;
ksurf = kms_display_create_surface(ndpy, nconf, width, height);
return &ksurf->base;
}
static boolean
kms_display_is_format_supported(struct native_display *ndpy,
enum pipe_format fmt, boolean is_color)
{
return ndpy->screen->is_format_supported(ndpy->screen,
fmt, PIPE_TEXTURE_2D, 0,
(is_color) ? PIPE_BIND_RENDER_TARGET :
PIPE_BIND_DEPTH_STENCIL, 0);
}
static const struct native_config **
kms_display_get_configs(struct native_display *ndpy, int *num_configs)
{
struct kms_display *kdpy = kms_display(ndpy);
const struct native_config **configs;
/* first time */
if (!kdpy->config) {
struct native_config *nconf;
enum pipe_format format;
kdpy->config = CALLOC(1, sizeof(*kdpy->config));
if (!kdpy->config)
return NULL;
nconf = &kdpy->config->base;
nconf->buffer_mask =
(1 << NATIVE_ATTACHMENT_FRONT_LEFT) |
(1 << NATIVE_ATTACHMENT_BACK_LEFT);
format = PIPE_FORMAT_B8G8R8A8_UNORM;
if (!kms_display_is_format_supported(&kdpy->base, format, TRUE)) {
format = PIPE_FORMAT_A8R8G8B8_UNORM;
if (!kms_display_is_format_supported(&kdpy->base, format, TRUE))
format = PIPE_FORMAT_NONE;
}
if (format == PIPE_FORMAT_NONE) {
FREE(kdpy->config);
kdpy->config = NULL;
return NULL;
}
nconf->color_format = format;
/* support KMS */
if (kdpy->resources)
nconf->scanout_bit = TRUE;
}
configs = MALLOC(sizeof(*configs));
if (configs) {
configs[0] = &kdpy->config->base;
if (num_configs)
*num_configs = 1;
}
return configs;
}
static int
kms_display_get_param(struct native_display *ndpy,
enum native_param_type param)
{
int val;
switch (param) {
default:
val = 0;
break;
}
return val;
}
static void
kms_display_destroy(struct native_display *ndpy)
{
struct kms_display *kdpy = kms_display(ndpy);
int i;
if (kdpy->config)
FREE(kdpy->config);
if (kdpy->connectors) {
for (i = 0; i < kdpy->num_connectors; i++) {
struct kms_connector *kconn = &kdpy->connectors[i];
if (kconn->connector) {
drmModeFreeConnector(kconn->connector);
FREE(kconn->kms_modes);
}
}
FREE(kdpy->connectors);
}
if (kdpy->shown_surfaces)
FREE(kdpy->shown_surfaces);
if (kdpy->saved_crtcs) {
for (i = 0; i < kdpy->resources->count_crtcs; i++) {
struct kms_crtc *kcrtc = &kdpy->saved_crtcs[i];
if (kcrtc->crtc) {
/* restore crtc */
drmModeSetCrtc(kdpy->fd, kcrtc->crtc->crtc_id,
kcrtc->crtc->buffer_id, kcrtc->crtc->x, kcrtc->crtc->y,
kcrtc->connectors, kcrtc->num_connectors,
&kcrtc->crtc->mode);
drmModeFreeCrtc(kcrtc->crtc);
}
}
FREE(kdpy->saved_crtcs);
}
if (kdpy->resources)
drmModeFreeResources(kdpy->resources);
if (kdpy->base.screen)
kdpy->base.screen->destroy(kdpy->base.screen);
if (kdpy->fd >= 0)
close(kdpy->fd);
FREE(kdpy);
}
static const char *
get_drm_screen_name(int fd, drmVersionPtr version)
{
const char *name = version->name;
if (name && !strcmp(name, "radeon")) {
int chip_id;
struct drm_radeon_info info;
memset(&info, 0, sizeof(info));
info.request = RADEON_INFO_DEVICE_ID;
info.value = pointer_to_intptr(&chip_id);
if (drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)) != 0)
return NULL;
name = is_r3xx(chip_id) ? "r300" : "r600";
}
return name;
}
/**
* Initialize KMS and pipe screen.
*/
static boolean
kms_display_init_screen(struct native_display *ndpy)
{
struct kms_display *kdpy = kms_display(ndpy);
drmVersionPtr version;
const char *name;
version = drmGetVersion(kdpy->fd);
if (!version) {
_eglLog(_EGL_WARNING, "invalid fd %d", kdpy->fd);
return FALSE;
}
name = get_drm_screen_name(kdpy->fd, version);
if (name) {
kdpy->base.screen =
kdpy->event_handler->new_drm_screen(&kdpy->base, name, kdpy->fd);
}
drmFreeVersion(version);
if (!kdpy->base.screen) {
_eglLog(_EGL_WARNING, "failed to create DRM screen");
return FALSE;
}
return TRUE;
}
static struct native_display_modeset kms_display_modeset = {
.get_connectors = kms_display_get_connectors,
.get_modes = kms_display_get_modes,
.create_scanout_surface = kms_display_create_scanout_surface,
.program = kms_display_program
};
static struct native_display *
kms_create_display(int fd, struct native_event_handler *event_handler,
void *user_data)
{
struct kms_display *kdpy;
kdpy = CALLOC_STRUCT(kms_display);
if (!kdpy)
return NULL;
kdpy->fd = fd;
kdpy->event_handler = event_handler;
kdpy->base.user_data = user_data;
if (!kms_display_init_screen(&kdpy->base)) {
kms_display_destroy(&kdpy->base);
return NULL;
}
kdpy->base.destroy = kms_display_destroy;
kdpy->base.get_param = kms_display_get_param;
kdpy->base.get_configs = kms_display_get_configs;
/* resources are fixed, unlike crtc, connector, or encoder */
kdpy->resources = drmModeGetResources(kdpy->fd);
if (kdpy->resources) {
kdpy->saved_crtcs =
CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->saved_crtcs));
if (!kdpy->saved_crtcs) {
kms_display_destroy(&kdpy->base);
return NULL;
}
kdpy->shown_surfaces =
CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->shown_surfaces));
if (!kdpy->shown_surfaces) {
kms_display_destroy(&kdpy->base);
return NULL;
}
kdpy->base.modeset = &kms_display_modeset;
}
else {
_eglLog(_EGL_DEBUG, "Failed to get KMS resources. Disable modeset.");
}
return &kdpy->base;
}
static struct native_display *
native_create_display(void *dpy, struct native_event_handler *event_handler,
void *user_data)
{
int fd;
if (dpy) {
fd = dup((int) pointer_to_intptr(dpy));
}
else {
fd = open("/dev/dri/card0", O_RDWR);
}
if (fd < 0)
return NULL;
return kms_create_display(fd, event_handler, user_data);
}
static const struct native_platform kms_platform = {
"KMS", /* name */
native_create_display
};
const struct native_platform *
native_get_kms_platform(void)
{
return &kms_platform;
}

View File

@@ -1086,20 +1086,30 @@ XMesaDestroyBuffer(XMesaBuffer b)
}
/**
* Notify the binding context to validate the buffer.
*/
void
xmesa_notify_invalid_buffer(XMesaBuffer b)
{
XMesaContext xmctx = XMesaGetCurrentContext();
if (xmctx && xmctx->xm_buffer == b)
xmctx->st->notify_invalid_framebuffer(xmctx->st, b->stfb);
}
/**
* Query the current drawable size and notify the binding context.
*/
void
xmesa_check_buffer_size(XMesaBuffer b)
{
XMesaContext xmctx = XMesaGetCurrentContext();
if (b->type == PBUFFER)
return;
xmesa_get_window_size(b->xm_visual->display, b, &b->width, &b->height);
if (xmctx && xmctx->xm_buffer == b)
xmctx->st->notify_invalid_framebuffer(xmctx->st, b->stfb);
xmesa_notify_invalid_buffer(b);
}

View File

@@ -360,6 +360,9 @@ extern void
xmesa_get_window_size(Display *dpy, XMesaBuffer b,
GLuint *width, GLuint *height);
extern void
xmesa_notify_invalid_buffer(XMesaBuffer b);
extern void
xmesa_check_buffer_size(XMesaBuffer b);

View File

@@ -339,6 +339,10 @@ xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi)
tmp = *front;
*front = *back;
*back = tmp;
/* the current context should validate the buffer after swapping */
if (!xmesa_strict_invalidate)
xmesa_notify_invalid_buffer(xstfb->buffer);
}
if (xmesa_strict_invalidate)

View File

@@ -69,6 +69,7 @@ COMMON_DRI_DRM_OBJECTS = [
drienv.AppendUnique(LIBS = [
'expat',
'talloc',
])
Export([

View File

@@ -11,6 +11,7 @@ env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE', 'GALLIUM_GALAHAD'])
env.Prepend(LIBS = [
ws_wrapper,
st_dri,
i915drm,
i915,

View File

@@ -185,6 +185,13 @@ $(MKLIB) -o $(notdir $@) -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
$(common_SYS) $($(1)_SYS)
endef
define mklib-cxx
$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) $< \
-Wl,--start-group $(common_LIBS) $($(1)_LIBS) -Wl,--end-group \
$(common_SYS) $($(1)_SYS)
endef
# EGL driver
$(OUTPUT_PATH)/egl_gallium.so: egl.o $(egl_LIBS)
$(call mklib,egl)
@@ -213,13 +220,13 @@ $(OUTPUT_PATH)/$(PIPE_PREFIX)swrast.so: pipe_swrast.o $(swrast_LIBS)
# state trackers
$(OUTPUT_PATH)/$(ST_PREFIX)$(GL_LIB).so: st_GL.o $(GL_LIBS)
$(call mklib,GL)
$(call mklib-cxx,GL)
$(OUTPUT_PATH)/$(ST_PREFIX)$(GLESv1_CM_LIB).so: st_GLESv1_CM.o $(GLESv1_CM_LIBS)
$(call mklib,GLESv1_CM)
$(call mklib-cxx,GLESv1_CM)
$(OUTPUT_PATH)/$(ST_PREFIX)$(GLESv2_LIB).so: st_GLESv2.o $(GLESv2_LIBS)
$(call mklib,GLESv2)
$(call mklib-cxx,GLESv2)
$(OUTPUT_PATH)/$(ST_PREFIX)$(VG_LIB).so: st_OpenVG.o $(OpenVG_LIBS)
$(call mklib,OpenVG)

View File

@@ -39,14 +39,6 @@
#include "state_tracker/st_api.h"
#include "state_tracker/st_gl_api.h"
/* piggy back on this libGL for OpenGL support in EGL */
struct st_api *
st_api_create_OpenGL()
{
return st_gl_api_create();
}
/* Helper function to choose and instantiate one of the software rasterizers:
* cell, llvmpipe, softpipe.
*

View File

@@ -5,13 +5,16 @@
#include "radeon_cs_gem.h"
#include "radeon_buffer.h"
#include "util/u_hash_table.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
#include "pipebuffer/pb_buffer.h"
#include "pipebuffer/pb_bufmgr.h"
#include "os/os_thread.h"
#include "radeon_winsys.h"
struct radeon_drm_bufmgr;
struct radeon_drm_buffer {
@@ -38,9 +41,19 @@ radeon_drm_buffer(struct pb_buffer *buf)
}
struct radeon_drm_bufmgr {
/* Base class. */
struct pb_manager base;
/* Winsys. */
struct radeon_libdrm_winsys *rws;
/* List of mapped buffers and its mutex. */
struct radeon_drm_buffer buffer_map_list;
pipe_mutex buffer_map_list_mutex;
/* List of buffer handles and its mutex. */
struct util_hash_table *buffer_handles;
pipe_mutex buffer_handles_mutex;
};
static INLINE struct radeon_drm_bufmgr *
@@ -54,11 +67,24 @@ static void
radeon_drm_buffer_destroy(struct pb_buffer *_buf)
{
struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
int name;
if (buf->bo->ptr != NULL) {
remove_from_list(buf);
radeon_bo_unmap(buf->bo);
buf->bo->ptr = NULL;
pipe_mutex_lock(buf->mgr->buffer_map_list_mutex);
/* Now test it again inside the mutex. */
if (buf->bo->ptr != NULL) {
remove_from_list(buf);
radeon_bo_unmap(buf->bo);
buf->bo->ptr = NULL;
}
pipe_mutex_unlock(buf->mgr->buffer_map_list_mutex);
}
name = radeon_gem_name_bo(buf->bo);
if (name) {
pipe_mutex_lock(buf->mgr->buffer_handles_mutex);
util_hash_table_remove(buf->mgr->buffer_handles,
(void*)(uintptr_t)name);
pipe_mutex_unlock(buf->mgr->buffer_handles_mutex);
}
radeon_bo_unref(buf->bo);
@@ -110,8 +136,16 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf,
return NULL;
}
if (buf->bo->ptr != NULL)
if (buf->bo->ptr != NULL) {
pipe_mutex_lock(buf->mgr->buffer_map_list_mutex);
/* Now test ptr again inside the mutex. We might have gotten a race
* during the first test. */
if (buf->bo->ptr != NULL) {
remove_from_list(buf);
}
pipe_mutex_unlock(buf->mgr->buffer_map_list_mutex);
return buf->bo->ptr;
}
if (flags & PB_USAGE_DONTBLOCK) {
uint32_t domain;
@@ -134,14 +168,22 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf,
if (radeon_bo_map(buf->bo, write)) {
return NULL;
}
insert_at_tail(&buf->mgr->buffer_map_list, buf);
pipe_mutex_lock(buf->mgr->buffer_map_list_mutex);
remove_from_list(buf);
pipe_mutex_unlock(buf->mgr->buffer_map_list_mutex);
return buf->bo->ptr;
}
static void
radeon_drm_buffer_unmap_internal(struct pb_buffer *_buf)
{
(void)_buf;
struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
pipe_mutex_lock(buf->mgr->buffer_map_list_mutex);
if (is_empty_list(buf)) { /* = is not inserted... */
insert_at_tail(&buf->mgr->buffer_map_list, buf);
}
pipe_mutex_unlock(buf->mgr->buffer_map_list_mutex);
}
static void
@@ -155,7 +197,7 @@ radeon_drm_buffer_get_base_buffer(struct pb_buffer *buf,
static enum pipe_error
radeon_drm_buffer_validate(struct pb_buffer *_buf,
radeon_drm_buffer_validate(struct pb_buffer *_buf,
struct pb_validate *vl,
unsigned flags)
{
@@ -178,14 +220,23 @@ const struct pb_vtbl radeon_drm_buffer_vtbl = {
radeon_drm_buffer_get_base_buffer,
};
struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager *_mgr,
uint32_t handle)
static struct pb_buffer *
radeon_drm_bufmgr_create_buffer_from_handle_unsafe(struct pb_manager *_mgr,
uint32_t handle)
{
struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
struct radeon_libdrm_winsys *rws = mgr->rws;
struct radeon_drm_buffer *buf;
struct radeon_bo *bo;
buf = util_hash_table_get(mgr->buffer_handles, (void*)(uintptr_t)handle);
if (buf) {
struct pb_buffer *b = NULL;
pb_reference(&b, &buf->base);
return b;
}
bo = radeon_bo_open(rws->bom, handle, 0,
0, 0, 0);
if (bo == NULL)
@@ -208,9 +259,25 @@ struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager
buf->bo = bo;
util_hash_table_set(mgr->buffer_handles, (void*)(uintptr_t)handle, buf);
return &buf->base;
}
struct pb_buffer *
radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager *_mgr,
uint32_t handle)
{
struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
struct pb_buffer *pb;
pipe_mutex_lock(mgr->buffer_handles_mutex);
pb = radeon_drm_bufmgr_create_buffer_from_handle_unsafe(_mgr, handle);
pipe_mutex_unlock(mgr->buffer_handles_mutex);
return pb;
}
static struct pb_buffer *
radeon_drm_bufmgr_create_buffer(struct pb_manager *_mgr,
pb_size size,
@@ -261,9 +328,22 @@ static void
radeon_drm_bufmgr_destroy(struct pb_manager *_mgr)
{
struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
util_hash_table_destroy(mgr->buffer_handles);
pipe_mutex_destroy(mgr->buffer_map_list_mutex);
pipe_mutex_destroy(mgr->buffer_handles_mutex);
FREE(mgr);
}
static unsigned handle_hash(void *key)
{
return (unsigned)key;
}
static int handle_compare(void *key1, void *key2)
{
return !((int)key1 == (int)key2);
}
struct pb_manager *
radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws)
{
@@ -279,6 +359,9 @@ radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws)
mgr->rws = rws;
make_empty_list(&mgr->buffer_map_list);
mgr->buffer_handles = util_hash_table_create(handle_hash, handle_compare);
pipe_mutex_init(mgr->buffer_map_list_mutex);
pipe_mutex_init(mgr->buffer_handles_mutex);
return &mgr->base;
}
@@ -454,6 +537,8 @@ void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr)
struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
struct radeon_drm_buffer *rpb, *t_rpb;
pipe_mutex_lock(mgr->buffer_map_list_mutex);
foreach_s(rpb, t_rpb, &mgr->buffer_map_list) {
radeon_bo_unmap(rpb->bo);
rpb->bo->ptr = NULL;
@@ -461,6 +546,8 @@ void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr)
}
make_empty_list(&mgr->buffer_map_list);
pipe_mutex_unlock(mgr->buffer_map_list_mutex);
}
void radeon_drm_bufmgr_wait(struct r300_winsys_screen *ws,

View File

@@ -250,6 +250,7 @@ static void radeon_r300_winsys_cs_destroy(struct r300_winsys_cs *rcs)
{
struct radeon_libdrm_cs *cs = radeon_libdrm_cs(rcs);
radeon_cs_destroy(cs->cs);
FREE(cs);
}
static void radeon_winsys_destroy(struct r300_winsys_screen *rws)
@@ -261,6 +262,8 @@ static void radeon_winsys_destroy(struct r300_winsys_screen *rws)
radeon_bo_manager_gem_dtor(ws->bom);
radeon_cs_manager_gem_dtor(ws->csm);
FREE(rws);
}
boolean radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws)

View File

@@ -76,6 +76,7 @@ CXX_SOURCES = \
loop_controls.cpp \
loop_unroll.cpp \
lower_noise.cpp \
lower_variable_index_to_cond_assign.cpp \
opt_redundant_jumps.cpp \
s_expression.cpp

View File

@@ -67,6 +67,7 @@ glsl_SOURCES = \
loop_controls.cpp \
loop_unroll.cpp \
lower_noise.cpp \
lower_variable_index_to_cond_assign.cpp \
opt_redundant_jumps.cpp
BUILT_SOURCES = glsl_parser.h glsl_parser.cpp glsl_lexer.cpp

View File

@@ -73,6 +73,7 @@ sources = [
'loop_controls.cpp',
'loop_unroll.cpp',
'lower_noise.cpp',
'lower_variable_index_to_cond_assign.cpp',
'opt_redundant_jumps.cpp',
's_expression.cpp',
]

View File

@@ -33,6 +33,20 @@ struct _mesa_glsl_parse_state;
struct YYLTYPE;
/**
* \defgroup AST Abstract syntax tree node definitions
*
* An abstract syntax tree is generated by the parser. This is a fairly
* direct representation of the gramma derivation for the source program.
* No symantic checking is done during the generation of the AST. Only
* syntactic checking is done. Symantic checking is performed by a later
* stage that converts the AST to a more generic intermediate representation.
*
*@{
*/
/**
* Base class of all abstract syntax tree nodes
*/
class ast_node {
public:
/* Callers of this talloc-based new need not call delete. It's
@@ -54,7 +68,14 @@ public:
talloc_free(table);
}
/**
* Print an AST node in something approximating the original GLSL code
*/
virtual void print(void) const;
/**
* Convert the AST node to the high-level intermediate representation
*/
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
@@ -91,19 +112,29 @@ public:
this->location.column = locp.first_column;
}
/**
* Source location of the AST node.
*/
struct {
unsigned source;
unsigned line;
unsigned column;
unsigned source; /**< GLSL source number. */
unsigned line; /**< Line number within the source string. */
unsigned column; /**< Column in the line. */
} location;
exec_node link;
protected:
/**
* The only constructor is protected so that only derived class objects can
* be created.
*/
ast_node(void);
};
/**
* Operators for AST expression nodes.
*/
enum ast_operators {
ast_assign,
ast_plus, /**< Unary + operator. */
@@ -161,6 +192,9 @@ enum ast_operators {
ast_sequence
};
/**
* Representation of any sort of expression.
*/
class ast_expression : public ast_node {
public:
ast_expression(int oper, ast_expression *,
@@ -651,7 +685,7 @@ public:
ast_function *prototype;
ast_compound_statement *body;
};
/*@}*/
extern void
_mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state);

View File

@@ -504,8 +504,9 @@ emit_inline_vector_constructor(const glsl_type *type,
instructions->push_tail(inst);
} else {
unsigned base_component = 0;
unsigned base_lhs_component = 0;
ir_constant_data data;
unsigned constant_mask = 0;
unsigned constant_mask = 0, constant_components = 0;
memset(&data, 0, sizeof(data));
@@ -515,8 +516,8 @@ emit_inline_vector_constructor(const glsl_type *type,
/* Do not try to assign more components to the vector than it has!
*/
if ((rhs_components + base_component) > lhs_components) {
rhs_components = lhs_components - base_component;
if ((rhs_components + base_lhs_component) > lhs_components) {
rhs_components = lhs_components - base_lhs_component;
}
const ir_constant *const c = param->as_constant();
@@ -543,18 +544,23 @@ emit_inline_vector_constructor(const glsl_type *type,
/* Mask of fields to be written in the assignment.
*/
constant_mask |= ((1U << rhs_components) - 1) << base_component;
}
constant_mask |= ((1U << rhs_components) - 1) << base_lhs_component;
constant_components++;
/* Advance the component index by the number of components that were
* just assigned.
base_component += rhs_components;
}
/* Advance the component index by the number of components
* that were just assigned.
*/
base_component += rhs_components;
base_lhs_component += rhs_components;
}
if (constant_mask != 0) {
ir_dereference *lhs = new(ctx) ir_dereference_variable(var);
ir_rvalue *rhs = new(ctx) ir_constant(var->type, &data);
const glsl_type *rhs_type = glsl_type::get_instance(var->type->base_type,
constant_components,
1);
ir_rvalue *rhs = new(ctx) ir_constant(rhs_type, &data);
ir_instruction *inst =
new(ctx) ir_assignment(lhs, rhs, NULL, constant_mask);
@@ -574,12 +580,10 @@ emit_inline_vector_constructor(const glsl_type *type,
const ir_constant *const c = param->as_constant();
if (c == NULL) {
/* Generate a swizzle that puts the first element of the source at
* the location of the first element of the destination.
*/
/* Generate a swizzle in case rhs_components != rhs->type->vector_elements. */
unsigned swiz[4] = { 0, 0, 0, 0 };
for (unsigned i = 0; i < rhs_components; i++)
swiz[i + base_component] = i;
swiz[i] = i;
/* Mask of fields to be written in the assignment.
*/
@@ -587,7 +591,7 @@ emit_inline_vector_constructor(const glsl_type *type,
<< base_component;
ir_dereference *lhs = new(ctx) ir_dereference_variable(var);
ir_rvalue *rhs = new(ctx) ir_swizzle(param, swiz, lhs_components);
ir_rvalue *rhs = new(ctx) ir_swizzle(param, swiz, rhs_components);
ir_instruction *inst =
new(ctx) ir_assignment(lhs, rhs, NULL, write_mask);
@@ -632,10 +636,10 @@ assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base,
*/
unsigned swiz[4] = { src_base, src_base, src_base, src_base };
for (unsigned i = 0; i < count; i++)
swiz[i + row_base] = src_base + i;
swiz[i + row_base] = i;
ir_rvalue *const rhs =
new(mem_ctx) ir_swizzle(src, swiz, column_ref->type->components());
new(mem_ctx) ir_swizzle(src, swiz, count);
/* Mask of fields to be written in the assignment.
*/
@@ -816,7 +820,7 @@ emit_inline_matrix_constructor(const glsl_type *type,
var->type->matrix_columns);
unsigned swiz[4] = { 0, 0, 0, 0 };
for (unsigned i = 1; i < src_matrix->type->vector_elements; i++)
for (unsigned i = 1; i < last_row; i++)
swiz[i] = i;
const unsigned write_mask = (1U << last_row) - 1;
@@ -837,14 +841,11 @@ emit_inline_matrix_constructor(const glsl_type *type,
*/
ir_rvalue *rhs;
if (lhs->type->vector_elements != rhs_col->type->vector_elements) {
rhs = new(ctx) ir_swizzle(rhs_col, swiz,
lhs->type->vector_elements);
rhs = new(ctx) ir_swizzle(rhs_col, swiz, last_row);
} else {
rhs = rhs_col;
}
assert(lhs->type == rhs->type);
ir_instruction *inst =
new(ctx) ir_assignment(lhs, rhs, NULL, write_mask);
instructions->push_tail(inst);

View File

@@ -1534,17 +1534,12 @@ ast_type_specifier::glsl_type(const char **name,
{
const struct glsl_type *type;
if ((this->type_specifier == ast_struct) && (this->type_name == NULL)) {
/* FINISHME: Handle annonymous structures. */
type = NULL;
} else {
type = state->symbols->get_type(this->type_name);
*name = this->type_name;
type = state->symbols->get_type(this->type_name);
*name = this->type_name;
if (this->is_array) {
YYLTYPE loc = this->get_location();
type = process_array_type(&loc, type, this->array_size, state);
}
if (this->is_array) {
YYLTYPE loc = this->get_location();
type = process_array_type(&loc, type, this->array_size, state);
}
return type;
@@ -2285,7 +2280,7 @@ ast_function::hir(exec_list *instructions,
* that the previously seen signature does not have an associated definition.
*/
f = state->symbols->get_function(name);
if (f != NULL && (state->es_shader || !f->has_builtin_signature())) {
if (f != NULL && (state->es_shader || f->has_user_signature())) {
sig = f->exact_matching_signature(&hir_parameters);
if (sig != NULL) {
const char *badvar = sig->qualifiers_match(&hir_parameters);
@@ -2705,7 +2700,6 @@ ast_struct_specifier::hir(exec_list *instructions,
}
}
/* Allocate storage for the structure fields and process the field
* declarations. As the declarations are processed, try to also convert
* the types to HIR. This ensures that structure definitions embedded in
@@ -2750,21 +2744,8 @@ ast_struct_specifier::hir(exec_list *instructions,
assert(i == decl_count);
const char *name;
if (this->name == NULL) {
static unsigned anon_count = 1;
char buf[32];
snprintf(buf, sizeof(buf), "#anon_struct_%04x", anon_count);
anon_count++;
name = strdup(buf);
} else {
name = this->name;
}
const glsl_type *t =
glsl_type::get_record_instance(fields, decl_count, name);
glsl_type::get_record_instance(fields, decl_count, this->name);
YYLTYPE loc = this->get_location();
if (!state->symbols->add_type(name, t)) {

View File

@@ -787,73 +787,73 @@ static const char *builtin_equal =
" (parameters\n"
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
" ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
" ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
" ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) bvec2 arg0)\n"
" (declare (in) bvec2 arg1))\n"
" ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) bvec3 arg0)\n"
" (declare (in) bvec3 arg1))\n"
" ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) bvec4 arg0)\n"
" (declare (in) bvec4 arg1))\n"
" ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
" ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
" ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
" ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
" ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
" ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
" ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
""
;
@@ -1044,91 +1044,55 @@ static const char *builtin_greaterThan =
" (parameters\n"
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
""
;
@@ -1138,91 +1102,55 @@ static const char *builtin_greaterThanEqual =
" (parameters\n"
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
""
;
@@ -1280,91 +1208,55 @@ static const char *builtin_lessThan =
" (parameters\n"
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
""
;
@@ -1374,91 +1266,55 @@ static const char *builtin_lessThanEqual =
" (parameters\n"
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
" ((declare () bvec2 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
" ((declare () bvec3 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
" ((declare () bvec4 temp)\n"
" (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
" (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
" ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
""
;
@@ -2033,8 +1889,8 @@ static const char *builtin_noise2 =
"\n"
" (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
" (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
" (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n"
" (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n"
" (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
" (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
" (return (var_ref t))\n"
" ))\n"
"\n"
@@ -2047,8 +1903,8 @@ static const char *builtin_noise2 =
"\n"
" (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
" (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n"
" (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n"
" (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n"
" (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
" (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
" (return (var_ref t))\n"
" ))\n"
"\n"
@@ -2063,8 +1919,8 @@ static const char *builtin_noise2 =
"\n"
" (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
" (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n"
" (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n"
" (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n"
" (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
" (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
" (return (var_ref t))\n"
" ))\n"
"\n"
@@ -2079,8 +1935,8 @@ static const char *builtin_noise2 =
"\n"
" (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
" (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))\n"
" (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n"
" (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n"
" (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
" (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
" (return (var_ref t))\n"
" ))\n"
"))\n"
@@ -2100,9 +1956,9 @@ static const char *builtin_noise3 =
" (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
" (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0)))))\n"
"\n"
" (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n"
" (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n"
" (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n"
" (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
" (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
" (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n"
" (return (var_ref t))\n"
" ))\n"
"\n"
@@ -2118,9 +1974,9 @@ static const char *builtin_noise3 =
" (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n"
" (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0)))))\n"
"\n"
" (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n"
" (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n"
" (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n"
" (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
" (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
" (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n"
" (return (var_ref t))\n"
" ))\n"
"\n"
@@ -2136,9 +1992,9 @@ static const char *builtin_noise3 =
" (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n"
" (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0)))))\n"
"\n"
" (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n"
" (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n"
" (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n"
" (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
" (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
" (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n"
" (return (var_ref t))\n"
" ))\n"
"\n"
@@ -2154,9 +2010,9 @@ static const char *builtin_noise3 =
" (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))\n"
" (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression float + (var_ref p) (constant float (1559.0)))))\n"
"\n"
" (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n"
" (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n"
" (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n"
" (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n"
" (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n"
" (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n"
" (return (var_ref t))\n"
" ))\n"
"))\n"
@@ -2181,10 +2037,10 @@ static const char *builtin_noise4 =
" (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
" (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec4 + (var_ref _p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
"\n"
" (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n"
" (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n"
" (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n"
" (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n"
" (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n"
" (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n"
" (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n"
" (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n"
" (return (var_ref _r))\n"
" ))\n"
"\n"
@@ -2205,10 +2061,10 @@ static const char *builtin_noise4 =
" (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
" (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec3 + (var_ref _p) (constant vec3 (601.0 313.0 29.0)))))\n"
"\n"
" (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n"
" (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n"
" (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n"
" (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n"
" (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n"
" (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n"
" (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n"
" (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n"
" (return (var_ref _r))\n"
" ))\n"
"\n"
@@ -2229,10 +2085,10 @@ static const char *builtin_noise4 =
" (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
" (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec2 + (var_ref _p) (constant vec2 (601.0 313.0)))))\n"
"\n"
" (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n"
" (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n"
" (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n"
" (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n"
" (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n"
" (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n"
" (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n"
" (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n"
" (return (var_ref _r))\n"
" ))\n"
"\n"
@@ -2246,17 +2102,17 @@ static const char *builtin_noise4 =
" (declare () vec4 _r)\n"
"\n"
" (declare () float _p)\n"
" (assign (constant bool (1)) (xy) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )\n"
" (assign (constant bool (1)) (x) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )\n"
"\n"
" (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n"
" (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression float + (var_ref p) (constant float (601.0 313.0 29.0 277.0)))))\n"
" (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
" (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression float + (var_ref _p) (constant float (601.0 313.0 29.0 277.0)))))\n"
"\n"
" (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n"
" (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n"
" (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n"
" (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n"
" (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n"
" (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n"
" (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n"
" (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n"
" (return (var_ref _r))\n"
" ))\n"
"))\n"
@@ -2311,73 +2167,73 @@ static const char *builtin_notEqual =
" (parameters\n"
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
" ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
" ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
" ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) bvec2 arg0)\n"
" (declare (in) bvec2 arg1))\n"
" ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) bvec3 arg0)\n"
" (declare (in) bvec3 arg1))\n"
" ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) bvec4 arg0)\n"
" (declare (in) bvec4 arg1))\n"
" ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
" ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
" ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
" ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
" ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
" ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
" ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
" ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
""
;

View File

@@ -3,71 +3,71 @@
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) bvec2 arg0)
(declare (in) bvec2 arg1))
((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) bvec3 arg0)
(declare (in) bvec3 arg1))
((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) bvec4 arg0)
(declare (in) bvec4 arg1))
((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))
))

View File

@@ -3,89 +3,53 @@
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))
))

View File

@@ -3,89 +3,53 @@
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))
))

View File

@@ -3,89 +3,53 @@
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))
))

View File

@@ -3,89 +3,53 @@
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
(assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
(assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))
))

View File

@@ -8,8 +8,8 @@
(assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
(assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
(assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))
(assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))
(assign (constant bool (1)) (x) (var_ref t) (var_ref a))
(assign (constant bool (1)) (y) (var_ref t) (var_ref b))
(return (var_ref t))
))
@@ -22,8 +22,8 @@
(assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
(assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
(assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))
(assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))
(assign (constant bool (1)) (x) (var_ref t) (var_ref a))
(assign (constant bool (1)) (y) (var_ref t) (var_ref b))
(return (var_ref t))
))
@@ -38,8 +38,8 @@
(assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
(assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
(assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))
(assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))
(assign (constant bool (1)) (x) (var_ref t) (var_ref a))
(assign (constant bool (1)) (y) (var_ref t) (var_ref b))
(return (var_ref t))
))
@@ -54,8 +54,8 @@
(assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
(assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))
(assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))
(assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))
(assign (constant bool (1)) (x) (var_ref t) (var_ref a))
(assign (constant bool (1)) (y) (var_ref t) (var_ref b))
(return (var_ref t))
))
))

View File

@@ -11,9 +11,9 @@
(assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
(assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0)))))
(assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))
(assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))
(assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))
(assign (constant bool (1)) (x) (var_ref t) (var_ref a))
(assign (constant bool (1)) (y) (var_ref t) (var_ref b))
(assign (constant bool (1)) (z) (var_ref t) (var_ref c))
(return (var_ref t))
))
@@ -29,9 +29,9 @@
(assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
(assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0)))))
(assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))
(assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))
(assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))
(assign (constant bool (1)) (x) (var_ref t) (var_ref a))
(assign (constant bool (1)) (y) (var_ref t) (var_ref b))
(assign (constant bool (1)) (z) (var_ref t) (var_ref c))
(return (var_ref t))
))
@@ -47,9 +47,9 @@
(assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
(assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0)))))
(assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))
(assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))
(assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))
(assign (constant bool (1)) (x) (var_ref t) (var_ref a))
(assign (constant bool (1)) (y) (var_ref t) (var_ref b))
(assign (constant bool (1)) (z) (var_ref t) (var_ref c))
(return (var_ref t))
))
@@ -65,9 +65,9 @@
(assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))
(assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression float + (var_ref p) (constant float (1559.0)))))
(assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))
(assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))
(assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))
(assign (constant bool (1)) (x) (var_ref t) (var_ref a))
(assign (constant bool (1)) (y) (var_ref t) (var_ref b))
(assign (constant bool (1)) (z) (var_ref t) (var_ref c))
(return (var_ref t))
))
))

View File

@@ -16,10 +16,10 @@
(assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
(assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec4 + (var_ref _p) (constant vec4 (601.0 313.0 29.0 277.0)))))
(assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))
(assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))
(assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))
(assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))
(assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))
(assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))
(assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))
(assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))
(return (var_ref _r))
))
@@ -40,10 +40,10 @@
(assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
(assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec3 + (var_ref _p) (constant vec3 (601.0 313.0 29.0)))))
(assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))
(assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))
(assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))
(assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))
(assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))
(assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))
(assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))
(assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))
(return (var_ref _r))
))
@@ -64,10 +64,10 @@
(assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
(assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec2 + (var_ref _p) (constant vec2 (601.0 313.0)))))
(assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))
(assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))
(assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))
(assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))
(assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))
(assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))
(assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))
(assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))
(return (var_ref _r))
))
@@ -81,17 +81,17 @@
(declare () vec4 _r)
(declare () float _p)
(assign (constant bool (1)) (xy) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )
(assign (constant bool (1)) (x) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )
(assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))
(assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression float + (var_ref p) (constant float (601.0 313.0 29.0 277.0)))))
(assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
(assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression float + (var_ref _p) (constant float (601.0 313.0 29.0 277.0)))))
(assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))
(assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))
(assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))
(assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))
(assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))
(assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))
(assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))
(assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))
(return (var_ref _r))
))
))

View File

@@ -3,71 +3,71 @@
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) bvec2 arg0)
(declare (in) bvec2 arg1))
((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) bvec3 arg0)
(declare (in) bvec3 arg1))
((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) bvec4 arg0)
(declare (in) bvec4 arg1))
((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))
((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))
))

View File

@@ -680,6 +680,11 @@ ast_struct_specifier::print(void) const
ast_struct_specifier::ast_struct_specifier(char *identifier,
ast_node *declarator_list)
{
if (identifier == NULL) {
static unsigned anon_count = 1;
identifier = talloc_asprintf(this, "#anon_struct_%04x", anon_count);
anon_count++;
}
name = identifier;
this->declarations.push_degenerate_list_at_head(&declarator_list->link);
}

View File

@@ -55,6 +55,9 @@ update_rhs_swizzle(ir_swizzle_mask &m, unsigned from, unsigned to)
void
ir_assignment::set_lhs(ir_rvalue *lhs)
{
void *mem_ctx = this;
bool swizzled = false;
while (lhs != NULL) {
ir_swizzle *swiz = lhs->as_swizzle();
@@ -82,7 +85,21 @@ ir_assignment::set_lhs(ir_rvalue *lhs)
this->write_mask = write_mask;
lhs = swiz->val;
this->rhs = new(this) ir_swizzle(this->rhs, rhs_swiz);
this->rhs = new(mem_ctx) ir_swizzle(this->rhs, rhs_swiz);
swizzled = true;
}
if (swizzled) {
/* Now, RHS channels line up with the LHS writemask. Collapse it
* to just the channels that will be written.
*/
ir_swizzle_mask rhs_swiz = { 0, 0, 0, 0, 0, 0 };
int rhs_chan = 0;
for (int i = 0; i < 4; i++) {
if (write_mask & (1 << i))
update_rhs_swizzle(rhs_swiz, i, rhs_chan++);
}
this->rhs = new(mem_ctx) ir_swizzle(this->rhs, rhs_swiz);
}
assert((lhs == NULL) || lhs->as_dereference());
@@ -122,6 +139,16 @@ ir_assignment::ir_assignment(ir_dereference *lhs, ir_rvalue *rhs,
this->rhs = rhs;
this->lhs = lhs;
this->write_mask = write_mask;
if (lhs->type->is_scalar() || lhs->type->is_vector()) {
int lhs_components = 0;
for (int i = 0; i < 4; i++) {
if (write_mask & (1 << i))
lhs_components++;
}
assert(lhs_components == this->rhs->type->vector_elements);
}
}
ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs,
@@ -1137,11 +1164,11 @@ ir_function::ir_function(const char *name)
bool
ir_function::has_builtin_signature()
ir_function::has_user_signature()
{
foreach_list(n, &this->signatures) {
ir_function_signature *const sig = (ir_function_signature *) n;
if (sig->is_builtin)
if (!sig->is_builtin)
return true;
}
return false;

View File

@@ -41,7 +41,31 @@ extern "C" {
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
/**
* \defgroup IR Intermediate representation nodes
*
* @{
*/
/**
* Class tags
*
* Each concrete class derived from \c ir_instruction has a value in this
* enumerant. The value for the type is stored in \c ir_instruction::ir_type
* by the constructor. While using type tags is not very C++, it is extremely
* convenient. For example, during debugging you can simply inspect
* \c ir_instruction::ir_type to find out the actual type of the object.
*
* In addition, it is possible to use a switch-statement based on \c
* \c ir_instruction::ir_type to select different behavior for different object
* types. For functions that have only slight differences for several object
* types, this allows writing very straightforward, readable code.
*/
enum ir_node_type {
/**
* Zero is unused so that the IR validator can detect cases where
* \c ir_instruction::ir_type has not been initialized.
*/
ir_type_unset,
ir_type_variable,
ir_type_assignment,
@@ -156,9 +180,12 @@ protected:
};
/**
* Variable storage classes
*/
enum ir_variable_mode {
ir_var_auto = 0,
ir_var_uniform,
ir_var_auto = 0, /**< Function local variables and globals. */
ir_var_uniform, /**< Variable declared as a uniform. */
ir_var_in,
ir_var_out,
ir_var_inout,
@@ -209,6 +236,9 @@ public:
*/
unsigned component_slots() const;
/**
* Delcared name of the variable
*/
const char *name;
/**
@@ -218,11 +248,28 @@ public:
*/
unsigned max_array_access;
/**
* Is the variable read-only?
*
* This is set for variables declared as \c const, shader inputs,
* and uniforms.
*/
unsigned read_only:1;
unsigned centroid:1;
unsigned invariant:1;
/**
* Storage class of the variable.
*
* \sa ir_variable_mode
*/
unsigned mode:3;
/**
* Interpolation mode for shader inputs / outputs
*
* \sa ir_variable_interpolation
*/
unsigned interpolation:2;
/**
@@ -233,9 +280,13 @@ public:
*/
unsigned array_lvalue:1;
/* ARB_fragment_coord_conventions */
/**
* \name ARB_fragment_coord_conventions
* @{
*/
unsigned origin_upper_left:1;
unsigned pixel_center_integer:1;
/*@}*/
/**
* Storage location of the base of this variable
@@ -410,8 +461,8 @@ public:
*/
const char *name;
/** Whether or not this function has a signature that is a built-in. */
bool has_builtin_signature();
/** Whether or not this function has a signature that isn't a built-in. */
bool has_user_signature();
/**
* List of ir_function_signature for each overloaded function with this name.
@@ -595,6 +646,14 @@ public:
* For non-vector types in the LHS, this field will be zero. For vector
* types, a bit will be set for each component that is written. Note that
* for \c vec2 and \c vec3 types only the lower bits will ever be set.
*
* A partially-set write mask means that each enabled channel gets
* the value from a consecutive channel of the rhs. For example,
* to write just .xyw of gl_FrontColor with color:
*
* (assign (constant bool (1)) (xyw)
* (var_ref gl_FragColor)
* (swiz xyw (var_ref color)))
*/
unsigned write_mask:4;
};
@@ -668,7 +727,8 @@ enum ir_expression_operation {
ir_binop_mod,
/**
* \name Binary comparison operators
* \name Binary comparison operators which return a boolean vector.
* The type of both operands must be equal.
*/
/*@{*/
ir_binop_less,
@@ -724,9 +784,22 @@ public:
virtual ir_expression *clone(void *mem_ctx, struct hash_table *ht) const;
/**
* Attempt to constant-fold the expression
*
* If the expression cannot be constant folded, this method will return
* \c NULL.
*/
virtual ir_constant *constant_expression_value();
/**
* Determine the number of operands used by an expression
*/
static unsigned int get_num_operands(ir_expression_operation);
/**
* Determine the number of operands used by an expression
*/
unsigned int get_num_operands() const
{
return get_num_operands(operation);
@@ -813,6 +886,9 @@ public:
return callee->function_name();
}
/**
* Get the function signature bound to this function call
*/
ir_function_signature *get_callee()
{
return callee;
@@ -977,11 +1053,11 @@ public:
* Texture sampling opcodes used in ir_texture
*/
enum ir_texture_opcode {
ir_tex, /* Regular texture look-up */
ir_txb, /* Texture look-up with LOD bias */
ir_txl, /* Texture look-up with explicit LOD */
ir_txd, /* Texture look-up with partial derivatvies */
ir_txf /* Texel fetch with explicit LOD */
ir_tex, /**< Regular texture look-up */
ir_txb, /**< Texture look-up with LOD bias */
ir_txl, /**< Texture look-up with explicit LOD */
ir_txd, /**< Texture look-up with partial derivatvies */
ir_txf /**< Texel fetch with explicit LOD */
};
@@ -1384,9 +1460,17 @@ private:
ir_constant(void);
};
/*@}*/
/**
* Apply a visitor to each IR node in a list
*/
void
visit_exec_list(exec_list *list, ir_visitor *visitor);
/**
* Validate invariants on each IR node in a list
*/
void validate_ir_tree(exec_list *instructions);
/**

View File

@@ -141,6 +141,9 @@ ir_loop::clone(void *mem_ctx, struct hash_table *ht) const
ir_call *
ir_call::clone(void *mem_ctx, struct hash_table *ht) const
{
if (this->type == glsl_type::error_type)
return ir_call::get_error_instruction(mem_ctx);
exec_list new_parameters;
foreach_iter(exec_list_iterator, iter, this->actual_parameters) {

View File

@@ -623,36 +623,41 @@ ir_expression::constant_expression_value()
}
break;
case ir_binop_equal:
switch (op[0]->type->base_type) {
case GLSL_TYPE_UINT:
data.b[0] = op[0]->value.u[0] == op[1]->value.u[0];
break;
case GLSL_TYPE_INT:
data.b[0] = op[0]->value.i[0] == op[1]->value.i[0];
break;
case GLSL_TYPE_FLOAT:
data.b[0] = op[0]->value.f[0] == op[1]->value.f[0];
break;
default:
assert(0);
assert(op[0]->type == op[1]->type);
for (unsigned c = 0; c < components; c++) {
switch (op[0]->type->base_type) {
case GLSL_TYPE_UINT:
data.b[c] = op[0]->value.u[c] == op[1]->value.u[c];
break;
case GLSL_TYPE_INT:
data.b[c] = op[0]->value.i[c] == op[1]->value.i[c];
break;
case GLSL_TYPE_FLOAT:
data.b[c] = op[0]->value.f[c] == op[1]->value.f[c];
break;
default:
assert(0);
}
}
break;
case ir_binop_nequal:
switch (op[0]->type->base_type) {
case GLSL_TYPE_UINT:
data.b[0] = op[0]->value.u[0] != op[1]->value.u[0];
break;
case GLSL_TYPE_INT:
data.b[0] = op[0]->value.i[0] != op[1]->value.i[0];
break;
case GLSL_TYPE_FLOAT:
data.b[0] = op[0]->value.f[0] != op[1]->value.f[0];
break;
default:
assert(0);
assert(op[0]->type != op[1]->type);
for (unsigned c = 0; c < components; c++) {
switch (op[0]->type->base_type) {
case GLSL_TYPE_UINT:
data.b[c] = op[0]->value.u[c] != op[1]->value.u[c];
break;
case GLSL_TYPE_INT:
data.b[c] = op[0]->value.i[c] != op[1]->value.i[c];
break;
case GLSL_TYPE_FLOAT:
data.b[c] = op[0]->value.f[c] != op[1]->value.f[c];
break;
default:
assert(0);
}
}
break;
case ir_binop_all_equal:
data.b[0] = op[0]->has_value(op[1]);
break;

View File

@@ -1,5 +1,5 @@
/*
* Constantright © 2010 Intel Corporation
* Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* constant of this software and associated documentation files (the "Software"),
@@ -168,18 +168,26 @@ ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue)
if (!found)
return;
int rhs_channel = 0;
for (int j = 0; j < 4; j++) {
if (j == channel)
break;
if (found->write_mask & (1 << j))
rhs_channel++;
}
switch (type->base_type) {
case GLSL_TYPE_FLOAT:
data.f[i] = found->constant->value.f[channel];
data.f[i] = found->constant->value.f[rhs_channel];
break;
case GLSL_TYPE_INT:
data.i[i] = found->constant->value.i[channel];
data.i[i] = found->constant->value.i[rhs_channel];
break;
case GLSL_TYPE_UINT:
data.u[i] = found->constant->value.u[channel];
data.u[i] = found->constant->value.u[rhs_channel];
break;
case GLSL_TYPE_BOOL:
data.b[i] = found->constant->value.b[channel];
data.b[i] = found->constant->value.b[rhs_channel];
break;
default:
assert(!"not reached");

View File

@@ -63,8 +63,11 @@ can_inline(ir_call *call)
v.run((exec_list *) &callee->body);
/* If the function is empty (no last instruction) or does not end with a
* return statement, we need to count the implicit return.
*/
ir_instruction *last = (ir_instruction *)callee->body.get_tail();
if (last && !last->as_return())
if (last == NULL || !last->as_return())
v.num_returns++;
return v.num_returns == 1;

View File

@@ -310,14 +310,11 @@ ir_mat_op_to_vec_visitor::do_equal_mat_mat(ir_variable *result_var,
new(this->mem_ctx) ir_expression(ir_binop_any_nequal,
glsl_type::bool_type, op0, op1);
ir_rvalue *const swiz =
new(this->mem_ctx) ir_swizzle(cmp, i, i, i, i, columns);
ir_dereference *const lhs =
new(this->mem_ctx) ir_dereference_variable(tmp_bvec);
ir_assignment *const assign =
new(this->mem_ctx) ir_assignment(lhs, swiz, NULL, (1U << i));
new(this->mem_ctx) ir_assignment(lhs, cmp, NULL, (1U << i));
this->base_ir->insert_before(assign);
}

View File

@@ -61,9 +61,9 @@ ir_noop_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue)
return;
if (elems >= 2 && swiz->mask.y != 1)
return;
if (elems >= 3 && swiz->mask.z != 1)
if (elems >= 3 && swiz->mask.z != 2)
return;
if (elems >= 4 && swiz->mask.w != 1)
if (elems >= 4 && swiz->mask.w != 3)
return;
this->progress = true;

View File

@@ -56,4 +56,6 @@ bool do_tree_grafting(exec_list *instructions);
bool do_vec_index_to_cond_assign(exec_list *instructions);
bool do_vec_index_to_swizzle(exec_list *instructions);
bool lower_noise(exec_list *instructions);
bool lower_variable_index_to_cond_assign(exec_list *instructions,
bool lower_input, bool lower_output, bool lower_temp, bool lower_uniform);
bool optimize_redundant_jumps(exec_list *instructions);

View File

@@ -153,6 +153,9 @@ void ir_print_visitor::visit(ir_function_signature *ir)
void ir_print_visitor::visit(ir_function *ir)
{
if (!ir->has_user_signature())
return;
printf("(function %s\n", ir->name);
indentation++;
foreach_iter(exec_list_iterator, iter, *ir) {

View File

@@ -124,7 +124,8 @@ ir_validate::visit_leave(ir_loop *ir)
" from: %p\n"
" to: %p\n"
" increment: %p\n",
ir->counter, ir->from, ir->to, ir->increment);
(void *) ir->counter, (void *) ir->from, (void *) ir->to,
(void *) ir->increment);
abort();
}
@@ -139,7 +140,8 @@ ir_validate::visit_leave(ir_loop *ir)
" from: %p\n"
" to: %p\n"
" increment: %p\n",
ir->counter, ir->from, ir->to, ir->increment);
(void *) ir->counter, (void *) ir->from, (void *) ir->to,
(void *) ir->increment);
abort();
}
}
@@ -389,14 +391,16 @@ ir_validate::visit_enter(ir_assignment *ir)
abort();
}
/* Mask of fields that do not exist in the destination. These should
* not be written by the assignment.
*/
const unsigned invalid_mask = ~((1U << lhs->type->components()) - 1);
int lhs_components = 0;
for (int i = 0; i < 4; i++) {
if (ir->write_mask & (1 << i))
lhs_components++;
}
if ((invalid_mask & ir->write_mask) != 0) {
printf("Assignment write mask enables invalid components for "
"type %s:\n", lhs->type->name);
if (lhs_components != ir->rhs->type->vector_elements) {
printf("Assignment count of LHS write mask channels enabled not\n"
"matching RHS vector size (%d LHS, %d RHS).\n",
lhs_components, ir->rhs->type->vector_elements);
ir->print();
abort();
}

View File

@@ -162,6 +162,9 @@ generate_110_uniforms(exec_list *instructions,
state->Const.MaxTextureCoords);
add_uniform(instructions, state, "gl_TextureMatrix", mat4_array_type);
add_uniform(instructions, state, "gl_TextureMatrixInverse", mat4_array_type);
add_uniform(instructions, state, "gl_TextureMatrixTranspose", mat4_array_type);
add_uniform(instructions, state, "gl_TextureMatrixInverseTranspose", mat4_array_type);
add_uniform(instructions, state, "gl_DepthRange",
state->symbols->get_type("gl_DepthRangeParameters"));

View File

@@ -457,7 +457,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
*/
if (input->type != output->type) {
linker_error_printf(prog,
"%s shader output `%s' delcared as "
"%s shader output `%s' declared as "
"type `%s', but %s shader input declared "
"as type `%s'\n",
producer_stage, output->name,
@@ -857,13 +857,15 @@ struct uniform_node {
*/
static void
update_uniform_array_sizes(struct gl_shader_program *prog)
update_array_sizes(struct gl_shader_program *prog)
{
for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
foreach_list(node, prog->_LinkedShaders[i]->ir) {
ir_variable *const var = ((ir_instruction *) node)->as_variable();
if ((var == NULL) || (var->mode != ir_var_uniform) ||
if ((var == NULL) || (var->mode != ir_var_uniform &&
var->mode != ir_var_in &&
var->mode != ir_var_out) ||
!var->type->is_array())
continue;
@@ -880,6 +882,7 @@ update_uniform_array_sizes(struct gl_shader_program *prog)
}
}
}
if (size + 1 != var->type->fields.array->length) {
var->type = glsl_type::get_array_instance(var->type->fields.array,
size + 1);
@@ -979,8 +982,6 @@ assign_uniform_locations(struct gl_shader_program *prog)
hash_table_string_compare);
void *mem_ctx = talloc_new(NULL);
update_uniform_array_sizes(prog);
for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
unsigned next_position = 0;
@@ -1475,6 +1476,8 @@ link_shaders(GLcontext *ctx, struct gl_shader_program *prog)
;
}
update_array_sizes(prog);
assign_uniform_locations(prog);
if (prog->_NumLinkedShaders && prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) {

View File

@@ -85,7 +85,7 @@ int
calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
enum ir_expression_operation op)
{
void *mem_ctx = talloc_init(__func__);
void *mem_ctx = talloc_init("%s", __func__);
ir_expression *const sub =
new(mem_ctx) ir_expression(ir_binop_sub, from->type, to, from);

View File

@@ -0,0 +1,358 @@
/*
* Copyright © 2010 Luca Barbieri
*
* 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.
*/
/**
* \file lower_variable_index_to_cond_assign.cpp
*
* Turns non-constant indexing into array types to a series of
* conditional moves of each element into a temporary.
*
* Pre-DX10 GPUs often don't have a native way to do this operation,
* and this works around that.
*/
#include "ir.h"
#include "ir_rvalue_visitor.h"
#include "ir_optimization.h"
#include "glsl_types.h"
#include "main/macros.h"
struct assignment_generator
{
ir_instruction* base_ir;
ir_rvalue* array;
bool is_write;
ir_variable* var;
assignment_generator()
{
}
void generate(unsigned i, ir_rvalue* condition, exec_list *list) const
{
/* Just clone the rest of the deref chain when trying to get at the
* underlying variable.
*/
void *mem_ctx = talloc_parent(base_ir);
ir_rvalue *element =
new(mem_ctx) ir_dereference_array(this->array->clone(mem_ctx, NULL),
new(mem_ctx) ir_constant(i));
ir_rvalue *variable = new(mem_ctx) ir_dereference_variable(this->var);
ir_assignment *assignment = (is_write)
? new(mem_ctx) ir_assignment(element, variable, condition)
: new(mem_ctx) ir_assignment(variable, element, condition);
list->push_tail(assignment);
}
};
struct switch_generator
{
/* make TFunction a template parameter if you need to use other generators */
typedef assignment_generator TFunction;
const TFunction& generator;
ir_variable* index;
unsigned linear_sequence_max_length;
unsigned condition_components;
void *mem_ctx;
switch_generator(const TFunction& generator, ir_variable *index,
unsigned linear_sequence_max_length,
unsigned condition_components)
: generator(generator), index(index),
linear_sequence_max_length(linear_sequence_max_length),
condition_components(condition_components)
{
this->mem_ctx = talloc_parent(index);
}
void linear_sequence(unsigned begin, unsigned end, exec_list *list)
{
if (begin == end)
return;
/* If the array access is a read, read the first element of this subregion
* unconditionally. The remaining tests will possibly overwrite this
* value with one of the other array elements.
*
* This optimization cannot be done for writes because it will cause the
* first element of the subregion to be written possibly *in addition* to
* one of the other elements.
*/
unsigned first;
if (!this->generator.is_write) {
this->generator.generate(begin, 0, list);
first = begin + 1;
} else {
first = begin;
}
for (unsigned i = first; i < end; i += 4) {
const unsigned comps = MIN2(condition_components, end - i);
ir_rvalue *broadcast_index =
new(this->mem_ctx) ir_dereference_variable(index);
if (comps) {
const ir_swizzle_mask m = { 0, 0, 0, 0, comps, false };
broadcast_index = new(this->mem_ctx) ir_swizzle(broadcast_index, m);
}
/* Compare the desired index value with the next block of four indices.
*/
ir_constant_data test_indices_data;
memset(&test_indices_data, 0, sizeof(test_indices_data));
test_indices_data.i[0] = i;
test_indices_data.i[1] = i + 1;
test_indices_data.i[2] = i + 2;
test_indices_data.i[3] = i + 3;
ir_constant *const test_indices =
new(this->mem_ctx) ir_constant(broadcast_index->type,
&test_indices_data);
ir_rvalue *const condition_val =
new(this->mem_ctx) ir_expression(ir_binop_equal,
&glsl_type::bool_type[comps - 1],
broadcast_index,
test_indices);
ir_variable *const condition =
new(this->mem_ctx) ir_variable(condition_val->type,
"dereference_array_condition",
ir_var_temporary);
list->push_tail(condition);
ir_rvalue *const cond_deref =
new(this->mem_ctx) ir_dereference_variable(condition);
list->push_tail(new(this->mem_ctx) ir_assignment(cond_deref,
condition_val, 0));
if (comps == 1) {
ir_rvalue *const cond_deref =
new(this->mem_ctx) ir_dereference_variable(condition);
this->generator.generate(i, cond_deref, list);
} else {
for (unsigned j = 0; j < comps; j++) {
ir_rvalue *const cond_deref =
new(this->mem_ctx) ir_dereference_variable(condition);
ir_rvalue *const cond_swiz =
new(this->mem_ctx) ir_swizzle(cond_deref, j, 0, 0, 0, 1);
this->generator.generate(i + j, cond_swiz, list);
}
}
}
}
void bisect(unsigned begin, unsigned end, exec_list *list)
{
unsigned middle = (begin + end) >> 1;
assert(index->type->is_integer());
ir_constant *const middle_c = (index->type->base_type == GLSL_TYPE_UINT)
? new(this->mem_ctx) ir_constant((unsigned)middle)
: new(this->mem_ctx) ir_constant((int)middle);
ir_dereference_variable *deref =
new(this->mem_ctx) ir_dereference_variable(this->index);
ir_expression *less =
new(this->mem_ctx) ir_expression(ir_binop_less, glsl_type::bool_type,
deref, middle_c);
ir_if *if_less = new(this->mem_ctx) ir_if(less);
generate(begin, middle, &if_less->then_instructions);
generate(middle, end, &if_less->else_instructions);
list->push_tail(if_less);
}
void generate(unsigned begin, unsigned end, exec_list *list)
{
unsigned length = end - begin;
if (length <= this->linear_sequence_max_length)
return linear_sequence(begin, end, list);
else
return bisect(begin, end, list);
}
};
/**
* Visitor class for replacing expressions with ir_constant values.
*/
class variable_index_to_cond_assign_visitor : public ir_rvalue_visitor {
public:
variable_index_to_cond_assign_visitor(bool lower_input,
bool lower_output,
bool lower_temp,
bool lower_uniform)
{
this->progress = false;
this->lower_inputs = lower_input;
this->lower_outputs = lower_output;
this->lower_temps = lower_temp;
this->lower_uniforms = lower_uniform;
}
bool progress;
bool lower_inputs;
bool lower_outputs;
bool lower_temps;
bool lower_uniforms;
bool is_array_or_matrix(const ir_instruction *ir) const
{
return (ir->type->is_array() || ir->type->is_matrix());
}
bool needs_lowering(ir_dereference_array *deref) const
{
if (deref == NULL || deref->array_index->as_constant()
|| !is_array_or_matrix(deref->array))
return false;
if (deref->array->ir_type == ir_type_constant)
return this->lower_temps;
const ir_variable *const var = deref->array->variable_referenced();
switch (var->mode) {
case ir_var_auto:
case ir_var_temporary:
return this->lower_temps;
case ir_var_uniform:
return this->lower_uniforms;
case ir_var_in:
return (var->location == -1) ? this->lower_temps : this->lower_inputs;
case ir_var_out:
return (var->location == -1) ? this->lower_temps : this->lower_outputs;
case ir_var_inout:
return this->lower_temps;
}
assert(!"Should not get here.");
return false;
}
ir_variable *convert_dereference_array(ir_dereference_array *orig_deref,
ir_rvalue* value)
{
assert(is_array_or_matrix(orig_deref->array));
const unsigned length = (orig_deref->array->type->is_array())
? orig_deref->array->type->length
: orig_deref->array->type->matrix_columns;
void *const mem_ctx = talloc_parent(base_ir);
ir_variable *var =
new(mem_ctx) ir_variable(orig_deref->type, "dereference_array_value",
ir_var_temporary);
base_ir->insert_before(var);
if (value) {
ir_dereference *lhs = new(mem_ctx) ir_dereference_variable(var);
ir_assignment *assign = new(mem_ctx) ir_assignment(lhs, value, NULL);
base_ir->insert_before(assign);
}
/* Store the index to a temporary to avoid reusing its tree. */
ir_variable *index =
new(mem_ctx) ir_variable(orig_deref->array_index->type,
"dereference_array_index", ir_var_temporary);
base_ir->insert_before(index);
ir_dereference *lhs = new(mem_ctx) ir_dereference_variable(index);
ir_assignment *assign =
new(mem_ctx) ir_assignment(lhs, orig_deref->array_index, NULL);
base_ir->insert_before(assign);
assignment_generator ag;
ag.array = orig_deref->array;
ag.base_ir = base_ir;
ag.var = var;
ag.is_write = !!value;
switch_generator sg(ag, index, 4, 4);
exec_list list;
sg.generate(0, length, &list);
base_ir->insert_before(&list);
return var;
}
virtual void handle_rvalue(ir_rvalue **pir)
{
if (!*pir)
return;
ir_dereference_array* orig_deref = (*pir)->as_dereference_array();
if (needs_lowering(orig_deref)) {
ir_variable* var = convert_dereference_array(orig_deref, 0);
assert(var);
*pir = new(talloc_parent(base_ir)) ir_dereference_variable(var);
this->progress = true;
}
}
ir_visitor_status
visit_leave(ir_assignment *ir)
{
ir_rvalue_visitor::visit_leave(ir);
ir_dereference_array *orig_deref = ir->lhs->as_dereference_array();
if (needs_lowering(orig_deref)) {
convert_dereference_array(orig_deref, ir->rhs);
ir->remove();
this->progress = true;
}
return visit_continue;
}
};
bool
lower_variable_index_to_cond_assign(exec_list *instructions,
bool lower_input,
bool lower_output,
bool lower_temp,
bool lower_uniform)
{
variable_index_to_cond_assign_visitor v(lower_input,
lower_output,
lower_temp,
lower_uniform);
visit_list_elements(&v, instructions);
return v.progress;
}

View File

@@ -118,6 +118,8 @@ dri2_destroy_context(struct glx_context *context)
struct dri2_context *pcp = (struct dri2_context *) context;
struct dri2_screen *psc = (struct dri2_screen *) context->psc;
driReleaseDrawables(&pcp->base);
if (context->xid)
glx_send_destroy_context(psc->base.dpy, context->xid);
@@ -136,6 +138,7 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old,
struct dri2_context *pcp = (struct dri2_context *) context;
struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc;
struct dri2_drawable *pdraw, *pread;
struct dri2_display *pdp;
pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw);
pread = (struct dri2_drawable *) driFetchDrawable(context, read);
@@ -143,11 +146,21 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old,
if (pdraw == NULL || pread == NULL)
return GLXBadDrawable;
if ((*psc->core->bindContext) (pcp->driContext,
pdraw->driDrawable, pread->driDrawable))
return Success;
if (!(*psc->core->bindContext) (pcp->driContext,
pdraw->driDrawable, pread->driDrawable))
return GLXBadContext;
return GLXBadContext;
/* If the server doesn't send invalidate events, we may miss a
* resize before the rendering starts. Invalidate the buffers now
* so the driver will recheck before rendering starts. */
pdp = (struct dri2_display *) psc->base.display;
if (!pdp->invalidateAvailable) {
dri2InvalidateBuffers(psc->base.dpy, pdraw->base.xDrawable);
if (pread != pdraw)
dri2InvalidateBuffers(psc->base.dpy, pread->base.xDrawable);
}
return Success;
}
static void
@@ -158,7 +171,8 @@ dri2_unbind_context(struct glx_context *context, struct glx_context *new)
(*psc->core->unbindContext) (pcp->driContext);
driReleaseDrawables(&pcp->base);
if (context == new)
driReleaseDrawables(&pcp->base);
}
static struct glx_context *

View File

@@ -391,17 +391,19 @@ driReleaseDrawables(struct glx_context *gc)
if (__glxHashLookup(priv->drawHash,
gc->currentDrawable, (void *) &pdraw) == 0) {
if (pdraw->drawable == pdraw->xDrawable)
if (pdraw->drawable == pdraw->xDrawable) {
(*pdraw->destroyDrawable)(pdraw);
__glxHashDelete(priv->drawHash, gc->currentDrawable);
__glxHashDelete(priv->drawHash, gc->currentDrawable);
}
}
if (gc->currentDrawable != gc->currentReadable &&
__glxHashLookup(priv->drawHash,
gc->currentReadable, (void *) &pdraw) == 0) {
if (pdraw->drawable == pdraw->xDrawable)
if (pdraw->drawable == pdraw->xDrawable) {
(*pdraw->destroyDrawable)(pdraw);
__glxHashDelete(priv->drawHash, gc->currentReadable);
__glxHashDelete(priv->drawHash, gc->currentReadable);
}
}
}

View File

@@ -1034,8 +1034,8 @@ __indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end,
void
__indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count,
GLsizei primcount)
__indirect_glMultiDrawArraysEXT(GLenum mode, const GLint *first,
const GLsizei *count, GLsizei primcount)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =

View File

@@ -106,8 +106,8 @@
<category name="GL_EXT_multi_draw_arrays" number="69">
<function name="MultiDrawArraysEXT" offset="assign">
<param name="mode" type="GLenum"/>
<param name="first" type="GLint *"/> <!-- Spec bug. Should be const. -->
<param name="count" type="GLsizei *"/> <!-- Spec bug. Should be const. -->
<param name="first" type="const GLint *"/>
<param name="count" type="const GLsizei *"/>
<param name="primcount" type="GLsizei"/>
<glx handcode="true"/>
</function>

View File

@@ -38,7 +38,7 @@
#include "GL/gl.h"
#include "GL/glext.h"
#ifndef GL_FIXED
#ifndef GL_OES_fixed_point
typedef int GLfixed;
typedef int GLclampx;
#endif

View File

@@ -61,7 +61,7 @@ entry_patch_public(void)
void
entry_patch(mapi_func entry, int slot)
{
void *code = (void *) entry;
char *code = (char *) entry;
*((unsigned int *) (code + 12)) = slot * sizeof(mapi_func);
}

View File

@@ -91,7 +91,7 @@ entry_patch_public(void)
void
entry_patch(mapi_func entry, int slot)
{
void *code = (void *) entry;
char *code = (char *) entry;
*((unsigned long *) (code + 8)) = slot * sizeof(mapi_func);
}

View File

@@ -63,7 +63,7 @@ entry_patch_public(void)
void
entry_patch(mapi_func entry, int slot)
{
void *code = (void *) entry;
char *code = (char *) entry;
*((unsigned long *) (code + 11)) = slot * sizeof(mapi_func);
*((unsigned long *) (code + 22)) = slot * sizeof(mapi_func);

View File

@@ -880,6 +880,7 @@ dri2CreateNewScreen(int scrn, int fd,
}
psp->DriverAPI = driDriverAPI;
psp->loaderPrivate = data;
driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions,
__dri2NConfigOptions);

View File

@@ -539,6 +539,7 @@ struct __DRIscreenRec {
driOptionCache optionInfo;
driOptionCache optionCache;
unsigned int api_mask;
void *loaderPrivate;
};
extern void

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