diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index 68da595728..7641053031 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -572,6 +572,10 @@ namespace dawn_native { 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 auto ExtractResourcesBinding = [this](const spirv_cross::SmallVector& resources, diff --git a/src/tests/unittests/validation/ShaderModuleValidationTests.cpp b/src/tests/unittests/validation/ShaderModuleValidationTests.cpp index 6a037e9c88..bb08ecc702 100644 --- a/src/tests/unittests/validation/ShaderModuleValidationTests.cpp +++ b/src/tests/unittests/validation/ShaderModuleValidationTests.cpp @@ -115,3 +115,16 @@ TEST_F(ShaderModuleValidationTest, NoChainedDescriptor) { wgpu::ShaderModuleDescriptor 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)); +}