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
613d27eb
Commit
613d27eb
authored
Sep 03, 2013
by
Matteo Bruni
Committed by
Alexandre Julliard
Sep 03, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Use the ID3DXInclude object to open the initial file in…
d3dx9: Use the ID3DXInclude object to open the initial file in D3DX[Assemble|Compile|Preprocess]ShaderFromFile.
parent
1f6173a6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
20 deletions
+44
-20
shader.c
dlls/d3dx9_36/shader.c
+44
-20
No files found.
dlls/d3dx9_36/shader.c
View file @
613d27eb
...
...
@@ -306,27 +306,38 @@ HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO
HRESULT
WINAPI
D3DXAssembleShaderFromFileW
(
const
WCHAR
*
filename
,
const
D3DXMACRO
*
defines
,
ID3DXInclude
*
include
,
DWORD
flags
,
ID3DXBuffer
**
shader
,
ID3DXBuffer
**
error_messages
)
{
void
*
buffer
;
const
void
*
buffer
;
DWORD
len
;
HRESULT
hr
;
struct
D3DXIncludeImpl
includefromfile
;
char
*
filename_a
;
TRACE
(
"filename %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.
\n
"
,
debugstr_w
(
filename
),
defines
,
include
,
flags
,
shader
,
error_messages
);
if
(
FAILED
(
map_view_of_file
(
filename
,
&
buffer
,
&
len
)))
return
D3DXERR_INVALIDDATA
;
if
(
!
include
)
{
includefromfile
.
ID3DXInclude_iface
.
lpVtbl
=
&
D3DXInclude_Vtbl
;
include
=
&
includefromfile
.
ID3DXInclude_iface
;
}
hr
=
D3DXAssembleShader
(
buffer
,
len
,
defines
,
include
,
flags
,
shader
,
error_messages
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
filename
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
filename_a
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
char
));
if
(
!
filename_a
)
return
E_OUTOFMEMORY
;
WideCharToMultiByte
(
CP_ACP
,
0
,
filename
,
-
1
,
filename_a
,
len
,
NULL
,
NULL
);
UnmapViewOfFile
(
buffer
);
hr
=
ID3DXInclude_Open
(
include
,
D3D_INCLUDE_LOCAL
,
filename_a
,
NULL
,
&
buffer
,
&
len
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
return
D3DXERR_INVALIDDATA
;
}
hr
=
D3DXAssembleShader
(
buffer
,
len
,
defines
,
include
,
flags
,
shader
,
error_messages
);
ID3DXInclude_Close
(
include
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
return
hr
;
}
...
...
@@ -425,7 +436,7 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO
ID3DXInclude
*
include
,
const
char
*
entrypoint
,
const
char
*
profile
,
DWORD
flags
,
ID3DXBuffer
**
shader
,
ID3DXBuffer
**
error_messages
,
ID3DXConstantTable
**
constant_table
)
{
void
*
buffer
;
const
void
*
buffer
;
DWORD
len
,
filename_len
;
HRESULT
hr
;
struct
D3DXIncludeImpl
includefromfile
;
...
...
@@ -436,9 +447,6 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO
debugstr_w
(
filename
),
defines
,
include
,
debugstr_a
(
entrypoint
),
debugstr_a
(
profile
),
flags
,
shader
,
error_messages
,
constant_table
);
if
(
FAILED
(
map_view_of_file
(
filename
,
&
buffer
,
&
len
)))
return
D3DXERR_INVALIDDATA
;
if
(
!
include
)
{
includefromfile
.
ID3DXInclude_iface
.
lpVtbl
=
&
D3DXInclude_Vtbl
;
...
...
@@ -448,12 +456,16 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO
filename_len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
filename
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
filename_a
=
HeapAlloc
(
GetProcessHeap
(),
0
,
filename_len
*
sizeof
(
char
));
if
(
!
filename_a
)
{
UnmapViewOfFile
(
buffer
);
return
E_OUTOFMEMORY
;
}
WideCharToMultiByte
(
CP_ACP
,
0
,
filename
,
-
1
,
filename_a
,
filename_len
,
NULL
,
NULL
);
hr
=
ID3DXInclude_Open
(
include
,
D3D_INCLUDE_LOCAL
,
filename_a
,
NULL
,
&
buffer
,
&
len
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
return
D3DXERR_INVALIDDATA
;
}
hr
=
D3DCompile
(
buffer
,
len
,
filename_a
,
(
const
D3D_SHADER_MACRO
*
)
defines
,
(
ID3DInclude
*
)
include
,
entrypoint
,
profile
,
flags
,
0
,
(
ID3DBlob
**
)
shader
,
(
ID3DBlob
**
)
error_messages
);
...
...
@@ -462,8 +474,8 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO
hr
=
D3DXGetShaderConstantTable
(
ID3DXBuffer_GetBufferPointer
(
*
shader
),
constant_table
);
ID3DXInclude_Close
(
include
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
UnmapViewOfFile
(
buffer
);
return
hr
;
}
...
...
@@ -546,29 +558,41 @@ HRESULT WINAPI D3DXPreprocessShaderFromFileA(const char *filename, const D3DXMAC
HRESULT
WINAPI
D3DXPreprocessShaderFromFileW
(
const
WCHAR
*
filename
,
const
D3DXMACRO
*
defines
,
ID3DXInclude
*
include
,
ID3DXBuffer
**
shader
,
ID3DXBuffer
**
error_messages
)
{
void
*
buffer
;
const
void
*
buffer
;
DWORD
len
;
HRESULT
hr
;
struct
D3DXIncludeImpl
includefromfile
;
char
*
filename_a
;
TRACE
(
"filename %s, defines %p, include %p, shader %p, error_messages %p.
\n
"
,
debugstr_w
(
filename
),
defines
,
include
,
shader
,
error_messages
);
if
(
FAILED
(
map_view_of_file
(
filename
,
&
buffer
,
&
len
)))
return
D3DXERR_INVALIDDATA
;
if
(
!
include
)
{
includefromfile
.
ID3DXInclude_iface
.
lpVtbl
=
&
D3DXInclude_Vtbl
;
include
=
&
includefromfile
.
ID3DXInclude_iface
;
}
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
filename
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
filename_a
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
char
));
if
(
!
filename_a
)
return
E_OUTOFMEMORY
;
WideCharToMultiByte
(
CP_ACP
,
0
,
filename
,
-
1
,
filename_a
,
len
,
NULL
,
NULL
);
hr
=
ID3DXInclude_Open
(
include
,
D3D_INCLUDE_LOCAL
,
filename_a
,
NULL
,
&
buffer
,
&
len
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
return
D3DXERR_INVALIDDATA
;
}
hr
=
D3DPreprocess
(
buffer
,
len
,
NULL
,
(
const
D3D_SHADER_MACRO
*
)
defines
,
(
ID3DInclude
*
)
include
,
(
ID3DBlob
**
)
shader
,
(
ID3DBlob
**
)
error_messages
);
UnmapViewOfFile
(
buffer
);
ID3DXInclude_Close
(
include
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
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