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
src/dawn_native/d3d12
|
@ -71,10 +71,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
const std::string ShaderModule::GetHLSLSource(PipelineLayout* layout) {
|
||||
std::unique_ptr<spirv_cross::CompilerHLSL> compiler_impl;
|
||||
spirv_cross::CompilerHLSL* compiler;
|
||||
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 (!GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
|
||||
// If these options are changed, the values in DawnSPIRVCrossHLSLFastFuzzer.cpp need to
|
||||
// be updated.
|
||||
spirv_cross::CompilerGLSL::Options options_glsl;
|
||||
|
@ -104,14 +101,21 @@ namespace dawn_native { namespace d3d12 {
|
|||
const BindingInfo& bindingInfo = groupBindingInfo[binding];
|
||||
if (bindingInfo.used) {
|
||||
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)) {
|
||||
shaderc_spvc::CompilationResult 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();
|
||||
} else {
|
||||
return compiler->compile();
|
||||
|
|
Loading…
Reference in New Issue