Add a toggle to disallow_spirv.
This toggle will be used by Chromium to disallow the unsecured SPIR-V path such that a renderer process can only use WGSL. This new toggle will be covered by a test in Chromium that ensures that in the default configuration SPIR-V is disallowed. Bug: chromium:1214923 Change-Id: Ia67e0c7466044e1086399d995dc841426fe604c9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/52781 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
d8ea0b15df
commit
b66f630f81
|
@ -1083,6 +1083,10 @@ namespace dawn_native {
|
||||||
FindInChain(chainedDescriptor, &wgslDesc);
|
FindInChain(chainedDescriptor, &wgslDesc);
|
||||||
|
|
||||||
if (spirvDesc) {
|
if (spirvDesc) {
|
||||||
|
if (device->IsToggleEnabled(Toggle::DisallowSpirv)) {
|
||||||
|
return DAWN_VALIDATION_ERROR("SPIR-V is disallowed.");
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<uint32_t> spirv(spirvDesc->code, spirvDesc->code + spirvDesc->codeSize);
|
std::vector<uint32_t> spirv(spirvDesc->code, spirvDesc->code + spirvDesc->codeSize);
|
||||||
if (device->IsToggleEnabled(Toggle::UseTintGenerator)) {
|
if (device->IsToggleEnabled(Toggle::UseTintGenerator)) {
|
||||||
tint::Program program;
|
tint::Program program;
|
||||||
|
|
|
@ -182,7 +182,13 @@ namespace dawn_native {
|
||||||
"Sets the D3DCOMPILE_SKIP_OPTIMIZATION and D3DCOMPILE_DEBUG compilation flags when "
|
"Sets the D3DCOMPILE_SKIP_OPTIMIZATION and D3DCOMPILE_DEBUG compilation flags when "
|
||||||
"compiling HLSL code. Enables better shader debugging with external graphics "
|
"compiling HLSL code. Enables better shader debugging with external graphics "
|
||||||
"debugging tools.",
|
"debugging tools.",
|
||||||
"https://crbug.com/dawn/776"}}
|
"https://crbug.com/dawn/776"}},
|
||||||
|
{Toggle::DisallowSpirv,
|
||||||
|
{"disallow_spirv",
|
||||||
|
"Disallow usage of SPIR-V completely so that only WGSL is used for shader modules."
|
||||||
|
"This is useful to prevent a Chromium renderer process from successfully sending"
|
||||||
|
"SPIR-V code to be compiled in the GPU process.",
|
||||||
|
"https://crbug.com/1214923"}},
|
||||||
// Dummy comment to separate the }} so it is clearer what to copy-paste to add a toggle.
|
// Dummy comment to separate the }} so it is clearer what to copy-paste to add a toggle.
|
||||||
}};
|
}};
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
|
@ -52,6 +52,7 @@ namespace dawn_native {
|
||||||
FlushBeforeClientWaitSync,
|
FlushBeforeClientWaitSync,
|
||||||
UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel,
|
UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel,
|
||||||
EmitHLSLDebugSymbols,
|
EmitHLSLDebugSymbols,
|
||||||
|
DisallowSpirv,
|
||||||
|
|
||||||
EnumCount,
|
EnumCount,
|
||||||
InvalidEnum = EnumCount,
|
InvalidEnum = EnumCount,
|
||||||
|
|
Loading…
Reference in New Issue