mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
Remove ShaderModule::code/codeSize
It was deprecated in favor of chaining a wgpu::ShaderModuleSPIRVDescriptor. Bug: dawn:22 Change-Id: I210cd7c21c33c6ca8dd286ea64389b774a4355e5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21683 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
437655216e
commit
2eca22f6d7
@@ -56,64 +56,6 @@ class DeprecationTests : public DawnTest {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Tests for ShaderModuleDescriptor.code/codeSize -> ShaderModuleSPIRVDescriptor
|
||||
|
||||
static const char kEmptyShader[] = R"(#version 450
|
||||
void main() {
|
||||
})";
|
||||
|
||||
// That creating a ShaderModule without the chained descriptor gives a warning.
|
||||
TEST_P(DeprecationTests, ShaderModuleNoSubDescriptorIsDeprecated) {
|
||||
std::vector<uint32_t> spirv =
|
||||
CompileGLSLToSpirv(utils::SingleShaderStage::Compute, kEmptyShader);
|
||||
|
||||
wgpu::ShaderModuleDescriptor descriptor;
|
||||
descriptor.codeSize = static_cast<uint32_t>(spirv.size());
|
||||
descriptor.code = spirv.data();
|
||||
EXPECT_DEPRECATION_WARNING(device.CreateShaderModule(&descriptor));
|
||||
}
|
||||
|
||||
// That creating a ShaderModule with both inline code and the chained descriptor is an error.
|
||||
TEST_P(DeprecationTests, ShaderModuleBothInlinedAndChainedIsInvalid) {
|
||||
std::vector<uint32_t> spirv =
|
||||
CompileGLSLToSpirv(utils::SingleShaderStage::Compute, kEmptyShader);
|
||||
|
||||
wgpu::ShaderModuleSPIRVDescriptor spirvDesc;
|
||||
spirvDesc.codeSize = static_cast<uint32_t>(spirv.size());
|
||||
spirvDesc.code = spirv.data();
|
||||
|
||||
wgpu::ShaderModuleDescriptor descriptor;
|
||||
descriptor.nextInChain = &spirvDesc;
|
||||
descriptor.codeSize = static_cast<uint32_t>(spirv.size());
|
||||
descriptor.code = spirv.data();
|
||||
ASSERT_DEVICE_ERROR(device.CreateShaderModule(&descriptor));
|
||||
}
|
||||
|
||||
// That creating a ShaderModule with both inline code still does correct state tracking
|
||||
TEST_P(DeprecationTests, ShaderModuleInlinedCodeStateTracking) {
|
||||
std::vector<uint32_t> spirv =
|
||||
CompileGLSLToSpirv(utils::SingleShaderStage::Compute, kEmptyShader);
|
||||
|
||||
wgpu::ShaderModuleDescriptor descriptor;
|
||||
descriptor.codeSize = static_cast<uint32_t>(spirv.size());
|
||||
descriptor.code = spirv.data();
|
||||
wgpu::ShaderModule module;
|
||||
EXPECT_DEPRECATION_WARNING(module = device.CreateShaderModule(&descriptor));
|
||||
|
||||
// Creating a compute pipeline works, because it is a compute module.
|
||||
wgpu::ComputePipelineDescriptor computePipelineDesc;
|
||||
computePipelineDesc.layout = nullptr;
|
||||
computePipelineDesc.computeStage.module = module;
|
||||
computePipelineDesc.computeStage.entryPoint = "main";
|
||||
device.CreateComputePipeline(&computePipelineDesc);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
||||
renderPipelineDesc.vertexStage.module =
|
||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, kEmptyShader);
|
||||
renderPipelineDesc.cFragmentStage.module = module;
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&renderPipelineDesc));
|
||||
}
|
||||
|
||||
// Tests for BufferCopyView.rowPitch/imageHeight -> bytesPerRow/rowsPerImage
|
||||
|
||||
class BufferCopyViewDeprecationTests : public DeprecationTests {
|
||||
|
||||
Reference in New Issue
Block a user