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
14ec785f
Commit
14ec785f
authored
May 15, 2012
by
Matteo Bruni
Committed by
Alexandre Julliard
May 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Partially implement D3DCompile function.
parent
ddab7fcd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
4 deletions
+97
-4
compiler.c
dlls/d3dcompiler_43/compiler.c
+97
-4
No files found.
dlls/d3dcompiler_43/compiler.c
View file @
14ec785f
...
...
@@ -490,21 +490,114 @@ HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filena
return
hr
;
}
static
struct
bwriter_shader
*
parse_hlsl_shader
(
const
char
*
text
,
enum
shader_type
type
,
DWORD
version
,
const
char
*
entrypoint
,
char
**
messages
)
{
FIXME
(
"
\n
"
);
return
NULL
;
}
static
HRESULT
compile_shader
(
const
char
*
preproc_shader
,
const
char
*
target
,
const
char
*
entrypoint
,
ID3DBlob
**
shader_blob
,
ID3DBlob
**
error_messages
)
{
struct
bwriter_shader
*
shader
;
char
*
messages
=
NULL
;
HRESULT
hr
;
DWORD
*
res
,
size
;
ID3DBlob
*
buffer
;
char
*
pos
;
FIXME
(
"Parse compilation target.
\n
"
);
shader
=
parse_hlsl_shader
(
preproc_shader
,
ST_VERTEX
,
2
,
entrypoint
,
&
messages
);
if
(
messages
)
{
TRACE
(
"Compiler messages:
\n
"
);
TRACE
(
"%s"
,
messages
);
TRACE
(
"Shader source:
\n
"
);
TRACE
(
"%s
\n
"
,
debugstr_a
(
preproc_shader
));
if
(
error_messages
)
{
const
char
*
preproc_messages
=
*
error_messages
?
ID3D10Blob_GetBufferPointer
(
*
error_messages
)
:
NULL
;
size
=
strlen
(
messages
)
+
(
preproc_messages
?
strlen
(
preproc_messages
)
:
0
)
+
1
;
hr
=
D3DCreateBlob
(
size
,
&
buffer
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
messages
);
if
(
shader
)
SlDeleteShader
(
shader
);
return
hr
;
}
pos
=
ID3D10Blob_GetBufferPointer
(
buffer
);
if
(
preproc_messages
)
{
memcpy
(
pos
,
preproc_messages
,
strlen
(
preproc_messages
)
+
1
);
pos
+=
strlen
(
preproc_messages
);
}
memcpy
(
pos
,
messages
,
strlen
(
messages
)
+
1
);
if
(
*
error_messages
)
ID3D10Blob_Release
(
*
error_messages
);
*
error_messages
=
buffer
;
}
HeapFree
(
GetProcessHeap
(),
0
,
messages
);
}
if
(
!
shader
)
{
ERR
(
"HLSL shader parsing failed.
\n
"
);
return
D3DXERR_INVALIDDATA
;
}
hr
=
SlWriteBytecode
(
shader
,
9
,
&
res
,
&
size
);
SlDeleteShader
(
shader
);
if
(
FAILED
(
hr
))
{
ERR
(
"SlWriteBytecode failed with error 0x%08x.
\n
"
,
hr
);
return
D3DXERR_INVALIDDATA
;
}
if
(
shader_blob
)
{
hr
=
D3DCreateBlob
(
size
,
&
buffer
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
res
);
return
hr
;
}
memcpy
(
ID3D10Blob_GetBufferPointer
(
buffer
),
res
,
size
);
*
shader_blob
=
buffer
;
}
HeapFree
(
GetProcessHeap
(),
0
,
res
);
return
S_OK
;
}
HRESULT
WINAPI
D3DCompile
(
const
void
*
data
,
SIZE_T
data_size
,
const
char
*
filename
,
const
D3D_SHADER_MACRO
*
defines
,
ID3DInclude
*
include
,
const
char
*
entrypoint
,
const
char
*
target
,
UINT
sflags
,
UINT
eflags
,
ID3DBlob
**
shader
,
ID3DBlob
**
error_messages
)
{
HRESULT
hr
;
FIXME
(
"data %p, data_size %lu, filename %s, defines %p, include %p, entrypoint %s,
\n
"
"target %s, sflags %#x, eflags %#x, shader %p, error_messages %p stub!
\n
"
,
data
,
data_size
,
debugstr_a
(
filename
),
defines
,
include
,
debugstr_a
(
entrypoint
),
debugstr_a
(
target
),
sflags
,
eflags
,
shader
,
error_messages
);
TRACE
(
"Shader source:
\n
%s
\n
"
,
debugstr_an
(
data
,
data_size
));
if
(
shader
)
*
shader
=
NULL
;
if
(
error_messages
)
*
error_messages
=
NULL
;
EnterCriticalSection
(
&
wpp_mutex
);
if
(
error_messages
)
D3DCreateBlob
(
1
,
error_messages
);
/* zero fill used as string end */
hr
=
preprocess_shader
(
data
,
data_size
,
defines
,
include
,
error_messages
);
if
(
SUCCEEDED
(
hr
))
hr
=
compile_shader
(
wpp_output
,
target
,
entrypoint
,
shader
,
error_messages
);
return
D3DERR_INVALIDCALL
;
HeapFree
(
GetProcessHeap
(),
0
,
wpp_output
);
LeaveCriticalSection
(
&
wpp_mutex
);
return
hr
;
}
HRESULT
WINAPI
D3DPreprocess
(
const
void
*
data
,
SIZE_T
size
,
const
char
*
filename
,
...
...
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