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
13801e63
Commit
13801e63
authored
Jul 13, 2022
by
Piotr Caban
Committed by
Alexandre Julliard
Aug 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx10: Add support for loading MipLevels data in load_texture_data.
parent
d1c03fe4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
48 deletions
+56
-48
d3dx10.c
dlls/d3dx10_43/tests/d3dx10.c
+1
-1
texture.c
dlls/d3dx10_43/texture.c
+55
-47
No files found.
dlls/d3dx10_43/tests/d3dx10.c
View file @
13801e63
...
...
@@ -1138,7 +1138,7 @@ static void check_resource_info(ID3D10Resource *resource, const struct test_imag
ok_
(
__FILE__
,
line
)(
desc_2d
.
Height
==
expected_height
,
"Got unexpected Height %u, expected %u.
\n
"
,
desc_2d
.
Height
,
expected_height
);
todo_wine_if
(
expected_mip_levels
!=
1
)
todo_wine_if
(
expected_mip_levels
!=
image
->
expected_info
.
MipLevels
)
ok_
(
__FILE__
,
line
)(
desc_2d
.
MipLevels
==
expected_mip_levels
,
"Got unexpected MipLevels %u, expected %u.
\n
"
,
desc_2d
.
MipLevels
,
expected_mip_levels
);
...
...
dlls/d3dx10_43/texture.c
View file @
13801e63
...
...
@@ -816,7 +816,7 @@ static HRESULT convert_image(IWICImagingFactory *factory, IWICBitmapFrameDecode
HRESULT
load_texture_data
(
const
void
*
data
,
SIZE_T
size
,
D3DX10_IMAGE_LOAD_INFO
*
load_info
,
D3D10_SUBRESOURCE_DATA
**
resource_data
)
{
unsigned
int
stride
,
frame_size
,
i
;
unsigned
int
stride
,
frame_size
,
i
,
j
;
IWICDdsFrameDecode
*
dds_frame
=
NULL
;
IWICBitmapFrameDecode
*
frame
=
NULL
;
IWICImagingFactory
*
factory
=
NULL
;
...
...
@@ -884,25 +884,29 @@ HRESULT load_texture_data(const void *data, SIZE_T size, D3DX10_IMAGE_LOAD_INFO
for
(
i
=
0
;
i
<
img_info
.
ArraySize
;
++
i
)
{
if
(
FAILED
(
hr
=
IWICDdsDecoder_GetFrame
(
dds_decoder
,
i
,
0
,
0
,
&
frame
)))
goto
end
;
if
(
FAILED
(
hr
=
IWICBitmapFrameDecode_QueryInterface
(
frame
,
&
IID_IWICDdsFrameDecode
,
(
void
**
)
&
dds_frame
)))
goto
end
;
if
(
FAILED
(
hr
=
dds_get_frame_info
(
dds_frame
,
&
img_info
,
&
format_info
,
&
stride
,
&
frame_size
)))
goto
end
;
if
(
!
i
)
for
(
j
=
0
;
j
<
img_info
.
MipLevels
;
++
j
)
{
img_info
.
Width
=
(
img_info
.
Width
+
format_info
.
BlockWidth
-
1
)
&
~
(
format_info
.
BlockWidth
-
1
);
img_info
.
Height
=
(
img_info
.
Height
+
format_info
.
BlockHeight
-
1
)
&
~
(
format_info
.
BlockHeight
-
1
);
}
if
(
FAILED
(
hr
=
IWICDdsDecoder_GetFrame
(
dds_decoder
,
i
,
j
,
0
,
&
frame
)))
goto
end
;
if
(
FAILED
(
hr
=
IWICBitmapFrameDecode_QueryInterface
(
frame
,
&
IID_IWICDdsFrameDecode
,
(
void
**
)
&
dds_frame
)))
goto
end
;
if
(
FAILED
(
hr
=
dds_get_frame_info
(
dds_frame
,
&
img_info
,
&
format_info
,
&
stride
,
&
frame_size
)))
goto
end
;
size
+=
sizeof
(
**
resource_data
)
+
frame_size
;
if
(
!
i
&&
!
j
)
{
img_info
.
Width
=
(
img_info
.
Width
+
format_info
.
BlockWidth
-
1
)
&
~
(
format_info
.
BlockWidth
-
1
);
img_info
.
Height
=
(
img_info
.
Height
+
format_info
.
BlockHeight
-
1
)
&
~
(
format_info
.
BlockHeight
-
1
);
}
IWICDdsFrameDecode_Release
(
dds_frame
);
dds_frame
=
NULL
;
IWICBitmapFrameDecode_Release
(
frame
);
frame
=
NULL
;
size
+=
sizeof
(
**
resource_data
)
+
frame_size
;
IWICDdsFrameDecode_Release
(
dds_frame
);
dds_frame
=
NULL
;
IWICBitmapFrameDecode_Release
(
frame
);
frame
=
NULL
;
}
}
if
(
!
(
res_data
=
malloc
(
size
)))
...
...
@@ -915,41 +919,45 @@ HRESULT load_texture_data(const void *data, SIZE_T size, D3DX10_IMAGE_LOAD_INFO
size
=
0
;
for
(
i
=
0
;
i
<
img_info
.
ArraySize
;
++
i
)
{
if
(
FAILED
(
hr
=
IWICDdsDecoder_GetFrame
(
dds_decoder
,
i
,
0
,
0
,
&
frame
)))
goto
end
;
if
(
FAILED
(
hr
=
IWICBitmapFrameDecode_QueryInterface
(
frame
,
&
IID_IWICDdsFrameDecode
,
(
void
**
)
&
dds_frame
)))
goto
end
;
if
(
FAILED
(
hr
=
dds_get_frame_info
(
dds_frame
,
&
img_info
,
&
format_info
,
&
stride
,
&
frame_size
)))
goto
end
;
buffer
=
res_data
+
sizeof
(
**
resource_data
)
*
img_info
.
ArraySize
+
size
;
size
+=
frame_size
;
if
(
img_info
.
Format
==
format_info
.
DxgiFormat
)
for
(
j
=
0
;
j
<
img_info
.
MipLevels
;
++
j
)
{
if
(
FAILED
(
hr
=
IWICDds
FrameDecode_CopyBlocks
(
dds_frame
,
NULL
,
stride
,
frame_size
,
buffer
)))
if
(
FAILED
(
hr
=
IWICDds
Decoder_GetFrame
(
dds_decoder
,
i
,
j
,
0
,
&
frame
)))
goto
end
;
}
else
{
if
(
!
(
dst_format
=
dxgi_format_to_wic_guid
(
img_info
.
Format
)))
{
hr
=
E_FAIL
;
FIXME
(
"Unsupported DXGI format %#x.
\n
"
,
img_info
.
Format
);
if
(
FAILED
(
hr
=
IWICBitmapFrameDecode_QueryInterface
(
frame
,
&
IID_IWICDdsFrameDecode
,
(
void
**
)
&
dds_frame
)))
goto
end
;
}
if
(
FAILED
(
hr
=
convert_image
(
factory
,
frame
,
dst_format
,
stride
,
frame_size
,
buffer
)))
if
(
FAILED
(
hr
=
dds_get_frame_info
(
dds_frame
,
&
img_info
,
&
format_info
,
&
stride
,
&
frame_size
)))
goto
end
;
}
IWICDdsFrameDecode_Release
(
dds_frame
);
dds_frame
=
NULL
;
IWICBitmapFrameDecode_Release
(
frame
);
frame
=
NULL
;
buffer
=
res_data
+
sizeof
(
**
resource_data
)
*
img_info
.
ArraySize
*
img_info
.
MipLevels
+
size
;
size
+=
frame_size
;
(
*
resource_data
)[
i
].
pSysMem
=
buffer
;
(
*
resource_data
)[
i
].
SysMemPitch
=
stride
;
(
*
resource_data
)[
i
].
SysMemSlicePitch
=
frame_size
;
if
(
img_info
.
Format
==
format_info
.
DxgiFormat
)
{
if
(
FAILED
(
hr
=
IWICDdsFrameDecode_CopyBlocks
(
dds_frame
,
NULL
,
stride
,
frame_size
,
buffer
)))
goto
end
;
}
else
{
if
(
!
(
dst_format
=
dxgi_format_to_wic_guid
(
img_info
.
Format
)))
{
hr
=
E_FAIL
;
FIXME
(
"Unsupported DXGI format %#x.
\n
"
,
img_info
.
Format
);
goto
end
;
}
if
(
FAILED
(
hr
=
convert_image
(
factory
,
frame
,
dst_format
,
stride
,
frame_size
,
buffer
)))
goto
end
;
}
IWICDdsFrameDecode_Release
(
dds_frame
);
dds_frame
=
NULL
;
IWICBitmapFrameDecode_Release
(
frame
);
frame
=
NULL
;
(
*
resource_data
)[
i
*
img_info
.
MipLevels
+
j
].
pSysMem
=
buffer
;
(
*
resource_data
)[
i
*
img_info
.
MipLevels
+
j
].
SysMemPitch
=
stride
;
(
*
resource_data
)[
i
*
img_info
.
MipLevels
+
j
].
SysMemSlicePitch
=
frame_size
;
}
}
}
else
...
...
@@ -984,7 +992,7 @@ HRESULT load_texture_data(const void *data, SIZE_T size, D3DX10_IMAGE_LOAD_INFO
load_info
->
Width
=
img_info
.
Width
;
load_info
->
Height
=
img_info
.
Height
;
load_info
->
MipLevels
=
1
;
load_info
->
MipLevels
=
img_info
.
MipLevels
;
load_info
->
Format
=
img_info
.
Format
;
load_info
->
Usage
=
D3D10_USAGE_DEFAULT
;
load_info
->
BindFlags
=
D3D10_BIND_SHADER_RESOURCE
;
...
...
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