Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
d4ae51e2
Commit
d4ae51e2
authored
Aug 19, 2022
by
Ziqing Hui
Committed by
Alexandre Julliard
Aug 31, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx10: Support effect creation for compiled shader.
parent
7e8bd131
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
19 deletions
+27
-19
compiler.c
dlls/d3dx10_43/compiler.c
+24
-8
d3dx10.c
dlls/d3dx10_43/tests/d3dx10.c
+3
-11
No files found.
dlls/d3dx10_43/compiler.c
View file @
d4ae51e2
...
...
@@ -28,12 +28,17 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx
);
#define D3DERR_INVALIDCALL 0x8876086c
static
HRESULT
create_effect
(
const
void
*
data
,
SIZE_T
datasize
,
const
char
*
filename
,
const
D3D10_SHADER_MACRO
*
defines
,
ID3D10Include
*
include
,
const
char
*
profile
,
UINT
shader_flags
,
UINT
effect_flags
,
ID3D10Device
*
device
,
ID3D10EffectPool
*
effect_pool
,
ID3D10Effect
**
effect
,
ID3D10Blob
**
errors
)
{
ID3D10Blob
*
code
;
const
char
dxbc
[]
=
{
'D'
,
'X'
,
'B'
,
'C'
};
ID3D10Blob
*
code
=
NULL
;
void
*
buffer
;
SIZE_T
size
;
HRESULT
hr
;
if
(
!
data
||
!
device
)
...
...
@@ -42,17 +47,28 @@ static HRESULT create_effect(const void *data, SIZE_T datasize, const char *file
if
(
errors
)
*
errors
=
NULL
;
if
(
FAILED
(
hr
=
D3DCompile
(
data
,
datasize
,
filename
,
defines
,
include
,
"main"
,
profile
,
shader_flags
,
effect_flags
,
&
code
,
errors
)))
buffer
=
(
void
*
)
data
;
size
=
datasize
;
/* Effect is not compiled. */
if
(
datasize
<
sizeof
(
dxbc
)
||
memcmp
(
dxbc
,
data
,
sizeof
(
dxbc
)))
{
WARN
(
"Effect compilation failed, hr %#lx.
\n
"
,
hr
);
return
hr
;
if
(
!
profile
)
return
D3DERR_INVALIDCALL
;
if
(
FAILED
(
hr
=
D3DCompile
(
data
,
datasize
,
filename
,
defines
,
include
,
"main"
,
profile
,
shader_flags
,
effect_flags
,
&
code
,
errors
)))
{
WARN
(
"Effect compilation failed, hr %#lx.
\n
"
,
hr
);
return
hr
;
}
buffer
=
ID3D10Blob_GetBufferPointer
(
code
);
size
=
ID3D10Blob_GetBufferSize
(
code
);
}
hr
=
D3D10CreateEffectFromMemory
(
ID3D10Blob_GetBufferPointer
(
code
),
ID3D10Blob_GetBufferSize
(
code
),
effect_flags
,
device
,
effect_pool
,
effect
);
ID3D10Blob_Release
(
code
);
hr
=
D3D10CreateEffectFromMemory
(
buffer
,
size
,
effect_flags
,
device
,
effect_pool
,
effect
);
if
(
code
)
ID3D10Blob_Release
(
code
);
return
hr
;
}
...
...
dlls/d3dx10_43/tests/d3dx10.c
View file @
d4ae51e2
...
...
@@ -3980,8 +3980,6 @@ static void test_create_effect_from_memory(void)
}
/* Test NULL data. */
if
(
strcmp
(
winetest_platform
,
"wine"
))
/* Crash on wine. */
{
errors
=
(
ID3D10Blob
*
)
0xdeadbeef
;
effect
=
(
ID3D10Effect
*
)
0xdeadbeef
;
hr
=
D3DX10CreateEffectFromMemory
(
NULL
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
...
...
@@ -4015,10 +4013,10 @@ static void test_create_effect_from_memory(void)
hr
=
D3DX10CreateEffectFromMemory
(
test_fx_source
,
strlen
(
test_fx_source
)
+
1
,
NULL
,
NULL
,
NULL
,
NULL
,
0x0
,
0x0
,
device
,
NULL
,
NULL
,
&
effect
,
&
errors
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!!
errors
&&
errors
!=
(
ID3D10Blob
*
)
0xdeadbeef
,
"Got unexpected errors %p.
\n
"
,
errors
);
todo_wine
ok
(
!!
errors
&&
errors
!=
(
ID3D10Blob
*
)
0xdeadbeef
,
"Got unexpected errors %p.
\n
"
,
errors
);
ok
(
effect
==
(
ID3D10Effect
*
)
0xdeadbeef
,
"Got unexpected effect %p.
\n
"
,
effect
);
ID3D10Blob_Release
(
errors
);
}
if
(
errors
&&
errors
!=
(
ID3D10Blob
*
)
0xdeadbeef
)
ID3D10Blob_Release
(
errors
);
/* Test creating effect from source. */
errors
=
(
ID3D10Blob
*
)
0xdeadbeef
;
...
...
@@ -4086,8 +4084,6 @@ static void test_create_effect_from_file(void)
ok
(
effect
==
(
ID3D10Effect
*
)
0xdeadbeef
,
"Got unexpected effect %p.
\n
"
,
effect
);
/* Test creating effect from compiled shader file. */
if
(
strcmp
(
winetest_platform
,
"wine"
))
/* Crash on wine. */
{
create_file
(
test_file_name
,
test_fx
,
sizeof
(
test_fx
),
path
);
errors
=
(
ID3D10Blob
*
)
0xdeadbeef
;
...
...
@@ -4109,7 +4105,6 @@ static void test_create_effect_from_file(void)
effect
->
lpVtbl
->
Release
(
effect
);
delete_file
(
test_file_name
);
}
/* Test creating effect from source file. */
create_file
(
test_file_name
,
test_fx_source
,
strlen
(
test_fx_source
)
+
1
,
path
);
...
...
@@ -4208,8 +4203,6 @@ static void test_create_effect_from_resource(void)
ok
(
effect
==
(
ID3D10Effect
*
)
0xdeadbeef
,
"Got unexpected effect %p.
\n
"
,
effect
);
/* Test creating effect from compiled shader resource. */
if
(
strcmp
(
winetest_platform
,
"wine"
))
/* Crash on wine. */
{
resource_module
=
create_resource_module
(
test_resource_name
,
test_fx
,
sizeof
(
test_fx
));
errors
=
(
ID3D10Blob
*
)
0xdeadbeef
;
...
...
@@ -4231,7 +4224,6 @@ static void test_create_effect_from_resource(void)
effect
->
lpVtbl
->
Release
(
effect
);
delete_resource_module
(
test_resource_name
,
resource_module
);
}
/* Test creating effect from source resource. */
resource_module
=
create_resource_module
(
test_resource_name
,
test_fx_source
,
strlen
(
test_fx_source
)
+
1
);
...
...
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