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
281f8ed4
Commit
281f8ed4
authored
Feb 10, 2021
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d10core/tests: Add format compatibility tests for compressed formats.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
172a90bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
205 additions
and
0 deletions
+205
-0
d3d10core.c
dlls/d3d10core/tests/d3d10core.c
+205
-0
No files found.
dlls/d3d10core/tests/d3d10core.c
View file @
281f8ed4
...
...
@@ -16129,6 +16129,210 @@ static void test_format_compatibility(void)
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
}
static
void
test_compressed_format_compatibility
(
void
)
{
const
struct
format_info
*
src_format
,
*
dst_format
;
unsigned
int
row_block_count
,
row_count
,
i
,
j
,
k
;
ID3D10Texture2D
*
src_texture
,
*
dst_texture
;
D3D10_SUBRESOURCE_DATA
resource_data
;
D3D10_TEXTURE2D_DESC
texture_desc
;
struct
resource_readback
rb
;
unsigned
int
block_idx
,
y
;
DWORD
colour
,
expected
;
ID3D10Device
*
device
;
const
BYTE
*
row
;
ULONG
refcount
;
D3D10_BOX
box
;
HRESULT
hr
;
static
const
struct
format_info
{
DXGI_FORMAT
id
;
size_t
block_size
;
size_t
block_edge
;
}
formats
[]
=
{
{
DXGI_FORMAT_R32G32B32A32_TYPELESS
,
16
,
1
},
{
DXGI_FORMAT_R32G32B32A32_FLOAT
,
16
,
1
},
{
DXGI_FORMAT_R32G32B32A32_UINT
,
16
,
1
},
{
DXGI_FORMAT_R32G32B32A32_SINT
,
16
,
1
},
{
DXGI_FORMAT_R16G16B16A16_TYPELESS
,
8
,
1
},
{
DXGI_FORMAT_R16G16B16A16_FLOAT
,
8
,
1
},
{
DXGI_FORMAT_R16G16B16A16_UNORM
,
8
,
1
},
{
DXGI_FORMAT_R16G16B16A16_UINT
,
8
,
1
},
{
DXGI_FORMAT_R16G16B16A16_SNORM
,
8
,
1
},
{
DXGI_FORMAT_R16G16B16A16_SINT
,
8
,
1
},
{
DXGI_FORMAT_R32G32_TYPELESS
,
8
,
1
},
{
DXGI_FORMAT_R32G32_FLOAT
,
8
,
1
},
{
DXGI_FORMAT_R32G32_UINT
,
8
,
1
},
{
DXGI_FORMAT_R32G32_SINT
,
8
,
1
},
{
DXGI_FORMAT_R32_TYPELESS
,
4
,
1
},
{
DXGI_FORMAT_R32_FLOAT
,
4
,
1
},
{
DXGI_FORMAT_R32_UINT
,
4
,
1
},
{
DXGI_FORMAT_R32_SINT
,
4
,
1
},
{
DXGI_FORMAT_R32G8X24_TYPELESS
,
8
,
1
},
{
DXGI_FORMAT_R10G10B10A2_TYPELESS
,
4
,
1
},
{
DXGI_FORMAT_R8G8B8A8_TYPELESS
,
4
,
1
},
{
DXGI_FORMAT_R16G16_TYPELESS
,
4
,
1
},
{
DXGI_FORMAT_R24G8_TYPELESS
,
4
,
1
},
{
DXGI_FORMAT_R9G9B9E5_SHAREDEXP
,
4
,
1
},
{
DXGI_FORMAT_R8G8_TYPELESS
,
2
,
1
},
{
DXGI_FORMAT_R16_TYPELESS
,
2
,
1
},
{
DXGI_FORMAT_R8_TYPELESS
,
1
,
1
},
{
DXGI_FORMAT_BC1_TYPELESS
,
8
,
4
},
{
DXGI_FORMAT_BC1_UNORM
,
8
,
4
},
{
DXGI_FORMAT_BC1_UNORM_SRGB
,
8
,
4
},
{
DXGI_FORMAT_BC2_TYPELESS
,
16
,
4
},
{
DXGI_FORMAT_BC2_UNORM
,
16
,
4
},
{
DXGI_FORMAT_BC2_UNORM_SRGB
,
16
,
4
},
{
DXGI_FORMAT_BC3_TYPELESS
,
16
,
4
},
{
DXGI_FORMAT_BC3_UNORM
,
16
,
4
},
{
DXGI_FORMAT_BC3_UNORM_SRGB
,
16
,
4
},
{
DXGI_FORMAT_BC4_TYPELESS
,
8
,
4
},
{
DXGI_FORMAT_BC4_UNORM
,
8
,
4
},
{
DXGI_FORMAT_BC4_SNORM
,
8
,
4
},
{
DXGI_FORMAT_BC5_TYPELESS
,
16
,
4
},
{
DXGI_FORMAT_BC5_UNORM
,
16
,
4
},
{
DXGI_FORMAT_BC5_SNORM
,
16
,
4
},
};
static
const
DWORD
initial_data
[
64
]
=
{
0
};
static
const
DWORD
texture_data
[]
=
{
0xff0000ff
,
0xff00ffff
,
0xff00ff00
,
0xffffff00
,
0xffff0000
,
0xffff00ff
,
0xff000000
,
0xff7f7f7f
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xff000000
,
0xffffffff
,
0xff000000
,
0xff000000
,
0xff000000
,
0xffffffff
,
0xff000000
,
0xff000000
,
0xff000000
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xff000000
,
0xffff0000
,
0xffff00ff
,
0xff000000
,
0xff7f7f7f
,
0xff0000ff
,
0xff00ffff
,
0xff00ff00
,
0xffffff00
,
0xff00ff00
,
0xffffff00
,
0xff0000ff
,
0xff00ffff
,
0xff000000
,
0xff7f7f7f
,
0xffff0000
,
0xffff00ff
,
0xffffffff
,
0xff000000
,
0xffffffff
,
0xffffffff
,
0xff000000
,
0xff000000
,
0xffffffff
,
0xff000000
,
0xff000000
,
0xff000000
,
0xffffffff
,
0xff000000
,
0xffffffff
,
0xff000000
,
0xffffffff
,
0xffffffff
,
0xff000000
,
0xff7f7f7f
,
0xffff0000
,
0xffff00ff
,
0xff00ff00
,
0xffffff00
,
0xff0000ff
,
0xff00ffff
,
};
if
(
!
(
device
=
create_device
()))
{
skip
(
"Failed to create device.
\n
"
);
return
;
}
row_block_count
=
4
;
texture_desc
.
MipLevels
=
1
;
texture_desc
.
ArraySize
=
1
;
texture_desc
.
SampleDesc
.
Count
=
1
;
texture_desc
.
SampleDesc
.
Quality
=
0
;
texture_desc
.
BindFlags
=
D3D10_BIND_SHADER_RESOURCE
;
texture_desc
.
CPUAccessFlags
=
0
;
texture_desc
.
MiscFlags
=
0
;
resource_data
.
SysMemSlicePitch
=
0
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
formats
);
++
i
)
{
src_format
=
&
formats
[
i
];
row_count
=
sizeof
(
texture_data
)
/
(
row_block_count
*
src_format
->
block_size
);
texture_desc
.
Width
=
row_block_count
*
src_format
->
block_edge
;
texture_desc
.
Height
=
row_count
*
src_format
->
block_edge
;
texture_desc
.
Format
=
src_format
->
id
;
texture_desc
.
Usage
=
D3D10_USAGE_IMMUTABLE
;
resource_data
.
pSysMem
=
texture_data
;
resource_data
.
SysMemPitch
=
row_block_count
*
src_format
->
block_size
;
hr
=
ID3D10Device_CreateTexture2D
(
device
,
&
texture_desc
,
&
resource_data
,
&
src_texture
);
ok
(
hr
==
S_OK
,
"Source format %#x: Got unexpected hr %#x.
\n
"
,
src_format
->
id
,
hr
);
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
formats
);
++
j
)
{
dst_format
=
&
formats
[
j
];
if
((
src_format
->
block_edge
==
1
&&
dst_format
->
block_edge
==
1
)
||
(
src_format
->
block_edge
!=
1
&&
dst_format
->
block_edge
!=
1
))
continue
;
row_count
=
sizeof
(
initial_data
)
/
(
row_block_count
*
dst_format
->
block_size
);
texture_desc
.
Width
=
row_block_count
*
dst_format
->
block_edge
;
texture_desc
.
Height
=
row_count
*
dst_format
->
block_edge
;
texture_desc
.
Format
=
dst_format
->
id
;
texture_desc
.
Usage
=
D3D10_USAGE_DEFAULT
;
resource_data
.
pSysMem
=
initial_data
;
resource_data
.
SysMemPitch
=
row_block_count
*
dst_format
->
block_size
;
hr
=
ID3D10Device_CreateTexture2D
(
device
,
&
texture_desc
,
&
resource_data
,
&
dst_texture
);
ok
(
hr
==
S_OK
,
"%#x -> %#x: Got unexpected hr %#x.
\n
"
,
src_format
->
id
,
dst_format
->
id
,
hr
);
set_box
(
&
box
,
0
,
0
,
0
,
src_format
->
block_edge
,
src_format
->
block_edge
,
1
);
ID3D10Device_CopySubresourceRegion
(
device
,
(
ID3D10Resource
*
)
dst_texture
,
0
,
dst_format
->
block_edge
,
dst_format
->
block_edge
,
0
,
(
ID3D10Resource
*
)
src_texture
,
0
,
&
box
);
get_texture_readback
(
dst_texture
,
0
,
&
rb
);
for
(
k
=
0
;
k
<
ARRAY_SIZE
(
texture_data
);
++
k
)
{
block_idx
=
(
k
*
sizeof
(
colour
))
/
dst_format
->
block_size
;
y
=
block_idx
/
row_block_count
;
row
=
rb
.
map_desc
.
pData
;
row
+=
y
*
rb
.
map_desc
.
RowPitch
;
colour
=
((
DWORD
*
)
row
)[
k
%
((
row_block_count
*
dst_format
->
block_size
)
/
sizeof
(
colour
))];
expected
=
initial_data
[
k
];
ok
(
colour
==
expected
,
"%#x -> %#x: Got unexpected colour 0x%08x at %u, expected 0x%08x.
\n
"
,
src_format
->
id
,
dst_format
->
id
,
colour
,
k
,
expected
);
if
(
colour
!=
expected
)
break
;
}
release_resource_readback
(
&
rb
);
ID3D10Device_CopyResource
(
device
,
(
ID3D10Resource
*
)
dst_texture
,
(
ID3D10Resource
*
)
src_texture
);
get_texture_readback
(
dst_texture
,
0
,
&
rb
);
for
(
k
=
0
;
k
<
ARRAY_SIZE
(
texture_data
);
++
k
)
{
block_idx
=
(
k
*
sizeof
(
colour
))
/
dst_format
->
block_size
;
y
=
block_idx
/
row_block_count
;
row
=
rb
.
map_desc
.
pData
;
row
+=
y
*
rb
.
map_desc
.
RowPitch
;
colour
=
((
DWORD
*
)
row
)[
k
%
((
row_block_count
*
dst_format
->
block_size
)
/
sizeof
(
colour
))];
expected
=
initial_data
[
k
];
ok
(
colour
==
expected
,
"%#x -> %#x: Got unexpected colour 0x%08x at %u, expected 0x%08x.
\n
"
,
src_format
->
id
,
dst_format
->
id
,
colour
,
k
,
expected
);
if
(
colour
!=
expected
)
break
;
}
release_resource_readback
(
&
rb
);
ID3D10Texture2D_Release
(
dst_texture
);
}
ID3D10Texture2D_Release
(
src_texture
);
}
refcount
=
ID3D10Device_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
}
static
void
check_clip_distance
(
struct
d3d10core_test_context
*
test_context
,
ID3D10Buffer
*
vb
)
{
static
const
float
white
[]
=
{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
};
...
...
@@ -18633,6 +18837,7 @@ START_TEST(d3d10core)
queue_test
(
test_stream_output_resume
);
queue_test
(
test_depth_bias
);
queue_test
(
test_format_compatibility
);
queue_test
(
test_compressed_format_compatibility
);
queue_test
(
test_clip_distance
);
queue_test
(
test_combined_clip_and_cull_distances
);
queue_test
(
test_generate_mips
);
...
...
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