Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8c158c1e
Commit
8c158c1e
authored
Feb 15, 2015
by
Stefan Dösinger
Committed by
Alexandre Julliard
Feb 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Port test_texturemapblend to ddraw2.c.
parent
c0efc3eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
332 additions
and
0 deletions
+332
-0
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+332
-0
No files found.
dlls/ddraw/tests/ddraw2.c
View file @
8c158c1e
...
...
@@ -6998,6 +6998,337 @@ static void test_surface_desc_lock(void)
DestroyWindow
(
window
);
}
static
void
test_texturemapblend
(
void
)
{
HRESULT
hr
;
DDSURFACEDESC
ddsd
;
DDBLTFX
fx
;
static
RECT
rect
=
{
0
,
0
,
64
,
128
};
static
D3DRECT
clear_rect
=
{{
0
},
{
0
},
{
640
},
{
480
}};
DDCOLORKEY
ckey
;
IDirectDrawSurface
*
surface
,
*
rt
;
IDirect3DTexture2
*
texture
;
D3DTEXTUREHANDLE
texture_handle
;
HWND
window
;
IDirectDraw2
*
ddraw
;
IDirect3DDevice2
*
device
;
IDirect3DMaterial2
*
material
;
IDirect3DViewport2
*
viewport
;
ULONG
ref
;
D3DCOLOR
color
;
static
D3DTLVERTEX
test1_quads
[]
=
{
{{
0
.
0
f
},
{
0
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0xffffffff
},
{
0
},
{
0
.
0
f
},
{
0
.
0
f
}},
{{
0
.
0
f
},
{
240
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0xffffffff
},
{
0
},
{
0
.
0
f
},
{
1
.
0
f
}},
{{
640
.
0
f
},
{
0
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0xffffffff
},
{
0
},
{
1
.
0
f
},
{
0
.
0
f
}},
{{
640
.
0
f
},
{
240
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0xffffffff
},
{
0
},
{
1
.
0
f
},
{
1
.
0
f
}},
{{
0
.
0
f
},
{
240
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x80ffffff
},
{
0
},
{
0
.
0
f
},
{
0
.
0
f
}},
{{
0
.
0
f
},
{
480
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x80ffffff
},
{
0
},
{
0
.
0
f
},
{
1
.
0
f
}},
{{
640
.
0
f
},
{
240
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x80ffffff
},
{
0
},
{
1
.
0
f
},
{
0
.
0
f
}},
{{
640
.
0
f
},
{
480
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x80ffffff
},
{
0
},
{
1
.
0
f
},
{
1
.
0
f
}},
},
test2_quads
[]
=
{
{{
0
.
0
f
},
{
0
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x00ff0080
},
{
0
},
{
0
.
0
f
},
{
0
.
0
f
}},
{{
0
.
0
f
},
{
240
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x00ff0080
},
{
0
},
{
0
.
0
f
},
{
1
.
0
f
}},
{{
640
.
0
f
},
{
0
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x00ff0080
},
{
0
},
{
1
.
0
f
},
{
0
.
0
f
}},
{{
640
.
0
f
},
{
240
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x00ff0080
},
{
0
},
{
1
.
0
f
},
{
1
.
0
f
}},
{{
0
.
0
f
},
{
240
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x008000ff
},
{
0
},
{
0
.
0
f
},
{
0
.
0
f
}},
{{
0
.
0
f
},
{
480
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x008000ff
},
{
0
},
{
0
.
0
f
},
{
1
.
0
f
}},
{{
640
.
0
f
},
{
240
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x008000ff
},
{
0
},
{
1
.
0
f
},
{
0
.
0
f
}},
{{
640
.
0
f
},
{
480
.
0
f
},
{
0
.
0
f
},
{
1
.
0
f
},
{
0x008000ff
},
{
0
},
{
1
.
0
f
},
{
1
.
0
f
}},
};
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ddraw
=
create_ddraw
();
ok
(
!!
ddraw
,
"Failed to create a ddraw object.
\n
"
);
if
(
!
(
device
=
create_device
(
ddraw
,
window
,
DDSCL_NORMAL
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
window
);
IDirectDraw2_Release
(
ddraw
);
return
;
}
hr
=
IDirect3DDevice2_GetRenderTarget
(
device
,
&
rt
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get render target, hr %#x.
\n
"
,
hr
);
material
=
create_diffuse_material
(
device
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
viewport
=
create_viewport
(
device
,
0
,
0
,
640
,
480
);
viewport_set_background
(
device
,
viewport
,
material
);
hr
=
IDirect3DDevice2_SetCurrentViewport
(
device
,
viewport
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set current viewport, hr %#x.
\n
"
,
hr
);
/* Test alpha with DDPF_ALPHAPIXELS texture - should be taken from texture alpha channel.
*
* The vertex alpha is completely ignored in this case, so case 1 and 2 combined are not
* a D3DTOP_MODULATE with texture alpha = 0xff in case 2 (no alpha in texture). */
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_HEIGHT
|
DDSD_WIDTH
|
DDSD_PIXELFORMAT
;
ddsd
.
dwHeight
=
128
;
ddsd
.
dwWidth
=
128
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
|
DDPF_ALPHAPIXELS
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
U5
(
ddsd
.
ddpfPixelFormat
).
dwRGBAlphaBitMask
=
0xff000000
;
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_QueryInterface
(
surface
,
&
IID_IDirect3DTexture2
,
(
void
**
)
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get texture interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture2_GetHandle
(
texture
,
device
,
&
texture_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get texture handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_TEXTUREHANDLE
,
texture_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_Clear
(
viewport
,
1
,
&
clear_rect
,
D3DCLEAR_TARGET
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear render target, hr %#x.
\n
"
,
hr
);
memset
(
&
fx
,
0
,
sizeof
(
fx
));
fx
.
dwSize
=
sizeof
(
fx
);
U5
(
fx
).
dwFillColor
=
0xff0000ff
;
hr
=
IDirectDrawSurface_Blt
(
surface
,
NULL
,
NULL
,
NULL
,
DDBLT_COLORFILL
|
DDBLT_WAIT
,
&
fx
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear texture, hr %#x.
\n
"
,
hr
);
U5
(
fx
).
dwFillColor
=
0x800000ff
;
hr
=
IDirectDrawSurface_Blt
(
surface
,
&
rect
,
NULL
,
NULL
,
DDBLT_COLORFILL
|
DDBLT_WAIT
,
&
fx
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear texture, hr %#x.
\n
"
,
hr
);
/* Note that the ddraw1 version of this test runs tests 1-3 with D3DRENDERSTATE_COLORKEYENABLE
* enabled, whereas this version only runs test 4 with color keying on. Because no color key
* is set on the texture this should not result in different behavior. */
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_CULLMODE
,
D3DCULL_NONE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_ZENABLE
,
D3DZB_FALSE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_SRCBLEND
,
D3DBLEND_SRCALPHA
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_DESTBLEND
,
D3DBLEND_INVSRCALPHA
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_ALPHABLENDENABLE
,
TRUE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_TEXTUREMAPBLEND
,
D3DTBLEND_MODULATE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DVT_TLVERTEX
,
&
test1_quads
[
0
],
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DVT_TLVERTEX
,
&
test1_quads
[
4
],
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
color
=
get_surface_color
(
rt
,
5
,
5
);
ok
(
compare_color
(
color
,
0x00000080
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
400
,
5
);
ok
(
compare_color
(
color
,
0x000000ff
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
5
,
245
);
ok
(
compare_color
(
color
,
0x00000080
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
400
,
245
);
ok
(
compare_color
(
color
,
0x000000ff
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
IDirect3DTexture2_Release
(
texture
);
ref
=
IDirectDrawSurface_Release
(
surface
);
ok
(
ref
==
0
,
"Surface not properly released, refcount %u.
\n
"
,
ref
);
/* Test alpha with texture that has no alpha channel - alpha should be taken from diffuse vertex color. */
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_HEIGHT
|
DDSD_WIDTH
|
DDSD_PIXELFORMAT
;
ddsd
.
dwHeight
=
128
;
ddsd
.
dwWidth
=
128
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_QueryInterface
(
surface
,
&
IID_IDirect3DTexture2
,
(
void
**
)
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get texture interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture2_GetHandle
(
texture
,
device
,
&
texture_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get texture handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_TEXTUREHANDLE
,
texture_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_Clear
(
viewport
,
1
,
&
clear_rect
,
D3DCLEAR_TARGET
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear render target, hr %#x.
\n
"
,
hr
);
U5
(
fx
).
dwFillColor
=
0xff0000ff
;
hr
=
IDirectDrawSurface_Blt
(
surface
,
NULL
,
NULL
,
NULL
,
DDBLT_COLORFILL
|
DDBLT_WAIT
,
&
fx
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear texture, hr %#x.
\n
"
,
hr
);
U5
(
fx
).
dwFillColor
=
0x800000ff
;
hr
=
IDirectDrawSurface_Blt
(
surface
,
&
rect
,
NULL
,
NULL
,
DDBLT_COLORFILL
|
DDBLT_WAIT
,
&
fx
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DVT_TLVERTEX
,
&
test1_quads
[
0
],
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DVT_TLVERTEX
,
&
test1_quads
[
4
],
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
color
=
get_surface_color
(
rt
,
5
,
5
);
ok
(
compare_color
(
color
,
0x000000ff
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
400
,
5
);
ok
(
compare_color
(
color
,
0x000000ff
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
5
,
245
);
ok
(
compare_color
(
color
,
0x00000080
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
400
,
245
);
ok
(
compare_color
(
color
,
0x00000080
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
IDirect3DTexture2_Release
(
texture
);
ref
=
IDirectDrawSurface_Release
(
surface
);
ok
(
ref
==
0
,
"Surface not properly released, refcount %u.
\n
"
,
ref
);
/* Test RGB - should multiply color components from diffuse vertex color and texture. */
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_HEIGHT
|
DDSD_WIDTH
|
DDSD_PIXELFORMAT
;
ddsd
.
dwHeight
=
128
;
ddsd
.
dwWidth
=
128
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
|
DDPF_ALPHAPIXELS
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
U5
(
ddsd
.
ddpfPixelFormat
).
dwRGBAlphaBitMask
=
0xff000000
;
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_QueryInterface
(
surface
,
&
IID_IDirect3DTexture2
,
(
void
**
)
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get texture interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture2_GetHandle
(
texture
,
device
,
&
texture_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get texture handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_TEXTUREHANDLE
,
texture_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_Clear
(
viewport
,
1
,
&
clear_rect
,
D3DCLEAR_TARGET
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear render target, hr %#x.
\n
"
,
hr
);
U5
(
fx
).
dwFillColor
=
0x00ffffff
;
hr
=
IDirectDrawSurface_Blt
(
surface
,
NULL
,
NULL
,
NULL
,
DDBLT_COLORFILL
|
DDBLT_WAIT
,
&
fx
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear texture, hr %#x.
\n
"
,
hr
);
U5
(
fx
).
dwFillColor
=
0x00ffff80
;
hr
=
IDirectDrawSurface_Blt
(
surface
,
&
rect
,
NULL
,
NULL
,
DDBLT_COLORFILL
|
DDBLT_WAIT
,
&
fx
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_ALPHABLENDENABLE
,
FALSE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DVT_TLVERTEX
,
&
test2_quads
[
0
],
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DVT_TLVERTEX
,
&
test2_quads
[
4
],
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
color
=
get_surface_color
(
rt
,
5
,
5
);
ok
(
compare_color
(
color
,
0x00ff0040
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
400
,
5
);
ok
(
compare_color
(
color
,
0x00ff0080
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
5
,
245
);
ok
(
compare_color
(
color
,
0x00800080
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
400
,
245
);
ok
(
compare_color
(
color
,
0x008000ff
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
IDirect3DTexture2_Release
(
texture
);
ref
=
IDirectDrawSurface_Release
(
surface
);
ok
(
ref
==
0
,
"Surface not properly released, refcount %u.
\n
"
,
ref
);
/* Test alpha again, now with color keyed texture (colorkey emulation in wine can interfere). */
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_HEIGHT
|
DDSD_WIDTH
|
DDSD_PIXELFORMAT
;
ddsd
.
dwHeight
=
128
;
ddsd
.
dwWidth
=
128
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
16
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0xf800
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x07e0
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x001f
;
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_QueryInterface
(
surface
,
&
IID_IDirect3DTexture2
,
(
void
**
)
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get texture interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture2_GetHandle
(
texture
,
device
,
&
texture_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get texture handle, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_TEXTUREHANDLE
,
texture_handle
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DViewport2_Clear
(
viewport
,
1
,
&
clear_rect
,
D3DCLEAR_TARGET
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear render target, hr %#x.
\n
"
,
hr
);
U5
(
fx
).
dwFillColor
=
0xf800
;
hr
=
IDirectDrawSurface_Blt
(
surface
,
NULL
,
NULL
,
NULL
,
DDBLT_COLORFILL
|
DDBLT_WAIT
,
&
fx
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear texture, hr %#x.
\n
"
,
hr
);
U5
(
fx
).
dwFillColor
=
0x001f
;
hr
=
IDirectDrawSurface_Blt
(
surface
,
&
rect
,
NULL
,
NULL
,
DDBLT_COLORFILL
|
DDBLT_WAIT
,
&
fx
);
ok
(
SUCCEEDED
(
hr
),
"Failed to clear texture, hr %#x.
\n
"
,
hr
);
ckey
.
dwColorSpaceLowValue
=
0x001f
;
ckey
.
dwColorSpaceHighValue
=
0x001f
;
hr
=
IDirectDrawSurface_SetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
ckey
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_ALPHABLENDENABLE
,
TRUE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_SetRenderState
(
device
,
D3DRENDERSTATE_COLORKEYENABLE
,
TRUE
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set render state, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DVT_TLVERTEX
,
&
test1_quads
[
0
],
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
D3DVT_TLVERTEX
,
&
test1_quads
[
4
],
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice2_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
color
=
get_surface_color
(
rt
,
5
,
5
);
ok
(
compare_color
(
color
,
0x00000000
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
400
,
5
);
ok
(
compare_color
(
color
,
0x00ff0000
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
5
,
245
);
ok
(
compare_color
(
color
,
0x00000000
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
color
=
get_surface_color
(
rt
,
400
,
245
);
ok
(
compare_color
(
color
,
0x00800000
,
2
),
"Got unexpected color 0x%08x.
\n
"
,
color
);
IDirect3DTexture2_Release
(
texture
);
ref
=
IDirectDrawSurface_Release
(
surface
);
ok
(
ref
==
0
,
"Surface not properly released, refcount %u.
\n
"
,
ref
);
destroy_viewport
(
device
,
viewport
);
ref
=
IDirect3DMaterial2_Release
(
material
);
ok
(
ref
==
0
,
"Material not properly released, refcount %u.
\n
"
,
ref
);
IDirectDrawSurface_Release
(
rt
);
IDirect3DDevice2_Release
(
device
);
ref
=
IDirectDraw2_Release
(
ddraw
);
ok
(
ref
==
0
,
"Ddraw object not properly released, refcount %u.
\n
"
,
ref
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw2
)
{
IDirectDraw2
*
ddraw
;
...
...
@@ -7069,4 +7400,5 @@ START_TEST(ddraw2)
test_palette_alpha
();
test_lost_device
();
test_surface_desc_lock
();
test_texturemapblend
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment