Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1283772a
Commit
1283772a
authored
Mar 15, 2007
by
H. Verbeet
Committed by
Alexandre Julliard
Mar 16, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Add a LockRect test for DXTn formats.
parent
fd64779f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
1 deletion
+57
-1
surface.c
dlls/d3d9/tests/surface.c
+57
-1
No files found.
dlls/d3d9/tests/surface.c
View file @
1283772a
/*
* Copyright
(C) 2006
Henri Verbeet
* Copyright
2006-2007
Henri Verbeet
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -172,6 +172,61 @@ static void test_surface_alignment(IDirect3DDevice9 *device_ptr)
}
}
/* Since the DXT formats are based on 4x4 blocks, locking works slightly
* different than with regular formats. This patch verifies we return the
* correct memory offsets */
static
void
test_lockrect_offset
(
IDirect3DDevice9
*
device
)
{
IDirect3DSurface9
*
surface
=
0
;
const
RECT
rect
=
{
60
,
60
,
68
,
68
};
D3DLOCKED_RECT
locked_rect
;
unsigned
int
expected_offset
;
unsigned
int
offset
;
unsigned
int
i
;
BYTE
*
base
;
HRESULT
hr
;
const
struct
{
D3DFORMAT
fmt
;
const
char
*
name
;
unsigned
int
block_width
;
unsigned
int
block_height
;
unsigned
int
block_size
;
}
dxt_formats
[]
=
{
{
D3DFMT_DXT1
,
"D3DFMT_DXT1"
,
4
,
4
,
8
},
{
D3DFMT_DXT2
,
"D3DFMT_DXT2"
,
4
,
4
,
16
},
{
D3DFMT_DXT3
,
"D3DFMT_DXT3"
,
4
,
4
,
16
},
{
D3DFMT_DXT4
,
"D3DFMT_DXT4"
,
4
,
4
,
16
},
{
D3DFMT_DXT5
,
"D3DFMT_DXT5"
,
4
,
4
,
16
},
};
for
(
i
=
0
;
i
<
(
sizeof
(
dxt_formats
)
/
sizeof
(
*
dxt_formats
));
++
i
)
{
hr
=
IDirect3DDevice9_CreateOffscreenPlainSurface
(
device
,
128
,
128
,
dxt_formats
[
i
].
fmt
,
D3DPOOL_SCRATCH
,
&
surface
,
0
);
ok
(
SUCCEEDED
(
hr
),
"CreateOffscreenPlainSurface failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DSurface9_LockRect
(
surface
,
&
locked_rect
,
NULL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"LockRect failed (%08x)
\n
"
,
hr
);
base
=
locked_rect
.
pBits
;
hr
=
IDirect3DSurface9_UnlockRect
(
surface
);
ok
(
SUCCEEDED
(
hr
),
"UnlockRect failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DSurface9_LockRect
(
surface
,
&
locked_rect
,
&
rect
,
0
);
ok
(
SUCCEEDED
(
hr
),
"LockRect failed (%08x)
\n
"
,
hr
);
offset
=
(
BYTE
*
)
locked_rect
.
pBits
-
base
;
expected_offset
=
(
rect
.
top
/
dxt_formats
[
i
].
block_height
)
*
locked_rect
.
Pitch
+
(
rect
.
left
/
dxt_formats
[
i
].
block_width
)
*
dxt_formats
[
i
].
block_size
;
todo_wine
ok
(
offset
==
expected_offset
,
"Got offset %u, expected offset %u for format %s
\n
"
,
offset
,
expected_offset
,
dxt_formats
[
i
].
name
);
hr
=
IDirect3DSurface9_UnlockRect
(
surface
);
ok
(
SUCCEEDED
(
hr
),
"UnlockRect failed (%08x)
\n
"
,
hr
);
IDirect3DSurface9_Release
(
surface
);
}
}
START_TEST
(
surface
)
{
HMODULE
d3d9_handle
;
...
...
@@ -189,4 +244,5 @@ START_TEST(surface)
test_surface_get_container
(
device_ptr
);
test_surface_alignment
(
device_ptr
);
test_lockrect_offset
(
device_ptr
);
}
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