Validate that ShaderModuleDescriptor has chained descriptor
Bug: chromium:1074575 Change-Id: Ibb124ca8c4771d9b8f2846d3a5f79dca6de8743d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21360 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
70ffa0c285
commit
818c6b7082
|
@ -329,10 +329,14 @@ namespace dawn_native {
|
|||
return ValidateSpirv(device, descriptor->code, descriptor->codeSize);
|
||||
}
|
||||
|
||||
// For now only a single SPIRV or WGSL subdescriptor is allowed.
|
||||
const ChainedStruct* chainedDescriptor = descriptor->nextInChain;
|
||||
if (chainedDescriptor == nullptr) {
|
||||
return DAWN_VALIDATION_ERROR("Shader module descriptor missing chained descriptor");
|
||||
}
|
||||
// For now only a single SPIRV or WGSL subdescriptor is allowed.
|
||||
if (chainedDescriptor->nextInChain != nullptr) {
|
||||
return DAWN_VALIDATION_ERROR("chained nextInChain must be nullptr");
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Shader module descriptor chained nextInChain must be nullptr");
|
||||
}
|
||||
|
||||
switch (chainedDescriptor->sType) {
|
||||
|
|
|
@ -108,3 +108,10 @@ TEST_F(ShaderModuleValidationTest, FragmentOutputLocationExceedsMaxColorAttachme
|
|||
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment,
|
||||
stream.str().c_str()));
|
||||
}
|
||||
|
||||
// Test that it is invalid to create a shader module with no chained descriptor. (It must be
|
||||
// WGSL or SPIRV, not empty)
|
||||
TEST_F(ShaderModuleValidationTest, NoChainedDescriptor) {
|
||||
wgpu::ShaderModuleDescriptor desc = {};
|
||||
ASSERT_DEVICE_ERROR(device.CreateShaderModule(&desc));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue