Disallow using combined textures and samplers in shaders
This patch adds a validation to disallow declaraing combined textures and samplers in shaders. SPVC doesn't provide a way to extract the information of combined textures and samplers from shaders, so currently we cannot add the related validation when we use SPVC. BUG=dawn:423 TEST=dawn_unittests Change-Id: I81f05dc6adb57fbc981ee1a651e160c096315551 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22000 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
parent
8a3cc5c4df
commit
214c71769b
|
@ -572,6 +572,10 @@ namespace dawn_native {
|
||||||
return DAWN_VALIDATION_ERROR("Push constants aren't supported.");
|
return DAWN_VALIDATION_ERROR("Push constants aren't supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (resources.sampled_images.size() > 0) {
|
||||||
|
return DAWN_VALIDATION_ERROR("Combined images and samplers aren't supported.");
|
||||||
|
}
|
||||||
|
|
||||||
// Fill in bindingInfo with the SPIRV bindings
|
// Fill in bindingInfo with the SPIRV bindings
|
||||||
auto ExtractResourcesBinding =
|
auto ExtractResourcesBinding =
|
||||||
[this](const spirv_cross::SmallVector<spirv_cross::Resource>& resources,
|
[this](const spirv_cross::SmallVector<spirv_cross::Resource>& resources,
|
||||||
|
|
|
@ -115,3 +115,16 @@ TEST_F(ShaderModuleValidationTest, NoChainedDescriptor) {
|
||||||
wgpu::ShaderModuleDescriptor desc = {};
|
wgpu::ShaderModuleDescriptor desc = {};
|
||||||
ASSERT_DEVICE_ERROR(device.CreateShaderModule(&desc));
|
ASSERT_DEVICE_ERROR(device.CreateShaderModule(&desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test that it is not allowed to use combined texture and sampler.
|
||||||
|
// TODO(jiawei.shao@intel.com): support extracting combined texture and sampler in spvc.
|
||||||
|
TEST_F(ShaderModuleValidationTest, CombinedTextureAndSampler) {
|
||||||
|
const char* shader = R"(
|
||||||
|
#version 450
|
||||||
|
layout (set = 0, binding = 0) uniform sampler2D texture;
|
||||||
|
void main() {
|
||||||
|
})";
|
||||||
|
|
||||||
|
ASSERT_DEVICE_ERROR(
|
||||||
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, shader));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue