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

Matteo Bruni matteo.mystral at gmail.com
Thu Feb 11 16:54:38 CST 2016


2016-02-11 22:03 GMT+01:00 Stefan Dösinger <stefandoesinger at gmail.com>:
> -----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?

No, no serious testing. I can try to collect some data though.

> 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.

In practice that should work although OpenGL doesn't offer any
guarantee. Even ARB_robust_buffer_access_behavior explicitly mentions
"Out-of-bounds reads may return values from within the buffer object
or zero."
I guess we can reevaluate that kind of solution when we'll switch to
using UBOs for d3d8/9 constants.

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

That's ultimately the reason I sent this. Currently we don't quite
know which other games are broken (maybe more subtly) by this issue
and every time there is some kind of weird bug in a game one has
always the suspicion "this isn't the float constant register overrun
thing again, right?" in the back of his head...

2016-02-11 22:27 GMT+01:00 Henri Verbeet <hverbeet at gmail.com>:
> Yeah, I'm not all that convinced this is how we want to fix this, or
> that this is necessarily something that needs fixing on our end. I
> could perhaps be convinced to have a registry setting along the lines
> of StrictDrawOrdering though.

Actually a registry setting (RangeCheckFloatConstants?) should work
WRT my worry above. I'll send an updated version.



More information about the wine-devel mailing list