Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vkd3d
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wine
vkd3d
Commits
c270d9a8
Commit
c270d9a8
authored
7 years ago
by
Józef Kucia
Browse files
Options
Downloads
Patches
Plain Diff
libs/vkd3d: Accept DXBC shaders.
parent
d32134da
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile.am
+1
-1
1 addition, 1 deletion
Makefile.am
libs/vkd3d/state.c
+31
-3
31 additions, 3 deletions
libs/vkd3d/state.c
with
32 additions
and
4 deletions
Makefile.am
+
1
−
1
View file @
c270d9a8
...
...
@@ -86,7 +86,7 @@ libvkd3d_la_SOURCES = \
libs/vkd3d/vkd3d_main.c
\
libs/vkd3d/vkd3d_private.h
\
libs/vkd3d/vulkan_procs.h
libvkd3d_la_LIBADD
=
libvkd3d-common.la @PTHREAD_LIBS@ @VULKAN_LIBS@
libvkd3d_la_LIBADD
=
libvkd3d-common.la
libvkd3d-shader.la
@PTHREAD_LIBS@ @VULKAN_LIBS@
libvkd3d_utils_la_SOURCES
=
\
libs/vkd3d-utils/vkd3d_utils_main.c
\
...
...
This diff is collapsed.
Click to expand it.
libs/vkd3d/state.c
+
31
−
3
View file @
c270d9a8
...
...
@@ -18,6 +18,9 @@
*/
#include
"vkd3d_private.h"
#include
"vkd3d_shader.h"
#include
"spirv/1.0/spirv.h"
/* ID3D12RootSignature */
static
inline
struct
d3d12_root_signature
*
impl_from_ID3D12RootSignature
(
ID3D12RootSignature
*
iface
)
...
...
@@ -439,12 +442,19 @@ struct d3d12_pipeline_state *unsafe_impl_from_ID3D12PipelineState(ID3D12Pipeline
return
impl_from_ID3D12PipelineState
(
iface
);
}
static
bool
d3d12_shader_bytecode_is_spirv
(
const
D3D12_SHADER_BYTECODE
*
code
)
{
return
*
(
uint32_t
*
)
code
->
pShaderBytecode
==
SpvMagicNumber
;
}
static
HRESULT
create_shader_stage
(
struct
d3d12_device
*
device
,
struct
VkPipelineShaderStageCreateInfo
*
stage_desc
,
enum
VkShaderStageFlagBits
stage
,
const
D3D12_SHADER_BYTECODE
*
code
)
{
const
struct
vkd3d_vk_device_procs
*
vk_procs
=
&
device
->
vk_procs
;
struct
VkShaderModuleCreateInfo
shader_desc
;
struct
vkd3d_shader_code
spirv
=
{};
VkResult
vr
;
HRESULT
hr
;
stage_desc
->
sType
=
VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
;
stage_desc
->
pNext
=
NULL
;
...
...
@@ -456,9 +466,27 @@ static HRESULT create_shader_stage(struct d3d12_device *device, struct VkPipelin
shader_desc
.
sType
=
VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
;
shader_desc
.
pNext
=
NULL
;
shader_desc
.
flags
=
0
;
shader_desc
.
codeSize
=
code
->
BytecodeLength
;
shader_desc
.
pCode
=
code
->
pShaderBytecode
;
if
((
vr
=
VK_CALL
(
vkCreateShaderModule
(
device
->
vk_device
,
&
shader_desc
,
NULL
,
&
stage_desc
->
module
)))
<
0
)
if
(
d3d12_shader_bytecode_is_spirv
(
code
))
{
shader_desc
.
codeSize
=
code
->
BytecodeLength
;
shader_desc
.
pCode
=
code
->
pShaderBytecode
;
}
else
{
struct
vkd3d_shader_code
dxbc
=
{
code
->
pShaderBytecode
,
code
->
BytecodeLength
};
if
(
FAILED
(
hr
=
vkd3d_shader_compile_dxbc
(
&
dxbc
,
&
spirv
,
0
)))
{
WARN
(
"Failed to compile shader, hr %#x.
\n
"
,
hr
);
return
hr
;
}
shader_desc
.
codeSize
=
spirv
.
size
;
shader_desc
.
pCode
=
spirv
.
code
;
}
vr
=
VK_CALL
(
vkCreateShaderModule
(
device
->
vk_device
,
&
shader_desc
,
NULL
,
&
stage_desc
->
module
));
vkd3d_shader_free_shader_code
(
&
spirv
);
if
(
vr
<
0
)
{
WARN
(
"Failed to create Vulkan shader module, vr %d.
\n
"
,
vr
);
return
hresult_from_vk_result
(
vr
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment