Removing deprecated spvc API usages

Roll third_party/shaderc/ c6a2ef12d..a4f9acedf (5 commits)

c6a2ef12df..a4f9acedf3

$ 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>
This commit is contained in:
Ryan Harrison 2020-01-24 16:16:59 +00:00 committed by Commit Bot service account
parent fa06dd0b62
commit 1d036f7766
6 changed files with 30 additions and 18 deletions

2
DEPS
View File

@ -69,7 +69,7 @@ deps = {
'condition': 'dawn_standalone', 'condition': 'dawn_standalone',
}, },
'third_party/shaderc': { 'third_party/shaderc': {
'url': '{chromium_git}/external/github.com/google/shaderc@c6a2ef12dffcd0c13f4d8c90b1a2f23ccda7931a', 'url': '{chromium_git}/external/github.com/google/shaderc@a4f9acedf3c042537db8b28065728df484ca5663',
'condition': 'dawn_standalone', 'condition': 'dawn_standalone',
}, },

View File

@ -56,8 +56,9 @@ namespace dawn_native { namespace d3d12 {
mSpvcContext.InitializeForHlsl(descriptor->code, descriptor->codeSize, options), mSpvcContext.InitializeForHlsl(descriptor->code, descriptor->codeSize, options),
"Unable to initialize instance of spvc")); "Unable to initialize instance of spvc"));
spirv_cross::Compiler* compiler = spirv_cross::Compiler* compiler;
reinterpret_cast<spirv_cross::Compiler*>(mSpvcContext.GetCompiler()); DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetCompiler(reinterpret_cast<void**>(&compiler)),
"Unable to get cross compiler"));
DAWN_TRY(ExtractSpirvInfo(*compiler)); DAWN_TRY(ExtractSpirvInfo(*compiler));
} else { } else {
spirv_cross::CompilerHLSL compiler(descriptor->code, descriptor->codeSize); spirv_cross::CompilerHLSL compiler(descriptor->code, descriptor->codeSize);
@ -116,8 +117,9 @@ namespace dawn_native { namespace d3d12 {
shaderc_spvc::CompilationResult result; shaderc_spvc::CompilationResult result;
DAWN_TRY(CheckSpvcSuccess(mSpvcContext.CompileShader(&result), DAWN_TRY(CheckSpvcSuccess(mSpvcContext.CompileShader(&result),
"Unable to generate HLSL shader w/ spvc")); "Unable to generate HLSL shader w/ spvc"));
std::string result_string = std::string result_string;
result.GetStringOutput(); // Stripping const for ResultOrError DAWN_TRY(CheckSpvcSuccess(result.GetStringOutput(&result_string),
"Unable to get HLSL shader text"));
return result_string; return result_string;
} else { } else {
return compiler->compile(); return compiler->compile();

View File

@ -95,8 +95,9 @@ namespace dawn_native { namespace metal {
GetMSLCompileOptions()), GetMSLCompileOptions()),
"Unable to initialize instance of spvc")); "Unable to initialize instance of spvc"));
spirv_cross::CompilerMSL* compiler = spirv_cross::CompilerMSL* compiler;
reinterpret_cast<spirv_cross::CompilerMSL*>(mSpvcContext.GetCompiler()); DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetCompiler(reinterpret_cast<void**>(&compiler)),
"Unable to get cross compiler"));
DAWN_TRY(ExtractSpirvInfo(*compiler)); DAWN_TRY(ExtractSpirvInfo(*compiler));
} else { } else {
spirv_cross::CompilerMSL compiler(mSpirv); spirv_cross::CompilerMSL compiler(mSpirv);
@ -119,7 +120,8 @@ namespace dawn_native { namespace metal {
DAWN_TRY(CheckSpvcSuccess( DAWN_TRY(CheckSpvcSuccess(
mSpvcContext.InitializeForMsl(mSpirv.data(), mSpirv.size(), GetMSLCompileOptions()), mSpvcContext.InitializeForMsl(mSpirv.data(), mSpirv.size(), GetMSLCompileOptions()),
"Unable to initialize instance of spvc")); "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 { } else {
// If these options are changed, the values in DawnSPIRVCrossMSLFastFuzzer.cpp need to // If these options are changed, the values in DawnSPIRVCrossMSLFastFuzzer.cpp need to
// be updated. // be updated.
@ -196,9 +198,11 @@ namespace dawn_native { namespace metal {
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) { if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
shaderc_spvc::CompilationResult result; shaderc_spvc::CompilationResult result;
DAWN_TRY(CheckSpvcSuccess(mSpvcContext.CompileShader(&result), DAWN_TRY(CheckSpvcSuccess(mSpvcContext.CompileShader(&result),
"Unable to compile shader")); "Unable to compile MSL shader"));
std::string result_str;
mslSource = [NSString stringWithFormat:@"%s", result.GetStringOutput().c_str()]; DAWN_TRY(CheckSpvcSuccess(result.GetStringOutput(&result_str),
"Unable to get MSL shader text"));
mslSource = [NSString stringWithFormat:@"%s", result_str.c_str()];
} else { } else {
std::string msl = compiler->compile(); std::string msl = compiler->compile();
mslSource = [NSString stringWithFormat:@"%s", msl.c_str()]; mslSource = [NSString stringWithFormat:@"%s", msl.c_str()];

View File

@ -137,8 +137,11 @@ namespace dawn_native { namespace null {
return DAWN_VALIDATION_ERROR("Unable to initialize instance of spvc"); return DAWN_VALIDATION_ERROR("Unable to initialize instance of spvc");
} }
spirv_cross::Compiler* compiler = spirv_cross::Compiler* compiler;
reinterpret_cast<spirv_cross::Compiler*>(context.GetCompiler()); 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)); DAWN_TRY(module->ExtractSpirvInfo(*compiler));
} else { } else {
spirv_cross::Compiler compiler(descriptor->code, descriptor->codeSize); spirv_cross::Compiler compiler(descriptor->code, descriptor->codeSize);

View File

@ -94,7 +94,8 @@ namespace dawn_native { namespace opengl {
DAWN_TRY(CheckSpvcSuccess( DAWN_TRY(CheckSpvcSuccess(
mSpvcContext.InitializeForGlsl(descriptor->code, descriptor->codeSize, options), mSpvcContext.InitializeForGlsl(descriptor->code, descriptor->codeSize, options),
"Unable to initialize instance of spvc")); "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 { } else {
// If these options are changed, the values in DawnSPIRVCrossGLSLFastFuzzer.cpp need to // If these options are changed, the values in DawnSPIRVCrossGLSLFastFuzzer.cpp need to
// be updated. // be updated.
@ -192,8 +193,9 @@ namespace dawn_native { namespace opengl {
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) { if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
shaderc_spvc::CompilationResult result; shaderc_spvc::CompilationResult result;
DAWN_TRY(CheckSpvcSuccess(mSpvcContext.CompileShader(&result), DAWN_TRY(CheckSpvcSuccess(mSpvcContext.CompileShader(&result),
"Unable to compile shader using spvc")); "Unable to compile GLSL shader using spvc"));
mGlslSource = result.GetStringOutput(); DAWN_TRY(CheckSpvcSuccess(result.GetStringOutput(&mGlslSource),
"Unable to get GLSL shader text"));
} else { } else {
mGlslSource = compiler->compile(); mGlslSource = compiler->compile();
} }

View File

@ -45,8 +45,9 @@ namespace dawn_native { namespace vulkan {
mSpvcContext.InitializeForGlsl(descriptor->code, descriptor->codeSize, options), mSpvcContext.InitializeForGlsl(descriptor->code, descriptor->codeSize, options),
"Unable to initialize instance of spvc")); "Unable to initialize instance of spvc"));
spirv_cross::Compiler* compiler = spirv_cross::Compiler* compiler;
reinterpret_cast<spirv_cross::Compiler*>(mSpvcContext.GetCompiler()); DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetCompiler(reinterpret_cast<void**>(&compiler)),
"Unable to get cross compiler"));
DAWN_TRY(ExtractSpirvInfo(*compiler)); DAWN_TRY(ExtractSpirvInfo(*compiler));
} else { } else {
spirv_cross::Compiler compiler(descriptor->code, descriptor->codeSize); spirv_cross::Compiler compiler(descriptor->code, descriptor->codeSize);