[PATCH 3/5] wined3d: Check relative addressing indices when accessing uniforms in GLSL shaders.

Stefan Dösinger stefandoesinger at gmail.com
Thu Feb 11 15:03:36 CST 2016


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

> +                        sprintf(register_name, "(%s + %u >= 0 &&
> %s + %u < %u ? %s_c[%s + %u] : vec4(0.0))",
Did you do any testing on the performance impact of this? This seems
like something where it's convenient to sacrifice performance
everywhere for a corner case, but later on we wonder why games are
unplayably slow. Keep in mind that currently it's pretty difficult to
be GPU limited. With the CSMT patches you'll have a higher chance of
being GPU limited, but there's no guarantee of course.

dx10+ GPUs don't return 0.0 reliably on Windows here. My Geforce GPUs
returned the int constants at c[-32] to c[-48].

I think there are additional options of increasing our odds of
behaving like Windows. E.g. with constant buffers we could create a
buffer that matches the hardware page size (which we can't query, I
know) and fill everything except the 256 d3d9 constants with zeroes.
If the out of bounds read falls into the buffer we get a zero. If not,
the hardware should detect the invalid read and I'd expect it to
return zero due to exactly this d3d requirement.

Also I think d3d9 HW should "just work" in this regard because only
256 registers exist.

Yes, I am aware that there are more games than just The Witcher that
are affected by this problem.

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

iQIcBAEBCAAGBQJWvPcoAAoJEN0/YqbEcdMwUJwQAI4eKz1YGS4N/VzSAt/7QlT+
xq6KOrGGjkbJCjtW97R16hisqLTrNqmq80qvHAPHX0Nh2Pa5Dcx9sbbgryGEsSfm
ExzAKuMUSPsNch9mb5+72zXYn71UCRmBZxcfkt/NwQSD8qfhQD13OdxhQrWordMJ
ZKphTjiBk7/O2gA6myxt7QcbFYjLHuee6kA909EF0tEpfjQ2Zeu+OsvTUnKbpQ1o
P/nUU8goFpn0yom3X07dnjXkDUnvpuyK2d+5Mgp2xt9sHya0gGN5dbTNnRyEPs7O
IwmWEUzVTQxEJYakASjZxA+3FlkzJrCZUHKufWNWMwPSFFCThuF/JXEoFb4+khW9
uVW0J73q257JibOvWg1AsJwGumn+5jKtXqrAO0WZlshxDx6iudN8RMEv2RngeMeo
SFzYWfzHgLfHYmCeGVpPGqc9H3ThTukvymi3bBitqv0t/Zp7cXQ8fh0ghHNdRiEw
6ygzJxUJay3CRr9VKm/8hUaJBHCFdZOYjEk1z5IpgJhS4igeab7bE/z6KenCiY08
0/Mpb7UnUnrKb229u0fwEMyJSUHt8FkSf5tJBi4Bnl11qfDJdBccUc/5HuYB2Puk
XfbWNHUDZA6clW/G2MumekuyUi9F4QIWypUrsqgBaWgJ+xxTzmm3UCOQkc4uv9as
h5IrX0kN1CRYpBMwurXg
=K2RI
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list