mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Make all backend::ShaderModule get SPIRV from the frontend
This will make it easier to support SPIRV as a chained sub-descriptor of ShaderModuleDescriptor in follow-up CLs. Also fix a couple style and formatting issues. Bug: dawn:22 Change-Id: Iddaf1f87edee65687e17670b70024835918a0382 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19864 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
3966eb1175
commit
21744d0fb8
@@ -125,14 +125,14 @@ namespace dawn_native { namespace null {
|
||||
}
|
||||
ResultOrError<ShaderModuleBase*> Device::CreateShaderModuleImpl(
|
||||
const ShaderModuleDescriptor* descriptor) {
|
||||
auto module = new ShaderModule(this, descriptor);
|
||||
Ref<ShaderModule> module = AcquireRef(new ShaderModule(this, descriptor));
|
||||
|
||||
if (IsToggleEnabled(Toggle::UseSpvc)) {
|
||||
shaderc_spvc::CompileOptions options;
|
||||
options.SetValidate(IsValidationEnabled());
|
||||
shaderc_spvc::Context* context = module->GetContext();
|
||||
shaderc_spvc_status status =
|
||||
context->InitializeForGlsl(descriptor->code, descriptor->codeSize, options);
|
||||
shaderc_spvc_status status = context->InitializeForGlsl(
|
||||
module->GetSpirv().data(), module->GetSpirv().size(), options);
|
||||
if (status != shaderc_spvc_status_success) {
|
||||
return DAWN_VALIDATION_ERROR("Unable to initialize instance of spvc");
|
||||
}
|
||||
@@ -144,10 +144,10 @@ namespace dawn_native { namespace null {
|
||||
}
|
||||
DAWN_TRY(module->ExtractSpirvInfo(*compiler));
|
||||
} else {
|
||||
spirv_cross::Compiler compiler(descriptor->code, descriptor->codeSize);
|
||||
spirv_cross::Compiler compiler(module->GetSpirv());
|
||||
DAWN_TRY(module->ExtractSpirvInfo(compiler));
|
||||
}
|
||||
return module;
|
||||
return module.Detach();
|
||||
}
|
||||
ResultOrError<SwapChainBase*> Device::CreateSwapChainImpl(
|
||||
const SwapChainDescriptor* descriptor) {
|
||||
|
||||
Reference in New Issue
Block a user