Removing deprecated spvc API usages
Roll third_party/shaderc/ c6a2ef12d..a4f9acedf (5 commits)
https://chromium.googlesource.com/external/github.com/google/shaderc/+log/c6a2ef12dffc..a4f9acedf3c0
$ git log c6a2ef12d..a4f9acedf --date=short --no-merges --format='%ad %ae %s'
2020-01-23 rharrison Big cleanup to normalize API behaviour (#967)
2020-01-22 rharrison Start v2020.0 (#970)
2020-01-22 rharrison Fix the version string (#971)
2020-01-22 rharrison Finalize v2019.1 (#969)
2020-01-20 rharrison Rolling 3 dependencies and updating expectations (#966)
Created with:
roll-dep third_party/shaderc
BUG=dawn:324
Change-Id: I3c3900dcccc317054f035e21a6863f068ce417c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15421
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/DEPS b/DEPS
index 61b9721..9387d50 100644
--- a/DEPS
+++ b/DEPS
@@ -69,7 +69,7 @@
'condition': 'dawn_standalone',
},
'third_party/shaderc': {
- 'url': '{chromium_git}/external/github.com/google/shaderc@c6a2ef12dffcd0c13f4d8c90b1a2f23ccda7931a',
+ 'url': '{chromium_git}/external/github.com/google/shaderc@a4f9acedf3c042537db8b28065728df484ca5663',
'condition': 'dawn_standalone',
},
diff --git a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
index 1049ed9..f6fefff 100644
--- a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
+++ b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
@@ -56,8 +56,9 @@
mSpvcContext.InitializeForHlsl(descriptor->code, descriptor->codeSize, options),
"Unable to initialize instance of spvc"));
- spirv_cross::Compiler* compiler =
- reinterpret_cast<spirv_cross::Compiler*>(mSpvcContext.GetCompiler());
+ spirv_cross::Compiler* compiler;
+ DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetCompiler(reinterpret_cast<void**>(&compiler)),
+ "Unable to get cross compiler"));
DAWN_TRY(ExtractSpirvInfo(*compiler));
} else {
spirv_cross::CompilerHLSL compiler(descriptor->code, descriptor->codeSize);
@@ -116,8 +117,9 @@
shaderc_spvc::CompilationResult result;
DAWN_TRY(CheckSpvcSuccess(mSpvcContext.CompileShader(&result),
"Unable to generate HLSL shader w/ spvc"));
- std::string result_string =
- result.GetStringOutput(); // Stripping const for ResultOrError
+ std::string result_string;
+ DAWN_TRY(CheckSpvcSuccess(result.GetStringOutput(&result_string),
+ "Unable to get HLSL shader text"));
return result_string;
} else {
return compiler->compile();
diff --git a/src/dawn_native/metal/ShaderModuleMTL.mm b/src/dawn_native/metal/ShaderModuleMTL.mm
index d817321..679ea02 100644
--- a/src/dawn_native/metal/ShaderModuleMTL.mm
+++ b/src/dawn_native/metal/ShaderModuleMTL.mm
@@ -95,8 +95,9 @@
GetMSLCompileOptions()),
"Unable to initialize instance of spvc"));
- spirv_cross::CompilerMSL* compiler =
- reinterpret_cast<spirv_cross::CompilerMSL*>(mSpvcContext.GetCompiler());
+ spirv_cross::CompilerMSL* compiler;
+ DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetCompiler(reinterpret_cast<void**>(&compiler)),
+ "Unable to get cross compiler"));
DAWN_TRY(ExtractSpirvInfo(*compiler));
} else {
spirv_cross::CompilerMSL compiler(mSpirv);
@@ -119,7 +120,8 @@
DAWN_TRY(CheckSpvcSuccess(
mSpvcContext.InitializeForMsl(mSpirv.data(), mSpirv.size(), GetMSLCompileOptions()),
"Unable to initialize instance of spvc"));
- compiler = reinterpret_cast<spirv_cross::CompilerMSL*>(mSpvcContext.GetCompiler());
+ DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetCompiler(reinterpret_cast<void**>(&compiler)),
+ "Unable to get cross compiler"));
} else {
// If these options are changed, the values in DawnSPIRVCrossMSLFastFuzzer.cpp need to
// be updated.
@@ -196,9 +198,11 @@
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
shaderc_spvc::CompilationResult result;
DAWN_TRY(CheckSpvcSuccess(mSpvcContext.CompileShader(&result),
- "Unable to compile shader"));
-
- mslSource = [NSString stringWithFormat:@"%s", result.GetStringOutput().c_str()];
+ "Unable to compile MSL shader"));
+ std::string result_str;
+ DAWN_TRY(CheckSpvcSuccess(result.GetStringOutput(&result_str),
+ "Unable to get MSL shader text"));
+ mslSource = [NSString stringWithFormat:@"%s", result_str.c_str()];
} else {
std::string msl = compiler->compile();
mslSource = [NSString stringWithFormat:@"%s", msl.c_str()];
diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp
index 9d8dd0b..579aec1 100644
--- a/src/dawn_native/null/DeviceNull.cpp
+++ b/src/dawn_native/null/DeviceNull.cpp
@@ -137,8 +137,11 @@
return DAWN_VALIDATION_ERROR("Unable to initialize instance of spvc");
}
- spirv_cross::Compiler* compiler =
- reinterpret_cast<spirv_cross::Compiler*>(context.GetCompiler());
+ spirv_cross::Compiler* compiler;
+ status = context.GetCompiler(reinterpret_cast<void**>(&compiler));
+ if (status != shaderc_spvc_status_success) {
+ return DAWN_VALIDATION_ERROR("Unable to get cross compiler");
+ }
DAWN_TRY(module->ExtractSpirvInfo(*compiler));
} else {
spirv_cross::Compiler compiler(descriptor->code, descriptor->codeSize);
diff --git a/src/dawn_native/opengl/ShaderModuleGL.cpp b/src/dawn_native/opengl/ShaderModuleGL.cpp
index f8cde6d..ac2f522 100644
--- a/src/dawn_native/opengl/ShaderModuleGL.cpp
+++ b/src/dawn_native/opengl/ShaderModuleGL.cpp
@@ -94,7 +94,8 @@
DAWN_TRY(CheckSpvcSuccess(
mSpvcContext.InitializeForGlsl(descriptor->code, descriptor->codeSize, options),
"Unable to initialize instance of spvc"));
- compiler = reinterpret_cast<spirv_cross::CompilerGLSL*>(mSpvcContext.GetCompiler());
+ DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetCompiler(reinterpret_cast<void**>(&compiler)),
+ "Unable to get cross compiler"));
} else {
// If these options are changed, the values in DawnSPIRVCrossGLSLFastFuzzer.cpp need to
// be updated.
@@ -192,8 +193,9 @@
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
shaderc_spvc::CompilationResult result;
DAWN_TRY(CheckSpvcSuccess(mSpvcContext.CompileShader(&result),
- "Unable to compile shader using spvc"));
- mGlslSource = result.GetStringOutput();
+ "Unable to compile GLSL shader using spvc"));
+ DAWN_TRY(CheckSpvcSuccess(result.GetStringOutput(&mGlslSource),
+ "Unable to get GLSL shader text"));
} else {
mGlslSource = compiler->compile();
}
diff --git a/src/dawn_native/vulkan/ShaderModuleVk.cpp b/src/dawn_native/vulkan/ShaderModuleVk.cpp
index 8c94f70..e756852 100644
--- a/src/dawn_native/vulkan/ShaderModuleVk.cpp
+++ b/src/dawn_native/vulkan/ShaderModuleVk.cpp
@@ -45,8 +45,9 @@
mSpvcContext.InitializeForGlsl(descriptor->code, descriptor->codeSize, options),
"Unable to initialize instance of spvc"));
- spirv_cross::Compiler* compiler =
- reinterpret_cast<spirv_cross::Compiler*>(mSpvcContext.GetCompiler());
+ spirv_cross::Compiler* compiler;
+ DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetCompiler(reinterpret_cast<void**>(&compiler)),
+ "Unable to get cross compiler"));
DAWN_TRY(ExtractSpirvInfo(*compiler));
} else {
spirv_cross::Compiler compiler(descriptor->code, descriptor->codeSize);