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
de8f35bb
Commit
de8f35bb
authored
Sep 01, 2010
by
Matteo Bruni
Committed by
Alexandre Julliard
Sep 02, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Implement D3DXCompileShaderFromFile.
parent
f26ab721
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
shader.c
dlls/d3dx9_36/shader.c
+75
-0
No files found.
dlls/d3dx9_36/shader.c
View file @
de8f35bb
...
...
@@ -383,6 +383,81 @@ HRESULT WINAPI D3DXCompileShader(LPCSTR pSrcData,
return
hr
;
}
HRESULT
WINAPI
D3DXCompileShaderFromFileA
(
LPCSTR
filename
,
CONST
D3DXMACRO
*
defines
,
LPD3DXINCLUDE
include
,
LPCSTR
entrypoint
,
LPCSTR
profile
,
DWORD
flags
,
LPD3DXBUFFER
*
shader
,
LPD3DXBUFFER
*
error_messages
,
LPD3DXCONSTANTTABLE
*
constant_table
)
{
LPWSTR
filename_w
=
NULL
;
DWORD
len
;
HRESULT
ret
;
if
(
!
filename
)
return
D3DXERR_INVALIDDATA
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
NULL
,
0
);
filename_w
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
!
filename_w
)
return
E_OUTOFMEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
filename_w
,
len
);
ret
=
D3DXCompileShaderFromFileW
(
filename_w
,
defines
,
include
,
entrypoint
,
profile
,
flags
,
shader
,
error_messages
,
constant_table
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_w
);
return
ret
;
}
HRESULT
WINAPI
D3DXCompileShaderFromFileW
(
LPCWSTR
filename
,
CONST
D3DXMACRO
*
defines
,
LPD3DXINCLUDE
include
,
LPCSTR
entrypoint
,
LPCSTR
profile
,
DWORD
flags
,
LPD3DXBUFFER
*
shader
,
LPD3DXBUFFER
*
error_messages
,
LPD3DXCONSTANTTABLE
*
constant_table
)
{
void
*
buffer
;
DWORD
len
;
HRESULT
hr
;
struct
D3DXIncludeImpl
includefromfile
;
char
*
filename_a
;
if
(
FAILED
(
map_view_of_file
(
filename
,
&
buffer
,
&
len
)))
return
D3DXERR_INVALIDDATA
;
if
(
!
include
)
{
includefromfile
.
lpVtbl
=
&
D3DXInclude_Vtbl
;
include
=
(
LPD3DXINCLUDE
)
&
includefromfile
;
}
filename_a
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
char
));
if
(
!
filename_a
)
{
UnmapViewOfFile
(
buffer
);
return
E_OUTOFMEMORY
;
}
WideCharToMultiByte
(
CP_ACP
,
0
,
filename
,
-
1
,
filename_a
,
len
,
NULL
,
NULL
);
hr
=
D3DCompile
(
buffer
,
len
,
filename_a
,
(
D3D_SHADER_MACRO
*
)
defines
,
(
ID3DInclude
*
)
include
,
entrypoint
,
profile
,
flags
,
0
,
(
ID3DBlob
**
)
shader
,
(
ID3DBlob
**
)
error_messages
);
if
(
SUCCEEDED
(
hr
)
&&
constant_table
)
hr
=
D3DXGetShaderConstantTable
(
ID3DXBuffer_GetBufferPointer
(
*
shader
),
constant_table
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
UnmapViewOfFile
(
buffer
);
return
hr
;
}
static
const
struct
ID3DXConstantTableVtbl
ID3DXConstantTable_Vtbl
;
typedef
struct
ID3DXConstantTableImpl
{
...
...
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