[PATCH 5/5] wined3d: Set color keys through the command stream.

Stefan Dösinger stefandoesinger at gmail.com
Tue Apr 7 05:53:51 CDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 2015-04-07 um 12:17 schrieb Henri Verbeet:
> On 6 April 2015 at 00:28, Stefan Dösinger <stefan at codeweavers.com>
> wrote:
>> +#define WINED3D_CKEY_REMOVE 0x80000000 +
> It seems unfortunate to define part of the flags in 
> include/wine/wined3d.h and part of the flags in dlls/wined3d/cs.c. 
> You'd probably also want to mask out private flags in 
> wined3d_cs_emit_set_color_key().
There are multiple ways to pass this information. The simplest one is
an extra field in struct wined3d_cs_set_color_key, but that seems
unfortunate because we have plenty of spare bits elsewhere. I could
also define a separate op for unsetting the key. Whatever you prefer.

> This one is different in that it operates on a texture, and
> anything that would need to read the color key would then need to
> either wait for the texture to become idle, or run from the CS
> itself.
The color key is currently read by the texture loading code, which is
either called by draws (called through the CS) or by blits (which we
want to call through the CS at some point). I don't see a clean way to
move the read to the main thread.

What we could do is shadow the texture 0 color key in wined3d_state.
In this case the command stream op would only be used for changing
this mirrored value, and it would be emitted when texture 0 is changed
or when texture 0's color key is changed(*). In this case we need a
separate way to pass the key to blits (could be a blit op parameter,
and passed around between functions), and wined3d_texture_load needs
to somehow find out when to read the color key from the state structure.

Note that for GLSL / ARB fragment processing I'll handle color keying
with discard / KIL in the shader and the color key becomes more or
less a shader constant, and I'll keep track of changes to it with a
new state.

The immediate requirement that prompted this change is that setting
the key on the texture that's currently bound to texture 0 should
invalidate WINED3D_RS_COLORKEYENABLE. The state invalidation must be
done through the command stream or wait for all commands to be executed.

(*): Windows drivers disagree on color keying on textures 1-7. dx9+
GPUs apply the color key, at least my Radeon 9000 (dx8) does not, and
doesn't seem to have circuitry for more than one key. I think we can
safely keep color keying limited to texture 0.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJVI7c/AAoJEN0/YqbEcdMwNp0P/RLwIPMvauRRxV/szi1lvWjG
QZw0kileb1rd8RNVcsnXBaa0XU9emfHvjAIu5qr2vVfha4Z7Zf+K15/OfzNfIahW
RQ12LJAo84690zLMq1FIyfWiqDLKbcR7Ais/Z7Haxnzi70q7JZwIUamZN0QO1j5k
4RZsxWnhDzOJpLeXSJQq69RrDTPkz2/FdCs/ipvnh40ORiTkFOna74zdCP1VgpI7
/GX0qUCuCyxnETea3RCHp+Wu6Is3Ji+ICUfDeqkJ0xtTUyu+Pek25utbpavdB0Lh
X2Rl++Bb3z1GAcMZFv8VRQokWlMfIxep+yq2CoSzP7afaH+xLfXn30GLqVh+uoCx
8/elA8G9QBLP+y/fP2OjV1l2WvaPDru17ZPxUXL9QbyvAcXDihQYgAfaFi3+peQ7
KfpM1Y0Wq7EYyWUmG/U+mWJafDIp5p89qWo1wXRn/0ntYdY0+ZuKU+KOhX8GSNCr
nZp48fZED5D88nPLK4pGJap77qfH22d/aVeZ0ryXuFvnBN3G6MDh9X9bTuDrZ+eu
D8s5kySrB0qX4ZhDdfQmavMbFw94FjW+pT9gD1ZsOlgZ0QvVVx54wqqDTbSJTVJX
woiTOYZKgz4lx1Q0rcUXXOjk5/ouIy9BK/ugMqf6i1Zpp/syEwxB58j29maH9yTk
ZuxX9/hbxAhvVvIp6bt4
=P0DT
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list