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
6d41756c
Commit
6d41756c
authored
Apr 18, 2023
by
Stefan Dösinger
Committed by
Alexandre Julliard
Apr 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Load D3DAssemble via GetProcAddress.
This allows linking our d3dx9.dll to Microsoft's d3dcompiler.lib implib.
parent
e0513f4d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
shader.c
dlls/d3dx9_36/shader.c
+25
-8
No files found.
dlls/d3dx9_36/shader.c
View file @
6d41756c
...
...
@@ -26,11 +26,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx
);
/* This function is not declared in the SDK headers yet. */
HRESULT
WINAPI
D3DAssemble
(
const
void
*
data
,
SIZE_T
datasize
,
const
char
*
filename
,
const
D3D_SHADER_MACRO
*
defines
,
ID3DInclude
*
include
,
UINT
flags
,
ID3DBlob
**
shader
,
ID3DBlob
**
error_messages
);
static
inline
BOOL
is_valid_bytecode
(
DWORD
token
)
{
return
(
token
&
0xfffe0000
)
==
0xfffe0000
;
...
...
@@ -193,19 +188,41 @@ HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const
return
S_FALSE
;
}
static
BOOL
WINAPI
load_d3dassemble_once
(
INIT_ONCE
*
once
,
void
*
param
,
void
**
context
)
{
/* FIXME: This assumes that d3dcompiler.h and dlls/d3dcompiler_XX/Makefile.in stay
* in sync regarding which library creates the unnumbered d3dcompiler.lib implib.
* GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, D3DCompile) would
* be nice, but "D3DCompile" will point to the IAT stub, not d3dcompiler_xy.dll */
HMODULE
mod
=
GetModuleHandleW
(
D3DCOMPILER_DLL_W
);
void
**
assemble
=
param
;
if
(
!
mod
)
ERR
(
"%s not found - which d3dcompiler are we linked against?
\n
"
,
D3DCOMPILER_DLL_A
);
*
assemble
=
(
void
*
)
GetProcAddress
(
mod
,
"D3DAssemble"
);
return
TRUE
;
}
HRESULT
WINAPI
D3DXAssembleShader
(
const
char
*
data
,
UINT
data_len
,
const
D3DXMACRO
*
defines
,
ID3DXInclude
*
include
,
DWORD
flags
,
ID3DXBuffer
**
shader
,
ID3DXBuffer
**
error_messages
)
{
static
HRESULT
(
WINAPI
*
pD3DAssemble
)(
const
void
*
data
,
SIZE_T
datasize
,
const
char
*
filename
,
const
D3D_SHADER_MACRO
*
defines
,
ID3DInclude
*
include
,
UINT
flags
,
ID3DBlob
*
*
shader
,
ID3DBlob
*
*
error_messages
);
static
INIT_ONCE
init_once
=
INIT_ONCE_STATIC_INIT
;
HRESULT
hr
;
TRACE
(
"data %p, data_len %u, defines %p, include %p, flags %#lx, shader %p, error_messages %p.
\n
"
,
data
,
data_len
,
defines
,
include
,
flags
,
shader
,
error_messages
);
InitOnceExecuteOnce
(
&
init_once
,
load_d3dassemble_once
,
&
pD3DAssemble
,
NULL
);
/* Forward to d3dcompiler: the parameter types aren't really different,
the actual data types are equivalent */
hr
=
D3DAssemble
(
data
,
data_len
,
NULL
,
(
D3D_SHADER_MACRO
*
)
defines
,
(
ID3DInclude
*
)
include
,
flags
,
(
ID3DBlob
**
)
shader
,
(
ID3DBlob
**
)
error_messages
);
hr
=
p
D3DAssemble
(
data
,
data_len
,
NULL
,
(
D3D_SHADER_MACRO
*
)
defines
,
(
ID3DInclude
*
)
include
,
flags
,
(
ID3DBlob
**
)
shader
,
(
ID3DBlob
**
)
error_messages
);
if
(
hr
==
E_FAIL
)
hr
=
D3DXERR_INVALIDDATA
;
return
hr
;
...
...
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