Compare commits

..

68 Commits

Author SHA1 Message Date
Emil Velikov
5fe79b0b12 docs: Update 10.4.0 release notes
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-12-14 13:45:54 +00:00
Emil Velikov
45f3aa0bc7 Bump version to 10.4.0 (final)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-12-14 13:32:44 +00:00
Alexander von Gluck IV
90239276ff mesa/drivers: Add missing mesautil lib to Haiku swrast
* Resolves missing util_format_linear_to_srgb_8unorm_table symbol.

(cherry picked from commit ad2ffd3bc6)
2014-12-11 13:54:54 +00:00
Roland Scheidegger
57868b1ee4 llvmpipe: fix lp_test_arit denorm handling
llvmpipe disables denorms on purpose (on x86/sse only), because denorms are
generally neither required nor desired for graphic apis (and in case of d3d10,
they are forbidden).
However, this caused some arithmetic tests using denorms to fail on some
systems, because the reference did not generate the same results anymore.
(It did not fail on all systems - behavior of these math functions is sort
of undefined when called with non-standard floating point mode, hence the
result differing depending on implementation and in particular the sse
capabilities.)
So, for the reference, simply flush all (input/output) denorms manually
to zero in this case.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=67672.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 8148a06b8f)
Nominated-by: Matt Turner <mattst88@gmail.com>
2014-12-11 13:54:54 +00:00
Marek Olšák
fe2eac2237 docs/relnotes: document the removal of GALLIUM_MSAA
Cc: 10.2.10.3 10.4 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit ac319d94d3)
2014-12-11 13:54:54 +00:00
Matt Turner
db784a09f1 i965: Disable unlit-centroid workaround on Gen < 6.
Back to the original commit (8313f444) adding the workaround, we were
enabling it on gens <= 7, even though gens <= 5 can't do multisampling.

I cannot find documentation that says that Sandybridge needs this
workaround but in practice disabling it causes these piglit tests to
fail:

EXT_framebuffer_multisample/interpolation {2,4} centroid-deriv{,-disabled}

On Ironlake:

total instructions in shared programs: 4358478 -> 4349671 (-0.20%)
instructions in affected programs:     117680 -> 108873 (-7.48%)

A bunch of shaders in TF2, Portal 2, and L4D2 are cut by 25~30%.

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
(cherry picked from commit 1a2de7dce8)
2014-12-11 13:54:53 +00:00
Dave Airlie
d9f4aaa095 r600g: only init GS_VERT_ITEMSIZE on r600
On evergreen there are 4 regs, on r600/700 there is only one.

Don't initialise regs and trash someone elses state.

Not sure this fixes anything, but hey one less stupid.

Reviewed-By: Glenn Kennard <glenn.kennard@gmail.com>
Cc: "10.3 10.4" mesa-stable@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 7f21cf7198)
2014-12-11 13:54:53 +00:00
Timothy Arceri
e340a28dba mesa: use build flag to ensure stack is realigned on x86
Nowadays GCC assumes stack pointer is 16-byte aligned even on 32-bits, but that is an assumption OpenGL drivers (or any dynamic library for that matter) can't afford to make as there are many closed- and open- source application binaries out there that only assume 4-byte stack alignment.

V4: fix comment and indentation

V3: move all sse4.1 build flag config to the same location
 and add comment as to why we need to do the realign

V2: use $target_cpu rather than $host_cpu
  and setup build flags in config rather than makefile

https://bugs.freedesktop.org/show_bug.cgi?id=86788
Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Matt Turner <mattst88@gmail.com>
CC: "10.4" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit f1b5f2b157)
2014-12-11 13:54:53 +00:00
Tom Stellard
6b908efd58 radeonsi: Program RASTER_CONFIG for harvested GPUs v5
Harvested GPUs have some of their render backends disabled, so
in order to prevent the hardware from trying to render things
with these disabled backends we need to correctly program
the PA_SC_RASTER_CONFIG register.

v2:
  - Write RASTER_CONFIG for all SEs.

v3:
  - Set GRBM_GFX_INDEX.INSTANCE_BROADCAST_WRITES bit.
  - Set GRBM_GFX_INFEX.SH_BROADCAST_WRITES bit when done setting
    PA_SC_RASTER_CONFIG.
  - Get num_se and num_sh_per_se from kernel.

v4:
  - Get correct value for num_se
  - Remove loop for setting PA_SC_RASTER_CONFIG
  - Only compute raster config when a backend has been disabled.

v5: Michel Dänzer
  - Fix computation for chips with multiple SEs

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

CC: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 67dcbcd92c)
2014-12-11 13:54:53 +00:00
Abdiel Janulgue
65f03e6733 ir_to_mesa: Remove sat to clamp lowering pass
Fixes an infinite loop in swrast where the lowering pass unpacks saturate into
clamp but the opt_algebraic pass tries to do the opposite.

v3 (Ian):
This is a revert of commit cfa8c1cb "ir_to_mesa: lower ir_unop_saturate" on
the ir_to_mesa.cpp portion. prog_execute.c can handle saturates in vertex
shaders, so classic swrast shouldn't need this lowering pass.

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83463
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
(cherry picked from commit 39f7b72428)
2014-12-11 13:54:53 +00:00
Chris Forbes
ffaf58e7d0 i965/Gen6-7: Fix point sprites with PolygonMode(GL_POINT)
This was an oversight in the original patch. When PolygonMode is
used, then front faces, back faces, or both may be rendered as
points and are affected by point sprite state.

Note that SNB/IVB can't actually be fully conformant here, for
a legacy context -- we don't have separate sets of pointsprite
enables for front and back faces. Haswell ignores pointsprite
state correctly in hardware for non-point rasterization, so can
do this correctly, but it doesn't seem worth it.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86764
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit ed56c16820)
2014-12-11 13:54:53 +00:00
Ben Widawsky
bb9dea8a29 i965/gs: Avoid DW * DW mul
The GS has an interesting use for mul. Because the GS can emit multiple
vertices per input vertex, and it also has a unique count at the top of the URB
payload, the GS unit needs to be able to dynamically specify URB write offsets
(relative to the global offset). The documentation in the function has a very
good explanation from Paul on the mechanics.

This fixes around 2000 piglit tests on BSW.

v2:
Reworded commit message (Ben) no mention of CHV (Matt)
Change SHRT_MAX to USHRT_MAX (Ken, and Matt)
Update comment in code to reflect the use of UW (Ben)
Add Gen7+ assertion for the relevant GS code, since it won't work on Gen6- (Ken)
Drop the bogus hunk in emit_control_data_bits() (Ken)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84777 (with many dupes)
Cc: "10.4 10.3 10.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit f13870db09)
2014-12-11 13:54:53 +00:00
José Fonseca
be59440b53 util/primconvert: Avoid point arithmetic; apply offset on all cases.
Matches what u_vbuf_get_minmax_index() does.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit f9098f0972)
2014-12-11 13:54:52 +00:00
Ilia Mirkin
ac8d596498 util/primconvert: take ib offset into account
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
(cherry picked from commit c3bed13604)
2014-12-11 13:54:52 +00:00
Ilia Mirkin
112d2fdb17 util/primconvert: support instanced rendering
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
(cherry picked from commit fb434e675f)
2014-12-11 13:54:52 +00:00
Ilia Mirkin
c6353cee0c util/primconvert: pass index bias through
The index_bias (aka base_vertex) applies to the downstream draw just as
much, since the actual index values are never modified.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
(cherry picked from commit 1dfa039168)
2014-12-11 13:54:52 +00:00
Emil Velikov
09e4f1a50f Increment version to 10.4.0-rc4
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-12-05 18:52:11 +00:00
Axel Davy
c7b9a2e38a st/nine: Fix vertex declarations for non-standard (usage/index)
Nine code to match vertex declaration to vs inputs was limiting
the number of possible combinations.

Some sm3 games have issues with that, because arbitrary (usage/index)
can be used.

This patch does the following changes to fix the problem:
. Change the numbers given to (usage/index) combinations to uint16
. Do not put limits on the indices when it doesn't make sense
. change the conversion rule (usage/index) -> number to fit all combinations
. Instead of having a table usage_map mapping a (usage/index) number to
an input index, usage_map maps input indices to their (usage/index)

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: Yaroslav Andrusyak <pontostroy@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit 712a4c5438)
2014-12-03 23:20:56 +00:00
Axel Davy
6fcbf9aee3 st/nine: sm1_declusage_to_tgsi, do not restrict indices with TGSI_SEMANTIC_GENERIC
With sm3, you can declare an input/output with an usage and an usage index.

Nine code hardcodes the translation usage/index to a corresponding TGSI code.
The translation was limited to a few usage/index combinations that were corresponding
to most of the needs of games, but some games did not work.

This patch rewrites that Nine code to map all possible usage/index combination
to TGSI code. The index associated to TGSI_SEMANTIC_GENERIC doesn't need to be low
for good performance, as the old code was supposing, and is not particularly bounded
(it's UINT16). Given the index is BYTE, we can map all combinations.

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: Yaroslav Andrusyak <pontostroy@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit 5d6d260833)
2014-12-03 23:20:01 +00:00
Axel Davy
fd2852fe5b st/nine: Queries: Fix D3DISSUE_END behaviour.
Issuing D3DISSUE_END should:
. reset previous queries if possible
. end the query

Previous behaviour wasn't calling end_query for
queries not needing D3DISSUE_BEGIN, nor resetting
previous queries.

This fixes several applications not launching properly.

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit eac0b9b68a)

Conflicts:
	src/gallium/state_trackers/nine/query9.c
2014-12-03 23:18:48 +00:00
Brian Paul
57057c439e mesa: fix height error check for 1D array textures
height=0 is legal for 1D array textures (as depth=0 is legal for
2D arrays).  Fixes new piglit ext_texture_array-errors test.

Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 4e6244e80f)
2014-12-03 23:16:36 +00:00
Dave Airlie
b5cc04b6ad r600g/sb: fix issues cause by GLSL switching to loops for switch
Since 73dd50acf6
glsl: implement switch flow control using a loop

The SB backend was falling over in an assert or crashing.

Tracked this down to the loops having no repeats, but requiring
a working break, initial code just called the loop handler for
all non-if statements, but this caused a regression in
tests/shaders/dead-code-break-interaction.shader_test.
So I had to add further code to detect if all the departure
nodes are empty and avoid generating an empty loop for that case.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86089
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-By: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 7b0067d23a)
2014-12-03 23:15:27 +00:00
Brian Paul
d2e9fd5b6d mesa: fix arithmetic error in _mesa_compute_compressed_pixelstore()
We need parenthesis around the expression which computes the number of
blocks per row.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 991d5cf8ce)
2014-12-03 23:15:12 +00:00
Ilia Mirkin
b61192f2ae freedreno/ir3: fix UMAD
Looks like none of the mad variants do u16 * u16 + u32, so just add in
the extra value "by hand".

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit de83ef677f)
2014-12-03 23:15:05 +00:00
Ilia Mirkin
75c4824d2f freedreno/a3xx: only enable blend clamp for non-float formats
This fixes arb_color_buffer_float-render GL_RGBA16F.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
(cherry picked from commit 3de9fa8ff4)
2014-12-03 23:14:48 +00:00
Christoph Bumiller
f30fbbdbdd nv50/ir/tgsi: handle TGSI_OPCODE_ARR
This instruction is used by st/nine.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit f3b4b263c2)
2014-12-03 23:14:34 +00:00
Emil Velikov
b247956c77 cherry-ignore: drop whitespace commit
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-12-03 23:13:53 +00:00
Axel Davy
72a802a9c2 st/nine: Fix setting of the shift modifier in nine_shader
It is an sint_4, but it was stored in a uint_8...
The code using it was acting as if it was signed.

Problem found thanks to Coverity

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit d52328fc39)
2014-12-03 22:59:28 +00:00
David Heidelberg
cfbc474d80 st/nine: remove unused pipe_viewport_state::translate[3] and scale[3]
2efabd9f5a removed them as unused.

This caused random memory overwrites (reported by Coverity).

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: David Heidelberg <david@ixit.cz>
(cherry picked from commit 90fea6b3e0)
2014-12-03 22:59:21 +00:00
Axel Davy
360872a45e st/nine: fix wrong variable reset
Error detected by Coverity (COPY_PASTE_ERROR)

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: David Heidelberg <david@ixit.cz>
(cherry picked from commit 614d9387c7)
2014-12-03 22:59:12 +00:00
David Heidelberg
42839ea5ba st/nine: return GetAvailableTextureMem in bytes as expected (v2)
PIPE_CAP_VIDEO_MEMORY returns the amount of video memory in megabytes,
so need to converted it to bytes.

Fixed Warframe memory detection.

v2: also prepare for cards with more than 4GB memory

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: Yaroslav Andrusyak <pontostroy@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: David Heidelberg <david@ixit.cz>
(cherry picked from commit a99f31bced)
2014-12-03 22:59:07 +00:00
Axel Davy
8dc03bd575 st/nine: Add pool check to SetTexture (v2)
D3DPOOL_SCRATCH is disallowed according to spec.
D3DPOOL_SYSTEMMEM should be allowed but we don't handle it right for now.

v2: Fixes segfault in SetTexture when unsetting the texture

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit 4eea2496bc)
2014-12-03 22:58:54 +00:00
Axel Davy
41906e9764 st/nine: propertly declare constants (v2)
Fixes "Error : CONST[20]: Undeclared source register" when running
dx9_alpha_blending_material. Also artifacts on ilo.

v2: also remove unused MISC_CONST

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit 890f963d64)
2014-12-03 22:58:49 +00:00
Stanislaw Halik
56572002fc st/nine: call DBG() at more external entry points
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
(cherry picked from commit 7f74b9d479)
2014-12-03 22:58:44 +00:00
Axel Davy
c0e0de45dc st/nine: rework the way D3DPOOL_SYSTEMMEM is handled
This patch moves the data field from Resource9 to Surface9 and cleans
D3DPOOL_SYSTEMMEM handling in Texture9. This fixes HL2 lost coast.

It also removes in Texture9 some code written to support importing
and exporting non D3DPOOL_SYSTEMMEM shared buffers. This code hadn't
the design required to support the feature and wasn't used.

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit 6aeae7442d)
2014-12-03 22:58:39 +00:00
Axel Davy
b75a285633 st/nine: Rework Basetexture9 and Resource9.
Instead of having parts of the structures initialised by the parents,
have them initialised by the children.

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit 133b2087c5)
2014-12-03 22:58:35 +00:00
Axel Davy
1cf4dbdc81 st/nine: clean device9ex.
Pass ex specific parameters as arguments to device9 ctor instead
of passing them by filling the structure.

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
(cherry picked from commit 104b5a8193)
2014-12-03 22:58:29 +00:00
Emil Velikov
c29ddc923f Increment version to 10.4.0-rc3
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-11-28 17:58:26 +00:00
Ilia Mirkin
085de45812 freedreno/ir3: don't pass consts to madsh.m16 in MOD logic
madsh.m16 can't handle a const in src1, make sure to unconst it

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 37fe347542)
2014-11-28 17:29:29 +00:00
Dave Airlie
31c7e6c51d r600g: merge the TXQ and BUFFER constant buffers (v1.1)
We are using 1 more buffer than we have, although in the future the
driver should just end up using one buffer in total probably, this
is a good first step, it merges the txq cube array and buffer info
constants on r600 and evergreen.

This should in theory fix geom shader tests on r600.

v1.1: fix comments from Glenn.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 07ae69753c)

Squashed with commit

r600g: fix fallout from last patch

I accidentally rebased from the wrong machine and missed some
fixes that were on my r600 box.

doh.

this fixes a bunch of geom shader textureSize tests on rv635
from gpu reset to pass.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86760
Reported-by: wolput@onsneteindhoven.nl
Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit b10ddf962f)

Squashed with commit

r600g: make llvm code compile this time

Actually compiling the code helps make it compile.

Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 91a827624c)
2014-11-28 17:29:07 +00:00
José Fonseca
2a0290d5f5 st/wgl: Don't export wglGetExtensionsStringARB.
It's not exported by the official opengl32.dll neither.  Applications are
supposed to get it via wglGetProcAddress(), not GetProcAddress().

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
(cherry picked from commit cb009bdd44)
2014-11-28 17:28:28 +00:00
José Fonseca
f77a97f057 mapi/glapi: Fix dll linkage of GLES1 symbols.
This fixes several MSVC warnings like:

  warning C4273: 'glClearColorx' : inconsistent dll linkage

In fact, we should avoid using `declspec(dllexport)` altogether, and use
exclusively the .DEF instead, which gives more precise control of which
symbols must be exported, but all the public GL/GLES headers practically
force us to pick between `declspec(dllexport)` or
`declspec(dllimport)`.

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
(cherry picked from commit 5fdb6d6839)
2014-11-28 17:28:20 +00:00
José Fonseca
d45c35c3d7 util/u_snprintf: Don't redefine HAVE_STDINT_H as 0.
We now always guarantee availability of stdint.h on MSVC -- if MSVC
doesn't supply one we use our own.

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
(cherry picked from commit 4b6e93650c)
2014-11-28 17:28:13 +00:00
Emil Velikov
16eaf01a6a nine: the .pc file should not follow mesa version
The version provided by it should be the same as the one
provided/handled by the module. Add the missing tiny version.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: David Heidelberg <david@ixit.cz>
(cherry picked from commit 9b7037a369)
2014-11-26 21:23:59 +00:00
Chris Forbes
6316d415c4 i965/Gen6-7: Do not replace texcoords with point coord if not drawing points
Fixes broken rendering in Windows-based QtQuick2 apps run through Wine.
This library sets all texture units' GL_COORD_REPLACE, leaves point
sprite mode enabled, and then draws a triangle fan.

Will need a slightly different fix for Gen4-5, but I don't have my old
machines in a usable state currently.

V2: - Simplify patch -- the real changes are no longer duplicated across
      the Gen6 and Gen7 atoms.
    - Also don't clobber attr overrides -- which matters on Haswell too,
      and fixes the other half of the problem
    - Fix newly-introduced warnings
V3: - Use BRW_NEW_GEOMETRY_PROGRAM and brw->geometry_program rather than
      core flag and state; keep the state flags in order.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84651
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 0008d0e59e)
2014-11-26 21:23:23 +00:00
Kenneth Graunke
dca88397ca glsl: Make lower_constant_arrays_to_uniforms require dereferences.
Ilia noticed that my lowering pass was converting the constant array
used by textureGatherOffsets' offsets parameter to a uniform.  This
broke textureGather for Nouveau, and is generally a horrible plan,
since it violates the GLSL constraint that offsets must be an
immediate constant.

When I wrote this pass, I neglected to consider whole array assignment.
I figured opt_array_splitting would handle constant indexing, so this
pass was really about fixing variable indexing.

textureGatherOffsets is an example of whole array access that we really
don't want to touch.  Whole array copies don't appear to benefit from
this either - they're most likely initializers for temporary arrays
which are going to be mutated anyway.  Since you're copying, you may
as well copy from immediates, not uniforms.

This patch makes the pass look for ir_dereference_arrays of
ir_constants, rather than looking for any ir_constant directly.
This way, it ignores whole array assignment.

No shader-db changes or Piglit regressions on Haswell.  Some Piglit
tests generate different code (fixing textureGatherOffsets on Nouveau).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 60f011af1a)
2014-11-26 21:23:14 +00:00
Chris Forbes
6c383aaadd mesa: Fix Get(GL_TRANSPOSE_CURRENT_MATRIX_ARB) to transpose
This was just returning the same value as GL_CURRENT_MATRIX_ARB.
Spotted while investigating something else in apitrace.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 2b4fe85f0e)
2014-11-26 21:23:08 +00:00
Chris Forbes
7e47ae3185 glsl: Generate unique names for each const array lowered to uniforms
Uniform names (even for hidden uniforms) are required to be unique; some
parts of the compiler assume they can be looked up by name.

Fixes the piglit test: tests/spec/glsl-1.20/linker/array-initializers-1

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 129178893b)
2014-11-26 21:20:33 +00:00
Chris Forbes
9e94c05936 i965: Handle nested uniform array indexing
When converting a uniform array reference to a pull constant load, the
`reladdr` expression itself may have its own `reladdr`, arbitrarily
deeply. This arises from expressions like:

   a[b[x]]     where a, b are uniform arrays (or lowered const arrays),
               and x is not a constant.

Just iterate the lowering to pull constants until we stop seeing these
nested. For most shaders, there will be only one pass through this loop.

Fixes the piglit test:
tests/spec/glsl-1.20/linker/double-indirect-1.shader_test

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit adefccd12a)
2014-11-26 21:20:11 +00:00
Dave Airlie
4952c49f21 r600g: do all CUBE ALU operations before gradient texture operations (v2.1)
This moves all the CUBE section above the gradients section,
so that the gradient emission happens on one block which
is what sb/hardware expect.

v2: avoid changes to bytecode by using spare temps
v2.1: shame gcc, oh the shame. (uninit var warnings)

Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit c88385603a)
2014-11-26 21:20:05 +00:00
Dave Airlie
013eba0ec1 r600: fix texture gradients instruction emission (v2)
The piglit tests were failing, and it appeared to be SB
optimising out things, but Glenn pointed out the gradients
are meant to be clause local, so we should emit the texture
instructions in the same clause. This moves things around
to always copy to a temp and then emit the texture clauses
for H/V.

v2: Glenn pointed out we could get another ALU fetch in
the wrong place, so load the src gpr earlier as well.

Fixes at least:
./bin/tex-miplevel-selection textureGrad 2D

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 38ec184419)
2014-11-26 21:19:56 +00:00
Ilia Mirkin
db9a6b96ab nv50,nvc0: buffer resources can be bound as other things down the line
res->bind is not an indicator of how the resource is currently bound.
buffers can be rebound across different binding points without changing
underlying storage.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit fecae4625c)
2014-11-24 00:55:28 +00:00
Ilia Mirkin
4d9c0445dd nv50,nvc0: actually check constbufs for invalidation
The number of vertex buffers has nothing to do with the number of bound
constbufs.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit e80a0a7d9a)
2014-11-24 00:55:22 +00:00
Ilia Mirkin
1a8f90dc70 nv50/ir: set neg modifiers on min/max args
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86618
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 7d07083cfd)
2014-11-24 00:55:17 +00:00
Emil Velikov
7fe9292069 Increment version to 10.4.0-rc2
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-11-22 03:58:31 +00:00
Chad Versace
c260cb700b i965: Fix segfault in WebGL Conformance on Ivybridge
Fixes regression of WebGL Conformance test texture-size-limit [1] on
Ivybridge Mobile GT2 0x0166 with Google Chrome R38.

Regression introduced by

    commit 6c04423153
    Author: Kenneth Graunke <kenneth@whitecape.org>
    Date:   Sun Feb 2 02:58:42 2014 -0800

        i965: Bump GL_MAX_CUBE_MAP_TEXTURE_SIZE to 8192.

The test regressed because the pointer offset arithmetic in
intel_miptree_map_gtt() overflows for large textures. The pointer
arithmetic is not 64-bit safe.

[1] 52f0dc240f/sdk/tests/conformance/textures/texture-size-limit.html

Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=78770
Fixes: Intel CHRMOS-1377
Reported-by: Lu Hua <huax.lu@intel.com>
Reviewed-by: Ian Romanic <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit b69c7c5dac)
2014-11-19 18:58:22 +00:00
Dave Airlie
aab3758916 r600g: limit texture offset application to specific types (v2)
For 1D and 2D arrays we don't want the other coordinates being
offset and affecting where we sample. I wrote this patch 6 months
ago but lost it.

Fixes:
./bin/tex-miplevel-selection textureLodOffset 1DArray
./bin/tex-miplevel-selection textureLodOffset 2DArray
./bin/tex-miplevel-selection textureOffset 1DArray
./bin/tex-miplevel-selection textureOffset 1DArrayShadow
./bin/tex-miplevel-selection textureOffset 2DArray
./bin/tex-miplevel-selection textureOffset(bias) 1DArray
./bin/tex-miplevel-selection textureOffset(bias) 2DArray

v2: rewrite to handle more cases and be consistent with code
above.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 1830138cc0)
2014-11-19 00:53:30 +00:00
Dave Airlie
be24d54195 r600g: geom shaders: always load texture src regs from inputs
Otherwise we seem to lose the split_gs_inputs and try and
pull from an uninitialised register.

fixes 9 texelFetch geom shader tests.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit d4c342f67e)
2014-11-19 00:53:23 +00:00
Marek Olšák
8751abf752 radeonsi: support per-sample gl_FragCoord
Cc: 10.4 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit da2dea3843)
2014-11-19 00:53:14 +00:00
Ilia Mirkin
da7475f35f st/mesa: add a fallback for clear_with_quad when no vs_layer
Not all drivers can set gl_Layer from VS. Add a fallback that passes the
instance id from VS to GS, and then uses the GS to set the layer.

Tested by adding

  quad_buffers |= clear_buffers;
  clear_buffers = 0;

to the st_Clear logic, and forcing set_vertex_shader_layered in all
cases. No piglit regressions (on piglits with 'clear' in the name).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 68db29c434)
2014-11-19 00:53:08 +00:00
Dave Airlie
7b62f0eb50 r600g/cayman: handle empty vertex shaders
Some of the geom shader tests produce an empty vertex shader,
on cayman we'd crash in the finaliser because last_cf was NULL.

cayman doesn't need the NOP workaround, so if the code arrives
here with no last_cf, just emit an END.

fixes crashes in a bunch of piglit geom shader tests.

Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 4e520101e6)
2014-11-19 00:53:00 +00:00
Dave Airlie
fa62619da5 r600g/cayman: fix texture gather tests
It appears on cayman the TG4 outputs were reordered.

This fixes a lot of piglit tests.

Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 27e1e0e710)
2014-11-19 00:52:52 +00:00
Dave Airlie
2e3d2035cf r600g/cayman: fix integer multiplication output overwrite (v2)
This fixes tests/spec/glsl-1.10/execution/fs-op-assign-mult-ivec2-ivec2-overwrite.shader_test.

hopeful fix for fd.o bug 85376

Reported-by: ghallberg
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 4a128d5a16)
2014-11-19 00:52:44 +00:00
Brian Paul
edb2186671 st/mesa: copy sampler_array_size field when copying instructions
The sampler_array_size field was added by "mesa/st: add support for
dynamic sampler offsets".  But the field wasn't getting copied in
the get_pixel_transfer_visitor() or get_bitmap_visitor() functions.

The count_resources() function then didn't properly compute the
glsl_to_tgsi_visitor::samplers_used bitmask.  Then, we didn't declare
all the sampler registers in st_translate_program().  Finally, we
asserted when we tried to emit a tgsi ureg src register with File =
TGSI_FILE_UNDEFINED.

Add the missing assignments and some new assertions to catch the
invalid register sooner.

Cc: "10.3, 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
(cherry picked from commit 11abd7b2bc)
2014-11-19 00:52:36 +00:00
Michel Dänzer
5a2ff2002b radeonsi: Disable asynchronous DMA except for PIPE_BUFFER
Using the asynchronous DMA engine for multi-dimensional operations seems
to cause random GPU lockups for various people. While the root cause for
this might need to be fixed in the kernel, let's disable it for now.

Before re-enabling this, please make sure you can hit all newly enabled
paths in your testing, preferably with both piglit and real world apps,
and get in touch with people on the bug reports below for stability
testing.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85647
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83500
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
(cherry picked from commit ae4536b4f7)
2014-11-19 00:51:57 +00:00
Vinson Lee
0a3c146723 scons: Require glproto >= 1.4.13 for X11.
GLXBadProfileARB and X_GLXCreateContextAtrribsARB require glproto >=
1.4.13. These symbols were added in commit
d5d41112cb "st/xlib: Generate errors as
specified."

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 876c53375e)
2014-11-19 00:51:50 +00:00
Emil Velikov
6452e24ebc configure.ac: roll up a program for the sse4.1 check
So when checking/building sse code we have three possibilities:
 1 Old compiler, throws an error when using -msse*
 2 New compiler, user disables sse* (-mno-sse*)
 3 New compiler, user doesn't disable sse

The original code, added code for #1 but not #2. Later on we patched
around the lack of handling #2 by wrapping the code in __SSE4_1__.
Yet it lead to a missing/undefined symbol in case of #1 or #2, which
might cause an issue for #2 when using the i965 driver.

A bit later we "fixed" the undefined symbol by using #1, rather than
updating it to handle #2. With this commit we set things straight :)

To top it all up, conventions state that in case of conflicting
(-enable-foo -disable-foo) options, the latter one takes precedence.
Thus we need to make sure to prepend -msse4.1 to CFLAGS in our test.

v2: Clean the #includes. Suggested by Ilia, Matt & Siavash.

Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: David Heidelberg <david@ixit.cz>
Tested-by: Siavash Eliasi <siavashserver@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 1a6ae84041)
2014-11-19 00:51:44 +00:00
Ilia Mirkin
4186c1c7b1 nv50,nvc0: use clip_halfz setting when creating rasterizer state
This enables the ARB_clip_control extension.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 3bc42a09e2)
2014-11-19 00:51:38 +00:00
89 changed files with 1387 additions and 651 deletions

View File

@@ -1 +1 @@
10.4.0-rc1
10.4.0

2
bin/.cherry-ignore Normal file
View File

@@ -0,0 +1,2 @@
# No whitespace commits in stable.
a10bf5c10caf27232d4df8da74d5c35c23eb883d

View File

@@ -252,11 +252,29 @@ AC_SUBST([VISIBILITY_CXXFLAGS])
dnl
dnl Optional flags, check for compiler support
dnl
AX_CHECK_COMPILE_FLAG([-msse4.1], [SSE41_SUPPORTED=1], [SSE41_SUPPORTED=0])
SSE41_CFLAGS="-msse4.1"
dnl Code compiled by GCC with -msse* assumes a 16 byte aligned
dnl stack, but on x86-32 such alignment is not guaranteed.
case "$target_cpu" in
i?86)
SSE41_CFLAGS="$SSE41_CFLAGS -mstackrealign"
;;
esac
save_CFLAGS="$CFLAGS"
CFLAGS="$SSE41_CFLAGS $CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <smmintrin.h>
int main () {
__m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
c = _mm_max_epu32(a, b);
return 0;
}]])], SSE41_SUPPORTED=1)
CFLAGS="$save_CFLAGS"
if test "x$SSE41_SUPPORTED" = x1; then
DEFINES="$DEFINES -DUSE_SSE41"
fi
AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
AC_SUBST([SSE41_CFLAGS], $SSE41_CFLAGS)
dnl Can't have static and shared libraries, default to static if user
dnl explicitly requested. If both disabled, set to static since shared
@@ -2076,6 +2094,8 @@ AM_CONDITIONAL(HAVE_SPARC_ASM, test "x$asm_arch" = xsparc)
AC_SUBST([NINE_MAJOR], 1)
AC_SUBST([NINE_MINOR], 0)
AC_SUBST([NINE_TINY], 0)
AC_SUBST([NINE_VERSION], "$NINE_MAJOR.$NINE_MINOR.$NINE_TINY")
AC_SUBST([VDPAU_MAJOR], 1)
AC_SUBST([VDPAU_MINOR], 0)

View File

@@ -187,7 +187,7 @@ GL 4.4, GLSL 4.40:
GL 4.5, GLSL 4.50:
GL_ARB_ES3_1_compatibility not started
GL_ARB_clip_control DONE (llvmpipe, softpipe, r300, r600, radeonsi)
GL_ARB_clip_control DONE (nv50, nvc0, r300, r600, radeonsi, llvmpipe, softpipe)
GL_ARB_conditional_render_inverted DONE (i965, nv50, nvc0, llvmpipe, softpipe)
GL_ARB_cull_distance not started
GL_ARB_derivative_control DONE (i965, nv50, nvc0, r600)

View File

@@ -88,6 +88,8 @@ following options during configure, if you would like support for svga driver
Note: The files are installed in $(libdir)/gallium-pipe/ and the interface
between them and libxatracker.so is <strong>not</strong> stable.
</p>
<li>The environment variable GALLIUM_MSAA that forced a multisample GLX visual was removed.</li>
</ul>
</div>

View File

@@ -327,6 +327,7 @@ DRM drivers that don't have a full-fledged GEM (such as qxl or simpledrm)</li>
<li>Removed support for the GL_ATI_envmap_bumpmap extension</li>
<li>The hacky --enable-32/64-bit is no longer available in configure. To build
32/64 bit mesa refer to the default method recommended by your distribution</li>
</li>The environment variable GALLIUM_MSAA that forced a multisample GLX visual was removed.</li>
</ul>
</div>

View File

@@ -14,7 +14,7 @@
<iframe src="../contents.html"></iframe>
<div class="content">
<h1>Mesa 10.4 Release Notes / TBD</h1>
<h1>Mesa 10.4 Release Notes / December 14, 2014</h1>
<p>
Mesa 10.4 is a new development release.
@@ -47,18 +47,209 @@ Note: some of the new features are only available with certain drivers.
<li>GL_ARB_conditional_render_inverted on nv50</li>
<li>GL_ARB_sample_shading on r600</li>
<li>GL_ARB_texture_view on nv50, nvc0</li>
<li>GL_ARB_clip_control on llvmpipe, softpipe, r300, r600, radeonsi</li>
<li>GL_ARB_clip_control on nv50, nvc0, r300, r600, radeonsi, llvmpipe, softpipe</li>
<li>GL_KHR_context_flush_control on all drivers</li>
</ul>
<h2>Bug fixes</h2>
TBD.
<p>This list is likely incomplete.</p>
<ul>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79963">Bug 79963</a> - [ILK Bisected]some piglit and ogles2conform cases fail </li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29661">Bug 29661</a> - MSVC built u_format_test fails on Windows</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=38873">Bug 38873</a> - [855gm] gnome-shell misrendered</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=54372">Bug 54372</a> - GLX_INTEL_swap_event crashes driver when swapping window buffers</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=60879">Bug 60879</a> - [radeonsi] X11 can't start with acceleration enabled</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=61415">Bug 61415</a> - Clover ignores --with-opencl-libdir path</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=64471">Bug 64471</a> - Radeon HD6570 lockup in Brütal Legend with HyperZ</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=66184">Bug 66184</a> - src/mesa/state_tracker/st_glsl_to_tgsi.cpp:3216:simplify_cmp: Assertion `inst-&gt;dst.index &lt; 4096' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=67672">Bug 67672</a> - [llvmpipe] lp_test_arit fails on old CPUs</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=69200">Bug 69200</a> - [Bisected]Piglit glx/glx-multithread-shader-compile aborted</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=70410">Bug 70410</a> - egl-static/Makefile: linking fails with llvm &gt;= 3.4</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=72685">Bug 72685</a> - [radeonsi hyperz] Artifacts in Unigine Sanctuary</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=72819">Bug 72819</a> - [855GM] Incorrect drop shadow color on windows and strange white rectangle when showing/hiding GLX-dock...</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=74563">Bug 74563</a> - Surfaceless contexts are not properly released by DRI drivers</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=74863">Bug 74863</a> - [r600g] HyperZ broken on RV770 and CYPRESS (Left 4 Dead 2 trees corruption) bisected!</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=75011">Bug 75011</a> - [hyperz] Performance drop since git-01e6371 (disable hyperz by default) with radeonsi</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=75112">Bug 75112</a> - Meta Bug for HyperZ issues on r600g and radeonsi</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=76252">Bug 76252</a> - Dynamic loading/unloading of opengl32.dll results in a deadlock</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=76861">Bug 76861</a> - mid3 generates slow code for constant arguments</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=77957">Bug 77957</a> - Variably-indexed constant arrays result in terrible shader code</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78468">Bug 78468</a> - Compiling of shader gets stuck in infinite loop</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78770">Bug 78770</a> - [SNB bisected]Webglc conformance/textures/texture-size-limit.html fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79155">Bug 79155</a> - [Tesseract Game] Global Illumination: Medium Causes Color Distortion</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=79462">Bug 79462</a> - [NVC0/Codegen] Shader compilation falis in spill logic</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80011">Bug 80011</a> - [softpipe] tgsi/tgsi_exec.c:2023:exec_txf: Assertion `0' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80012">Bug 80012</a> - [softpipe] draw/draw_gs.c:113:tgsi_fetch_gs_outputs: Assertion `!util_is_inf_or_nan(output[slot][0])' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80050">Bug 80050</a> - [855GM] Incorrect drop shadow color under windows in Cinnamon persists with MESA 10.1.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80247">Bug 80247</a> - Khronos conformance test ES3-CTS.gtf.GL3Tests.transform_feedback.transform_feedback_vertex_id fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80561">Bug 80561</a> - Incorrect implementation of some VDPAU APIs.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80615">Bug 80615</a> - Files in bellagio directory [omx tracker] don't respect installation folder</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=80848">Bug 80848</a> - [dri3] Building mesa fails with dri3 enabled</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81680">Bug 81680</a> - [r600g] Firefox crashes with hardware acceleration turned on</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82255">Bug 82255</a> - [VP2] Chroma planes are vertically stretched during VDPAU playback</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82472">Bug 82472</a> - piglit 16385-consecutive-chars regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82537">Bug 82537</a> - Stunt Rally GLSL compiler assertion failure</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82538">Bug 82538</a> - Super Maryo Chronicles fails with st/mesa assertion failure</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82539">Bug 82539</a> - vmw_screen_dri.lo In file included from vmw_screen_dri.c:41: vmwgfx_drm.h:32:17: error: drm.h: No such file or directory</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82796">Bug 82796</a> - [IVB/BYT-M/HSW/BDW Bisected]Synmark2_v6.0_OglTerrainFlyInst/OglTerrainPanInst cannot run as image validation failed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82804">Bug 82804</a> - unreal engine 4 rendering errors</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82828">Bug 82828</a> - Regression: Crash in 3Dmark2001</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82846">Bug 82846</a> - [BDW Bisected] Gpu hang when running Lightsmark v2008/Warsow v1.0/Xonotic v0.7/unigine-demos</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82881">Bug 82881</a> - test_vec4_register_coalesce regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82882">Bug 82882</a> - [swrast] piglit glsl-fs-uniform-bool-1 regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82921">Bug 82921</a> - layout(location=0) emits error &gt;= MAX_UNIFORM_LOCATIONS due to integer underflow</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82929">Bug 82929</a> - [BDW Bisected]glxgears causes X hang</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82932">Bug 82932</a> - [SNB+ Bisected]Ogles3conform ES3-CTS.shaders.indexing.vector_subscript.vec3_static_loop_subscript_write_direct_read_vertex fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83079">Bug 83079</a> - [NVC0] Dota 2 (Linux native and Wine) crash with Nouveau Drivers</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83080">Bug 83080</a> - [SNB+ Bisected]ES3-CTS.shaders.loops.do_while_constant_iterations.mixed_break_continue_fragment fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83081">Bug 83081</a> - [BDW Bisected]Piglit spec_ARB_sample_shading_builtin-gl-sample-mask_2 is core dumped</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83127">Bug 83127</a> - [ILK Bisected]Piglit glean_texCombine fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83148">Bug 83148</a> - Unity invisible under Ubuntu 14.04 and 14.10</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83355">Bug 83355</a> - FTBFS: src/mesa/program/program_lexer.l:122:64: error: unknown type name 'YYSTYPE'</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83380">Bug 83380</a> - Linking fails when not writing gl_Position.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83418">Bug 83418</a> - EU IV is incorrectly rendered after git1409011930.d571f2</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83432">Bug 83432</a> - r600_query.c:269:r600_emit_query_end: Assertion `ctx-&gt;num_pipelinestat_queries &gt; 0' failed [Gallium HUD]</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83463">Bug 83463</a> - [swrast] piglit glsl-vs-clamp-1 regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83468">Bug 83468</a> - [UBO] Using bool from UBO as if-statement condition asserts</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83500">Bug 83500</a> - si_dma_copy_tile causes GPU hangs</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83506">Bug 83506</a> - [UBO] row_major layout ignored inside structures</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83533">Bug 83533</a> - [UBO] nested structures don't get appropriate padding</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83573">Bug 83573</a> - [swrast] piglit fs-op-not-bool-using-if regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83574">Bug 83574</a> - [llvmpipe] [softpipe] piglit arb_explicit_uniform_location-use-of-unused-loc regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83741">Bug 83741</a> - [UBO] row_major layout partially ignored for arrays of structures</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83777">Bug 83777</a> - [regression] ilo fails to build</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83934">Bug 83934</a> - Structures must have same name to be considered same type.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84140">Bug 84140</a> - mplayer crashes playing some files using vdpau output</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84145">Bug 84145</a> - UE4: Realistic Rendering Demo render blue</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84178">Bug 84178</a> - Big glamor regression in Xorg server 1.6.99.1 GIT: x11perf 1.5 Test: PutImage XY 500x500 Square</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84355">Bug 84355</a> - texture2DProjLod and textureCubeLod are not supported when using GLES.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84529">Bug 84529</a> - [IVB bisected] glean fragProg1 CMP test failed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84538">Bug 84538</a> - lp_test_format.c:226:4: error: too few arguments to function gallivm_create</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84539">Bug 84539</a> - brw_fs_register_coalesce.cpp:183: bool fs_visitor::register_coalesce(): Assertion `src_size &lt;= 11' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84557">Bug 84557</a> - [HSW] &quot;Emit ELSE/ENDIF JIP with type D on Gen 7&quot; causes Atomic Afterlife and GPU hangs</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84651">Bug 84651</a> - Distorted graphics or black window when running Battle.net app on Intel hardware via wine</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84662">Bug 84662</a> - Long pauses with Unreal demo Elemental on R9270X since : Always flush the HDP cache before submitting a CS to the GPU</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84777">Bug 84777</a> - [BSW]Piglit spec_glsl-1.50_execution_geometry-basic fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84807">Bug 84807</a> - Build issue starting between bf4aecfb2acc8d0dc815105d2f36eccbc97c284b and a3e9582f09249ad27716ba82c7dfcee685b65d51</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85189">Bug 85189</a> - llvm/invocation.cpp: In function 'void {anonymous}::optimize(llvm::Module*, unsigned int, const std::vector&lt;llvm::Function*&gt;&amp;)': llvm/invocation.cpp:324:18: error: expected type-specifier</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85267">Bug 85267</a> - vlc crashes with vdpau (Radeon 3850HD) [r600]</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85377">Bug 85377</a> - lp_test_format failure with llvm-3.6</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85425">Bug 85425</a> - [bisected] Compiler error in clip control operations in meta</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85429">Bug 85429</a> - indirect.c:296: multiple definition of `__indirect_glNewList'</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85454">Bug 85454</a> - Unigine Sanctuary with Wine crashes on Mesa Git</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85647">Bug 85647</a> - Random radeonsi crashes with mesa 10.3.x</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85683">Bug 85683</a> - [i965 Bisected]Piglit shaders_glsl-vs-raytrace-bug26691 segfault</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85691">Bug 85691</a> - 'glsl: Drop constant 0.0 components from dot products.' broke piglit shaders/glsl-gnome-shell-dim-window and a few others with Gallium</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86025">Bug 86025</a> - src\glsl\list.h(535) : error C2143: syntax error : missing ';' before 'type'</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86089">Bug 86089</a> - [r600g][mesa 10.4.0-dev] shader failure - r600_sb::bc_finalizer::cf_peephole() when starting Second Life</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86145">Bug 86145</a> - Pipeline statistic counter values for VF always 0</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86618">Bug 86618</a> - [NV96] neg modifiers not working in MIN and MAX operations</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86760">Bug 86760</a> - mesa doesn't build: recipe for target 'r600_llvm.lo' failed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86764">Bug 86764</a> - [SNB+ Bisected]Piglit glean/pointSprite fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=86788">Bug 86788</a> - (bisected) 32bit UrbanTerror 4.1 timedemo sse4.1 segfault...</li>
</ul>
<h2>Changes</h2>
<ul>
<li>The environment variable GALLIUM_MSAA that forced a multisample GLX visual was removed.</li>
</ul>
</div>

View File

@@ -621,7 +621,7 @@ def generate(env):
env.Tool('custom')
createInstallMethods(env)
env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes'])
env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes', 'glproto >= 1.4.13'])
env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 1.8'])
env.PkgCheckModules('XF86VIDMODE', ['xxf86vm'])
env.PkgCheckModules('DRM', ['libdrm >= 2.4.38'])

View File

@@ -124,6 +124,9 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
new_info.indexed = true;
new_info.min_index = info->min_index;
new_info.max_index = info->max_index;
new_info.index_bias = info->index_bias;
new_info.start_instance = info->start_instance;
new_info.instance_count = info->instance_count;
if (info->indexed) {
u_index_translator(pc->primtypes_mask,
@@ -136,6 +139,7 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
src = pipe_buffer_map(pc->pipe, ib->buffer,
PIPE_TRANSFER_READ, &src_transfer);
}
src = (const uint8_t *)src + ib->offset;
}
else {
u_index_generator(pc->primtypes_mask,

View File

@@ -124,6 +124,76 @@ void *util_make_layered_clear_vertex_shader(struct pipe_context *pipe)
return pipe->create_vs_state(pipe, &state);
}
/**
* Takes position and color, and outputs position, color, and instance id.
*/
void *util_make_layered_clear_helper_vertex_shader(struct pipe_context *pipe)
{
static const char text[] =
"VERT\n"
"DCL IN[0]\n"
"DCL IN[1]\n"
"DCL SV[0], INSTANCEID\n"
"DCL OUT[0], POSITION\n"
"DCL OUT[1], GENERIC[0]\n"
"DCL OUT[2], GENERIC[1]\n"
"MOV OUT[0], IN[0]\n"
"MOV OUT[1], IN[1]\n"
"MOV OUT[2].x, SV[0].xxxx\n"
"END\n";
struct tgsi_token tokens[1000];
struct pipe_shader_state state = {tokens};
if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
assert(0);
return NULL;
}
return pipe->create_vs_state(pipe, &state);
}
/**
* Takes position, color, and target layer, and emits vertices on that target
* layer, with the specified color.
*/
void *util_make_layered_clear_geometry_shader(struct pipe_context *pipe)
{
static const char text[] =
"GEOM\n"
"PROPERTY GS_INPUT_PRIMITIVE TRIANGLES\n"
"PROPERTY GS_OUTPUT_PRIMITIVE TRIANGLE_STRIP\n"
"PROPERTY GS_MAX_OUTPUT_VERTICES 3\n"
"PROPERTY GS_INVOCATIONS 1\n"
"DCL IN[][0], POSITION\n" /* position */
"DCL IN[][1], GENERIC[0]\n" /* color */
"DCL IN[][2], GENERIC[1]\n" /* vs invocation */
"DCL OUT[0], POSITION\n"
"DCL OUT[1], GENERIC[0]\n"
"DCL OUT[2], LAYER\n"
"IMM[0] INT32 {0, 0, 0, 0}\n"
"MOV OUT[0], IN[0][0]\n"
"MOV OUT[1], IN[0][1]\n"
"MOV OUT[2].x, IN[0][2].xxxx\n"
"EMIT IMM[0].xxxx\n"
"MOV OUT[0], IN[1][0]\n"
"MOV OUT[1], IN[1][1]\n"
"MOV OUT[2].x, IN[1][2].xxxx\n"
"EMIT IMM[0].xxxx\n"
"MOV OUT[0], IN[2][0]\n"
"MOV OUT[1], IN[2][1]\n"
"MOV OUT[2].x, IN[2][2].xxxx\n"
"EMIT IMM[0].xxxx\n"
"END\n";
struct tgsi_token tokens[1000];
struct pipe_shader_state state = {tokens};
if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
assert(0);
return NULL;
}
return pipe->create_gs_state(pipe, &state);
}
/**
* Make simple fragment texture shader:

View File

@@ -59,6 +59,12 @@ util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe,
extern void *
util_make_layered_clear_vertex_shader(struct pipe_context *pipe);
extern void *
util_make_layered_clear_helper_vertex_shader(struct pipe_context *pipe);
extern void *
util_make_layered_clear_geometry_shader(struct pipe_context *pipe);
extern void *
util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
unsigned tex_target,

View File

@@ -176,7 +176,7 @@
#define HAVE_ASPRINTF 1 /* not needed */
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 0
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_INTTYPES_H 0
#define HAVE_LOCALE_H 0

View File

