mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-06 22:53:35 +00:00
Use spvc API for calls in ShaderModuleD3D12
BUG=dawn:291 Change-Id: I0c467d1d7b213872ec0bc1e3924ab89f7786aeba Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14281 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
84d836295e
commit
32c1eae35f
@ -71,10 +71,7 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
const std::string ShaderModule::GetHLSLSource(PipelineLayout* layout) {
|
const std::string ShaderModule::GetHLSLSource(PipelineLayout* layout) {
|
||||||
std::unique_ptr<spirv_cross::CompilerHLSL> compiler_impl;
|
std::unique_ptr<spirv_cross::CompilerHLSL> compiler_impl;
|
||||||
spirv_cross::CompilerHLSL* compiler;
|
spirv_cross::CompilerHLSL* compiler;
|
||||||
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
|
if (!GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
|
||||||
compiler = reinterpret_cast<spirv_cross::CompilerHLSL*>(mSpvcContext.GetCompiler());
|
|
||||||
// TODO(rharrison): Check status & have some sort of meaningful error path
|
|
||||||
} else {
|
|
||||||
// If these options are changed, the values in DawnSPIRVCrossHLSLFastFuzzer.cpp need to
|
// If these options are changed, the values in DawnSPIRVCrossHLSLFastFuzzer.cpp need to
|
||||||
// be updated.
|
// be updated.
|
||||||
spirv_cross::CompilerGLSL::Options options_glsl;
|
spirv_cross::CompilerGLSL::Options options_glsl;
|
||||||
@ -104,14 +101,21 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
const BindingInfo& bindingInfo = groupBindingInfo[binding];
|
const BindingInfo& bindingInfo = groupBindingInfo[binding];
|
||||||
if (bindingInfo.used) {
|
if (bindingInfo.used) {
|
||||||
uint32_t bindingOffset = bindingOffsets[binding];
|
uint32_t bindingOffset = bindingOffsets[binding];
|
||||||
compiler->set_decoration(bindingInfo.id, spv::DecorationBinding, bindingOffset);
|
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
|
||||||
|
mSpvcContext.SetDecoration(bindingInfo.id, SHADERC_SPVC_DECORATION_BINDING,
|
||||||
|
bindingOffset);
|
||||||
|
// TODO(dawn:301): Check status & have some sort of meaningful error path
|
||||||
|
} else {
|
||||||
|
compiler->set_decoration(bindingInfo.id, spv::DecorationBinding,
|
||||||
|
bindingOffset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
|
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
|
||||||
shaderc_spvc::CompilationResult result;
|
shaderc_spvc::CompilationResult result;
|
||||||
mSpvcContext.CompileShader(&result);
|
mSpvcContext.CompileShader(&result);
|
||||||
// TODO(rharrison): Check status & have some sort of meaningful error path
|
// TODO(dawn:301): Check status & have some sort of meaningful error path
|
||||||
return result.GetStringOutput();
|
return result.GetStringOutput();
|
||||||
} else {
|
} else {
|
||||||
return compiler->compile();
|
return compiler->compile();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user