Make ComboRenderPipelineDescriptor non copyable.
This causes subtle bugs in tests when pointers in combo render pipeline descriptors point at other combo render pipeline descriptors. BUG=dawn:22 Change-Id: I5234df26895986fd1d7a9b4e835598177581803a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11340 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
394553b02e
commit
b8dbada76d
|
@ -704,25 +704,30 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) {
|
|||
renderBundleDesc.cColorFormats[1] = dawn::TextureFormat::RG16Float;
|
||||
renderBundleDesc.cColorFormats[2] = dawn::TextureFormat::R16Sint;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
||||
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
|
||||
renderPipelineDesc.colorStateCount = 3;
|
||||
renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||
renderPipelineDesc.cColorStates[1]->format = dawn::TextureFormat::RG16Float;
|
||||
renderPipelineDesc.cColorStates[2]->format = dawn::TextureFormat::R16Sint;
|
||||
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor* desc) {
|
||||
InitializeRenderPipelineDescriptor(desc);
|
||||
desc->colorStateCount = 3;
|
||||
desc->cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||
desc->cColorStates[1]->format = dawn::TextureFormat::RG16Float;
|
||||
desc->cColorStates[2]->format = dawn::TextureFormat::R16Sint;
|
||||
};
|
||||
|
||||
// Test the success case.
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
SetupRenderPipelineDescForTest(&desc);
|
||||
|
||||
dawn::RenderBundleEncoder renderBundleEncoder =
|
||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||
renderBundleEncoder.SetPipeline(pipeline);
|
||||
renderBundleEncoder.Finish();
|
||||
}
|
||||
|
||||
// Test the failure case for mismatched format types.
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc = renderPipelineDesc;
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
SetupRenderPipelineDescForTest(&desc);
|
||||
desc.cColorStates[1]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
||||
dawn::RenderBundleEncoder renderBundleEncoder =
|
||||
|
@ -734,7 +739,8 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) {
|
|||
|
||||
// Test the failure case for missing format
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc = renderPipelineDesc;
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
SetupRenderPipelineDescForTest(&desc);
|
||||
desc.colorStateCount = 2;
|
||||
|
||||
dawn::RenderBundleEncoder renderBundleEncoder =
|
||||
|
@ -752,27 +758,31 @@ TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) {
|
|||
renderBundleDesc.cColorFormats[0] = dawn::TextureFormat::RGBA8Unorm;
|
||||
renderBundleDesc.depthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
|
||||
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
|
||||
renderPipelineDesc.colorStateCount = 1;
|
||||
renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||
renderPipelineDesc.depthStencilState = &renderPipelineDesc.cDepthStencilState;
|
||||
renderPipelineDesc.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
auto SetupRenderPipelineDescForTest = [this](utils::ComboRenderPipelineDescriptor* desc) {
|
||||
InitializeRenderPipelineDescriptor(desc);
|
||||
desc->colorStateCount = 1;
|
||||
desc->cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||
desc->depthStencilState = &desc->cDepthStencilState;
|
||||
desc->cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
};
|
||||
|
||||
// Test the success case.
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
SetupRenderPipelineDescForTest(&desc);
|
||||
|
||||
dawn::RenderBundleEncoder renderBundleEncoder =
|
||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&renderPipelineDesc);
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&desc);
|
||||
renderBundleEncoder.SetPipeline(pipeline);
|
||||
renderBundleEncoder.Finish();
|
||||
}
|
||||
|
||||
// Test the failure case for mismatched format.
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc = renderPipelineDesc;
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
SetupRenderPipelineDescForTest(&desc);
|
||||
desc.cDepthStencilState.format = dawn::TextureFormat::Depth24Plus;
|
||||
desc.depthStencilState = &desc.cDepthStencilState;
|
||||
|
||||
dawn::RenderBundleEncoder renderBundleEncoder =
|
||||
device.CreateRenderBundleEncoder(&renderBundleDesc);
|
||||
|
@ -783,7 +793,8 @@ TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) {
|
|||
|
||||
// Test the failure case for missing format.
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor desc = renderPipelineDesc;
|
||||
utils::ComboRenderPipelineDescriptor desc(device);
|
||||
SetupRenderPipelineDescForTest(&desc);
|
||||
desc.depthStencilState = nullptr;
|
||||
|
||||
dawn::RenderBundleEncoder renderBundleEncoder =
|
||||
|
|
|
@ -35,6 +35,11 @@ namespace utils {
|
|||
public:
|
||||
ComboRenderPipelineDescriptor(const dawn::Device& device);
|
||||
|
||||
ComboRenderPipelineDescriptor(const ComboRenderPipelineDescriptor&) = delete;
|
||||
ComboRenderPipelineDescriptor& operator=(const ComboRenderPipelineDescriptor&) = delete;
|
||||
ComboRenderPipelineDescriptor(ComboRenderPipelineDescriptor&&) = delete;
|
||||
ComboRenderPipelineDescriptor& operator=(ComboRenderPipelineDescriptor&&) = delete;
|
||||
|
||||
dawn::PipelineStageDescriptor cFragmentStage;
|
||||
|
||||
ComboVertexInputDescriptor cVertexInput;
|
||||
|
|
Loading…
Reference in New Issue