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
02385a40
Commit
02385a40
authored
Feb 10, 2021
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Allow resource copies between block-compatible formats.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
281f8ed4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
42 deletions
+76
-42
d3d11.c
dlls/d3d11/tests/d3d11.c
+4
-6
device.c
dlls/wined3d/device.c
+20
-4
utils.c
dlls/wined3d/utils.c
+51
-32
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/d3d11/tests/d3d11.c
View file @
02385a40
...
...
@@ -27928,9 +27928,8 @@ static void test_format_compatibility(void)
colour
=
get_readback_color
(
&
rb
,
x
,
y
,
0
);
expected
=
test_data
[
i
].
success
&&
x
>=
texel_dwords
&&
y
?
bitmap_data
[
j
-
(
4
+
texel_dwords
)]
:
initial_data
[
j
];
todo_wine_if
(
test_data
[
i
].
src_format
==
DXGI_FORMAT_R9G9B9E5_SHAREDEXP
&&
expected
)
ok
(
colour
==
expected
,
"Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.
\n
"
,
i
,
colour
,
x
,
y
,
expected
);
ok
(
colour
==
expected
,
"Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.
\n
"
,
i
,
colour
,
x
,
y
,
expected
);
}
release_resource_readback
(
&
rb
);
...
...
@@ -27943,9 +27942,8 @@ static void test_format_compatibility(void)
y
=
j
/
4
;
colour
=
get_readback_color
(
&
rb
,
x
,
y
,
0
);
expected
=
test_data
[
i
].
success
?
bitmap_data
[
j
]
:
initial_data
[
j
];
todo_wine_if
(
test_data
[
i
].
src_format
==
DXGI_FORMAT_R9G9B9E5_SHAREDEXP
&&
expected
)
ok
(
colour
==
expected
,
"Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.
\n
"
,
i
,
colour
,
x
,
y
,
expected
);
ok
(
colour
==
expected
,
"Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.
\n
"
,
i
,
colour
,
x
,
y
,
expected
);
}
release_resource_readback
(
&
rb
);
dlls/wined3d/device.c
View file @
02385a40
...
...
@@ -4520,6 +4520,24 @@ void CDECL wined3d_device_copy_uav_counter(struct wined3d_device *device,
wined3d_cs_emit_copy_uav_counter
(
device
->
cs
,
dst_buffer
,
offset
,
uav
);
}
static
bool
resources_format_compatible
(
const
struct
wined3d_resource
*
src_resource
,
const
struct
wined3d_resource
*
dst_resource
)
{
if
(
src_resource
->
format
->
id
==
dst_resource
->
format
->
id
)
return
true
;
if
(
src_resource
->
format
->
typeless_id
&&
src_resource
->
format
->
typeless_id
==
dst_resource
->
format
->
typeless_id
)
return
true
;
if
(
src_resource
->
device
->
feature_level
<
WINED3D_FEATURE_LEVEL_10_1
)
return
false
;
if
((
src_resource
->
format_flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
(
dst_resource
->
format_flags
&
WINED3DFMT_FLAG_CAST_TO_BLOCK
))
return
src_resource
->
format
->
block_byte_count
==
dst_resource
->
format
->
byte_count
;
if
((
src_resource
->
format_flags
&
WINED3DFMT_FLAG_CAST_TO_BLOCK
)
&&
(
dst_resource
->
format_flags
&
WINED3DFMT_FLAG_BLOCKS
))
return
src_resource
->
format
->
byte_count
==
dst_resource
->
format
->
block_byte_count
;
return
false
;
}
void
CDECL
wined3d_device_copy_resource
(
struct
wined3d_device
*
device
,
struct
wined3d_resource
*
dst_resource
,
struct
wined3d_resource
*
src_resource
)
{
...
...
@@ -4553,8 +4571,7 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
return
;
}
if
(
src_resource
->
format
->
typeless_id
!=
dst_resource
->
format
->
typeless_id
||
(
!
src_resource
->
format
->
typeless_id
&&
src_resource
->
format
->
id
!=
dst_resource
->
format
->
id
))
if
(
!
resources_format_compatible
(
src_resource
,
dst_resource
))
{
WARN
(
"Resource formats %s and %s are incompatible.
\n
"
,
debug_d3dformat
(
dst_resource
->
format
->
id
),
...
...
@@ -4616,8 +4633,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
return
WINED3DERR_INVALIDCALL
;
}
if
(
src_resource
->
format
->
typeless_id
!=
dst_resource
->
format
->
typeless_id
||
(
!
src_resource
->
format
->
typeless_id
&&
src_resource
->
format
->
id
!=
dst_resource
->
format
->
id
))
if
(
!
resources_format_compatible
(
src_resource
,
dst_resource
))
{
WARN
(
"Resource formats %s and %s are incompatible.
\n
"
,
debug_d3dformat
(
dst_resource
->
format
->
id
),
...
...
dlls/wined3d/utils.c
View file @
02385a40
...
...
@@ -330,19 +330,37 @@ struct wined3d_format_base_flags
* resource size. */
static
const
struct
wined3d_format_base_flags
format_base_flags
[]
=
{
{
WINED3DFMT_ATI1N
,
WINED3DFMT_FLAG_MAPPABLE
|
WINED3DFMT_FLAG_BROKEN_PITCH
},
{
WINED3DFMT_ATI2N
,
WINED3DFMT_FLAG_MAPPABLE
|
WINED3DFMT_FLAG_BROKEN_PITCH
},
{
WINED3DFMT_D16_LOCKABLE
,
WINED3DFMT_FLAG_MAPPABLE
},
{
WINED3DFMT_INTZ
,
WINED3DFMT_FLAG_MAPPABLE
},
{
WINED3DFMT_R11G11B10_FLOAT
,
WINED3DFMT_FLAG_FLOAT
},
{
WINED3DFMT_D32_FLOAT
,
WINED3DFMT_FLAG_FLOAT
},
{
WINED3DFMT_S8_UINT_D24_FLOAT
,
WINED3DFMT_FLAG_FLOAT
},
{
WINED3DFMT_D32_FLOAT_S8X24_UINT
,
WINED3DFMT_FLAG_FLOAT
},
{
WINED3DFMT_INST
,
WINED3DFMT_FLAG_EXTENSION
},
{
WINED3DFMT_NULL
,
WINED3DFMT_FLAG_EXTENSION
},
{
WINED3DFMT_NVDB
,
WINED3DFMT_FLAG_EXTENSION
},
{
WINED3DFMT_ATOC
,
WINED3DFMT_FLAG_EXTENSION
},
{
WINED3DFMT_RESZ
,
WINED3DFMT_FLAG_EXTENSION
},
{
WINED3DFMT_ATI1N
,
WINED3DFMT_FLAG_MAPPABLE
|
WINED3DFMT_FLAG_BROKEN_PITCH
},
{
WINED3DFMT_ATI2N
,
WINED3DFMT_FLAG_MAPPABLE
|
WINED3DFMT_FLAG_BROKEN_PITCH
},
{
WINED3DFMT_D16_LOCKABLE
,
WINED3DFMT_FLAG_MAPPABLE
},
{
WINED3DFMT_INTZ
,
WINED3DFMT_FLAG_MAPPABLE
},
{
WINED3DFMT_R11G11B10_FLOAT
,
WINED3DFMT_FLAG_FLOAT
},
{
WINED3DFMT_D32_FLOAT
,
WINED3DFMT_FLAG_FLOAT
},
{
WINED3DFMT_S8_UINT_D24_FLOAT
,
WINED3DFMT_FLAG_FLOAT
},
{
WINED3DFMT_D32_FLOAT_S8X24_UINT
,
WINED3DFMT_FLAG_FLOAT
},
{
WINED3DFMT_INST
,
WINED3DFMT_FLAG_EXTENSION
},
{
WINED3DFMT_NULL
,
WINED3DFMT_FLAG_EXTENSION
},
{
WINED3DFMT_NVDB
,
WINED3DFMT_FLAG_EXTENSION
},
{
WINED3DFMT_ATOC
,
WINED3DFMT_FLAG_EXTENSION
},
{
WINED3DFMT_RESZ
,
WINED3DFMT_FLAG_EXTENSION
},
{
WINED3DFMT_R32G32B32A32_TYPELESS
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32G32B32A32_FLOAT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32G32B32A32_UINT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32G32B32A32_SINT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R16G16B16A16_TYPELESS
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R16G16B16A16_FLOAT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R16G16B16A16_UNORM
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R16G16B16A16_UINT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R16G16B16A16_SNORM
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R16G16B16A16_SINT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32G32_TYPELESS
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32G32_FLOAT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32G32_UINT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32G32_SINT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32_TYPELESS
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32_FLOAT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32_UINT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
{
WINED3DFMT_R32_SINT
,
WINED3DFMT_FLAG_CAST_TO_BLOCK
},
};
static
void
rgb888_from_rgb565
(
WORD
rgb565
,
BYTE
*
r
,
BYTE
*
g
,
BYTE
*
b
)
...
...
@@ -580,25 +598,26 @@ struct wined3d_format_block_info
static
const
struct
wined3d_format_block_info
format_block_info
[]
=
{
{
WINED3DFMT_DXT1
,
4
,
4
,
8
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_DXT2
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_DXT3
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_DXT4
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_DXT5
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC1_UNORM
,
4
,
4
,
8
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC2_UNORM
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC3_UNORM
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC4_UNORM
,
4
,
4
,
8
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC4_SNORM
,
4
,
4
,
8
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC5_UNORM
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC5_SNORM
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC6H_UF16
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC6H_SF16
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC7_UNORM
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_ATI1N
,
4
,
4
,
8
,
WINED3DFMT_FLAG_COMPRESSED
|
WINED3DFMT_FLAG_BLOCKS_NO_VERIFY
},
{
WINED3DFMT_ATI2N
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
|
WINED3DFMT_FLAG_BLOCKS_NO_VERIFY
},
{
WINED3DFMT_YUY2
,
2
,
1
,
4
,
WINED3DFMT_FLAG_BLOCKS_NO_VERIFY
},
{
WINED3DFMT_UYVY
,
2
,
1
,
4
,
WINED3DFMT_FLAG_BLOCKS_NO_VERIFY
},
{
WINED3DFMT_DXT1
,
4
,
4
,
8
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_DXT2
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_DXT3
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_DXT4
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_DXT5
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC1_UNORM
,
4
,
4
,
8
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC2_UNORM
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC3_UNORM
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC4_UNORM
,
4
,
4
,
8
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC4_SNORM
,
4
,
4
,
8
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC5_UNORM
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC5_SNORM
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC6H_UF16
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC6H_SF16
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_BC7_UNORM
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
},
{
WINED3DFMT_ATI1N
,
4
,
4
,
8
,
WINED3DFMT_FLAG_COMPRESSED
|
WINED3DFMT_FLAG_BLOCKS_NO_VERIFY
},
{
WINED3DFMT_ATI2N
,
4
,
4
,
16
,
WINED3DFMT_FLAG_COMPRESSED
|
WINED3DFMT_FLAG_BLOCKS_NO_VERIFY
},
{
WINED3DFMT_YUY2
,
2
,
1
,
4
,
WINED3DFMT_FLAG_BLOCKS_NO_VERIFY
},
{
WINED3DFMT_UYVY
,
2
,
1
,
4
,
WINED3DFMT_FLAG_BLOCKS_NO_VERIFY
},
{
WINED3DFMT_R9G9B9E5_SHAREDEXP
,
1
,
1
,
4
},
};
struct
wined3d_format_vertex_info
...
...
dlls/wined3d/wined3d_private.h
View file @
02385a40
...
...
@@ -5713,6 +5713,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
#define WINED3DFMT_FLAG_BLIT 0x02000000
#define WINED3DFMT_FLAG_MAPPABLE 0x04000000
#define WINED3DFMT_FLAG_CAST_TO_BLOCK 0x08000000
struct
wined3d_rational
{
...
...
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