Re: d3d9: update locked_rect only if wined3d_surface_map succeeded

2013-10-05 Thread Lasse Rasinen
Stefan Dösinger  writes:

> Am 2013-10-03 21:45, schrieb Henri Verbeet:
>> On 3 October 2013 21:16, Lasse Rasinen  wrote:
>>> According to debugging output, Artemis Spaceship Bridge Simulator
>>> 2.0 calls LockRect twice on the same texture (for whatever
>>> reason) and crashes.
>>> 
>>> http://bugs.winehq.org/show_bug.cgi?id=34271
>>> 
>>> This change prevents the locked_rect being overwritten with
>>> garbage in that case, and the game no longer crashes.
>>> 
>> I think this patch makes sense, but could you please add a test
>> case as well? Ideally we'd also have similar tests for other
>> resources (i.e., textures, volumes, vertex buffers, index buffers)
>> and D3D versions (ddraw, d3d8), but that's not a strict
>> requirement.
> I'd expect that the correct behavior is to set pBits to NULL.
> test_volume_locking() demonstrates this for volumes.

That appears to work too, thanks.

I'll have a look at the existing tests; let's see what I come up with.
-- 
Lasse Rasinen
lrasi...@iki.fi





Re: d3d9: update locked_rect only if wined3d_surface_map succeeded

2013-10-03 Thread Stefan Dösinger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Am 2013-10-03 21:45, schrieb Henri Verbeet:
> On 3 October 2013 21:16, Lasse Rasinen  wrote:
>> According to debugging output, Artemis Spaceship Bridge Simulator
>> 2.0 calls LockRect twice on the same texture (for whatever
>> reason) and crashes.
>> 
>> http://bugs.winehq.org/show_bug.cgi?id=34271
>> 
>> This change prevents the locked_rect being overwritten with
>> garbage in that case, and the game no longer crashes.
>> 
> I think this patch makes sense, but could you please add a test
> case as well? Ideally we'd also have similar tests for other
> resources (i.e., textures, volumes, vertex buffers, index buffers)
> and D3D versions (ddraw, d3d8), but that's not a strict
> requirement.
I'd expect that the correct behavior is to set pBits to NULL.
test_volume_locking() demonstrates this for volumes.

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.20 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSTdihAAoJEN0/YqbEcdMwFOoP/RJbSrIe02Zs+3kZ3orWZTW9
kYDUNQd1kBPE4FPn4XxRBN4n8imOylpNj5M8hrAVSUlXzHhYJ7r3MWCGL9p+Xgra
ycYCN36u9eRMgo3LLzw3HH1z/D3qObwzHEgVZFa6UVgBfUqKxuWmbRLRm51uF9B+
YslkqGyX6d3+BqFO3Xw1h4AA+BxeEBmR/dCmMhEdzcRhgUPaCRjd0UiPnAD9SNLk
9hNbkmp6P5dfvz4fbYFmtbCiGwy0ma6BuyA9Oh925fQ7vcka6OHmIU78R5FU1zMF
GEMQ9rNz/coWGWs+eFh0u09WXK3BlgN+cz8YTF/bH6iRazsyfuKNrmyVXXAyxG/c
PuqTt4HhJ459KuFUGsa+he/VdqOKeoxj/h/0s/aNRnn/k6L5Coa0HUVT2BqOVi3e
4wLnHog5nwJzPMzCu89QZtJVtg9lCpfkRPPSMxt5YuM1SRoZFXCjSs9mms9TBhtt
b41UK9Oy3bJVh16YdPxNj1AFpdXpngeK19jpjErH+nhXtjm6uOKinFsKYD/8L285
cRLvyND3SYK2JxyezAEEuUJlA95qKFZdcLqUPjj2ZAoXEeMCgVefIJIRPQ/znM8V
vZHH1ejo0SvtcpidTa4LLCyccbUqTPl1BpSXPLbrRiTqwdIeDuWHNo/rTVRVLGBZ
JmhUXEaVBE3Uuo+VzPbD
=38ER
-END PGP SIGNATURE-




Re: d3d9: update locked_rect only if wined3d_surface_map succeeded

2013-10-03 Thread Henri Verbeet
On 3 October 2013 21:16, Lasse Rasinen  wrote:
> According to debugging output, Artemis Spaceship Bridge Simulator 2.0
> calls LockRect twice on the same texture (for whatever reason) and crashes.
>
> http://bugs.winehq.org/show_bug.cgi?id=34271
>
> This change prevents the locked_rect being overwritten with garbage in
> that case, and the game no longer crashes.
>
I think this patch makes sense, but could you please add a test case
as well? Ideally we'd also have similar tests for other resources
(i.e., textures, volumes, vertex buffers, index buffers) and D3D
versions (ddraw, d3d8), but that's not a strict requirement.

> +if (hr == WINED3D_OK) {
> +locked_rect->Pitch = map_desc.row_pitch;
> +locked_rect->pBits = map_desc.data;
> +}
>
Minor style issue, this should be:

if (SUCCEEDED(hr))
{
...
}