mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Refactor code to have rudimentary support for using SPVC
This is the first step for having a fully operational SPVC usage path. This version of SPVC integration uses SPVC for setting up the options to the compiler, but a lot of the actual interaction with spirv-cross is done in Dawn, just via SPVC's compiler object. Future CLs will migrate more of the spirv-cross interaction to using the SPVC API, eventually removing the need for Dawn to know about spirv-cross. BUG=dawn:288 Change-Id: I68e0773f910d7fe967235b6987b3debe1d13883f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14143 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
969df2b3a2
commit
be5c135672
@@ -129,9 +129,22 @@ namespace dawn_native { namespace null {
|
||||
const ShaderModuleDescriptor* descriptor) {
|
||||
auto module = new ShaderModule(this, descriptor);
|
||||
|
||||
spirv_cross::Compiler compiler(descriptor->code, descriptor->codeSize);
|
||||
module->ExtractSpirvInfo(compiler);
|
||||
if (IsToggleEnabled(Toggle::UseSpvc)) {
|
||||
shaderc_spvc::CompileOptions options;
|
||||
shaderc_spvc::Context context;
|
||||
shaderc_spvc_status status =
|
||||
context.InitializeForGlsl(descriptor->code, descriptor->codeSize, options);
|
||||
if (status != shaderc_spvc_status_success) {
|
||||
return DAWN_VALIDATION_ERROR("Unable to initialize instance of spvc");
|
||||
}
|
||||
|
||||
spirv_cross::Compiler* compiler =
|
||||
reinterpret_cast<spirv_cross::Compiler*>(context.GetCompiler());
|
||||
module->ExtractSpirvInfo(*compiler);
|
||||
} else {
|
||||
spirv_cross::Compiler compiler(descriptor->code, descriptor->codeSize);
|
||||
module->ExtractSpirvInfo(compiler);
|
||||
}
|
||||
return module;
|
||||
}
|
||||
ResultOrError<SwapChainBase*> Device::CreateSwapChainImpl(
|
||||
|
||||
Reference in New Issue
Block a user