@@ -105,8 +105,7 @@ fd3_blend_state_create(struct pipe_context *pctx,
A3XX_RB_MRT_BLEND_CONTROL_RGB_DEST_FACTOR(fd_blend_factor(rt->rgb_dst_factor)) |
A3XX_RB_MRT_BLEND_CONTROL_ALPHA_SRC_FACTOR(fd_blend_factor(rt->alpha_src_factor)) |
A3XX_RB_MRT_BLEND_CONTROL_ALPHA_BLEND_OPCODE(blend_func(rt->alpha_func)) |
A3XX_RB_MRT_BLEND_CONTROL_ALPHA_DEST_FACTOR(fd_blend_factor(rt->alpha_dst_factor)) |
A3XX_RB_MRT_BLEND_CONTROL_CLAMP_ENABLE;
A3XX_RB_MRT_BLEND_CONTROL_ALPHA_DEST_FACTOR(fd_blend_factor(rt->alpha_dst_factor));
so->rb_mrt[i].control =
A3XX_RB_MRT_CONTROL_ROP_CODE(rop) |

View File

@@ -566,16 +566,20 @@ fd3_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
}
}
if ((dirty & FD_DIRTY_BLEND) && ctx->blend) {
if ((dirty & (FD_DIRTY_BLEND | FD_DIRTY_FRAMEBUFFER)) && ctx->blend) {
struct fd3_blend_stateobj *blend = fd3_blend_stateobj(ctx->blend);
uint32_t i;
for (i = 0; i < ARRAY_SIZE(blend->rb_mrt); i++) {
bool is_float = util_format_is_float(
pipe_surface_format(ctx->framebuffer.cbufs[i]));
OUT_PKT0(ring, REG_A3XX_RB_MRT_CONTROL(i), 1);
OUT_RING(ring, blend->rb_mrt[i].control);
OUT_PKT0(ring, REG_A3XX_RB_MRT_BLEND_CONTROL(i), 1);
OUT_RING(ring, blend->rb_mrt[i].blend_control);
OUT_RING(ring, blend->rb_mrt[i].blend_control |
COND(!is_float, A3XX_RB_MRT_BLEND_CONTROL_CLAMP_ENABLE));
}
}

View File

@@ -2112,7 +2112,7 @@ trans_cov(const struct instr_translater *t,
* madsh.m16 tmp1, a, b, tmp0 (mul-add shift high mix, i.e. ah * bl << 16)
* madsh.m16 dst, b, a, tmp1 (i.e. al * bh << 16)
*
* For UMAD, replace first mull.u with mad.u16.
* For UMAD, add in the extra argument after mull.u.
*/
static void
trans_umul(const struct instr_translater *t,
@@ -2135,16 +2135,16 @@ trans_umul(const struct instr_translater *t,
if (is_rel_or_const(b))
b = get_unconst(ctx, b);
if (t->tgsi_opc == TGSI_OPCODE_UMUL) {
/* mull.u tmp0, a, b */
instr = instr_create(ctx, 2, OPC_MULL_U);
vectorize(ctx, instr, &tmp0_dst, 2, a, 0, b, 0);
} else {
/* mull.u tmp0, a, b */
instr = instr_create(ctx, 2, OPC_MULL_U);
vectorize(ctx, instr, &tmp0_dst, 2, a, 0, b, 0);
if (t->tgsi_opc == TGSI_OPCODE_UMAD) {
struct tgsi_src_register *c = &inst->Src[2].Register;
/* mad.u16 tmp0, a, b, c */
instr = instr_create(ctx, 3, OPC_MAD_U16);
vectorize(ctx, instr, &tmp0_dst, 3, a, 0, b, 0, c, 0);
/* add.u tmp0, tmp0, c */
instr = instr_create(ctx, 2, OPC_ADD_U);
vectorize(ctx, instr, &tmp0_dst, 2, tmp0_src, 0, c, 0);
}
/* madsh.m16 tmp1, a, b, tmp0 */
@@ -2350,6 +2350,9 @@ trans_idiv(const struct instr_translater *t,
if (t->tgsi_opc == TGSI_OPCODE_MOD || t->tgsi_opc == TGSI_OPCODE_UMOD) {
/* The division result will have ended up in q. */
if (is_rel_or_const(b))
b = get_unconst(ctx, b);
/* mull.u r, q, b */
instr = instr_create(ctx, 2, OPC_MULL_U);
vectorize(ctx, instr, &r_dst, 2, q_src, 0, b, 0);

View File

@@ -33,6 +33,7 @@
#include "util/u_pointer.h"
#include "util/u_memory.h"
#include "util/u_math.h"
#include "util/u_cpu_detect.h"
#include "gallivm/lp_bld.h"
#include "gallivm/lp_bld_debug.h"
@@ -332,6 +333,38 @@ build_unary_test_func(struct gallivm_state *gallivm,
}
/*
* Flush denorms to zero.
*/
static float
flush_denorm_to_zero(float val)
{
/*
* If we have a denorm manually set it to (+-)0.
* This is because the reference may or may not do the right thing
* otherwise because we want the result according to treating all
* denormals as zero (FTZ/DAZ). Not using fpclassify because
* a) some compilers are stuck at c89 (msvc)
* b) not sure it reliably works with non-standard ftz/daz mode
* And, right now we only disable denorms with jited code on x86/sse
* (albeit this should be classified as a bug) so to get results which
* match we must only flush them to zero here in that case too.
*/
union fi fi_val;
fi_val.f = val;
#if defined(PIPE_ARCH_SSE)
if (util_cpu_caps.has_sse) {
if ((fi_val.ui & 0x7f800000) == 0) {
fi_val.ui &= 0xff800000;
}
}
#endif
return fi_val.f;
}
/*
* Test one LLVM unary arithmetic builder function.
*/
@@ -374,10 +407,13 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test)
test_func_jit(out, in);
for (i = 0; i < num_vals; ++i) {
float ref = test->ref(in[i]);
float testval, ref;
double error, precision;
bool pass;
testval = flush_denorm_to_zero(in[i]);
ref = flush_denorm_to_zero(test->ref(testval));
if (util_inf_sign(ref) && util_inf_sign(out[i]) == util_inf_sign(ref)) {
error = 0;
} else {

View File

@@ -924,7 +924,9 @@ CodeEmitterNV50::emitMINMAX(const Instruction *i)
break;
}
code[1] |= i->src(0).mod.abs() << 20;
code[1] |= i->src(0).mod.neg() << 26;
code[1] |= i->src(1).mod.abs() << 19;
code[1] |= i->src(1).mod.neg() << 27;
}
emitForm_MAD(i);
}

View File

@@ -2343,9 +2343,12 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
mkMov(dst0[c], val0);
break;
case TGSI_OPCODE_ARL:
case TGSI_OPCODE_ARR:
FOR_EACH_DST_ENABLED_CHANNEL(0, c, tgsi) {
const RoundMode rnd =
tgsi.getOpcode() == TGSI_OPCODE_ARR ? ROUND_N : ROUND_M;
src0 = fetchSrc(0, c);
mkCvt(OP_CVT, TYPE_S32, dst0[c], TYPE_F32, src0)->rnd = ROUND_M;
mkCvt(OP_CVT, TYPE_S32, dst0[c], TYPE_F32, src0)->rnd = rnd;
}
break;
case TGSI_OPCODE_UARL:

View File

@@ -415,7 +415,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_3D_VERTEX_BUFFER_COUNT 0x00000d78
#define NV50_3D_UNK0D7C 0x00000d7c
#define NV50_3D_DEPTH_CLIP_NEGATIVE_Z 0x00000d7c
#define NV50_3D_CLEAR_COLOR(i0) (0x00000d80 + 0x4*(i0))
#define NV50_3D_CLEAR_COLOR__ESIZE 0x00000004

View File

@@ -180,7 +180,12 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
}
}
if (res->bind & PIPE_BIND_VERTEX_BUFFER) {
if (res->bind & (PIPE_BIND_VERTEX_BUFFER |
PIPE_BIND_INDEX_BUFFER |
PIPE_BIND_CONSTANT_BUFFER |
PIPE_BIND_STREAM_OUTPUT |
PIPE_BIND_SAMPLER_VIEW)) {
assert(nv50->num_vtxbufs <= PIPE_MAX_ATTRIBS);
for (i = 0; i < nv50->num_vtxbufs; ++i) {
if (nv50->vtxbuf[i].buffer == res) {
@@ -190,14 +195,11 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
return ref;
}
}
}
if (res->bind & PIPE_BIND_INDEX_BUFFER) {
if (nv50->idxbuf.buffer == res)
if (!--ref)
return ref;
}
if (res->bind & PIPE_BIND_SAMPLER_VIEW) {
for (s = 0; s < 3; ++s) {
assert(nv50->num_textures[s] <= PIPE_MAX_SAMPLERS);
for (i = 0; i < nv50->num_textures[s]; ++i) {
@@ -210,12 +212,11 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
}
}
}
}
if (res->bind & PIPE_BIND_CONSTANT_BUFFER) {
for (s = 0; s < 3; ++s) {
assert(nv50->num_vtxbufs <= NV50_MAX_PIPE_CONSTBUFS);
for (i = 0; i < nv50->num_vtxbufs; ++i) {
for (i = 0; i < NV50_MAX_PIPE_CONSTBUFS; ++i) {
if (!(nv50->constbuf_valid[s] & (1 << i)))
continue;
if (!nv50->constbuf[s][i].user &&
nv50->constbuf[s][i].u.buf == res) {
nv50->dirty |= NV50_NEW_CONSTBUF;

View File

@@ -173,6 +173,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
case PIPE_CAP_SAMPLER_VIEW_TARGET:
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
case PIPE_CAP_CLIP_HALFZ:
return 1;
case PIPE_CAP_SEAMLESS_CUBE_MAP:
return 1; /* class_3d >= NVA0_3D_CLASS; */
@@ -204,7 +205,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
case PIPE_CAP_COMPUTE:
case PIPE_CAP_DRAW_INDIRECT:
case PIPE_CAP_CLIP_HALFZ:
return 0;
case PIPE_CAP_VENDOR_ID:

View File

@@ -333,6 +333,9 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,
SB_BEGIN_3D(so, VIEW_VOLUME_CLIP_CTRL, 1);
SB_DATA (so, reg);
SB_BEGIN_3D(so, DEPTH_CLIP_NEGATIVE_Z, 1);
SB_DATA (so, cso->clip_halfz);
assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
return (void *)so;
}

View File

@@ -318,6 +318,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NVC0_3D_VERTEX_BUFFER_COUNT 0x00000d78
#define NVC0_3D_DEPTH_CLIP_NEGATIVE_Z 0x00000d7c
#define NVC0_3D_CLEAR_COLOR(i0) (0x00000d80 + 0x4*(i0))
#define NVC0_3D_CLEAR_COLOR__ESIZE 0x00000004
#define NVC0_3D_CLEAR_COLOR__LEN 0x00000004

View File

@@ -196,7 +196,12 @@ nvc0_invalidate_resource_storage(struct nouveau_context *ctx,
}
}
if (res->bind & PIPE_BIND_VERTEX_BUFFER) {
if (res->bind & (PIPE_BIND_VERTEX_BUFFER |
PIPE_BIND_INDEX_BUFFER |
PIPE_BIND_CONSTANT_BUFFER |
PIPE_BIND_STREAM_OUTPUT |
PIPE_BIND_COMMAND_ARGS_BUFFER |
PIPE_BIND_SAMPLER_VIEW)) {
for (i = 0; i < nvc0->num_vtxbufs; ++i) {
if (nvc0->vtxbuf[i].buffer == res) {
nvc0->dirty |= NVC0_NEW_ARRAYS;
@@ -205,17 +210,14 @@ nvc0_invalidate_resource_storage(struct nouveau_context *ctx,
return ref;
}
}
}
if (res->bind & PIPE_BIND_INDEX_BUFFER) {
if (nvc0->idxbuf.buffer == res) {
nvc0->dirty |= NVC0_NEW_IDXBUF;
nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_IDX);
if (!--ref)
return ref;
}
}
if (res->bind & PIPE_BIND_SAMPLER_VIEW) {
for (s = 0; s < 5; ++s) {
for (i = 0; i < nvc0->num_textures[s]; ++i) {
if (nvc0->textures[s][i] &&
@@ -228,11 +230,11 @@ nvc0_invalidate_resource_storage(struct nouveau_context *ctx,
}
}
}
}
if (res->bind & PIPE_BIND_CONSTANT_BUFFER) {
for (s = 0; s < 5; ++s) {
for (i = 0; i < nvc0->num_vtxbufs; ++i) {
for (i = 0; i < NVC0_MAX_PIPE_CONSTBUFS; ++i) {
if (!(nvc0->constbuf_valid[s] & (1 << i)))
continue;
if (!nvc0->constbuf[s][i].user &&
nvc0->constbuf[s][i].u.buf == res) {
nvc0->dirty |= NVC0_NEW_CONSTBUF;

View File

@@ -171,6 +171,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
case PIPE_CAP_SAMPLER_VIEW_TARGET:
case PIPE_CAP_CLIP_HALFZ:
return 1;
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
@@ -188,7 +189,6 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT:
case PIPE_CAP_FAKE_SW_MSAA:
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
case PIPE_CAP_CLIP_HALFZ:
return 0;
case PIPE_CAP_VENDOR_ID:

View File

@@ -313,6 +313,8 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe,
SB_BEGIN_3D(so, VIEW_VOLUME_CLIP_CTRL, 1);
SB_DATA (so, reg);
SB_IMMED_3D(so, DEPTH_CLIP_NEGATIVE_Z, cso->clip_halfz);
assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
return (void *)so;
}

View File

@@ -23,7 +23,6 @@
#define CONSTANT_BUFFER_0_ADDR_SPACE 8
#define CONSTANT_BUFFER_1_ADDR_SPACE (CONSTANT_BUFFER_0_ADDR_SPACE + R600_UCP_CONST_BUFFER)
#define CONSTANT_TXQ_BUFFER (CONSTANT_BUFFER_0_ADDR_SPACE + R600_TXQ_CONST_BUFFER)
#define LLVM_R600_BUFFER_INFO_CONST_BUFFER \
(CONSTANT_BUFFER_0_ADDR_SPACE + R600_BUFFER_INFO_CONST_BUFFER)
@@ -690,7 +689,7 @@ static void llvm_emit_tex(
if (emit_data->inst->Dst[0].Register.WriteMask & 4) {
LLVMValueRef offset = lp_build_const_int32(bld_base->base.gallivm, 0);
LLVMValueRef ZLayer = LLVMBuildExtractElement(gallivm->builder,
llvm_load_const_buffer(bld_base, offset, CONSTANT_TXQ_BUFFER),
llvm_load_const_buffer(bld_base, offset, LLVM_R600_BUFFER_INFO_CONST_BUFFER),
lp_build_const_int32(gallivm, 0), "");
emit_data->output[0] = LLVMBuildInsertElement(gallivm->builder, emit_data->output[0], ZLayer, lp_build_const_int32(gallivm, 2), "");

View File

@@ -44,20 +44,19 @@
#define R600_TRACE_CS_DWORDS 7
#define R600_MAX_USER_CONST_BUFFERS 13
#define R600_MAX_DRIVER_CONST_BUFFERS 4
#define R600_MAX_DRIVER_CONST_BUFFERS 3
#define R600_MAX_CONST_BUFFERS (R600_MAX_USER_CONST_BUFFERS + R600_MAX_DRIVER_CONST_BUFFERS)
/* start driver buffers after user buffers */
#define R600_UCP_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS)
#define R600_TXQ_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS + 1)
#define R600_BUFFER_INFO_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS + 2)
#define R600_GS_RING_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS + 3)
/* Currently R600_MAX_CONST_BUFFERS is too large, the hardware only has 16 buffers, but the driver is
* trying to use 17. Avoid accidentally aliasing with user UBOs for SAMPLE_POSITIONS by using an id<16.
#define R600_BUFFER_INFO_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS + 1)
#define R600_GS_RING_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS + 2)
/* Currently R600_MAX_CONST_BUFFERS just fits on the hw, which has a limit
* of 16 const buffers.
* UCP/SAMPLE_POSITIONS are never accessed by same shader stage so they can use the same id.
*
* Fixing this properly would require the driver to combine its buffers into a single hardware buffer,
* which would also allow supporting the d3d 11 mandated minimum of 15 user const buffers.
* In order to support d3d 11 mandated minimum of 15 user const buffers
* we'd have to squash all use cases into one driver buffer.
*/
#define R600_SAMPLE_POSITIONS_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS)
@@ -316,7 +315,6 @@ struct r600_samplerview_state {
uint32_t dirty_mask;
uint32_t compressed_depthtex_mask; /* which textures are depth */
uint32_t compressed_colortex_mask;
boolean dirty_txq_constants;
boolean dirty_buffer_constants;
};

View File

@@ -2728,8 +2728,10 @@ static int cayman_mul_int_instr(struct r600_shader_ctx *ctx)
struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
int i, j, k, r;
struct r600_bytecode_alu alu;
int last_slot = (inst->Dst[0].Register.WriteMask & 0x8) ? 4 : 3;
for (k = 0; k < last_slot; k++) {
int lasti = tgsi_last_instruction(inst->Dst[0].Register.WriteMask);
int t1 = ctx->temp_reg;
for (k = 0; k <= lasti; k++) {
if (!(inst->Dst[0].Register.WriteMask & (1 << k)))
continue;
@@ -2739,7 +2741,8 @@ static int cayman_mul_int_instr(struct r600_shader_ctx *ctx)
for (j = 0; j < inst->Instruction.NumSrcRegs; j++) {
r600_bytecode_src(&alu.src[j], &ctx->src[j], k);
}
tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
alu.dst.sel = t1;
alu.dst.chan = i;
alu.dst.write = (i == k);
if (i == 3)
alu.last = 1;
@@ -2748,6 +2751,23 @@ static int cayman_mul_int_instr(struct r600_shader_ctx *ctx)
return r;
}
}
for (i = 0 ; i <= lasti; i++) {
if (!(inst->Dst[0].Register.WriteMask & (1 << i)))
continue;
memset(&alu, 0, sizeof(struct r600_bytecode_alu));
alu.op = ALU_OP1_MOV;
alu.src[0].sel = t1;
alu.src[0].chan = i;
tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
alu.dst.write = 1;
if (i == lasti)
alu.last = 1;
r = r600_bytecode_add_alu(ctx->bc, &alu);
if (r)
return r;
}
return 0;
}
@@ -4899,7 +4919,8 @@ static inline boolean tgsi_tex_src_requires_loading(struct r600_shader_ctx *ctx,
return (inst->Src[index].Register.File != TGSI_FILE_TEMPORARY &&
inst->Src[index].Register.File != TGSI_FILE_INPUT &&
inst->Src[index].Register.File != TGSI_FILE_OUTPUT) ||
ctx->src[index].neg || ctx->src[index].abs;
ctx->src[index].neg || ctx->src[index].abs ||
(inst->Src[index].Register.File == TGSI_FILE_INPUT && ctx->type == TGSI_PROCESSOR_GEOMETRY);
}
static inline unsigned tgsi_tex_get_src_gpr(struct r600_shader_ctx *ctx,
@@ -5014,8 +5035,9 @@ static int r600_do_buffer_txq(struct r600_shader_ctx *ctx)
alu.op = ALU_OP1_MOV;
if (ctx->bc->chip_class >= EVERGREEN) {
alu.src[0].sel = 512 + (id / 4);
alu.src[0].chan = id % 4;
/* channel 0 or 2 of each word */
alu.src[0].sel = 512 + (id / 2);
alu.src[0].chan = (id % 2) * 2;
} else {
/* r600 we have them at channel 2 of the second dword */
alu.src[0].sel = 512 + (id * 2) + 1;
@@ -5074,6 +5096,14 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
inst->Instruction.Opcode == TGSI_OPCODE_TG4)
sampler_src_reg = 2;
/* TGSI moves the sampler to src reg 3 for TXD */
if (inst->Instruction.Opcode == TGSI_OPCODE_TXD)
sampler_src_reg = 3;
sampler_index_mode = inst->Src[sampler_src_reg].Indirect.Index == 2 ? 2 : 0; // CF_INDEX_1 : CF_INDEX_NONE
if (sampler_index_mode)
ctx->shader->uses_index_registers = true;
src_gpr = tgsi_tex_get_src_gpr(ctx, 0);
if (inst->Texture.Texture == TGSI_TEXTURE_BUFFER) {
@@ -5088,64 +5118,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
}
}
if (inst->Instruction.Opcode == TGSI_OPCODE_TXD) {
/* TGSI moves the sampler to src reg 3 for TXD */
sampler_src_reg = 3;
sampler_index_mode = inst->Src[sampler_src_reg].Indirect.Index == 2 ? 2 : 0; // CF_INDEX_1 : CF_INDEX_NONE
for (i = 1; i < 3; i++) {
/* set gradients h/v */
memset(&tex, 0, sizeof(struct r600_bytecode_tex));
tex.op = (i == 1) ? FETCH_OP_SET_GRADIENTS_H :
FETCH_OP_SET_GRADIENTS_V;
tex.sampler_id = tgsi_tex_get_src_gpr(ctx, sampler_src_reg);
tex.sampler_index_mode = sampler_index_mode;
tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
tex.resource_index_mode = sampler_index_mode;
if (tgsi_tex_src_requires_loading(ctx, i)) {
tex.src_gpr = r600_get_temp(ctx);
tex.src_sel_x = 0;
tex.src_sel_y = 1;
tex.src_sel_z = 2;
tex.src_sel_w = 3;
for (j = 0; j < 4; j++) {
memset(&alu, 0, sizeof(struct r600_bytecode_alu));
alu.op = ALU_OP1_MOV;
r600_bytecode_src(&alu.src[0], &ctx->src[i], j);
alu.dst.sel = tex.src_gpr;
alu.dst.chan = j;
if (j == 3)
alu.last = 1;
alu.dst.write = 1;
r = r600_bytecode_add_alu(ctx->bc, &alu);
if (r)
return r;
}
} else {
tex.src_gpr = tgsi_tex_get_src_gpr(ctx, i);
tex.src_sel_x = ctx->src[i].swizzle[0];
tex.src_sel_y = ctx->src[i].swizzle[1];
tex.src_sel_z = ctx->src[i].swizzle[2];
tex.src_sel_w = ctx->src[i].swizzle[3];
tex.src_rel = ctx->src[i].rel;
}
tex.dst_gpr = ctx->temp_reg; /* just to avoid confusing the asm scheduler */
tex.dst_sel_x = tex.dst_sel_y = tex.dst_sel_z = tex.dst_sel_w = 7;
if (inst->Texture.Texture != TGSI_TEXTURE_RECT) {
tex.coord_type_x = 1;
tex.coord_type_y = 1;
tex.coord_type_z = 1;
tex.coord_type_w = 1;
}
r = r600_bytecode_add_tex(ctx->bc, &tex);
if (r)
return r;
}
} else if (inst->Instruction.Opcode == TGSI_OPCODE_TXP) {
if (inst->Instruction.Opcode == TGSI_OPCODE_TXP) {
int out_chan;
/* Add perspective divide */
if (ctx->bc->chip_class == CAYMAN) {
@@ -5209,9 +5182,6 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
src_gpr = ctx->temp_reg;
}
sampler_index_mode = inst->Src[sampler_src_reg].Indirect.Index == 2 ? 2 : 0; // CF_INDEX_1 : CF_INDEX_NONE
if (sampler_index_mode)
ctx->shader->uses_index_registers = true;
if ((inst->Texture.Texture == TGSI_TEXTURE_CUBE ||
inst->Texture.Texture == TGSI_TEXTURE_CUBE_ARRAY ||
@@ -5430,6 +5400,69 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
src_gpr = ctx->temp_reg;
}
if (inst->Instruction.Opcode == TGSI_OPCODE_TXD) {
int temp_h = 0, temp_v = 0;
int start_val = 0;
/* if we've already loaded the src (i.e. CUBE don't reload it). */
if (src_loaded == TRUE)
start_val = 1;
else
src_loaded = TRUE;
for (i = start_val; i < 3; i++) {
int treg = r600_get_temp(ctx);
if (i == 0)
src_gpr = treg;
else if (i == 1)
temp_h = treg;
else
temp_v = treg;
for (j = 0; j < 4; j++) {
memset(&alu, 0, sizeof(struct r600_bytecode_alu));
alu.op = ALU_OP1_MOV;
r600_bytecode_src(&alu.src[0], &ctx->src[i], j);
alu.dst.sel = treg;
alu.dst.chan = j;
if (j == 3)
alu.last = 1;
alu.dst.write = 1;
r = r600_bytecode_add_alu(ctx->bc, &alu);
if (r)
return r;
}
}
for (i = 1; i < 3; i++) {
/* set gradients h/v */
memset(&tex, 0, sizeof(struct r600_bytecode_tex));
tex.op = (i == 1) ? FETCH_OP_SET_GRADIENTS_H :
FETCH_OP_SET_GRADIENTS_V;
tex.sampler_id = tgsi_tex_get_src_gpr(ctx, sampler_src_reg);
tex.sampler_index_mode = sampler_index_mode;
tex.resource_id = tex.sampler_id + R600_MAX_CONST_BUFFERS;
tex.resource_index_mode = sampler_index_mode;
tex.src_gpr = (i == 1) ? temp_h : temp_v;
tex.src_sel_x = 0;
tex.src_sel_y = 1;
tex.src_sel_z = 2;
tex.src_sel_w = 3;
tex.dst_gpr = r600_get_temp(ctx); /* just to avoid confusing the asm scheduler */
tex.dst_sel_x = tex.dst_sel_y = tex.dst_sel_z = tex.dst_sel_w = 7;
if (inst->Texture.Texture != TGSI_TEXTURE_RECT) {
tex.coord_type_x = 1;
tex.coord_type_y = 1;
tex.coord_type_z = 1;
tex.coord_type_w = 1;
}
r = r600_bytecode_add_tex(ctx->bc, &tex);
if (r)
return r;
}
}
if (src_requires_loading && !src_loaded) {
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bytecode_alu));
@@ -5514,9 +5547,24 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
/* texture offsets do not apply to other texture targets */
}
} else {
offset_x = ctx->literals[4 * inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleX] << 1;
offset_y = ctx->literals[4 * inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleY] << 1;
offset_z = ctx->literals[4 * inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleZ] << 1;
switch (inst->Texture.Texture) {
case TGSI_TEXTURE_3D:
offset_z = ctx->literals[4 * inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleZ] << 1;
/* fallthrough */
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_RECT:
case TGSI_TEXTURE_SHADOWRECT:
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_SHADOW2D_ARRAY:
offset_y = ctx->literals[4 * inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleY] << 1;
/* fallthrough */
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
case TGSI_TEXTURE_1D_ARRAY:
case TGSI_TEXTURE_SHADOW1D_ARRAY:
offset_x = ctx->literals[4 * inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleX] << 1;
}
}
}
@@ -5650,9 +5698,16 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
memset(&alu, 0, sizeof(struct r600_bytecode_alu));
alu.op = ALU_OP1_MOV;
alu.src[0].sel = 512 + (id / 4);
alu.src[0].kc_bank = R600_TXQ_CONST_BUFFER;
alu.src[0].chan = id % 4;
if (ctx->bc->chip_class >= EVERGREEN) {
/* channel 1 or 3 of each word */
alu.src[0].sel = 512 + (id / 2);
alu.src[0].chan = ((id % 2) * 2) + 1;
} else {
/* r600 we have them at channel 2 of the second dword */
alu.src[0].sel = 512 + (id * 2) + 1;
alu.src[0].chan = 2;
}
alu.src[0].kc_bank = R600_BUFFER_INFO_CONST_BUFFER;
tgsi_dst(ctx, &inst->Dst[0], 2, &alu.dst);
alu.last = 1;
r = r600_bytecode_add_alu(ctx->bc, &alu);
@@ -5743,11 +5798,18 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
int8_t texture_component_select = ctx->literals[4 * inst->Src[1].Register.Index + inst->Src[1].Register.SwizzleX];
tex.inst_mod = texture_component_select;
if (ctx->bc->chip_class == CAYMAN) {
/* GATHER4 result order is different from TGSI TG4 */
tex.dst_sel_x = (inst->Dst[0].Register.WriteMask & 2) ? 1 : 7;
tex.dst_sel_y = (inst->Dst[0].Register.WriteMask & 4) ? 2 : 7;
tex.dst_sel_z = (inst->Dst[0].Register.WriteMask & 1) ? 0 : 7;
tex.dst_sel_w = (inst->Dst[0].Register.WriteMask & 8) ? 3 : 7;
tex.dst_sel_x = (inst->Dst[0].Register.WriteMask & 2) ? 0 : 7;
tex.dst_sel_y = (inst->Dst[0].Register.WriteMask & 4) ? 1 : 7;
tex.dst_sel_z = (inst->Dst[0].Register.WriteMask & 1) ? 2 : 7;
tex.dst_sel_w = (inst->Dst[0].Register.WriteMask & 8) ? 3 : 7;
} else {
tex.dst_sel_x = (inst->Dst[0].Register.WriteMask & 2) ? 1 : 7;
tex.dst_sel_y = (inst->Dst[0].Register.WriteMask & 4) ? 2 : 7;
tex.dst_sel_z = (inst->Dst[0].Register.WriteMask & 1) ? 0 : 7;
tex.dst_sel_w = (inst->Dst[0].Register.WriteMask & 8) ? 3 : 7;
}
}
else if (inst->Instruction.Opcode == TGSI_OPCODE_LODQ) {
tex.dst_sel_x = (inst->Dst[0].Register.WriteMask & 2) ? 1 : 7;

View File

@@ -2659,11 +2659,8 @@ void r600_update_gs_state(struct pipe_context *ctx, struct r600_pipe_shader *sha
r600_store_context_reg(cb, R_028A6C_VGT_GS_OUT_PRIM_TYPE,
r600_conv_prim_to_gs_out(rshader->gs_output_prim));
r600_store_context_reg_seq(cb, R_0288C8_SQ_GS_VERT_ITEMSIZE, 4);
r600_store_value(cb, cp_shader->ring_item_size >> 2);
r600_store_value(cb, 0);
r600_store_value(cb, 0);
r600_store_value(cb, 0);
r600_store_context_reg(cb, R_0288C8_SQ_GS_VERT_ITEMSIZE,
cp_shader->ring_item_size >> 2);
r600_store_context_reg(cb, R_0288A8_SQ_ESGS_RING_ITEMSIZE,
(rshader->ring_item_size) >> 2);

View File

@@ -649,7 +649,6 @@ static void r600_set_sampler_views(struct pipe_context *pipe, unsigned shader,
dst->views.dirty_mask |= new_mask;
dst->views.compressed_depthtex_mask &= dst->views.enabled_mask;
dst->views.compressed_colortex_mask &= dst->views.enabled_mask;
dst->views.dirty_txq_constants = TRUE;
dst->views.dirty_buffer_constants = TRUE;
r600_sampler_views_dirty(rctx, &dst->views);
@@ -984,6 +983,7 @@ static void r600_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask
* then in the shader, we AND the 4 components with 0xffffffff or 0,
* then OR the alpha with the value given here.
* We use a 6th constant to store the txq buffer size in
* we use 7th slot for number of cube layers in a cube map array.
*/
static void r600_setup_buffer_constants(struct r600_context *rctx, int shader_type)
{
@@ -1022,6 +1022,7 @@ static void r600_setup_buffer_constants(struct r600_context *rctx, int shader_ty
samplers->buffer_constants[offset + 4] = 0;
samplers->buffer_constants[offset + 5] = samplers->views.views[i]->base.texture->width0 / util_format_get_blocksize(samplers->views.views[i]->base.format);
samplers->buffer_constants[offset + 6] = samplers->views.views[i]->base.texture->array_size / 6;
}
}
@@ -1033,7 +1034,10 @@ static void r600_setup_buffer_constants(struct r600_context *rctx, int shader_ty
pipe_resource_reference(&cb.buffer, NULL);
}
/* On evergreen we only need to store the buffer size for TXQ */
/* On evergreen we store two values
* 1. buffer size for TXQ
* 2. number of cube layers in a cube map array.
*/
static void eg_setup_buffer_constants(struct r600_context *rctx, int shader_type)
{
struct r600_textures_info *samplers = &rctx->samplers[shader_type];
@@ -1048,12 +1052,16 @@ static void eg_setup_buffer_constants(struct r600_context *rctx, int shader_type
samplers->views.dirty_buffer_constants = FALSE;
bits = util_last_bit(samplers->views.enabled_mask);
array_size = bits * sizeof(uint32_t) * 4;
array_size = bits * 2 * sizeof(uint32_t) * 4;
samplers->buffer_constants = realloc(samplers->buffer_constants, array_size);
memset(samplers->buffer_constants, 0, array_size);
for (i = 0; i < bits; i++)
if (samplers->views.enabled_mask & (1 << i))
samplers->buffer_constants[i] = samplers->views.views[i]->base.texture->width0 / util_format_get_blocksize(samplers->views.views[i]->base.format);
for (i = 0; i < bits; i++) {
if (samplers->views.enabled_mask & (1 << i)) {
uint32_t offset = i * 2;
samplers->buffer_constants[offset] = samplers->views.views[i]->base.texture->width0 / util_format_get_blocksize(samplers->views.views[i]->base.format);
samplers->buffer_constants[offset + 1] = samplers->views.views[i]->base.texture->array_size / 6;
}
}
cb.buffer = NULL;
cb.user_buffer = samplers->buffer_constants;
@@ -1063,35 +1071,6 @@ static void eg_setup_buffer_constants(struct r600_context *rctx, int shader_type
pipe_resource_reference(&cb.buffer, NULL);
}
static void r600_setup_txq_cube_array_constants(struct r600_context *rctx, int shader_type)
{
struct r600_textures_info *samplers = &rctx->samplers[shader_type];
int bits;
uint32_t array_size;
struct pipe_constant_buffer cb;
int i;
if (!samplers->views.dirty_txq_constants)
return;
samplers->views.dirty_txq_constants = FALSE;
bits = util_last_bit(samplers->views.enabled_mask);
array_size = bits * sizeof(uint32_t) * 4;
samplers->txq_constants = realloc(samplers->txq_constants, array_size);
memset(samplers->txq_constants, 0, array_size);
for (i = 0; i < bits; i++)
if (samplers->views.enabled_mask & (1 << i))
samplers->txq_constants[i] = samplers->views.views[i]->base.texture->array_size / 6;
cb.buffer = NULL;
cb.user_buffer = samplers->txq_constants;
cb.buffer_offset = 0;
cb.buffer_size = array_size;
rctx->b.b.set_constant_buffer(&rctx->b.b, shader_type, R600_TXQ_CONST_BUFFER, &cb);
pipe_resource_reference(&cb.buffer, NULL);
}
/* set sample xy locations as array of fragment shader constants */
void r600_set_sample_locations_constant_buffer(struct r600_context *rctx)
{
@@ -1175,7 +1154,7 @@ static bool r600_update_derived_state(struct r600_context *rctx)
struct pipe_context * ctx = (struct pipe_context*)rctx;
bool ps_dirty = false, vs_dirty = false, gs_dirty = false;
bool blend_disable;
bool need_buf_const;
if (!rctx->blitter->running) {
unsigned i;
@@ -1296,29 +1275,35 @@ static bool r600_update_derived_state(struct r600_context *rctx)
/* on R600 we stuff masks + txq info into one constant buffer */
/* on evergreen we only need a txq info one */
if (rctx->b.chip_class < EVERGREEN) {
if (rctx->ps_shader && rctx->ps_shader->current->shader.uses_tex_buffers)
r600_setup_buffer_constants(rctx, PIPE_SHADER_FRAGMENT);
if (rctx->vs_shader && rctx->vs_shader->current->shader.uses_tex_buffers)
r600_setup_buffer_constants(rctx, PIPE_SHADER_VERTEX);
if (rctx->gs_shader && rctx->gs_shader->current->shader.uses_tex_buffers)
r600_setup_buffer_constants(rctx, PIPE_SHADER_GEOMETRY);
} else {
if (rctx->ps_shader && rctx->ps_shader->current->shader.uses_tex_buffers)
eg_setup_buffer_constants(rctx, PIPE_SHADER_FRAGMENT);
if (rctx->vs_shader && rctx->vs_shader->current->shader.uses_tex_buffers)
eg_setup_buffer_constants(rctx, PIPE_SHADER_VERTEX);
if (rctx->gs_shader && rctx->gs_shader->current->shader.uses_tex_buffers)
eg_setup_buffer_constants(rctx, PIPE_SHADER_GEOMETRY);
if (rctx->ps_shader) {
need_buf_const = rctx->ps_shader->current->shader.uses_tex_buffers || rctx->ps_shader->current->shader.has_txq_cube_array_z_comp;
if (need_buf_const) {
if (rctx->b.chip_class < EVERGREEN)
r600_setup_buffer_constants(rctx, PIPE_SHADER_FRAGMENT);
else
eg_setup_buffer_constants(rctx, PIPE_SHADER_FRAGMENT);
}
}
if (rctx->vs_shader) {
need_buf_const = rctx->vs_shader->current->shader.uses_tex_buffers || rctx->vs_shader->current->shader.has_txq_cube_array_z_comp;
if (need_buf_const) {
if (rctx->b.chip_class < EVERGREEN)
r600_setup_buffer_constants(rctx, PIPE_SHADER_VERTEX);
else
eg_setup_buffer_constants(rctx, PIPE_SHADER_VERTEX);
}
}
if (rctx->ps_shader && rctx->ps_shader->current->shader.has_txq_cube_array_z_comp)
r600_setup_txq_cube_array_constants(rctx, PIPE_SHADER_FRAGMENT);
if (rctx->vs_shader && rctx->vs_shader->current->shader.has_txq_cube_array_z_comp)
r600_setup_txq_cube_array_constants(rctx, PIPE_SHADER_VERTEX);
if (rctx->gs_shader && rctx->gs_shader->current->shader.has_txq_cube_array_z_comp)
r600_setup_txq_cube_array_constants(rctx, PIPE_SHADER_GEOMETRY);
if (rctx->gs_shader) {
need_buf_const = rctx->gs_shader->current->shader.uses_tex_buffers || rctx->gs_shader->current->shader.has_txq_cube_array_z_comp;
if (need_buf_const) {
if (rctx->b.chip_class < EVERGREEN)
r600_setup_buffer_constants(rctx, PIPE_SHADER_GEOMETRY);
else
eg_setup_buffer_constants(rctx, PIPE_SHADER_GEOMETRY);
}
}
if (rctx->b.chip_class < EVERGREEN && rctx->ps_shader && rctx->vs_shader) {
if (!r600_adjust_gprs(rctx)) {

View File

@@ -46,15 +46,22 @@ int bc_finalizer::run() {
for (regions_vec::reverse_iterator I = rv.rbegin(), E = rv.rend(); I != E;
++I) {
region_node *r = *I;
bool is_if = false;
assert(r);
bool loop = r->is_loop();
assert(r->first);
if (r->first->is_container()) {
container_node *repdep1 = static_cast<container_node*>(r->first);
assert(repdep1->is_depart() || repdep1->is_repeat());
if_node *n_if = static_cast<if_node*>(repdep1->first);
if (n_if && n_if->is_if())
is_if = true;
}
if (loop)
finalize_loop(r);
else
if (is_if)
finalize_if(r);
else
finalize_loop(r);
r->expand();
}
@@ -83,14 +90,18 @@ int bc_finalizer::run() {
last_cf = c;
}
if (last_cf->bc.op_ptr->flags & CF_ALU) {
if (!ctx.is_cayman() && last_cf->bc.op_ptr->flags & CF_ALU) {
last_cf = sh.create_cf(CF_OP_NOP);
sh.root->push_back(last_cf);
}
if (ctx.is_cayman())
last_cf->insert_after(sh.create_cf(CF_OP_CF_END));
else
if (ctx.is_cayman()) {
if (!last_cf) {
cf_node *c = sh.create_cf(CF_OP_CF_END);
sh.root->push_back(c);
} else
last_cf->insert_after(sh.create_cf(CF_OP_CF_END));
} else
last_cf->bc.end_of_program = 1;
for (unsigned t = EXP_PIXEL; t < EXP_TYPE_COUNT; ++t) {
@@ -108,16 +119,33 @@ void bc_finalizer::finalize_loop(region_node* r) {
cf_node *loop_start = sh.create_cf(CF_OP_LOOP_START_DX10);
cf_node *loop_end = sh.create_cf(CF_OP_LOOP_END);
bool has_instr = false;
loop_start->jump_after(loop_end);
loop_end->jump_after(loop_start);
if (!r->is_loop()) {
for (depart_vec::iterator I = r->departs.begin(), E = r->departs.end();
I != E; ++I) {
depart_node *dep = *I;
if (!dep->empty()) {
has_instr = true;
break;
}
}
} else
has_instr = true;
if (has_instr) {
loop_start->jump_after(loop_end);
loop_end->jump_after(loop_start);
}
for (depart_vec::iterator I = r->departs.begin(), E = r->departs.end();
I != E; ++I) {
depart_node *dep = *I;
cf_node *loop_break = sh.create_cf(CF_OP_LOOP_BREAK);
loop_break->jump(loop_end);
dep->push_back(loop_break);
if (has_instr) {
cf_node *loop_break = sh.create_cf(CF_OP_LOOP_BREAK);
loop_break->jump(loop_end);
dep->push_back(loop_break);
}
dep->expand();
}
@@ -133,8 +161,10 @@ void bc_finalizer::finalize_loop(region_node* r) {
rep->expand();
}
r->push_front(loop_start);
r->push_back(loop_end);
if (has_instr) {
r->push_front(loop_start);
r->push_back(loop_end);
}
}
void bc_finalizer::finalize_if(region_node* r) {

View File

@@ -250,6 +250,21 @@ void si_dma_copy(struct pipe_context *ctx,
return;
}
/* XXX: Using the asynchronous DMA engine for multi-dimensional
* operations seems to cause random GPU lockups for various people.
* While the root cause for this might need to be fixed in the kernel,
* let's disable it for now.
*
* Before re-enabling this, please make sure you can hit all newly
* enabled paths in your testing, preferably with both piglit and real
* world apps, and get in touch with people on the bug reports below
* for stability testing.
*
* https://bugs.freedesktop.org/show_bug.cgi?id=85647
* https://bugs.freedesktop.org/show_bug.cgi?id=83500
*/
goto fallback;
if (src->format != dst->format || src_box->depth > 1 ||
rdst->dirty_level_mask != 0 ||
rdst->cmask.size || rdst->fmask.size ||

View File

@@ -3081,6 +3081,110 @@ void si_init_state_functions(struct si_context *sctx)
sctx->b.b.draw_vbo = si_draw_vbo;
}
static void
si_write_harvested_raster_configs(struct si_context *sctx,
struct si_pm4_state *pm4,
unsigned raster_config)
{
unsigned sh_per_se = MAX2(sctx->screen->b.info.max_sh_per_se, 1);
unsigned num_se = MAX2(sctx->screen->b.info.max_se, 1);
unsigned rb_mask = sctx->screen->b.info.si_backend_enabled_mask;
unsigned num_rb = sctx->screen->b.info.r600_num_backends;
unsigned rb_per_pkr = num_rb / num_se / sh_per_se;
unsigned rb_per_se = num_rb / num_se;
unsigned se0_mask = (1 << rb_per_se) - 1;
unsigned se1_mask = se0_mask << rb_per_se;
unsigned se;
assert(num_se == 1 || num_se == 2);
assert(sh_per_se == 1 || sh_per_se == 2);
assert(rb_per_pkr == 1 || rb_per_pkr == 2);
/* XXX: I can't figure out what the *_XSEL and *_YSEL
* fields are for, so I'm leaving them as their default
* values. */
se0_mask &= rb_mask;
se1_mask &= rb_mask;
if (num_se == 2 && (!se0_mask || !se1_mask)) {
raster_config &= C_028350_SE_MAP;
if (!se0_mask) {
raster_config |=
S_028350_SE_MAP(V_028350_RASTER_CONFIG_SE_MAP_3);
} else {
raster_config |=
S_028350_SE_MAP(V_028350_RASTER_CONFIG_SE_MAP_0);
}
}
for (se = 0; se < num_se; se++) {
unsigned raster_config_se = raster_config;
unsigned pkr0_mask = ((1 << rb_per_pkr) - 1) << (se * rb_per_se);
unsigned pkr1_mask = pkr0_mask << rb_per_pkr;
pkr0_mask &= rb_mask;
pkr1_mask &= rb_mask;
if (sh_per_se == 2 && (!pkr0_mask || !pkr1_mask)) {
raster_config_se &= C_028350_PKR_MAP;
if (!pkr0_mask) {
raster_config_se |=
S_028350_PKR_MAP(V_028350_RASTER_CONFIG_PKR_MAP_3);
} else {
raster_config_se |=
S_028350_PKR_MAP(V_028350_RASTER_CONFIG_PKR_MAP_0);
}
}
if (rb_per_pkr == 2) {
unsigned rb0_mask = 1 << (se * rb_per_se);
unsigned rb1_mask = rb0_mask << 1;
rb0_mask &= rb_mask;
rb1_mask &= rb_mask;
if (!rb0_mask || !rb1_mask) {
raster_config_se &= C_028350_RB_MAP_PKR0;
if (!rb0_mask) {
raster_config_se |=
S_028350_RB_MAP_PKR0(V_028350_RASTER_CONFIG_RB_MAP_3);
} else {
raster_config_se |=
S_028350_RB_MAP_PKR0(V_028350_RASTER_CONFIG_RB_MAP_0);
}
}
if (sh_per_se == 2) {
rb0_mask = 1 << (se * rb_per_se + rb_per_pkr);
rb1_mask = rb0_mask << 1;
rb0_mask &= rb_mask;
rb1_mask &= rb_mask;
if (!rb0_mask || !rb1_mask) {
raster_config_se &= C_028350_RB_MAP_PKR1;
if (!rb0_mask) {
raster_config_se |=
S_028350_RB_MAP_PKR1(V_028350_RASTER_CONFIG_RB_MAP_3);
} else {
raster_config_se |=
S_028350_RB_MAP_PKR1(V_028350_RASTER_CONFIG_RB_MAP_0);
}
}
}
}
si_pm4_set_reg(pm4, GRBM_GFX_INDEX,
SE_INDEX(se) | SH_BROADCAST_WRITES |
INSTANCE_BROADCAST_WRITES);
si_pm4_set_reg(pm4, R_028350_PA_SC_RASTER_CONFIG, raster_config_se);
}
si_pm4_set_reg(pm4, GRBM_GFX_INDEX,
SE_BROADCAST_WRITES | SH_BROADCAST_WRITES |
INSTANCE_BROADCAST_WRITES);
}
void si_init_config(struct si_context *sctx)
{
struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
@@ -3152,24 +3256,38 @@ void si_init_config(struct si_context *sctx)
break;
}
} else {
unsigned rb_mask = sctx->screen->b.info.si_backend_enabled_mask;
unsigned num_rb = sctx->screen->b.info.r600_num_backends;
unsigned raster_config;
switch (sctx->screen->b.family) {
case CHIP_TAHITI:
case CHIP_PITCAIRN:
si_pm4_set_reg(pm4, R_028350_PA_SC_RASTER_CONFIG, 0x2a00126a);
raster_config = 0x2a00126a;
break;
case CHIP_VERDE:
si_pm4_set_reg(pm4, R_028350_PA_SC_RASTER_CONFIG, 0x0000124a);
raster_config = 0x0000124a;
break;
case CHIP_OLAND:
si_pm4_set_reg(pm4, R_028350_PA_SC_RASTER_CONFIG, 0x00000082);
raster_config = 0x00000082;
break;
case CHIP_HAINAN:
si_pm4_set_reg(pm4, R_028350_PA_SC_RASTER_CONFIG, 0x00000000);
raster_config = 0x00000000;
break;
default:
si_pm4_set_reg(pm4, R_028350_PA_SC_RASTER_CONFIG, 0x00000000);
fprintf(stderr,
"radeonsi: Unknown GPU, using 0 for raster_config\n");
raster_config = 0x00000000;
break;
}
/* Always use the default config when all backends are enabled. */
if (rb_mask && util_bitcount(rb_mask) >= num_rb) {
si_pm4_set_reg(pm4, R_028350_PA_SC_RASTER_CONFIG,
raster_config);
} else {
si_write_harvested_raster_configs(sctx, pm4, raster_config);
}
}
si_pm4_set_reg(pm4, R_028204_PA_SC_WINDOW_SCISSOR_TL, S_028204_WINDOW_OFFSET_DISABLE(1));

View File

@@ -237,20 +237,21 @@ static void si_shader_ps(struct si_shader *shader)
for (i = 0; i < info->num_inputs; i++) {
switch (info->input_semantic_name[i]) {
case TGSI_SEMANTIC_POSITION:
if (info->input_interpolate_loc[i] ==
TGSI_INTERPOLATE_LOC_CENTROID) {
/* SPI_BARYC_CNTL.POS_FLOAT_LOCATION
* Possible vaules:
* 0 -> Position = pixel center (default)
* 1 -> Position = pixel centroid
* 2 -> Position = iterated sample number XXX:
* What does this mean?
*/
/* SPI_BARYC_CNTL.POS_FLOAT_LOCATION
* Possible vaules:
* 0 -> Position = pixel center (default)
* 1 -> Position = pixel centroid
* 2 -> Position = at sample position
*/
switch (info->input_interpolate_loc[i]) {
case TGSI_INTERPOLATE_LOC_CENTROID:
spi_baryc_cntl |= S_0286E0_POS_FLOAT_LOCATION(1);
break;
case TGSI_INTERPOLATE_LOC_SAMPLE:
spi_baryc_cntl |= S_0286E0_POS_FLOAT_LOCATION(2);
break;
}
/* Fall through */
case TGSI_SEMANTIC_FACE:
continue;
break;
}
}

View File

@@ -204,7 +204,13 @@
* 6. COMMAND [29:22] | BYTE_COUNT [20:0]
*/
#define GRBM_GFX_INDEX 0x802C
#define INSTANCE_INDEX(x) ((x) << 0)
#define SH_INDEX(x) ((x) << 8)
#define SE_INDEX(x) ((x) << 16)
#define SH_BROADCAST_WRITES (1 << 29)
#define INSTANCE_BROADCAST_WRITES (1 << 30)
#define SE_BROADCAST_WRITES (1 << 31)
#define R_0084FC_CP_STRMOUT_CNTL 0x0084FC
#define S_0084FC_OFFSET_UPDATE_DONE(x) (((x) & 0x1) << 0)
#define R_0085F0_CP_COHER_CNTL 0x0085F0

View File

@@ -990,7 +990,7 @@ NineAdapter9_CreateDevice( struct NineAdapter9 *This,
params.BehaviorFlags = BehaviorFlags;
hr = NineDevice9_new(screen, &params, &caps, pPresentationParameters,
pD3D9, pPresentationGroup, This->ctx,
pD3D9, pPresentationGroup, This->ctx, FALSE, NULL,
(struct NineDevice9 **)ppReturnedDeviceInterface);
if (FAILED(hr)) {
DBG("Failed to create device.\n");

View File

@@ -41,25 +41,31 @@
HRESULT
NineBaseTexture9_ctor( struct NineBaseTexture9 *This,
struct NineUnknownParams *pParams,
struct pipe_resource *initResource,
D3DRESOURCETYPE Type,
D3DPOOL Pool )
D3DFORMAT format,
D3DPOOL Pool,
DWORD Usage)
{
BOOL alloc = (Pool == D3DPOOL_DEFAULT) && !This->base.resource &&
(This->format != D3DFMT_NULL);
BOOL alloc = (Pool == D3DPOOL_DEFAULT) && !initResource &&
(format != D3DFMT_NULL);
HRESULT hr;
DWORD usage = This->base.usage;
user_assert(!(usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) ||
DBG("This=%p, pParams=%p initResource=%p Type=%d format=%d Pool=%d Usage=%d\n",
This, pParams, initResource, Type, format, Pool, Usage);
user_assert(!(Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) ||
Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
user_assert(!(usage & D3DUSAGE_DYNAMIC) ||
user_assert(!(Usage & D3DUSAGE_DYNAMIC) ||
Pool != D3DPOOL_MANAGED, D3DERR_INVALIDCALL);
hr = NineResource9_ctor(&This->base, pParams, alloc, Type, Pool);
hr = NineResource9_ctor(&This->base, pParams, initResource, alloc, Type, Pool, Usage);
if (FAILED(hr))
return hr;
This->format = format;
This->pipe = pParams->device->pipe;
This->mipfilter = (This->base.usage & D3DUSAGE_AUTOGENMIPMAP) ?
This->mipfilter = (Usage & D3DUSAGE_AUTOGENMIPMAP) ?
D3DTEXF_LINEAR : D3DTEXF_NONE;
This->lod = 0;
This->lod_resident = -1;
@@ -90,6 +96,8 @@ NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
{
DWORD old = This->lod;
DBG("This=%p LODNew=%d\n", This, LODNew);
user_assert(This->base.pool == D3DPOOL_MANAGED, 0);
This->lod = MIN2(LODNew, This->base.info.last_level);
@@ -103,12 +111,16 @@ NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
DWORD WINAPI
NineBaseTexture9_GetLOD( struct NineBaseTexture9 *This )
{
DBG("This=%p\n", This);
return This->lod;
}
DWORD WINAPI
NineBaseTexture9_GetLevelCount( struct NineBaseTexture9 *This )
{
DBG("This=%p\n", This);
if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP)
return 1;
return This->base.info.last_level + 1;
@@ -118,6 +130,8 @@ HRESULT WINAPI
NineBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This,
D3DTEXTUREFILTERTYPE FilterType )
{
DBG("This=%p FilterType=%d\n", This, FilterType);
if (!(This->base.usage & D3DUSAGE_AUTOGENMIPMAP))
return D3D_OK;
user_assert(FilterType != D3DTEXF_NONE, D3DERR_INVALIDCALL);
@@ -130,6 +144,8 @@ NineBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This,
D3DTEXTUREFILTERTYPE WINAPI
NineBaseTexture9_GetAutoGenFilterType( struct NineBaseTexture9 *This )
{
DBG("This=%p\n", This);
return This->mipfilter;
}
@@ -430,6 +446,8 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
struct pipe_sampler_view templ;
uint8_t swizzle[4];
DBG("This=%p sRGB=%d\n", This, sRGB);
if (unlikely(!resource)) {
if (unlikely(This->format == D3DFMT_NULL))
return D3D_OK;
@@ -482,6 +500,8 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
void WINAPI
NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
{
DBG("This=%p\n", This);
if (This->dirty && This->base.pool == D3DPOOL_MANAGED)
NineBaseTexture9_UploadSelf(This);
}
@@ -490,9 +510,9 @@ NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
void
NineBaseTexture9_Dump( struct NineBaseTexture9 *This )
{
DBG("\nNineBaseTexture9(%p->%p/%p): Pool=%s Type=%s Usage=%s\n"
DBG("\nNineBaseTexture9(%p->NULL/%p): Pool=%s Type=%s Usage=%s\n"
"Format=%s Dims=%ux%ux%u/%u LastLevel=%u Lod=%u(%u)\n", This,
This->base.resource, This->base.data,
This->base.resource,
nine_D3DPOOL_to_str(This->base.pool),
nine_D3DRTYPE_to_str(This->base.type),
nine_D3DUSAGE_to_str(This->base.usage),

View File

@@ -59,8 +59,11 @@ NineBaseTexture9( void *data )
HRESULT
NineBaseTexture9_ctor( struct NineBaseTexture9 *This,
struct NineUnknownParams *pParams,
struct pipe_resource *initResource,
D3DRESOURCETYPE Type,
D3DPOOL Pool );
D3DFORMAT format,
D3DPOOL Pool,
DWORD Usage);
void
NineBaseTexture9_dtor( struct NineBaseTexture9 *This );

View File

@@ -42,6 +42,11 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
D3DSURFACE_DESC sfdesc;
HRESULT hr;
DBG("This=%p pParams=%p EdgeLength=%u Levels=%u Usage=%d "
"Format=%d Pool=%d pSharedHandle=%p\n",
This, pParams, EdgeLength, Levels, Usage,
Format, Pool, pSharedHandle);
user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) ||
(Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), D3DERR_INVALIDCALL);
@@ -50,9 +55,6 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
if (Usage & D3DUSAGE_AUTOGENMIPMAP)
Levels = 0;
This->base.format = Format;
This->base.base.usage = Usage;
info->screen = pParams->device->screen;
info->target = PIPE_TEXTURE_CUBE;
info->format = d3d9_to_pipe_format(Format);
@@ -85,8 +87,8 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
if (!This->surfaces)
return E_OUTOFMEMORY;
hr = NineBaseTexture9_ctor(&This->base, pParams, D3DRTYPE_CUBETEXTURE,
Pool);
hr = NineBaseTexture9_ctor(&This->base, pParams, NULL, D3DRTYPE_CUBETEXTURE,
Format, Pool, Usage);
if (FAILED(hr))
return hr;
This->base.pstype = 2;
@@ -105,7 +107,7 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
sfdesc.Width = sfdesc.Height = u_minify(EdgeLength, i / 6);
hr = NineSurface9_new(This->base.base.base.device, NineUnknown(This),
This->base.base.resource, D3DRTYPE_CUBETEXTURE,
This->base.base.resource, NULL, D3DRTYPE_CUBETEXTURE,
i / 6, i % 6,
&sfdesc, &This->surfaces[i]);
if (FAILED(hr))
@@ -138,6 +140,8 @@ NineCubeTexture9_GetLevelDesc( struct NineCubeTexture9 *This,
UINT Level,
D3DSURFACE_DESC *pDesc )
{
DBG("This=%p Level=%u pDesc=%p\n", This, Level, pDesc);
user_assert(Level <= This->base.base.info.last_level, D3DERR_INVALIDCALL);
user_assert(Level == 0 || !(This->base.base.usage & D3DUSAGE_AUTOGENMIPMAP),
D3DERR_INVALIDCALL);
@@ -155,6 +159,9 @@ NineCubeTexture9_GetCubeMapSurface( struct NineCubeTexture9 *This,
{
const unsigned s = Level * 6 + FaceType;
DBG("This=%p FaceType=%d Level=%u ppCubeMapSurface=%p\n",
This, FaceType, Level, ppCubeMapSurface);
user_assert(Level <= This->base.base.info.last_level, D3DERR_INVALIDCALL);
user_assert(Level == 0 || !(This->base.base.usage & D3DUSAGE_AUTOGENMIPMAP),
D3DERR_INVALIDCALL);
@@ -176,6 +183,9 @@ NineCubeTexture9_LockRect( struct NineCubeTexture9 *This,
{
const unsigned s = Level * 6 + FaceType;
DBG("This=%p FaceType=%d Level=%u pLockedRect=%p pRect=%p Flags=%d\n",
This, FaceType, Level, pLockedRect, pRect, Flags);
user_assert(Level <= This->base.base.info.last_level, D3DERR_INVALIDCALL);
user_assert(Level == 0 || !(This->base.base.usage & D3DUSAGE_AUTOGENMIPMAP),
D3DERR_INVALIDCALL);
@@ -191,6 +201,8 @@ NineCubeTexture9_UnlockRect( struct NineCubeTexture9 *This,
{
const unsigned s = Level * 6 + FaceType;
DBG("This=%p FaceType=%d Level=%u\n", This, FaceType, Level);
user_assert(Level <= This->base.base.info.last_level, D3DERR_INVALIDCALL);
user_assert(FaceType < 6, D3DERR_INVALIDCALL);
@@ -202,6 +214,8 @@ NineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This,
D3DCUBEMAP_FACES FaceType,
const RECT *pDirtyRect )
{
DBG("This=%p FaceType=%d pDirtyRect=%p\n", This, FaceType, pDirtyRect);
user_assert(FaceType < 6, D3DERR_INVALIDCALL);
if (This->base.base.pool != D3DPOOL_MANAGED) {

View File

@@ -58,6 +58,8 @@ NineDevice9_SetDefaultState( struct NineDevice9 *This, boolean is_reset )
{
struct NineSurface9 *refSurf = NULL;
DBG("This=%p is_reset=%d\n", This, (int) is_reset);
assert(!This->is_recording);
nine_state_set_defaults(&This->state, &This->caps, is_reset);
@@ -94,6 +96,8 @@ NineDevice9_RestoreNonCSOState( struct NineDevice9 *This, unsigned mask )
{
struct pipe_context *pipe = This->pipe;
DBG("This=%p mask=%u\n", This, mask);
if (mask & 0x1) {
struct pipe_constant_buffer cb;
cb.buffer_offset = 0;
@@ -139,10 +143,18 @@ NineDevice9_ctor( struct NineDevice9 *This,
D3DPRESENT_PARAMETERS *pPresentationParameters,
IDirect3D9 *pD3D9,
ID3DPresentGroup *pPresentationGroup,
struct d3dadapter9_context *pCTX )
struct d3dadapter9_context *pCTX,
boolean ex,
D3DDISPLAYMODEEX *pFullscreenDisplayMode )
{
unsigned i;
HRESULT hr = NineUnknown_ctor(&This->base, pParams);
DBG("This=%p pParams=%p pScreen=%p pCreationParameters=%p pCaps=%p pPresentationParameters=%p "
"pD3D9=%p pPresentationGroup=%p pCTX=%p ex=%d pFullscreenDisplayMode=%p\n",
This, pParams, pScreen, pCreationParameters, pCaps, pPresentationParameters, pD3D9,
pPresentationGroup, pCTX, (int) ex, pFullscreenDisplayMode);
if (FAILED(hr)) { return hr; }
list_inithead(&This->update_textures);
@@ -151,6 +163,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
This->caps = *pCaps;
This->d3d9 = pD3D9;
This->params = *pCreationParameters;
This->ex = ex;
This->present = pPresentationGroup;
IDirect3D9_AddRef(This->d3d9);
ID3DPresentGroup_AddRef(This->present);
@@ -177,12 +190,12 @@ NineDevice9_ctor( struct NineDevice9 *This,
if (FAILED(hr))
return hr;
if (This->ex) {
if (ex) {
D3DDISPLAYMODEEX *mode = NULL;
struct NineSwapChain9Ex **ret =
(struct NineSwapChain9Ex **)&This->swapchains[i];
if (This->pFullscreenDisplayMode) mode = &(This->pFullscreenDisplayMode[i]);
if (pFullscreenDisplayMode) mode = &(pFullscreenDisplayMode[i]);
/* when this is a Device9Ex, it should create SwapChain9Exs */
hr = NineSwapChain9Ex_new(This, TRUE, present,
&pPresentationParameters[i], pCTX,
@@ -310,9 +323,6 @@ NineDevice9_ctor( struct NineDevice9 *This,
This->update = &This->state;
nine_update_state(This, ~0);
/* Is just used to pass the parameter from NineDevice9Ex_ctor */
This->pFullscreenDisplayMode = NULL;
ID3DPresentGroup_Release(This->present);
return D3D_OK;
@@ -413,7 +423,11 @@ NineDevice9_TestCooperativeLevel( struct NineDevice9 *This )
UINT WINAPI
NineDevice9_GetAvailableTextureMem( struct NineDevice9 *This )
{
return This->screen->get_param(This->screen, PIPE_CAP_VIDEO_MEMORY);
const unsigned mem = This->screen->get_param(This->screen, PIPE_CAP_VIDEO_MEMORY);
if (mem < 4096)
return mem << 20;
else
return UINT_MAX;
}
HRESULT WINAPI
@@ -536,6 +550,8 @@ NineDevice9_SetCursorPosition( struct NineDevice9 *This,
{
struct NineSwapChain9 *swap = This->swapchains[0];
DBG("This=%p X=%d Y=%d Flags=%d\n", This, X, Y, Flags);
This->cursor.pos.x = X;
This->cursor.pos.y = Y;
@@ -548,6 +564,9 @@ NineDevice9_ShowCursor( struct NineDevice9 *This,
BOOL bShow )
{
BOOL old = This->cursor.visible;
DBG("This=%p bShow=%d\n", This, (int) bShow);
This->cursor.visible = bShow && (This->cursor.hotspot.x != -1);
if (!This->cursor.software)
ID3DPresent_SetCursor(This->swapchains[0]->present, NULL, NULL, bShow);
@@ -564,6 +583,9 @@ NineDevice9_CreateAdditionalSwapChain( struct NineDevice9 *This,
ID3DPresent *present;
HRESULT hr;
DBG("This=%p pPresentationParameters=%p pSwapChain=%p\n",
This, pPresentationParameters, pSwapChain);
user_assert(pPresentationParameters, D3DERR_INVALIDCALL);
hr = ID3DPresentGroup_CreateAdditionalPresent(This->present, pPresentationParameters, &present);
@@ -641,6 +663,9 @@ NineDevice9_Present( struct NineDevice9 *This,
unsigned i;
HRESULT hr;
DBG("This=%p pSourceRect=%p pDestRect=%p hDestWindowOverride=%p pDirtyRegion=%p\n",
This, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
/* XXX is this right? */
for (i = 0; i < This->nswapchains; ++i) {
hr = NineSwapChain9_Present(This->swapchains[i], pSourceRect, pDestRect,
@@ -974,7 +999,7 @@ create_zs_or_rt_surface(struct NineDevice9 *This,
} else {
resource = NULL;
}
hr = NineSurface9_new(This, NULL, resource, 0, 0, 0, &desc, &surface);
hr = NineSurface9_new(This, NULL, resource, NULL, 0, 0, 0, &desc, &surface);
pipe_resource_reference(&resource, NULL);
if (SUCCEEDED(hr))
@@ -1710,6 +1735,9 @@ NineDevice9_SetTransform( struct NineDevice9 *This,
{
struct nine_state *state = This->update;
D3DMATRIX *M = nine_state_access_transform(state, State, TRUE);
DBG("This=%p State=%d pMatrix=%p\n", This, State, pMatrix);
user_assert(M, D3DERR_INVALIDCALL);
*M = *pMatrix;
@@ -1738,6 +1766,9 @@ NineDevice9_MultiplyTransform( struct NineDevice9 *This,
struct nine_state *state = This->update;
D3DMATRIX T;
D3DMATRIX *M = nine_state_access_transform(state, State, TRUE);
DBG("This=%p State=%d pMatrix=%p\n", This, State, pMatrix);
user_assert(M, D3DERR_INVALIDCALL);
nine_d3d_matrix_matrix_mul(&T, pMatrix, M);
@@ -2172,6 +2203,7 @@ NineDevice9_SetTexture( struct NineDevice9 *This,
IDirect3DBaseTexture9 *pTexture )
{
struct nine_state *state = This->update;
struct NineBaseTexture9 *tex = NineBaseTexture9(pTexture);
DBG("This=%p Stage=%u pTexture=%p\n", This, Stage, pTexture);
@@ -2179,12 +2211,19 @@ NineDevice9_SetTexture( struct NineDevice9 *This,
Stage == D3DDMAPSAMPLER ||
(Stage >= D3DVERTEXTEXTURESAMPLER0 &&
Stage <= D3DVERTEXTEXTURESAMPLER3), D3DERR_INVALIDCALL);
user_assert(!tex || tex->base.pool != D3DPOOL_SCRATCH, D3DERR_INVALIDCALL);
if (unlikely(tex && tex->base.pool == D3DPOOL_SYSTEMMEM)) {
/* TODO: Currently not implemented. Better return error
* with message telling what's wrong */
ERR("This=%p D3DPOOL_SYSTEMMEM not implemented for SetTexture\n", This);
user_assert(tex->base.pool != D3DPOOL_SYSTEMMEM, D3DERR_INVALIDCALL);
}
if (Stage >= D3DDMAPSAMPLER)
Stage = Stage - D3DDMAPSAMPLER + NINE_MAX_SAMPLERS_PS;
if (!This->is_recording) {
struct NineBaseTexture9 *tex = NineBaseTexture9(pTexture);
struct NineBaseTexture9 *old = state->texture[Stage];
if (old == tex)
return D3D_OK;
@@ -2648,6 +2687,11 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This,
HRESULT hr;
unsigned buffer_offset, buffer_size;
DBG("This=%p SrcStartIndex=%u DestIndex=%u VertexCount=%u "
"pDestBuffer=%p pVertexDecl=%p Flags=%d\n",
This, SrcStartIndex, DestIndex, VertexCount, pDestBuffer,
pVertexDecl, Flags);
if (!screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS))
STUB(D3DERR_INVALIDCALL);
@@ -2725,6 +2769,9 @@ NineDevice9_CreateVertexDeclaration( struct NineDevice9 *This,
{
struct NineVertexDeclaration9 *vdecl;
DBG("This=%p pVertexElements=%p ppDecl=%p\n",
This, pVertexElements, ppDecl);
HRESULT hr = NineVertexDeclaration9_new(This, pVertexElements, &vdecl);
if (SUCCEEDED(hr))
*ppDecl = (IDirect3DVertexDeclaration9 *)vdecl;
@@ -2801,6 +2848,8 @@ NineDevice9_CreateVertexShader( struct NineDevice9 *This,
struct NineVertexShader9 *vs;
HRESULT hr;
DBG("This=%p pFunction=%p ppShader=%p\n", This, pFunction, ppShader);
hr = NineVertexShader9_new(This, &vs, pFunction, NULL);
if (FAILED(hr))
return hr;
@@ -2981,6 +3030,9 @@ NineDevice9_SetStreamSource( struct NineDevice9 *This,
struct NineVertexBuffer9 *pVBuf9 = NineVertexBuffer9(pStreamData);
const unsigned i = StreamNumber;
DBG("This=%p StreamNumber=%u pStreamData=%p OffsetInBytes=%u Stride=%u\n",
This, StreamNumber, pStreamData, OffsetInBytes, Stride);
user_assert(StreamNumber < This->caps.MaxStreams, D3DERR_INVALIDCALL);
user_assert(Stride <= This->caps.MaxStreamStride, D3DERR_INVALIDCALL);
@@ -3068,6 +3120,8 @@ NineDevice9_SetIndices( struct NineDevice9 *This,
{
struct nine_state *state = This->update;
DBG("This=%p pIndexData=%p\n", This, pIndexData);
if (likely(!This->is_recording))
if (state->idxbuf == NineIndexBuffer9(pIndexData))
return D3D_OK;
@@ -3099,6 +3153,8 @@ NineDevice9_CreatePixelShader( struct NineDevice9 *This,
struct NinePixelShader9 *ps;
HRESULT hr;
DBG("This=%p pFunction=%p ppShader=%p\n", This, pFunction, ppShader);
hr = NinePixelShader9_new(This, &ps, pFunction, NULL);
if (FAILED(hr))
return hr;
@@ -3301,6 +3357,8 @@ NineDevice9_CreateQuery( struct NineDevice9 *This,
struct NineQuery9 *query;
HRESULT hr;
DBG("This=%p Type=%d ppQuery=%p\n", This, Type, ppQuery);
if (!ppQuery)
return nine_is_query_supported(Type);
@@ -3447,6 +3505,8 @@ NineDevice9_new( struct pipe_screen *pScreen,
IDirect3D9 *pD3D9,
ID3DPresentGroup *pPresentationGroup,
struct d3dadapter9_context *pCTX,
boolean ex,
D3DDISPLAYMODEEX *pFullscreenDisplayMode,
struct NineDevice9 **ppOut )
{
BOOL lock;
@@ -3454,5 +3514,6 @@ NineDevice9_new( struct pipe_screen *pScreen,
NINE_NEW(Device9, ppOut, lock, /* args */
pScreen, pCreationParameters, pCaps,
pPresentationParameters, pD3D9, pPresentationGroup, pCTX);
pPresentationParameters, pD3D9, pPresentationGroup, pCTX,
ex, pFullscreenDisplayMode);
}

View File

@@ -48,7 +48,6 @@ struct NineDevice9
{
struct NineUnknown base;
boolean ex;
D3DDISPLAYMODEEX *pFullscreenDisplayMode;
/* G3D context */
struct pipe_screen *screen;
@@ -134,6 +133,8 @@ NineDevice9_new( struct pipe_screen *pScreen,
IDirect3D9 *pD3D9,
ID3DPresentGroup *pPresentationGroup,
struct d3dadapter9_context *pCTX,
boolean ex,
D3DDISPLAYMODEEX *pFullscreenDisplayMode,
struct NineDevice9 **ppOut );
HRESULT
@@ -145,7 +146,9 @@ NineDevice9_ctor( struct NineDevice9 *This,
D3DPRESENT_PARAMETERS *pPresentationParameters,
IDirect3D9 *pD3D9,
ID3DPresentGroup *pPresentationGroup,
struct d3dadapter9_context *pCTX );
struct d3dadapter9_context *pCTX,
boolean ex,
D3DDISPLAYMODEEX *pFullscreenDisplayMode );
void
NineDevice9_dtor( struct NineDevice9 *This );

View File

@@ -39,13 +39,18 @@ NineDevice9Ex_ctor( struct NineDevice9Ex *This,
ID3DPresentGroup *pPresentationGroup,
struct d3dadapter9_context *pCTX )
{
This->base.ex = TRUE;
This->base.pFullscreenDisplayMode = pFullscreenDisplayMode;
DBG("This=%p pParams=%p pScreen=%p pCreationParameters=%p pCaps=%p "
"pPresentationParameters=%p pFullscreenDisplayMode=%p "
"pD3D9Ex=%p pPresentationGroup=%p pCTX=%p\n",
This, pParams, pScreen, pCreationParameters, pCaps,
pPresentationParameters, pFullscreenDisplayMode,
pD3D9Ex, pPresentationGroup, pCTX);
return NineDevice9_ctor(&This->base, pParams,
pScreen, pCreationParameters, pCaps,
pPresentationParameters,
(IDirect3D9 *)pD3D9Ex, pPresentationGroup, pCTX);
(IDirect3D9 *)pD3D9Ex, pPresentationGroup, pCTX,
TRUE, pFullscreenDisplayMode);
}
static void
@@ -89,6 +94,11 @@ NineDevice9Ex_PresentEx( struct NineDevice9Ex *This,
unsigned i;
HRESULT hr;
DBG("This=%p pSourceRect=%p pDestRect=%p hDestWindowOverride=%p "
"pDirtyRegion=%p dwFlags=%d\n",
This, pSourceRect, pDestRect, hDestWindowOverride,
pDirtyRegion, dwFlags);
for (i = 0; i < This->base.nswapchains; i++) {
hr = NineSwapChain9_Present(This->base.swapchains[i], pSourceRect, pDestRect,
hDestWindowOverride, pDirtyRegion, dwFlags);
@@ -229,6 +239,9 @@ NineDevice9Ex_GetDisplayModeEx( struct NineDevice9Ex *This,
{
struct NineSwapChain9Ex *swapchain;
DBG("This=%p iSwapChain=%u pMode=%p pRotation=%p\n",
This, iSwapChain, pMode, pRotation);
user_assert(iSwapChain < This->base.nswapchains, D3DERR_INVALIDCALL);
swapchain = NineSwapChain9Ex(This->base.swapchains[iSwapChain]);

View File

@@ -76,8 +76,8 @@ NineIndexBuffer9_ctor( struct NineIndexBuffer9 *This,
info->last_level = 0;
info->nr_samples = 0;
hr = NineResource9_ctor(&This->base, pParams, TRUE, D3DRTYPE_INDEXBUFFER,
pDesc->Pool);
hr = NineResource9_ctor(&This->base, pParams, NULL, TRUE, D3DRTYPE_INDEXBUFFER,
pDesc->Pool, pDesc->Usage);
if (FAILED(hr))
return hr;

View File

@@ -58,6 +58,8 @@ NineUnknown_QueryInterface( struct NineUnknown *This,
{
unsigned i = 0;
DBG("This=%p riid=%p ppvObject=%p\n", This, riid, ppvObject);
if (!ppvObject) return E_POINTER;
do {

View File

@@ -30,25 +30,27 @@
#define NINE_RESOURCE_FLAG_DUMMY (PIPE_RESOURCE_FLAG_ST_PRIV << 2)
/* vertexdeclaration9.c */
unsigned nine_d3d9_to_nine_declusage(unsigned usage, unsigned index);
uint16_t nine_d3d9_to_nine_declusage(unsigned usage, unsigned index);
#define NINE_DECLUSAGE_POSITION(i) ( 0 + (i))
#define NINE_DECLUSAGE_BLENDWEIGHT(i) ( 5 + (i))
#define NINE_DECLUSAGE_BLENDINDICES(i) ( 9 + (i))
#define NINE_DECLUSAGE_NORMAL(i) (13 + (i))
#define NINE_DECLUSAGE_PSIZE 15
#define NINE_DECLUSAGE_TEXCOORD(i) (16 + (i))
#define NINE_DECLUSAGE_TANGENT(i) (32 + (i))
#define NINE_DECLUSAGE_BINORMAL(i) (34 + (i))
#define NINE_DECLUSAGE_TESSFACTOR 36
#define NINE_DECLUSAGE_POSITIONT 37
#define NINE_DECLUSAGE_COLOR(i) (38 + (i))
#define NINE_DECLUSAGE_DEPTH 43
#define NINE_DECLUSAGE_FOG 44
#define NINE_DECLUSAGE_SAMPLE 45
#define NINE_DECLUSAGE_NONE 46
#define NINE_DECLUSAGE_LAST NINE_DECLUSAGE_NONE
#define NINE_DECLUSAGE_COUNT (NINE_DECLUSAGE_LAST + 1)
#define NINE_DECLUSAGE_POSITION 0
#define NINE_DECLUSAGE_BLENDWEIGHT 1
#define NINE_DECLUSAGE_BLENDINDICES 2
#define NINE_DECLUSAGE_NORMAL 3
#define NINE_DECLUSAGE_TEXCOORD 4
#define NINE_DECLUSAGE_TANGENT 5
#define NINE_DECLUSAGE_BINORMAL 6
#define NINE_DECLUSAGE_COLOR 7
#define NINE_DECLUSAGE_POSITIONT 8
#define NINE_DECLUSAGE_PSIZE 9
#define NINE_DECLUSAGE_TESSFACTOR 10
#define NINE_DECLUSAGE_DEPTH 11
#define NINE_DECLUSAGE_FOG 12
#define NINE_DECLUSAGE_SAMPLE 13
#define NINE_DECLUSAGE_NONE 14
#define NINE_DECLUSAGE_COUNT (NINE_DECLUSAGE_NONE + 1)
#define NINE_DECLUSAGE_i(declusage, n) NINE_DECLUSAGE_##declusage + n * NINE_DECLUSAGE_COUNT
#define NINED3DCLEAR_DEPTHSTENCIL (D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL)

View File

@@ -189,13 +189,10 @@ static void nine_ureg_tgsi_dump(struct ureg_program *ureg, boolean override)
/* AL should contain base address of lights table. */
#define LIGHT_CONST(i) \
ureg_src_indirect(ureg_src_register(TGSI_FILE_CONSTANT, (i)), _X(AL))
ureg_src_indirect(ureg_DECL_constant(ureg, i), _X(AL))
#define MATERIAL_CONST(i) \
ureg_src_register(TGSI_FILE_CONSTANT, 19 + (i))
#define MISC_CONST(i) \
ureg_src_register(TGSI_FILE_CONSTANT, (i))
ureg_DECL_constant(ureg, 19 + (i))
#define _CONST(n) ureg_DECL_constant(ureg, n)
@@ -278,7 +275,7 @@ struct vs_build_ctx
struct ureg_program *ureg;
const struct nine_ff_vs_key *key;
unsigned input[PIPE_MAX_ATTRIBS];
uint16_t input[PIPE_MAX_ATTRIBS];
unsigned num_inputs;
struct ureg_src aVtx;
@@ -307,7 +304,7 @@ get_texcoord_sn(struct pipe_screen *screen)
}
static INLINE struct ureg_src
build_vs_add_input(struct vs_build_ctx *vs, unsigned ndecl)
build_vs_add_input(struct vs_build_ctx *vs, uint16_t ndecl)
{
const unsigned i = vs->num_inputs++;
assert(i < PIPE_MAX_ATTRIBS);
@@ -373,10 +370,10 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
* (texture coordinates handled later)
*/
vs->aVtx = build_vs_add_input(vs,
key->position_t ? NINE_DECLUSAGE_POSITIONT : NINE_DECLUSAGE_POSITION(0));
key->position_t ? NINE_DECLUSAGE_POSITIONT : NINE_DECLUSAGE_POSITION);
if (need_rNrm)
vs->aNrm = build_vs_add_input(vs, NINE_DECLUSAGE_NORMAL(0));
vs->aNrm = build_vs_add_input(vs, NINE_DECLUSAGE_NORMAL);
vs->aCol[0] = ureg_imm1f(ureg, 1.0f);
vs->aCol[1] = ureg_imm1f(ureg, 1.0f);
@@ -385,9 +382,9 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
const unsigned mask = key->mtl_diffuse | key->mtl_specular |
key->mtl_ambient | key->mtl_emissive;
if ((mask & 0x1) && !key->color0in_one)
vs->aCol[0] = build_vs_add_input(vs, NINE_DECLUSAGE_COLOR(0));
vs->aCol[0] = build_vs_add_input(vs, NINE_DECLUSAGE_i(COLOR, 0));
if ((mask & 0x2) && !key->color1in_one)
vs->aCol[1] = build_vs_add_input(vs, NINE_DECLUSAGE_COLOR(1));
vs->aCol[1] = build_vs_add_input(vs, NINE_DECLUSAGE_i(COLOR, 1));
vs->mtlD = MATERIAL_CONST(1);
vs->mtlA = MATERIAL_CONST(2);
@@ -402,20 +399,20 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
if (key->mtl_emissive == 1) vs->mtlE = vs->aCol[0]; else
if (key->mtl_emissive == 2) vs->mtlE = vs->aCol[1];
} else {
if (!key->color0in_one) vs->aCol[0] = build_vs_add_input(vs, NINE_DECLUSAGE_COLOR(0));
if (!key->color1in_one) vs->aCol[1] = build_vs_add_input(vs, NINE_DECLUSAGE_COLOR(1));
if (!key->color0in_one) vs->aCol[0] = build_vs_add_input(vs, NINE_DECLUSAGE_i(COLOR, 0));
if (!key->color1in_one) vs->aCol[1] = build_vs_add_input(vs, NINE_DECLUSAGE_i(COLOR, 1));
}
if (key->vertexpointsize)
vs->aPsz = build_vs_add_input(vs, NINE_DECLUSAGE_PSIZE);
if (key->vertexblend_indexed)
vs->aInd = build_vs_add_input(vs, NINE_DECLUSAGE_BLENDINDICES(0));
vs->aInd = build_vs_add_input(vs, NINE_DECLUSAGE_BLENDINDICES);
if (key->vertexblend)
vs->aWgt = build_vs_add_input(vs, NINE_DECLUSAGE_BLENDWEIGHT(0));
vs->aWgt = build_vs_add_input(vs, NINE_DECLUSAGE_BLENDWEIGHT);
if (key->vertextween) {
vs->aVtx1 = build_vs_add_input(vs, NINE_DECLUSAGE_POSITION(1));
vs->aNrm1 = build_vs_add_input(vs, NINE_DECLUSAGE_NORMAL(1));
vs->aVtx1 = build_vs_add_input(vs, NINE_DECLUSAGE_i(POSITION,1));
vs->aNrm1 = build_vs_add_input(vs, NINE_DECLUSAGE_i(NORMAL,1));
}
/* Declare outputs:
@@ -599,7 +596,7 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
oTex[i] = ureg_DECL_output(ureg, texcoord_sn, i);
if (tci == NINED3DTSS_TCI_PASSTHRU)
vs->aTex[idx] = build_vs_add_input(vs, NINE_DECLUSAGE_TEXCOORD(idx));
vs->aTex[idx] = build_vs_add_input(vs, NINE_DECLUSAGE_i(TEXCOORD,idx));
if (!dim) {
dst[c = 4] = oTex[i];
@@ -1377,7 +1374,7 @@ nine_ff_get_vs(struct NineDevice9 *device)
enum pipe_error err;
struct vs_build_ctx bld;
struct nine_ff_vs_key key;
unsigned s;
unsigned s, i;
assert(sizeof(key) <= sizeof(key.value32));
@@ -1388,14 +1385,19 @@ nine_ff_get_vs(struct NineDevice9 *device)
/* FIXME: this shouldn't be NULL, but it is on init */
if (state->vdecl) {
if (state->vdecl->usage_map[NINE_DECLUSAGE_POSITIONT] != 0xff)
key.position_t = 1;
if (state->vdecl->usage_map[NINE_DECLUSAGE_COLOR(0)] == 0xff)
key.color0in_one = 1;
if (state->vdecl->usage_map[NINE_DECLUSAGE_COLOR(1)] == 0xff)
key.color1in_one = 1;
if (state->vdecl->usage_map[NINE_DECLUSAGE_PSIZE] != 0xff)
key.vertexpointsize = 1;
key.color0in_one = 1;
key.color1in_one = 1;
for (i = 0; i < state->vdecl->nelems; i++) {
uint16_t usage = state->vdecl->usage_map[i];
if (usage == NINE_DECLUSAGE_POSITIONT)
key.position_t = 1;
else if (usage == NINE_DECLUSAGE_i(COLOR, 0))
key.color0in_one = 0;
else if (usage == NINE_DECLUSAGE_i(COLOR, 1))
key.color1in_one = 0;
else if (usage == NINE_DECLUSAGE_PSIZE)
key.vertexpointsize = 1;
}
}
if (!key.vertexpointsize)
key.pointscale = !!state->rs[D3DRS_POINTSCALEENABLE];

View File

@@ -239,7 +239,7 @@ struct sm1_dst_param
BYTE file;
BYTE mask;
BYTE mod;
BYTE shift; /* sint4 */
int8_t shift; /* sint4 */
BYTE type;
};
@@ -1685,101 +1685,93 @@ sm1_declusage_to_tgsi(struct tgsi_declaration_semantic *sem,
boolean tc,
struct sm1_semantic *dcl)
{
const unsigned generic_base = tc ? 0 : 8; /* TEXCOORD[0..7] */
BYTE index = dcl->usage_idx;
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = 0;
/* TGSI_SEMANTIC_GENERIC assignments (+8 if !PIPE_CAP_TGSI_TEXCOORD):
* Try to put frequently used semantics at low GENERIC indices.
/* For everything that is not matching to a TGSI_SEMANTIC_****,
* we match to a TGSI_SEMANTIC_GENERIC with index.
*
* POSITION[1..4]: 17, 27, 28, 29
* COLOR[2..4]: 14, 15, 26
* TEXCOORD[8..15]: 10, 11, 18, 19, 20, 21, 22, 23
* BLENDWEIGHT[0..3]: 0, 4, 8, 12
* BLENDINDICES[0..3]: 1, 5, 9, 13
* NORMAL[0..1]: 2, 6
* TANGENT[0]: 3, 24
* BINORMAL[0]: 7, 25
* TESSFACTOR[0]: 16
* The index can be anything UINT16 and usage_idx is BYTE,
* so we can fit everything. It doesn't matter if indices
* are close together or low.
*
*
* POSITION >= 1: 10 * index + 6
* COLOR >= 2: 10 * (index-1) + 7
* TEXCOORD[0..15]: index
* BLENDWEIGHT: 10 * index + 18
* BLENDINDICES: 10 * index + 19
* NORMAL: 10 * index + 20
* TANGENT: 10 * index + 21
* BINORMAL: 10 * index + 22
* TESSFACTOR: 10 * index + 23
*/
switch (dcl->usage) {
case D3DDECLUSAGE_POSITION:
case D3DDECLUSAGE_POSITIONT:
case D3DDECLUSAGE_DEPTH:
sem->Name = TGSI_SEMANTIC_POSITION;
assert(dcl->usage_idx <= 4);
if (dcl->usage_idx == 1) {
if (index == 0) {
sem->Name = TGSI_SEMANTIC_POSITION;
sem->Index = 0;
} else {
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = generic_base + 17;
} else
if (dcl->usage_idx >= 2) {
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = generic_base + 27 + (dcl->usage_idx - 2);
sem->Index = 10 * index + 6;
}
break;
case D3DDECLUSAGE_COLOR:
assert(dcl->usage_idx <= 4);
if (dcl->usage_idx < 2) {
if (index < 2) {
sem->Name = TGSI_SEMANTIC_COLOR;
sem->Index = dcl->usage_idx;
} else
if (dcl->usage_idx < 4) {
sem->Index = generic_base + 14 + (dcl->usage_idx - 2);
sem->Index = index;
} else {
sem->Index = generic_base + 26;
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = 10 * (index-1) + 7;
}
break;
case D3DDECLUSAGE_FOG:
assert(index == 0);
sem->Name = TGSI_SEMANTIC_FOG;
assert(dcl->usage_idx == 0);
sem->Index = 0;
break;
case D3DDECLUSAGE_PSIZE:
assert(index == 0);
sem->Name = TGSI_SEMANTIC_PSIZE;
assert(dcl->usage_idx == 0);
sem->Index = 0;
break;
case D3DDECLUSAGE_TEXCOORD:
assert(dcl->usage_idx < 16);
if (dcl->usage_idx < 8) {
if (tc)
sem->Name = TGSI_SEMANTIC_TEXCOORD;
sem->Index = dcl->usage_idx;
} else
if (dcl->usage_idx < 10) {
sem->Index = generic_base + 10 + (dcl->usage_idx - 8);
} else {
sem->Index = generic_base + 18 + (dcl->usage_idx - 10);
}
assert(index < 16);
if (index < 8 && tc)
sem->Name = TGSI_SEMANTIC_TEXCOORD;
else
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = index;
break;
case D3DDECLUSAGE_BLENDWEIGHT: /* 0, 4, 8, 12 */
assert(dcl->usage_idx < 4);
sem->Index = generic_base + dcl->usage_idx * 4;
case D3DDECLUSAGE_BLENDWEIGHT:
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = 10 * index + 18;
break;
case D3DDECLUSAGE_BLENDINDICES: /* 1, 5, 9, 13 */
assert(dcl->usage_idx < 4);
sem->Index = generic_base + dcl->usage_idx * 4 + 1;
case D3DDECLUSAGE_BLENDINDICES:
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = 10 * index + 19;
break;
case D3DDECLUSAGE_NORMAL: /* 2, 3 */
assert(dcl->usage_idx < 2);
sem->Index = generic_base + 2 + dcl->usage_idx * 4;
case D3DDECLUSAGE_NORMAL:
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = 10 * index + 20;
break;
case D3DDECLUSAGE_TANGENT:
/* Yes these are weird, but we try to fit the more frequently used
* into lower slots. */
assert(dcl->usage_idx <= 1);
sem->Index = generic_base + (dcl->usage_idx ? 24 : 3);
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = 10 * index + 21;
break;
case D3DDECLUSAGE_BINORMAL:
assert(dcl->usage_idx <= 1);
sem->Index = generic_base + (dcl->usage_idx ? 25 : 7);
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = 10 * index + 22;
break;
case D3DDECLUSAGE_TESSFACTOR:
assert(dcl->usage_idx == 0);
sem->Index = generic_base + 16;
sem->Name = TGSI_SEMANTIC_GENERIC;
sem->Index = 10 * index + 23;
break;
case D3DDECLUSAGE_SAMPLE:
sem->Name = TGSI_SEMANTIC_COUNT;
sem->Index = 0;
break;
default:
assert(!"Invalid DECLUSAGE.");
@@ -2535,6 +2527,7 @@ sm1_parse_get_param(struct shader_translator *tx, DWORD *reg, DWORD *rel)
static void
sm1_parse_dst_param(struct sm1_dst_param *dst, DWORD tok)
{
uint8_t shift;
dst->file =
(tok & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT |
(tok & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2;
@@ -2543,7 +2536,8 @@ sm1_parse_dst_param(struct sm1_dst_param *dst, DWORD tok)
dst->rel = NULL;
dst->mask = (tok & NINED3DSP_WRITEMASK_MASK) >> NINED3DSP_WRITEMASK_SHIFT;
dst->mod = (tok & D3DSP_DSTMOD_MASK) >> D3DSP_DSTMOD_SHIFT;
dst->shift = (tok & D3DSP_DSTSHIFT_MASK) >> D3DSP_DSTSHIFT_SHIFT;
shift = (tok & D3DSP_DSTSHIFT_MASK) >> D3DSP_DSTSHIFT_SHIFT;
dst->shift = (shift & 0x8) ? -(shift & 0x7) : shift & 0x7;
}
static void

View File

@@ -48,7 +48,7 @@ struct nine_shader_info
void *cso; /* out, pipe cso for bind_vs,fs_state */
uint8_t input_map[PIPE_MAX_ATTRIBS]; /* VS input -> NINE_DECLUSAGE_x */
uint16_t input_map[PIPE_MAX_ATTRIBS]; /* VS input -> NINE_DECLUSAGE_x */
uint8_t num_inputs; /* there may be unused inputs (NINE_DECLUSAGE_NONE) */
boolean position_t; /* out, true if VP writes pre-transformed position */

View File

@@ -141,11 +141,9 @@ update_viewport(struct NineDevice9 *device)
pvport.scale[0] = (float)vport->Width * 0.5f;
pvport.scale[1] = (float)vport->Height * -0.5f;
pvport.scale[2] = vport->MaxZ - vport->MinZ;
pvport.scale[3] = 1.0f;
pvport.translate[0] = (float)vport->Width * 0.5f + (float)vport->X;
pvport.translate[1] = (float)vport->Height * 0.5f + (float)vport->Y;
pvport.translate[2] = vport->MinZ;
pvport.translate[3] = 0.0f;
pipe->set_viewport_states(pipe, 0, 1, &pvport);
}
@@ -186,7 +184,8 @@ update_vertex_elements(struct NineDevice9 *device)
struct nine_state *state = &device->state;
const struct NineVertexDeclaration9 *vdecl = device->state.vdecl;
const struct NineVertexShader9 *vs;
unsigned n, l, b;
unsigned n, b, i;
int index;
struct pipe_vertex_element ve[PIPE_MAX_ATTRIBS];
state->stream_usage_mask = 0;
@@ -199,11 +198,16 @@ update_vertex_elements(struct NineDevice9 *device)
DBG("looking up input %u (usage %u) from vdecl(%p)\n",
n, vs->input_map[n].ndecl, vdecl);
assert(vs->input_map[n].ndecl < Elements(vdecl->usage_map));
l = vdecl->usage_map[vs->input_map[n].ndecl];
index = -1;
for (i = 0; i < vdecl->nelems; i++) {
if (vdecl->usage_map[i] == vs->input_map[n].ndecl) {
index = i;
break;
}
}
if (likely(l < vdecl->nelems)) {
ve[n] = vdecl->elems[l];
if (index >= 0) {
ve[n] = vdecl->elems[index];
b = ve[n].vertex_buffer_index;
state->stream_usage_mask |= 1 << b;
/* XXX wine just uses 1 here: */
@@ -400,7 +404,7 @@ update_constants(struct NineDevice9 *device, unsigned shader_type)
const_i = &device->state.ps_const_i[0][0];
dirty_b = device->state.changed.ps_const_b;
device->state.changed.vs_const_b = 0;
device->state.changed.ps_const_b = 0;
const_b = device->state.ps_const_b;
b_true = device->ps_bool_true;

View File

@@ -39,6 +39,8 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This,
struct nine_shader_info info;
HRESULT hr;
DBG("This=%p pParams=%p pFunction=%p cso=%p\n", This, pParams, pFunction, cso);
hr = NineUnknown_ctor(&This->base, pParams);
if (FAILED(hr))
return hr;
@@ -110,6 +112,8 @@ NinePixelShader9_GetFunction( struct NinePixelShader9 *This,
void *pData,
UINT *pSizeOfData )
{
DBG("This=%p pData=%p pSizeOfData=%p\n", This, pData, pSizeOfData);
user_assert(pSizeOfData, D3DERR_INVALIDCALL);
if (!pData) {

View File

@@ -107,6 +107,8 @@ NineQuery9_ctor( struct NineQuery9 *This,
const unsigned ptype = d3dquerytype_to_pipe_query(Type);
HRESULT hr;
DBG("This=%p pParams=%p Type=%d\n", This, pParams, Type);
hr = NineUnknown_ctor(&This->base, pParams);
if (FAILED(hr))
return hr;
@@ -170,6 +172,8 @@ NineQuery9_Issue( struct NineQuery9 *This,
{
struct pipe_context *pipe = This->base.device->pipe;
DBG("This=%p dwIssueFlags=%d\n", This, dwIssueFlags);
user_assert((dwIssueFlags == D3DISSUE_BEGIN && !This->instant) ||
(dwIssueFlags == 0) ||
(dwIssueFlags == D3DISSUE_END), D3DERR_INVALIDCALL);
@@ -186,10 +190,12 @@ NineQuery9_Issue( struct NineQuery9 *This,
pipe->begin_query(pipe, This->pq);
This->state = NINE_QUERY_STATE_RUNNING;
} else {
if (This->state == NINE_QUERY_STATE_RUNNING) {
pipe->end_query(pipe, This->pq);
This->state = NINE_QUERY_STATE_ENDED;
}
if (This->state != NINE_QUERY_STATE_RUNNING &&
This->type != D3DQUERYTYPE_EVENT &&
This->type != D3DQUERYTYPE_TIMESTAMP)
pipe->begin_query(pipe, This->pq);
pipe->end_query(pipe, This->pq);
This->state = NINE_QUERY_STATE_ENDED;
}
return D3D_OK;
}
@@ -221,6 +227,9 @@ NineQuery9_GetData( struct NineQuery9 *This,
union pipe_query_result presult;
union nine_query_result nresult;
DBG("This=%p pData=%p dwSize=%d dwGetDataFlags=%d\n",
This, pData, dwSize, dwGetDataFlags);
user_assert(This->state != NINE_QUERY_STATE_RUNNING, D3DERR_INVALIDCALL);
user_assert(dwSize == 0 || pData, D3DERR_INVALIDCALL);
user_assert(dwGetDataFlags == 0 ||

View File

@@ -38,29 +38,42 @@
HRESULT
NineResource9_ctor( struct NineResource9 *This,
struct NineUnknownParams *pParams,
struct pipe_resource *initResource,
BOOL Allocate,
D3DRESOURCETYPE Type,
D3DPOOL Pool )
D3DPOOL Pool,
DWORD Usage)
{
struct pipe_screen *screen;
HRESULT hr;
DBG("This=%p pParams=%p initResource=%p Allocate=%d "
"Type=%d Pool=%d Usage=%d\n",
This, pParams, initResource, (int) Allocate,
Type, Pool, Usage);
DBG("This=%p pParams=%p initResource=%p Allocate=%d Type=%d Pool=%d usage=%d\n",
This, pParams, initResource, Allocate, Type, Pool, Usage);
hr = NineUnknown_ctor(&This->base, pParams);
if (FAILED(hr))
return hr;
This->info.screen = screen = This->base.device->screen;
if (initResource)
pipe_resource_reference(&This->resource, initResource);
if (Allocate) {
assert(!initResource);
DBG("(%p) Creating pipe_resource.\n", This);
This->resource = screen->resource_create(screen, &This->info);
if (!This->resource)
return D3DERR_OUTOFVIDEOMEMORY;
}
This->data = NULL; /* FIXME remove, rather set it to null in surface9.c*/
This->type = Type;
This->pool = Pool;
This->usage = Usage;
This->priority = 0;
This->pdata = util_hash_table_create(ht_guid_hash, ht_guid_compare);
@@ -82,10 +95,6 @@ NineResource9_dtor( struct NineResource9 *This )
* still hold a reference. */
pipe_resource_reference(&This->resource, NULL);
/* release allocated system memory for non-D3DPOOL_DEFAULT resources */
if (This->data)
FREE(This->data);
NineUnknown_dtor(&This->base);
}
@@ -201,6 +210,9 @@ NineResource9_SetPriority( struct NineResource9 *This,
DWORD PriorityNew )
{
DWORD prev = This->priority;
DBG("This=%p, PriorityNew=%d\n", This, PriorityNew);
This->priority = PriorityNew;
return prev;
}

View File

@@ -36,8 +36,6 @@ struct NineResource9
struct pipe_resource *resource; /* device resource */
uint8_t *data; /* system memory backing */
D3DRESOURCETYPE type;
D3DPOOL pool;
DWORD priority;
@@ -57,9 +55,11 @@ NineResource9( void *data )
HRESULT
NineResource9_ctor( struct NineResource9 *This,
struct NineUnknownParams *pParams,
struct pipe_resource *initResource,
BOOL Allocate,
D3DRESOURCETYPE Type,
D3DPOOL Pool );
D3DPOOL Pool,
DWORD Usage);
void
NineResource9_dtor( struct NineResource9 *This );

View File

@@ -35,6 +35,9 @@ NineStateBlock9_ctor( struct NineStateBlock9 *This,
enum nine_stateblock_type type )
{
HRESULT hr = NineUnknown_ctor(&This->base, pParams);
DBG("This=%p pParams=%p type=%d\n", This, pParams, type);
if (FAILED(hr))
return hr;

View File

@@ -43,6 +43,7 @@ NineSurface9_ctor( struct NineSurface9 *This,
struct NineUnknownParams *pParams,
struct NineUnknown *pContainer,
struct pipe_resource *pResource,
void *user_buffer,
uint8_t TextureType,
unsigned Level,
unsigned Layer,
@@ -62,6 +63,8 @@ NineSurface9_ctor( struct NineSurface9 *This,
assert(pResource ||
pDesc->Pool != D3DPOOL_DEFAULT || pDesc->Format == D3DFMT_NULL);
assert(!pResource || !user_buffer);
This->base.info.screen = pParams->device->screen;
This->base.info.target = PIPE_TEXTURE_2D;
This->base.info.format = d3d9_to_pipe_format(pDesc->Format);
@@ -82,20 +85,17 @@ NineSurface9_ctor( struct NineSurface9 *This,
if (pDesc->Pool == D3DPOOL_SYSTEMMEM) {
This->base.info.usage = PIPE_USAGE_STAGING;
if (pResource)
This->base.data = (uint8_t *)pResource; /* this is *pSharedHandle */
pResource = NULL;
This->data = (uint8_t *)user_buffer; /* this is *pSharedHandle */
assert(!pResource);
} else {
if (pResource && (pDesc->Usage & D3DUSAGE_DYNAMIC))
pResource->flags |= NINE_RESOURCE_FLAG_LOCKABLE;
pipe_resource_reference(&This->base.resource, pResource);
}
hr = NineResource9_ctor(&This->base, pParams, FALSE, D3DRTYPE_SURFACE,
pDesc->Pool);
hr = NineResource9_ctor(&This->base, pParams, pResource, FALSE, D3DRTYPE_SURFACE,
pDesc->Pool, pDesc->Usage);
if (FAILED(hr))
return hr;
This->base.usage = pDesc->Usage;
This->pipe = This->base.base.device->pipe;
This->transfer = NULL;
@@ -109,13 +109,20 @@ NineSurface9_ctor( struct NineSurface9 *This,
This->stride = util_format_get_stride(This->base.info.format, pDesc->Width);
This->stride = align(This->stride, 4);
if (!pResource && !This->base.data) {
hr = NineSurface9_AllocateData(This);
if (FAILED(hr))
return hr;
if (!pResource && !This->data) {
const unsigned size = This->stride *
util_format_get_nblocksy(This->base.info.format, This->desc.Height);
DBG("(%p(This=%p),level=%u) Allocating 0x%x bytes of system memory.\n",
This->base.base.container, This, This->level, size);
This->data = (uint8_t *)MALLOC(size);
if (!This->data)
return E_OUTOFMEMORY;
This->manage_data = TRUE;
} else {
if (pResource && NineSurface9_IsOffscreenPlain(This))
pResource->flags |= NINE_RESOURCE_FLAG_LOCKABLE;
pResource->flags |= NINE_RESOURCE_FLAG_LOCKABLE; /* why setting this flag there ? too late ? should be before NineResource9_ctor call perhaps ? */
}
NineSurface9_Dump(This);
@@ -133,6 +140,9 @@ NineSurface9_dtor( struct NineSurface9 *This )
pipe_surface_reference(&This->surface[0], NULL);
pipe_surface_reference(&This->surface[1], NULL);
/* release allocated system memory for non-D3DPOOL_DEFAULT resources */
if (This->manage_data && This->data)
FREE(This->data);
NineResource9_dtor(&This->base);
}
@@ -167,7 +177,7 @@ NineSurface9_Dump( struct NineSurface9 *This )
DBG("\nNineSurface9(%p->%p/%p): Pool=%s Type=%s Usage=%s\n"
"Dims=%ux%u Format=%s Stride=%u Lockable=%i\n"
"Level=%u(%u), Layer=%u\n", This, This->base.resource, This->base.data,
"Level=%u(%u), Layer=%u\n", This, This->base.resource, This->data,
nine_D3DPOOL_to_str(This->desc.Pool),
nine_D3DRTYPE_to_str(This->desc.Type),
nine_D3DUSAGE_to_str(This->desc.Usage),
@@ -240,6 +250,8 @@ NineSurface9_AddDirtyRect( struct NineSurface9 *This,
float area[2];
struct u_rect rect, cover_a, cover_b;
DBG("This=%p box=%p\n", This, box);
if (!box) {
This->dirty_rects[0].x0 = 0;
This->dirty_rects[0].y0 = 0;
@@ -286,8 +298,8 @@ NineSurface9_GetSystemMemPointer(struct NineSurface9 *This, int x, int y)
y = util_format_get_nblocksy(This->base.info.format, y);
assert(This->base.data);
return This->base.data + (y * This->stride + x_offset);
assert(This->data);
return This->data + (y * This->stride + x_offset);
}
HRESULT WINAPI
@@ -360,7 +372,7 @@ NineSurface9_LockRect( struct NineSurface9 *This,
user_warn(This->desc.Format == D3DFMT_NULL);
if (This->base.data) {
if (This->data) {
DBG("returning system memory\n");
pLockedRect->Pitch = This->stride;
@@ -419,73 +431,6 @@ NineSurface9_ReleaseDC( struct NineSurface9 *This,
STUB(D3DERR_INVALIDCALL);
}
/* nine private */
HRESULT
NineSurface9_AllocateData( struct NineSurface9 *This )
{
#if 0
struct pipe_screen *screen = This->base.info.screen;
/* XXX: Can't use staging resource because apparently apps expect
* memory offsets to be the same across locks.
* NV50 doesn't support direct mapping yet so only enable this if
* everything else works.
*/
if (This->base.pool == D3DPOOL_SYSTEMMEM) {
/* Allocate a staging resource to save a copy:
* user -> staging resource
* staging resource -> (blit) -> video memory
*
* Instead of:
* user -> system memory
* system memory -> transfer staging area
* transfer -> video memory
*
* Does this work if we "lose" the device ?
*/
struct pipe_resource *resource;
struct pipe_resource templ;
templ.target = PIPE_TEXTURE_2D;
templ.format = This->base.info.format;
templ.width0 = This->desc.Width;
templ.height0 = This->desc.Height;
templ.depth0 = 1;
templ.array_size = 1;
templ.last_level = 0;
templ.nr_samples = 0;
templ.usage = PIPE_USAGE_STAGING;
templ.bind =
PIPE_BIND_SAMPLER_VIEW |
PIPE_BIND_TRANSFER_WRITE |
PIPE_BIND_TRANSFER_READ;
templ.flags = 0;
DBG("(%p(This=%p),level=%u) Allocating staging resource.\n",
This->base.base.container, This, This->level);
resource = screen->resource_create(screen, &templ);
if (!resource)
DBG("Failed to allocate staging resource.\n");
/* Also deallocate old staging resource. */
pipe_resource_reference(&This->base.resource, resource);
}
#endif
if (!This->base.resource) {
const unsigned size = This->stride *
util_format_get_nblocksy(This->base.info.format, This->desc.Height);
DBG("(%p(This=%p),level=%u) Allocating 0x%x bytes of system memory.\n",
This->base.base.container, This, This->level, size);
This->base.data = (uint8_t *)MALLOC(size);
if (!This->base.data)
return E_OUTOFMEMORY;
}
return D3D_OK;
}
IDirect3DSurface9Vtbl NineSurface9_vtable = {
(void *)NineUnknown_QueryInterface,
(void *)NineUnknown_AddRef,
@@ -528,6 +473,9 @@ NineSurface9_CopySurface( struct NineSurface9 *This,
uint8_t *p_dst;
const uint8_t *p_src;
DBG("This=%p From=%p pDestPoint=%p pSourceRect=%p\n",
This, From, pDestPoint, pSourceRect);
user_assert(This->desc.Format == From->desc.Format, D3DERR_INVALIDCALL);
dst_box.x = pDestPoint ? pDestPoint->x : 0;
@@ -643,6 +591,8 @@ NineSurface9_UploadSelf( struct NineSurface9 *This )
uint8_t *ptr;
unsigned i;
DBG("This=%p\n", This);
assert(This->base.pool == D3DPOOL_MANAGED);
if (!NineSurface9_IsDirty(This))
@@ -699,6 +649,7 @@ HRESULT
NineSurface9_new( struct NineDevice9 *pDevice,
struct NineUnknown *pContainer,
struct pipe_resource *pResource,
void *user_buffer,
uint8_t TextureType,
unsigned Level,
unsigned Layer,
@@ -706,6 +657,6 @@ NineSurface9_new( struct NineDevice9 *pDevice,
struct NineSurface9 **ppOut )
{
NINE_DEVICE_CHILD_NEW(Surface9, ppOut, pDevice, /* args */
pContainer, pResource,
pContainer, pResource, user_buffer,
TextureType, Level, Layer, pDesc);
}

View File

@@ -47,6 +47,8 @@ struct NineSurface9
unsigned layer;
D3DSURFACE_DESC desc;
uint8_t *data; /* system memory backing */
boolean manage_data;
unsigned stride; /* for system memory backing */
/* wine doesn't even use these, 2 will be enough */
@@ -62,6 +64,7 @@ HRESULT
NineSurface9_new( struct NineDevice9 *pDevice,
struct NineUnknown *pContainer,
struct pipe_resource *pResource,
void *user_buffer,
uint8_t TextureType, /* 0 if pContainer isn't BaseTexure9 */
unsigned Level,
unsigned Layer,
@@ -73,6 +76,7 @@ NineSurface9_ctor( struct NineSurface9 *This,
struct NineUnknownParams *pParams,
struct NineUnknown *pContainer,
struct pipe_resource *pResource,
void *user_buffer,
uint8_t TextureType,
unsigned Level,
unsigned Layer,
@@ -124,9 +128,6 @@ NineSurface9_ClearDirtyRects( struct NineSurface9 *This )
memset(&This->dirty_rects, 0, sizeof(This->dirty_rects));
}
HRESULT
NineSurface9_AllocateData( struct NineSurface9 *This );
HRESULT
NineSurface9_UploadSelf( struct NineSurface9 *This );

View File

@@ -304,7 +304,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
} else {
desc.Format = pParams->BackBufferFormat;
desc.Usage = D3DUSAGE_RENDERTARGET;
hr = NineSurface9_new(pDevice, NineUnknown(This), resource, 0,
hr = NineSurface9_new(pDevice, NineUnknown(This), resource, NULL, 0,
0, 0, &desc, &This->buffers[i]);
if (has_present_buffers)
pipe_resource_reference(&resource, NULL);
@@ -347,7 +347,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
/* XXX wine thinks the container of this should be the device */
desc.Format = pParams->AutoDepthStencilFormat;
desc.Usage = D3DUSAGE_DEPTHSTENCIL;
hr = NineSurface9_new(pDevice, NineUnknown(pDevice), resource, 0,
hr = NineSurface9_new(pDevice, NineUnknown(pDevice), resource, NULL, 0,
0, 0, &desc, &This->zsbuf);
pipe_resource_reference(&resource, NULL);
if (FAILED(hr)) {
@@ -737,6 +737,11 @@ NineSwapChain9_Present( struct NineSwapChain9 *This,
HRESULT hr = present(This, pSourceRect, pDestRect,
hDestWindowOverride, pDirtyRegion, dwFlags);
DBG("This=%p pSourceRect=%p pDestRect=%p hDestWindowOverride=%p "
"pDirtyRegion=%p dwFlags=%d\n",
This, pSourceRect, pDestRect, hDestWindowOverride,
pDirtyRegion,dwFlags);
if (hr == D3DERR_WASSTILLDRAWING)
return hr;
@@ -832,7 +837,7 @@ NineSwapChain9_GetFrontBufferData( struct NineSwapChain9 *This,
/* NineSurface9_CopySurface needs same format. */
desc.Format = dest_surface->desc.Format;
desc.Usage = D3DUSAGE_RENDERTARGET;
hr = NineSurface9_new(pDevice, NineUnknown(This), temp_resource, 0,
hr = NineSurface9_new(pDevice, NineUnknown(This), temp_resource, NULL, 0,
0, 0, &desc, &temp_surface);
pipe_resource_reference(&temp_resource, NULL);
if (FAILED(hr)) {

View File

@@ -37,6 +37,10 @@ NineSwapChain9Ex_ctor( struct NineSwapChain9Ex *This,
HWND hFocusWindow,
D3DDISPLAYMODEEX *mode )
{
DBG("This=%p pParams=%p implicit=%d pPresent=%p pPresentationParameters=%p "
"pCTX=%p hFocusWindow=%p mode=%p",
This, pParams, (int) implicit, pPresent, pPresentationParameters, pCTX, hFocusWindow, mode);
return NineSwapChain9_ctor(&This->base, pParams, implicit, pPresent,
pPresentationParameters, pCTX, hFocusWindow, mode);
}

View File

@@ -46,10 +46,11 @@ NineTexture9_ctor( struct NineTexture9 *This,
{
struct pipe_screen *screen = pParams->device->screen;
struct pipe_resource *info = &This->base.base.info;
struct pipe_resource *resource;
unsigned l;
D3DSURFACE_DESC sfdesc;
HRESULT hr;
const boolean shared_create = pSharedHandle && !*pSharedHandle;
void *user_buffer = NULL;
DBG("(%p) Width=%u Height=%u Levels=%u Usage=%s Format=%s Pool=%s "
"pSharedHandle=%p\n", This, Width, Height, Levels,
@@ -77,10 +78,7 @@ NineTexture9_ctor( struct NineTexture9 *This,
Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
if (pSharedHandle && Pool == D3DPOOL_DEFAULT) {
/* Note: Below there is some implementation to support buffer sharing in
* this case, but it won't work for cross-process. Thus just ignore
* that code. */
if (shared_create) {
if (!*pSharedHandle) {
DBG("Creating Texture with invalid handle. Importing will fail\n.");
*pSharedHandle = (HANDLE)1; /* Wine would keep it NULL */
pSharedHandle = NULL;
@@ -94,9 +92,6 @@ NineTexture9_ctor( struct NineTexture9 *This,
if (Usage & D3DUSAGE_AUTOGENMIPMAP)
Levels = 0;
This->base.format = Format;
This->base.base.usage = Usage;
info->screen = screen;
info->target = PIPE_TEXTURE_2D;
info->format = d3d9_to_pipe_format(Format);
@@ -130,25 +125,15 @@ NineTexture9_ctor( struct NineTexture9 *This,
if (Pool == D3DPOOL_SYSTEMMEM)
info->usage = PIPE_USAGE_STAGING;
if (pSharedHandle && !shared_create) {
if (Pool == D3DPOOL_SYSTEMMEM) {
/* Hack for surface creation. */
This->base.base.resource = (struct pipe_resource *)*pSharedHandle;
} else {
struct pipe_resource *res;
res = screen->resource_from_handle(screen, info,
(struct winsys_handle *)pSharedHandle);
if (!res)
return D3DERR_NOTFOUND;
This->base.base.resource = res;
}
if (pSharedHandle && *pSharedHandle) { /* Pool == D3DPOOL_SYSTEMMEM */
user_buffer = (void *)*pSharedHandle;
}
This->surfaces = CALLOC(info->last_level + 1, sizeof(*This->surfaces));
if (!This->surfaces)
return E_OUTOFMEMORY;
hr = NineBaseTexture9_ctor(&This->base, pParams, D3DRTYPE_TEXTURE, Pool);
hr = NineBaseTexture9_ctor(&This->base, pParams, NULL, D3DRTYPE_TEXTURE, Format, Pool, Usage);
if (FAILED(hr))
return hr;
This->base.pstype = (Height == 1) ? 1 : 0;
@@ -163,12 +148,19 @@ NineTexture9_ctor( struct NineTexture9 *This,
sfdesc.Pool = Pool;
sfdesc.MultiSampleType = D3DMULTISAMPLE_NONE;
sfdesc.MultiSampleQuality = 0;
if (Pool == D3DPOOL_SYSTEMMEM)
resource = NULL;
else
resource = This->base.base.resource;
for (l = 0; l <= info->last_level; ++l) {
sfdesc.Width = u_minify(Width, l);
sfdesc.Height = u_minify(Height, l);
hr = NineSurface9_new(This->base.base.base.device, NineUnknown(This),
This->base.base.resource, D3DRTYPE_TEXTURE, l, 0,
resource, user_buffer,
D3DRTYPE_TEXTURE, l, 0,
&sfdesc, &This->surfaces[l]);
if (FAILED(hr))
return hr;
@@ -176,19 +168,8 @@ NineTexture9_ctor( struct NineTexture9 *This,
This->dirty_rect.depth = 1; /* widht == 0 means empty, depth stays 1 */
if (pSharedHandle) {
if (Pool == D3DPOOL_SYSTEMMEM) {
This->base.base.resource = NULL;
if (shared_create)
*pSharedHandle = This->surfaces[0]->base.data;
} else
if (shared_create) {
boolean ok;
ok = screen->resource_get_handle(screen, This->base.base.resource,
(struct winsys_handle *)pSharedHandle);
if (!ok)
return D3DERR_DRIVERINTERNALERROR;
}
if (pSharedHandle && !*pSharedHandle) {/* Pool == D3DPOOL_SYSTEMMEM */
*pSharedHandle = This->surfaces[0]->data;
}
return D3D_OK;
@@ -245,6 +226,9 @@ NineTexture9_LockRect( struct NineTexture9 *This,
const RECT *pRect,
DWORD Flags )
{
DBG("This=%p Level=%u pLockedRect=%p pRect=%p Flags=%d\n",
This, Level, pLockedRect, pRect, Flags);
user_assert(Level <= This->base.base.info.last_level, D3DERR_INVALIDCALL);
user_assert(Level == 0 || !(This->base.base.usage & D3DUSAGE_AUTOGENMIPMAP),
D3DERR_INVALIDCALL);
@@ -257,6 +241,8 @@ HRESULT WINAPI
NineTexture9_UnlockRect( struct NineTexture9 *This,
UINT Level )
{
DBG("This=%p Level=%u\n", This, Level);
user_assert(Level <= This->base.base.info.last_level, D3DERR_INVALIDCALL);
return NineSurface9_UnlockRect(This->surfaces[Level]);

View File

@@ -85,8 +85,8 @@ NineVertexBuffer9_ctor( struct NineVertexBuffer9 *This,
info->last_level = 0;
info->nr_samples = 0;
hr = NineResource9_ctor(&This->base, pParams, TRUE, D3DRTYPE_VERTEXBUFFER,
pDesc->Pool);
hr = NineResource9_ctor(&This->base, pParams, NULL, TRUE,
D3DRTYPE_VERTEXBUFFER, pDesc->Pool, pDesc->Usage);
if (FAILED(hr))
return hr;

View File

@@ -95,21 +95,20 @@ nine_d3ddeclusage_check(unsigned usage, unsigned usage_idx)
{
switch (usage) {
case D3DDECLUSAGE_POSITIONT:
case D3DDECLUSAGE_PSIZE:
case D3DDECLUSAGE_TESSFACTOR:
case D3DDECLUSAGE_DEPTH:
case D3DDECLUSAGE_FOG:
case D3DDECLUSAGE_SAMPLE:
return usage_idx <= 0;
case D3DDECLUSAGE_NORMAL:
case D3DDECLUSAGE_TANGENT:
case D3DDECLUSAGE_BINORMAL:
return usage_idx <= 1;
case D3DDECLUSAGE_POSITION:
case D3DDECLUSAGE_BLENDWEIGHT:
case D3DDECLUSAGE_BLENDINDICES:
case D3DDECLUSAGE_COLOR:
return usage_idx <= 4;
return TRUE;
case D3DDECLUSAGE_PSIZE:
case D3DDECLUSAGE_FOG:
case D3DDECLUSAGE_SAMPLE:
return usage_idx <= 0;
case D3DDECLUSAGE_TEXCOORD:
return usage_idx <= 15;
default:
@@ -118,8 +117,8 @@ nine_d3ddeclusage_check(unsigned usage, unsigned usage_idx)
}
#define NINE_DECLUSAGE_CASE0(n) case D3DDECLUSAGE_##n: return NINE_DECLUSAGE_##n
#define NINE_DECLUSAGE_CASEi(n) case D3DDECLUSAGE_##n: return NINE_DECLUSAGE_##n(usage_idx)
INLINE unsigned
#define NINE_DECLUSAGE_CASEi(n) case D3DDECLUSAGE_##n: return NINE_DECLUSAGE_i(n, usage_idx)
uint16_t
nine_d3d9_to_nine_declusage(unsigned usage, unsigned usage_idx)
{
if (!nine_d3ddeclusage_check(usage, usage_idx))
@@ -135,7 +134,7 @@ nine_d3d9_to_nine_declusage(unsigned usage, unsigned usage_idx)
NINE_DECLUSAGE_CASEi(TANGENT);
NINE_DECLUSAGE_CASEi(BINORMAL);
NINE_DECLUSAGE_CASE0(TESSFACTOR);
NINE_DECLUSAGE_CASE0(POSITIONT);
NINE_DECLUSAGE_CASEi(POSITIONT);
NINE_DECLUSAGE_CASEi(COLOR);
NINE_DECLUSAGE_CASE0(DEPTH);
NINE_DECLUSAGE_CASE0(FOG);
@@ -148,58 +147,25 @@ nine_d3d9_to_nine_declusage(unsigned usage, unsigned usage_idx)
static const char *nine_declusage_names[] =
{
[NINE_DECLUSAGE_POSITION(0)] = "POSITION",
[NINE_DECLUSAGE_POSITION(1)] = "POSITION1",
[NINE_DECLUSAGE_POSITION(2)] = "POSITION2",
[NINE_DECLUSAGE_POSITION(3)] = "POSITION3",
[NINE_DECLUSAGE_POSITION(4)] = "POSITION4",
[NINE_DECLUSAGE_BLENDWEIGHT(0)] = "BLENDWEIGHT",
[NINE_DECLUSAGE_BLENDWEIGHT(1)] = "BLENDWEIGHT1",
[NINE_DECLUSAGE_BLENDWEIGHT(2)] = "BLENDWEIGHT2",
[NINE_DECLUSAGE_BLENDWEIGHT(3)] = "BLENDWEIGHT3",
[NINE_DECLUSAGE_BLENDINDICES(0)] = "BLENDINDICES",
[NINE_DECLUSAGE_BLENDINDICES(1)] = "BLENDINDICES1",
[NINE_DECLUSAGE_BLENDINDICES(2)] = "BLENDINDICES2",
[NINE_DECLUSAGE_BLENDINDICES(3)] = "BLENDINDICES3",
[NINE_DECLUSAGE_NORMAL(0)] = "NORMAL",
[NINE_DECLUSAGE_NORMAL(1)] = "NORMAL1",
[NINE_DECLUSAGE_POSITION] = "POSITION",
[NINE_DECLUSAGE_BLENDWEIGHT] = "BLENDWEIGHT",
[NINE_DECLUSAGE_BLENDINDICES] = "BLENDINDICES",
[NINE_DECLUSAGE_NORMAL] = "NORMAL",
[NINE_DECLUSAGE_PSIZE] = "PSIZE",
[NINE_DECLUSAGE_TEXCOORD(0)] = "TEXCOORD0",
[NINE_DECLUSAGE_TEXCOORD(1)] = "TEXCOORD1",
[NINE_DECLUSAGE_TEXCOORD(2)] = "TEXCOORD2",
[NINE_DECLUSAGE_TEXCOORD(3)] = "TEXCOORD3",
[NINE_DECLUSAGE_TEXCOORD(4)] = "TEXCOORD4",
[NINE_DECLUSAGE_TEXCOORD(5)] = "TEXCOORD5",
[NINE_DECLUSAGE_TEXCOORD(6)] = "TEXCOORD6",
[NINE_DECLUSAGE_TEXCOORD(7)] = "TEXCOORD7",
[NINE_DECLUSAGE_TEXCOORD(8)] = "TEXCOORD8",
[NINE_DECLUSAGE_TEXCOORD(9)] = "TEXCOORD9",
[NINE_DECLUSAGE_TEXCOORD(10)] = "TEXCOORD10",
[NINE_DECLUSAGE_TEXCOORD(11)] = "TEXCOORD11",
[NINE_DECLUSAGE_TEXCOORD(12)] = "TEXCOORD12",
[NINE_DECLUSAGE_TEXCOORD(13)] = "TEXCOORD13",
[NINE_DECLUSAGE_TEXCOORD(14)] = "TEXCOORD14",
[NINE_DECLUSAGE_TEXCOORD(15)] = "TEXCOORD15",
[NINE_DECLUSAGE_TANGENT(0)] = "TANGENT",
[NINE_DECLUSAGE_TANGENT(1)] = "TANGENT1",
[NINE_DECLUSAGE_BINORMAL(0)] = "BINORMAL",
[NINE_DECLUSAGE_BINORMAL(1)] = "BINORMAL1",
[NINE_DECLUSAGE_TEXCOORD] = "TEXCOORD",
[NINE_DECLUSAGE_TANGENT] = "TANGENT",
[NINE_DECLUSAGE_BINORMAL] = "BINORMAL",
[NINE_DECLUSAGE_TESSFACTOR] = "TESSFACTOR",
[NINE_DECLUSAGE_POSITIONT] = "POSITIONT",
[NINE_DECLUSAGE_COLOR(0)] = "DIFFUSE",
[NINE_DECLUSAGE_COLOR(1)] = "SPECULAR",
[NINE_DECLUSAGE_COLOR(2)] = "COLOR2",
[NINE_DECLUSAGE_COLOR(3)] = "COLOR3",
[NINE_DECLUSAGE_COLOR(4)] = "COLOR4",
[NINE_DECLUSAGE_COLOR] = "DIFFUSE",
[NINE_DECLUSAGE_DEPTH] = "DEPTH",
[NINE_DECLUSAGE_FOG] = "FOG",
[NINE_DECLUSAGE_NONE] = "(NONE)",
[NINE_DECLUSAGE_COUNT] = "(OOB)"
};
static INLINE const char *
nine_declusage_name(unsigned ndcl)
{
return nine_declusage_names[MIN2(ndcl, Elements(nine_declusage_names) - 1)];
return nine_declusage_names[ndcl % NINE_DECLUSAGE_COUNT];
}
HRESULT
@@ -210,6 +176,8 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This,
const D3DCAPS9 *caps;
unsigned i;
DBG("This=%p pParams=%p pElements=%p\n", This, pParams, pElements);
HRESULT hr = NineUnknown_ctor(&This->base, pParams);
if (FAILED(hr)) { return hr; }
@@ -223,15 +191,14 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This,
This->decls = CALLOC(This->nelems+1, sizeof(D3DVERTEXELEMENT9));
This->elems = CALLOC(This->nelems, sizeof(struct pipe_vertex_element));
This->usage_map = CALLOC(This->nelems, sizeof(uint16_t));
if (!This->decls || !This->elems) { return E_OUTOFMEMORY; }
memcpy(This->decls, pElements, sizeof(D3DVERTEXELEMENT9)*(This->nelems+1));
memset(This->usage_map, 0xff, sizeof(This->usage_map));
for (i = 0; i < This->nelems; ++i) {
uint8_t usage = nine_d3d9_to_nine_declusage(This->decls[i].Usage,
This->decls[i].UsageIndex);
This->usage_map[usage] = i;
uint16_t usage = nine_d3d9_to_nine_declusage(This->decls[i].Usage,
This->decls[i].UsageIndex);
This->usage_map[i] = usage;
This->elems[i].src_offset = This->decls[i].Offset;
This->elems[i].instance_divisor = 0;
@@ -239,11 +206,12 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This,
This->elems[i].src_format = decltype_format(This->decls[i].Type);
/* XXX Remember Method (tesselation), Usage, UsageIndex */
DBG("VERTEXELEMENT[%u]: Stream=%u Offset=%u Type=%s DeclUsage=%s\n", i,
DBG("VERTEXELEMENT[%u]: Stream=%u Offset=%u Type=%s DeclUsage=%s%d\n", i,
This->decls[i].Stream,
This->decls[i].Offset,
util_format_name(This->elems[i].src_format),
nine_declusage_name(usage));
nine_declusage_name(usage),
usage / NINE_DECLUSAGE_COUNT);
}
return D3D_OK;
@@ -256,6 +224,8 @@ NineVertexDeclaration9_dtor( struct NineVertexDeclaration9 *This )
FREE(This->decls);
if (This->elems)
FREE(This->elems);
if (This->usage_map)
FREE(This->usage_map);
NineUnknown_dtor(&This->base);
}
@@ -460,6 +430,9 @@ NineVertexDeclaration9_ConvertStreamOutput(
void *src_map;
void *dst_map;
DBG("This=%p pDstBuf=%p DestIndex=%u VertexCount=%u pSrcBuf=%p so=%p\n",
This, pDstBuf, DestIndex, VertexCount, pSrcBuf, so);
transkey.output_stride = 0;
for (i = 0; i < This->nelems; ++i) {
enum pipe_format format;

View File

@@ -40,9 +40,9 @@ struct NineVertexDeclaration9
struct pipe_vertex_element *elems;
unsigned nelems;
/* DECLUSAGE -> element index, for selecting the vertex element
/* index -> DECLUSAGE, for selecting the vertex element
* for each VS input */
uint8_t usage_map[NINE_DECLUSAGE_COUNT];
uint16_t *usage_map;
D3DVERTEXELEMENT9 *decls;
DWORD fvf;

View File

@@ -40,6 +40,9 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This,
HRESULT hr;
unsigned i;
DBG("This=%p pParams=%p pFunction=%p cso=%p\n",
This, pParams, pFunction, cso);
hr = NineUnknown_ctor(&This->base, pParams);
if (FAILED(hr))
return hr;

View File

@@ -32,7 +32,7 @@ struct NineVertexShader9
struct nine_shader_variant variant;
struct {
uint8_t ndecl; /* NINE_DECLUSAGE_x */
uint16_t ndecl; /* NINE_DECLUSAGE_x */
} input_map[PIPE_MAX_ATTRIBS];
unsigned num_inputs;

View File

@@ -342,6 +342,9 @@ NineVolume9_CopyVolume( struct NineVolume9 *This,
uint8_t *p_dst;
const uint8_t *p_src;
DBG("This=%p From=%p dstx=%u dsty=%u dstz=%u pSrcBox=%p\n",
This, From, dstx, dsty, dstz, pSrcBox);
user_assert(This->desc.Format == From->desc.Format, D3DERR_INVALIDCALL);
dst_box.x = dstx;
@@ -527,6 +530,9 @@ NineVolume9_SetPrivateData( struct NineVolume9 *This,
struct pheader *header;
const void *user_data = pData;
DBG("This=%p refguid=%p pData=%p SizeOfData=%d Flags=%d\n",
This, refguid, pData, SizeOfData, Flags);
if (Flags & D3DSPD_IUNKNOWN)
user_assert(SizeOfData == sizeof(IUnknown *), D3DERR_INVALIDCALL);
@@ -593,6 +599,8 @@ NineVolume9_FreePrivateData( struct NineVolume9 *This,
{
struct pheader *header;
DBG("This=%p refguid=%p\n", This, refguid);
header = util_hash_table_get(This->pdata, refguid);
if (!header) { return D3DERR_NOTFOUND; }

View File

@@ -41,6 +41,11 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
D3DVOLUME_DESC voldesc;
HRESULT hr;
DBG("This=%p pParams=%p Width=%u Height=%u Depth=%u Levels=%u "
"Usage=%d Format=%d Pool=%d pSharedHandle=%p\n",
This, pParams, Width, Height, Depth, Levels,
Usage, Format, Pool, pSharedHandle);
/* An IDirect3DVolume9 cannot be bound as a render target can it ? */
user_assert(!(Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)),
D3DERR_INVALIDCALL);
@@ -52,9 +57,6 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
if (Usage & D3DUSAGE_AUTOGENMIPMAP)
Levels = 0;
This->base.format = Format;
This->base.base.usage = Usage;
info->screen = pParams->device->screen;
info->target = PIPE_TEXTURE_3D;
info->format = d3d9_to_pipe_format(Format);
@@ -83,8 +85,8 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
return E_OUTOFMEMORY;
This->base.pstype = 3;
hr = NineBaseTexture9_ctor(&This->base, pParams,
D3DRTYPE_VOLUMETEXTURE, Pool);
hr = NineBaseTexture9_ctor(&This->base, pParams, NULL,
D3DRTYPE_VOLUMETEXTURE, Format, Pool, Usage);
if (FAILED(hr))
return hr;
@@ -159,6 +161,9 @@ NineVolumeTexture9_LockBox( struct NineVolumeTexture9 *This,
const D3DBOX *pBox,
DWORD Flags )
{
DBG("This=%p Level=%u pLockedVolume=%p pBox=%p Flags=%d\n",
This, Level, pLockedVolume, pBox, Flags);
user_assert(Level <= This->base.base.info.last_level, D3DERR_INVALIDCALL);
user_assert(Level == 0 || !(This->base.base.usage & D3DUSAGE_AUTOGENMIPMAP),
D3DERR_INVALIDCALL);
@@ -171,6 +176,8 @@ HRESULT WINAPI
NineVolumeTexture9_UnlockBox( struct NineVolumeTexture9 *This,
UINT Level )
{
DBG("This=%p Level=%u\n", This, Level);
user_assert(Level <= This->base.base.info.last_level, D3DERR_INVALIDCALL);
return NineVolume9_UnlockBox(This->volumes[Level]);
@@ -180,6 +187,8 @@ HRESULT WINAPI
NineVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This,
const D3DBOX *pDirtyBox )
{
DBG("This=%p pDirtybox=%p\n", This, pDirtyBox);
if (This->base.base.pool != D3DPOOL_MANAGED) {
if (This->base.base.usage & D3DUSAGE_AUTOGENMIPMAP)
This->base.dirty_mip = TRUE;

View File

@@ -367,7 +367,6 @@ EXPORTS
wglUseFontBitmapsW
wglUseFontOutlinesA
wglUseFontOutlinesW
wglGetExtensionsStringARB
DrvCopyContext
DrvCreateContext
DrvCreateLayerContext

View File

@@ -62,7 +62,7 @@ d3dadapter9_la_LDFLAGS = \
-shrext .so \
-module \
-no-undefined \
-version-number $(NINE_MAJOR):$(NINE_MINOR) \
-version-number $(NINE_MAJOR):$(NINE_MINOR):$(NINE_TINY) \
$(GC_SECTIONS) \
$(LD_NO_UNDEFINED)

View File

@@ -6,6 +6,6 @@ moduledir=@D3D_DRIVER_INSTALL_DIR@
Name: d3d
Description: Native D3D driver modules
Version: @VERSION@
Version: @NINE_VERSION@
Requires.private: @DRI_PC_REQ_PRIV@
Cflags: -I${includedir}

View File

@@ -325,6 +325,9 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
&ws->info.max_sclk);
ws->info.max_sclk /= 1000;
radeon_get_drm_value(ws->fd, RADEON_INFO_SI_BACKEND_ENABLED_MASK, NULL,
&ws->info.si_backend_enabled_mask);
ws->num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
/* Generation-specific queries. */

View File

@@ -231,6 +231,7 @@ struct radeon_info {
boolean si_tile_mode_array_valid;
uint32_t si_tile_mode_array[32];
uint32_t si_backend_enabled_mask;
boolean cik_macrotile_mode_array_valid;
uint32_t cik_macrotile_mode_array[16];

View File

@@ -49,6 +49,7 @@ public:
{
instructions = insts;
progress = false;
index = 0;
}
bool run()
@@ -62,6 +63,7 @@ public:
private:
exec_list *instructions;
bool progress;
unsigned index;
};
void
@@ -70,14 +72,20 @@ lower_const_array_visitor::handle_rvalue(ir_rvalue **rvalue)
if (!*rvalue)
return;
ir_constant *con = (*rvalue)->as_constant();
ir_dereference_array *dra = (*rvalue)->as_dereference_array();
if (!dra)
return;
ir_constant *con = dra->array->as_constant();
if (!con || !con->type->is_array())
return;
void *mem_ctx = ralloc_parent(con);
char *uniform_name = ralloc_asprintf(mem_ctx, "constarray__%d", index++);
ir_variable *uni =
new(mem_ctx) ir_variable(con->type, "constarray", ir_var_uniform);
new(mem_ctx) ir_variable(con->type, uniform_name, ir_var_uniform);
uni->constant_initializer = con;
uni->constant_value = con;
uni->data.has_initializer = true;
@@ -87,7 +95,8 @@ lower_const_array_visitor::handle_rvalue(ir_rvalue **rvalue)
uni->data.max_array_access = uni->type->length - 1;
instructions->push_head(uni);
*rvalue = new(mem_ctx) ir_dereference_variable(uni);
ir_dereference_variable *varref = new(mem_ctx) ir_dereference_variable(uni);
*rvalue = new(mem_ctx) ir_dereference_array(varref, dra->array_index);
progress = true;
}

View File

@@ -16,6 +16,7 @@ if env['platform'] == 'windows':
env.Append(CPPDEFINES = [
'_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
'KHRONOS_DLL_EXPORTS', # declare gl* as __declspec(dllexport) in Khronos headers
])
if env['gles']:
env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS'])

View File

@@ -153,7 +153,7 @@ libmesagallium_la_LIBADD = \
libmesa_sse41_la_SOURCES = \
main/streaming-load-memcpy.c \
main/sse_minmax.c
libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1
libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) $(SSE41_CFLAGS)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gl.pc

View File

@@ -28,7 +28,6 @@
static const struct brw_device_info brw_device_info_i965 = {
.gen = 4,
.has_negative_rhw_bug = true,
.needs_unlit_centroid_workaround = true,
.max_vs_threads = 16,
.max_gs_threads = 2,
.max_wm_threads = 8 * 4,
@@ -42,7 +41,6 @@ static const struct brw_device_info brw_device_info_g4x = {
.has_pln = true,
.has_compr4 = true,
.has_surface_tile_offset = true,
.needs_unlit_centroid_workaround = true,
.is_g4x = true,
.max_vs_threads = 32,
.max_gs_threads = 2,
@@ -57,7 +55,6 @@ static const struct brw_device_info brw_device_info_ilk = {
.has_pln = true,
.has_compr4 = true,
.has_surface_tile_offset = true,
.needs_unlit_centroid_workaround = true,
.max_vs_threads = 72,
.max_gs_threads = 32,
.max_wm_threads = 12 * 6,

View File

@@ -526,13 +526,17 @@ vec4_generator::generate_gs_set_write_offset(struct brw_reg dst,
*
* We can do this with the following EU instruction:
*
* mul(2) dst.3<1>UD src0<8;2,4>UD src1 { Align1 WE_all }
* mul(2) dst.3<1>UD src0<8;2,4>UD src1<...>UW { Align1 WE_all }
*/
brw_push_insn_state(p);
brw_set_default_access_mode(p, BRW_ALIGN_1);
brw_set_default_mask_control(p, BRW_MASK_DISABLE);
assert(brw->gen >= 7 &&
src1.file == BRW_IMMEDIATE_VALUE &&
src1.type == BRW_REGISTER_TYPE_UD &&
src1.dw1.ud <= USHRT_MAX);
brw_MUL(p, suboffset(stride(dst, 2, 2, 1), 3), stride(src0, 8, 2, 4),
src1);
retype(src1, BRW_REGISTER_TYPE_UW));
brw_set_default_access_mode(p, BRW_ALIGN_16);
brw_pop_insn_state(p);
}

View File

@@ -3354,6 +3354,7 @@ vec4_visitor::move_uniform_array_access_to_pull_constants()
{
int pull_constant_loc[this->uniforms];
memset(pull_constant_loc, -1, sizeof(pull_constant_loc));
bool nested_reladdr;
/* Walk through and find array access of uniforms. Put a copy of that
* uniform in the pull constant buffer.
@@ -3361,44 +3362,51 @@ vec4_visitor::move_uniform_array_access_to_pull_constants()
* Note that we don't move constant-indexed accesses to arrays. No
* testing has been done of the performance impact of this choice.
*/
foreach_block_and_inst_safe(block, vec4_instruction, inst, cfg) {
for (int i = 0 ; i < 3; i++) {
if (inst->src[i].file != UNIFORM || !inst->src[i].reladdr)
continue;
do {
nested_reladdr = false;
int uniform = inst->src[i].reg;
foreach_block_and_inst_safe(block, vec4_instruction, inst, cfg) {
for (int i = 0 ; i < 3; i++) {
if (inst->src[i].file != UNIFORM || !inst->src[i].reladdr)
continue;
/* If this array isn't already present in the pull constant buffer,
* add it.
*/
if (pull_constant_loc[uniform] == -1) {
const gl_constant_value **values =
&stage_prog_data->param[uniform * 4];
int uniform = inst->src[i].reg;
pull_constant_loc[uniform] = stage_prog_data->nr_pull_params / 4;
if (inst->src[i].reladdr->reladdr)
nested_reladdr = true; /* will need another pass */
assert(uniform < uniform_array_size);
for (int j = 0; j < uniform_size[uniform] * 4; j++) {
stage_prog_data->pull_param[stage_prog_data->nr_pull_params++]
= values[j];
}
}
/* If this array isn't already present in the pull constant buffer,
* add it.
*/
if (pull_constant_loc[uniform] == -1) {
const gl_constant_value **values =
&stage_prog_data->param[uniform * 4];
/* Set up the annotation tracking for new generated instructions. */
base_ir = inst->ir;
current_annotation = inst->annotation;
pull_constant_loc[uniform] = stage_prog_data->nr_pull_params / 4;
dst_reg temp = dst_reg(this, glsl_type::vec4_type);
assert(uniform < uniform_array_size);
for (int j = 0; j < uniform_size[uniform] * 4; j++) {
stage_prog_data->pull_param[stage_prog_data->nr_pull_params++]
= values[j];
}
}
emit_pull_constant_load(block, inst, temp, inst->src[i],
pull_constant_loc[uniform]);
/* Set up the annotation tracking for new generated instructions. */
base_ir = inst->ir;
current_annotation = inst->annotation;
inst->src[i].file = temp.file;
inst->src[i].reg = temp.reg;
inst->src[i].reg_offset = temp.reg_offset;
inst->src[i].reladdr = NULL;
dst_reg temp = dst_reg(this, glsl_type::vec4_type);
emit_pull_constant_load(block, inst, temp, inst->src[i],
pull_constant_loc[uniform]);
inst->src[i].file = temp.file;
inst->src[i].reg = temp.reg;
inst->src[i].reg_offset = temp.reg_offset;
inst->src[i].reladdr = NULL;
}
}
}
} while (nested_reladdr);
/* Now there are no accesses of the UNIFORM file with a reladdr, so
* no need to track them as larger-than-vec4 objects. This will be

View File

@@ -129,6 +129,26 @@ get_attr_override(const struct brw_vue_map *vue_map, int urb_entry_read_offset,
}
static bool
is_drawing_points(const struct brw_context *brw)
{
/* Determine if the primitives *reaching the SF* are points */
/* _NEW_POLYGON */
if (brw->ctx.Polygon.FrontMode == GL_POINT ||
brw->ctx.Polygon.BackMode == GL_POINT) {
return true;
}
if (brw->geometry_program) {
/* BRW_NEW_GEOMETRY_PROGRAM */
return brw->geometry_program->OutputType == GL_POINTS;
} else {
/* BRW_NEW_PRIMITIVE */
return brw->primitive == _3DPRIM_POINTLIST;
}
}
/**
* Create the mapping from the FS inputs we produce to the previous pipeline
* stage (GS or VS) outputs they source from.
@@ -149,6 +169,23 @@ calculate_attr_overrides(const struct brw_context *brw,
/* _NEW_LIGHT */
bool shade_model_flat = brw->ctx.Light.ShadeModel == GL_FLAT;
/* From the Ivybridge PRM, Vol 2 Part 1, 3DSTATE_SBE,
* description of dw10 Point Sprite Texture Coordinate Enable:
*
* "This field must be programmed to zero when non-point primitives
* are rendered."
*
* The SandyBridge PRM doesn't explicitly say that point sprite enables
* must be programmed to zero when rendering non-point primitives, but
* the IvyBridge PRM does, and if we don't, we get garbage.
*
* This is not required on Haswell, as the hardware ignores this state
* when drawing non-points -- although we do still need to be careful to
* correctly set the attr overrides.
*/
/* BRW_NEW_PRIMITIVE | BRW_NEW_GEOMETRY_PROGRAM */
bool drawing_points = is_drawing_points(brw);
/* Initialize all the attr_overrides to 0. In the loop below we'll modify
* just the ones that correspond to inputs used by the fs.
*/
@@ -167,18 +204,20 @@ calculate_attr_overrides(const struct brw_context *brw,
/* _NEW_POINT */
bool point_sprite = false;
if (brw->ctx.Point.PointSprite &&
(attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) &&
brw->ctx.Point.CoordReplace[attr - VARYING_SLOT_TEX0]) {
point_sprite = true;
if (drawing_points) {
if (brw->ctx.Point.PointSprite &&
(attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) &&
brw->ctx.Point.CoordReplace[attr - VARYING_SLOT_TEX0]) {
point_sprite = true;
}
if (attr == VARYING_SLOT_PNTC)
point_sprite = true;
if (point_sprite)
*point_sprite_enables |= (1 << input_index);
}
if (attr == VARYING_SLOT_PNTC)
point_sprite = true;
if (point_sprite)
*point_sprite_enables |= (1 << input_index);
/* flat shading */
if (interp_qualifier == INTERP_QUALIFIER_FLAT ||
(shade_model_flat && is_gl_Color &&
@@ -410,7 +449,9 @@ const struct brw_tracked_state gen6_sf_state = {
_NEW_POINT |
_NEW_MULTISAMPLE),
.brw = (BRW_NEW_CONTEXT |
BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_GEOMETRY_PROGRAM |
BRW_NEW_PRIMITIVE |
BRW_NEW_VUE_MAP_GEOM_OUT),
.cache = CACHE_NEW_WM_PROG
},

View File

@@ -92,7 +92,9 @@ const struct brw_tracked_state gen7_sbe_state = {
_NEW_POINT |
_NEW_PROGRAM),
.brw = (BRW_NEW_CONTEXT |
BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_GEOMETRY_PROGRAM |
BRW_NEW_PRIMITIVE |
BRW_NEW_VUE_MAP_GEOM_OUT),
.cache = CACHE_NEW_WM_PROG
},

View File

@@ -1745,8 +1745,8 @@ intel_miptree_map_gtt(struct brw_context *brw,
unsigned int bw, bh;
void *base;
unsigned int image_x, image_y;
int x = map->x;
int y = map->y;
intptr_t x = map->x;
intptr_t y = map->y;
/* For compressed formats, the stride is the number of bytes per
* row of blocks. intel_miptree_get_image_offset() already does
@@ -1772,7 +1772,8 @@ intel_miptree_map_gtt(struct brw_context *brw,
map->ptr = base + y * map->stride + x * mt->cpp;
}
DBG("%s: %d,%d %dx%d from mt %p (%s) %d,%d = %p/%d\n", __FUNCTION__,
DBG("%s: %d,%d %dx%d from mt %p (%s) "
"%"PRIiPTR",%"PRIiPTR" = %p/%d\n", __FUNCTION__,
map->x, map->y, map->w, map->h,
mt, _mesa_get_format_name(mt->format),
x, y, map->ptr, map->stride);

View File

@@ -13,6 +13,7 @@ env.Append(CPPPATH = [
])
env.Prepend(LIBS = [
mesautil,
glsl,
mesa,
])

View File

@@ -627,7 +627,7 @@ descriptor=[
# == GL_CURRENT_MATRIX_NV
[ "CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program" ],
# == GL_CURRENT_MATRIX_NV
[ "TRANSPOSE_CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program" ],
[ "TRANSPOSE_CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX_T, 0, extra_ARB_vertex_program_ARB_fragment_program" ],
# == GL_PROGRAM_ERROR_POSITION_NV
[ "PROGRAM_ERROR_POSITION_ARB", "CONTEXT_INT(Program.ErrorPos), extra_ARB_vertex_program_ARB_fragment_program" ],

View File

@@ -1542,7 +1542,7 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target,
maxSize >>= level;
if (width < 2 * border || width > 2 * border + maxSize)
return GL_FALSE;
if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
if (height < 0 || height > ctx->Const.MaxArrayTextureLayers)
return GL_FALSE;
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))

View File

@@ -2229,7 +2229,7 @@ _mesa_compute_compressed_pixelstore(GLuint dims, mesa_format texFormat,
if (packing->RowLength) {
store->TotalBytesPerRow = packing->CompressedBlockSize *
(packing->RowLength + bw - 1) / bw;
((packing->RowLength + bw - 1) / bw);
}
store->SkipBytes += packing->SkipPixels * packing->CompressedBlockSize / bw;

View File

@@ -2946,9 +2946,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
GLenum target = _mesa_shader_stage_to_program(prog->_LinkedShaders[i]->Stage);
lower_instructions(ir, (MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2
| LOG_TO_LOG2 | INT_DIV_TO_MUL_RCP
| ((options->EmitNoPow) ? POW_TO_EXP2 : 0)
| ((target == GL_VERTEX_PROGRAM_ARB) ? SAT_TO_CLAMP
: 0)));
| ((options->EmitNoPow) ? POW_TO_EXP2 : 0)));
progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;

View File

@@ -88,6 +88,14 @@ st_destroy_clear(struct st_context *st)
cso_delete_vertex_shader(st->cso_context, st->clear.vs);
st->clear.vs = NULL;
}
if (st->clear.vs_layered) {
cso_delete_vertex_shader(st->cso_context, st->clear.vs_layered);
st->clear.vs_layered = NULL;
}
if (st->clear.gs_layered) {
cso_delete_geometry_shader(st->cso_context, st->clear.gs_layered);
st->clear.gs_layered = NULL;
}
}
@@ -127,6 +135,7 @@ set_vertex_shader(struct st_context *st)
}
cso_set_vertex_shader_handle(st->cso_context, st->clear.vs);
cso_set_geometry_shader_handle(st->cso_context, NULL);
}
@@ -135,18 +144,25 @@ set_vertex_shader_layered(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_INSTANCEID) ||
!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT)) {
assert(!"Got layered clear, but the VS layer output is unsupported");
if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_INSTANCEID)) {
assert(!"Got layered clear, but VS instancing is unsupported");
set_vertex_shader(st);
return;
}
if (!st->clear.vs_layered) {
st->clear.vs_layered = util_make_layered_clear_vertex_shader(pipe);
bool vs_layer =
pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT);
if (vs_layer) {
st->clear.vs_layered = util_make_layered_clear_vertex_shader(pipe);
} else {
st->clear.vs_layered = util_make_layered_clear_helper_vertex_shader(pipe);
st->clear.gs_layered = util_make_layered_clear_geometry_shader(pipe);
}
}
cso_set_vertex_shader_handle(st->cso_context, st->clear.vs_layered);
cso_set_geometry_shader_handle(st->cso_context, st->clear.gs_layered);
}
@@ -332,7 +348,6 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers)
}
set_fragment_shader(st);
cso_set_geometry_shader_handle(st->cso_context, NULL);
if (num_layers > 1)
set_vertex_shader_layered(st);

View File

@@ -181,6 +181,7 @@ struct st_context
void *vs;
void *fs;
void *vs_layered;
void *gs_layered;
} clear;
/** used for anything using util_draw_vertex_buffer */

View File

@@ -4022,6 +4022,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp,
newinst = v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]);
newinst->tex_target = inst->tex_target;
newinst->sampler_array_size = inst->sampler_array_size;
}
/* Make modifications to fragment program info. */
@@ -4101,6 +4102,7 @@ get_bitmap_visitor(struct st_fragment_program *fp,
newinst = v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]);
newinst->tex_target = inst->tex_target;
newinst->sampler_array_size = inst->sampler_array_size;
}
/* Make modifications to fragment program info. */
@@ -4524,8 +4526,10 @@ compile_tgsi_instruction(struct st_translate *t,
inst->saturate,
clamp_dst_color_output);
for (i = 0; i < num_src; i++)
for (i = 0; i < num_src; i++) {
assert(inst->src[i].file != PROGRAM_UNDEFINED);
src[i] = translate_src(t, &inst->src[i]);
}
switch(inst->op) {
case TGSI_OPCODE_BGNLOOP:
@@ -4555,6 +4559,7 @@ compile_tgsi_instruction(struct st_translate *t,
case TGSI_OPCODE_TG4:
case TGSI_OPCODE_LODQ:
src[num_src] = t->samplers[inst->sampler.index];
assert(src[num_src].File != TGSI_FILE_NULL);
if (inst->sampler.reladdr)
src[num_src] =
ureg_src_indirect(src[num_src], ureg_src(t->address[2]));