Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
577d5d25
Commit
577d5d25
authored
18 years ago
by
Markus Amsler
Committed by
Alexandre Julliard
18 years ago
Browse files
Options
Downloads
Patches
Plain Diff
d3d8: Test refcount forwarding.
parent
886c196e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/d3d8/tests/device.c
+55
-4
55 additions, 4 deletions
dlls/d3d8/tests/device.c
with
55 additions
and
4 deletions
dlls/d3d8/tests/device.c
+
55
−
4
View file @
577d5d25
...
...
@@ -60,6 +60,13 @@ static int get_refcount(IUnknown *object)
ok(count == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, count); \
}
#define CHECK_ADDREF_REFCOUNT(obj,rc) \
{ \
int rc_new = rc; \
int count = IUnknown_AddRef( (IUnknown *)obj ); \
ok(count == rc_new, "Invalid refcount. Expected %d got %d\n", rc_new, count); \
}
#define CHECK_SURFACE_CONTAINER(obj,iid,expected) \
{ \
void *container_ptr = (void *)0x1337c0d3; \
...
...
@@ -254,6 +261,7 @@ static void test_refcount(void)
IDirect3DCubeTexture8
*
pCubeTexture
=
NULL
;
IDirect3DTexture8
*
pTexture
=
NULL
;
IDirect3DVolumeTexture8
*
pVolumeTexture
=
NULL
;
IDirect3DVolume8
*
pVolumeLevel
=
NULL
;
IDirect3DSurface8
*
pStencilSurface
=
NULL
;
IDirect3DSurface8
*
pImageSurface
=
NULL
;
IDirect3DSurface8
*
pRenderTarget
=
NULL
;
...
...
@@ -315,6 +323,7 @@ static void test_refcount(void)
* - the container is the device
* - they hold a refernce to the device
* - they are created with a refcount of 0 (Get/Release returns orignial refcount)
* - the refcount is not forwarded to the container.
*/
hr
=
IDirect3DDevice8_GetRenderTarget
(
pDevice
,
&
pRenderTarget
);
todo_wine
CHECK_CALL
(
hr
,
"GetRenderTarget"
,
pDevice
,
++
refcount
);
...
...
@@ -322,6 +331,12 @@ static void test_refcount(void)
{
todo_wine
CHECK_SURFACE_CONTAINER
(
pRenderTarget
,
IID_IDirect3DDevice8
,
pDevice
);
todo_wine
CHECK_REFCOUNT
(
pRenderTarget
,
1
);
todo_wine
CHECK_ADDREF_REFCOUNT
(
pRenderTarget
,
2
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
refcount
);
todo_wine
CHECK_RELEASE_REFCOUNT
(
pRenderTarget
,
1
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
refcount
);
hr
=
IDirect3DDevice8_GetRenderTarget
(
pDevice
,
&
pRenderTarget
);
todo_wine
CHECK_CALL
(
hr
,
"GetRenderTarget"
,
pDevice
,
refcount
);
todo_wine
CHECK_REFCOUNT
(
pRenderTarget
,
2
);
...
...
@@ -349,6 +364,12 @@ static void test_refcount(void)
{
CHECK_SURFACE_CONTAINER
(
pStencilSurface
,
IID_IDirect3DDevice8
,
pDevice
);
todo_wine
CHECK_REFCOUNT
(
pStencilSurface
,
1
);
todo_wine
CHECK_ADDREF_REFCOUNT
(
pStencilSurface
,
2
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
refcount
);
todo_wine
CHECK_RELEASE_REFCOUNT
(
pStencilSurface
,
1
);
todo_wine
CHECK_REFCOUNT
(
pDevice
,
refcount
);
todo_wine
CHECK_RELEASE_REFCOUNT
(
pStencilSurface
,
0
);
pStencilSurface
=
NULL
;
}
...
...
@@ -400,12 +421,44 @@ static void test_refcount(void)
hr
=
IDirect3DTexture8_GetSurfaceLevel
(
pTexture
,
1
,
&
pTextureLevel
);
CHECK_CALL
(
hr
,
"GetSurfaceLevel"
,
pDevice
,
refcount
);
/* But should increment texture's refcount */
CHECK_CALL
(
hr
,
"GetSurfaceLevel"
,
pTexture
,
tmp
+
1
);
CHECK_REFCOUNT
(
pTexture
,
tmp
+
1
);
/* Because the texture and surface refcount are identical */
if
(
pTextureLevel
)
{
CHECK_REFCOUNT
(
pTextureLevel
,
tmp
+
1
);
CHECK_ADDREF_REFCOUNT
(
pTextureLevel
,
tmp
+
2
);
CHECK_REFCOUNT
(
pTexture
,
tmp
+
2
);
CHECK_RELEASE_REFCOUNT
(
pTextureLevel
,
tmp
+
1
);
CHECK_REFCOUNT
(
pTexture
,
tmp
+
1
);
CHECK_RELEASE_REFCOUNT
(
pTexture
,
tmp
);
CHECK_REFCOUNT
(
pTextureLevel
,
tmp
);
}
}
hr
=
IDirect3DDevice8_CreateCubeTexture
(
pDevice
,
32
,
0
,
0
,
D3DFMT_X8R8G8B8
,
D3DPOOL_DEFAULT
,
&
pCubeTexture
);
CHECK_CALL
(
hr
,
"CreateCubeTexture"
,
pDevice
,
++
refcount
);
hr
=
IDirect3DDevice8_CreateVolumeTexture
(
pDevice
,
32
,
32
,
2
,
0
,
0
,
D3DFMT_X8R8G8B8
,
D3DPOOL_DEFAULT
,
&
pVolumeTexture
);
CHECK_CALL
(
hr
,
"CreateVolumeTexture"
,
pDevice
,
++
refcount
);
if
(
pVolumeTexture
)
{
tmp
=
get_refcount
(
(
IUnknown
*
)
pVolumeTexture
);
/* This should not increment device refcount */
hr
=
IDirect3DVolumeTexture8_GetVolumeLevel
(
pVolumeTexture
,
0
,
&
pVolumeLevel
);
CHECK_CALL
(
hr
,
"GetVolumeLevel"
,
pDevice
,
refcount
);
/* But should increment volume texture's refcount */
CHECK_REFCOUNT
(
pVolumeTexture
,
tmp
+
1
);
/* Because the volume texture and volume refcount are identical */
if
(
pVolumeLevel
)
{
CHECK_REFCOUNT
(
pVolumeLevel
,
tmp
+
1
);
CHECK_ADDREF_REFCOUNT
(
pVolumeLevel
,
tmp
+
2
);
CHECK_REFCOUNT
(
pVolumeTexture
,
tmp
+
2
);
CHECK_RELEASE_REFCOUNT
(
pVolumeLevel
,
tmp
+
1
);
CHECK_REFCOUNT
(
pVolumeTexture
,
tmp
+
1
);
CHECK_RELEASE_REFCOUNT
(
pVolumeTexture
,
tmp
);
CHECK_REFCOUNT
(
pVolumeLevel
,
tmp
);
}
}
/* Surfaces */
hr
=
IDirect3DDevice8_CreateDepthStencilSurface
(
pDevice
,
32
,
32
,
D3DFMT_D24S8
,
D3DMULTISAMPLE_NONE
,
&
pStencilSurface
);
CHECK_CALL
(
hr
,
"CreateDepthStencilSurface"
,
pDevice
,
++
refcount
);
...
...
@@ -459,9 +512,7 @@ cleanup:
if
(
dVertexShader
!=
-
1
)
IDirect3DDevice8_DeleteVertexShader
(
pDevice
,
dVertexShader
);
if
(
dPixelShader
!=
-
1
)
IDirect3DDevice8_DeletePixelShader
(
pDevice
,
dPixelShader
);
/* Textures */
/* pTextureLevel is holding a reference to the pTexture */
CHECK_RELEASE
(
pTexture
,
pDevice
,
refcount
);
CHECK_RELEASE
(
pTextureLevel
,
pDevice
,
--
refcount
);
CHECK_RELEASE
(
pTexture
,
pDevice
,
--
refcount
);
CHECK_RELEASE
(
pCubeTexture
,
pDevice
,
--
refcount
);
CHECK_RELEASE
(
pVolumeTexture
,
pDevice
,
--
refcount
);
/* Surfaces */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment