Starcraft Remastered is looking up for the GPU physical memory size to
check for minimum requirements to enable RealTime Lighting.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46624
Signed-off-by: Jon Doron <arilou@gmail.com>
These methods are not called from any of our objects that hold ref to the
inner window only, and since we return outer windows to external callers
now, they *must* have a ref to the outer window, which effectively means
these cannot be NULL. And some other places didn't check for NULL either
(e.g. get_parent).
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This would have crashed on detached windows, and checking the navigation_start
time has the same effect except it's decoupled from the outer window.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Use of last_was_rhw in these state handlers is, firstly, confusing to read.
The variable is actually supposed to be set for *this* draw, not the last one,
and state handlers indeed expect that, but that fact isn't obvious. Reading from
context->stream_info instead is clearer.
Secondly, since last_was_rhw is set by the STATE_VDECL handler, any other state
depending on it (including some, though not all, of the sites changed here) thus
has an implicit state handler ordering assumption. This is, needless to say,
fragile. context->stream_info is computed before state handlers, so that
dependency is a bit less fragile.
The comment was originally added in 4b831a5d3e.
At that point, it referred only to non-FFP shader constants. Subsequently
38934fe70d moved bumpenv constant loading to the
misc pipeline, apparently out of concerns that bumpenv constants might interact
badly with shader constants.
It's not clear whether those concerns were ever justified, and normal shader
constants are now sufficiently untangled from each other anyway. However,
bumpenv constants, like e.g. color keys, affect both FFP and non-FFP pipelines,
so it makes the most sense for them to remain in the misc state table anyway.
push_dc_driver() places drivers based on their priorities, so the newly created driver is not
necessarily on top. Thus in windrv_CreateDC(), find_dc_driver() should be used to find the DIB
driver instead of assuming the DIB driver is the top driver, which could be the path driver because
it has a higher priority.
The exact wrong code path was:
1. A path driver with priority 400 is created for a DC.
2. windrv_CreateDC() is called to create a window driver for the DC.
3. Then in dibdrv_CreateDC(), push_dc_driver() is called with 'dev' pointing to the top driver, which is the path driver.
4. push_dc_driver() updates 'dev' to point to the address of the next driver because DIB driver has a lower 300 priority.
5. The DIB driver is assigned to 'dev', which is not the original parameter passed into push_dc_driver().
6. In windrv_CreateDC(), get_dibdrv_pdev(*dev) is called, assuming the top driver is the DIB driver. But actually the top
driver that '*dev' points to is still the path driver.
The added tests can demonstrate the memory corruption before this fix is applied.