mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
Use const*const* to annotate color state descriptors
Color state descriptors are a sequence of descriptors embedded in RenderPipeline descriptor. We should use const*const* to annotate them for supporting potential extended features added in color state descriptors in future. BUG=dawn:77 Change-Id: Id755569fa5076668c3db7b219b699845bc2a1d69 Reviewed-on: https://dawn-review.googlesource.com/c/4880 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
f20f5b9493
commit
938811eef9
@@ -130,7 +130,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
||||
textureDescriptor.layout = pipelineLayout;
|
||||
textureDescriptor.cVertexStage.module = vsModule;
|
||||
textureDescriptor.cFragmentStage.module = fsModule;
|
||||
textureDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
textureDescriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
|
||||
|
||||
@@ -215,7 +215,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||
pipelineDescriptor.layout = pipelineLayout;
|
||||
pipelineDescriptor.cVertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
pipelineDescriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
|
||||
@@ -337,7 +337,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
||||
textureDescriptor.layout = pipelineLayout;
|
||||
textureDescriptor.cVertexStage.module = vsModule;
|
||||
textureDescriptor.cFragmentStage.module = fsModule;
|
||||
textureDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
textureDescriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
|
||||
|
||||
@@ -431,7 +431,7 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets)
|
||||
pipelineDescriptor.layout = pipelineLayout;
|
||||
pipelineDescriptor.cVertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
pipelineDescriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
@@ -54,7 +54,7 @@ class ColorStateTest : public DawnTest {
|
||||
|
||||
// Set up basePipeline and testPipeline. testPipeline has the given blend state on the first
|
||||
// attachment. basePipeline has no blending
|
||||
void SetupSingleSourcePipelines(const dawn::ColorStateDescriptor& colorStateDescriptor) {
|
||||
void SetupSingleSourcePipelines(dawn::ColorStateDescriptor colorStateDescriptor) {
|
||||
dawn::ShaderModule fsModule =
|
||||
utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"(
|
||||
#version 450
|
||||
@@ -73,7 +73,7 @@ class ColorStateTest : public DawnTest {
|
||||
baseDescriptor.layout = pipelineLayout;
|
||||
baseDescriptor.cVertexStage.module = vsModule;
|
||||
baseDescriptor.cFragmentStage.module = fsModule;
|
||||
baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
|
||||
|
||||
@@ -81,8 +81,8 @@ class ColorStateTest : public DawnTest {
|
||||
testDescriptor.layout = pipelineLayout;
|
||||
testDescriptor.cVertexStage.module = vsModule;
|
||||
testDescriptor.cFragmentStage.module = fsModule;
|
||||
testDescriptor.cColorStates[0] = colorStateDescriptor;
|
||||
testDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
testDescriptor.cColorStates[0] = &colorStateDescriptor;
|
||||
testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||
}
|
||||
@@ -834,14 +834,14 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
||||
blend3.srcFactor = dawn::BlendFactor::One;
|
||||
blend3.dstFactor = dawn::BlendFactor::One;
|
||||
|
||||
testDescriptor.cColorStates[0].colorBlend = blend1;
|
||||
testDescriptor.cColorStates[0].alphaBlend = blend1;
|
||||
testDescriptor.cColorStates[0]->colorBlend = blend1;
|
||||
testDescriptor.cColorStates[0]->alphaBlend = blend1;
|
||||
|
||||
testDescriptor.cColorStates[1].colorBlend = blend2;
|
||||
testDescriptor.cColorStates[1].alphaBlend = blend2;
|
||||
testDescriptor.cColorStates[1]->colorBlend = blend2;
|
||||
testDescriptor.cColorStates[1]->alphaBlend = blend2;
|
||||
|
||||
testDescriptor.cColorStates[3].colorBlend = blend3;
|
||||
testDescriptor.cColorStates[3].alphaBlend = blend3;
|
||||
testDescriptor.cColorStates[3]->colorBlend = blend3;
|
||||
testDescriptor.cColorStates[3]->alphaBlend = blend3;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||
|
||||
@@ -909,7 +909,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
|
||||
baseDescriptor.layout = pipelineLayout;
|
||||
baseDescriptor.cVertexStage.module = vsModule;
|
||||
baseDescriptor.cFragmentStage.module = fsModule;
|
||||
baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
baseDescriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
|
||||
|
||||
@@ -917,14 +917,14 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
|
||||
testDescriptor.layout = pipelineLayout;
|
||||
testDescriptor.cVertexStage.module = vsModule;
|
||||
testDescriptor.cFragmentStage.module = fsModule;
|
||||
testDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
dawn::BlendDescriptor blend;
|
||||
blend.operation = dawn::BlendOperation::Add;
|
||||
blend.srcFactor = dawn::BlendFactor::BlendColor;
|
||||
blend.dstFactor = dawn::BlendFactor::One;
|
||||
testDescriptor.cColorStates[0].colorBlend = blend;
|
||||
testDescriptor.cColorStates[0].alphaBlend = blend;
|
||||
testDescriptor.cColorStates[0]->colorBlend = blend;
|
||||
testDescriptor.cColorStates[0]->alphaBlend = blend;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||
constexpr dawn::Color kWhite{1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
@@ -64,7 +64,7 @@ class DrawIndexedTest : public DawnTest {
|
||||
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.indexFormat = dawn::IndexFormat::Uint32;
|
||||
descriptor.inputState = inputState;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
descriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class DrawTest : public DawnTest {
|
||||
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.indexFormat = dawn::IndexFormat::Uint32;
|
||||
descriptor.inputState = inputState;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
descriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class IndexFormatTest : public DawnTest {
|
||||
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.indexFormat = format;
|
||||
descriptor.inputState = inputState;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
descriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ class InputStateTest : public DawnTest {
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.inputState = inputState;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
descriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ class PrimitiveTopologyTest : public DawnTest {
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = primitiveTopology;
|
||||
descriptor.inputState = inputState;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
descriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
|
||||
@@ -195,8 +195,8 @@ class PushConstantTest: public DawnTest {
|
||||
blend.operation = dawn::BlendOperation::Add;
|
||||
blend.srcFactor = dawn::BlendFactor::One;
|
||||
blend.dstFactor = dawn::BlendFactor::One;
|
||||
descriptor.cColorStates[0].alphaBlend = blend;
|
||||
descriptor.cColorStates[0].colorBlend = blend;
|
||||
descriptor.cColorStates[0]->alphaBlend = blend;
|
||||
descriptor.cColorStates[0]->colorBlend = blend;
|
||||
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ protected:
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.indexFormat = dawn::IndexFormat::Uint32;
|
||||
descriptor.cColorStates[0].format = kFormat;
|
||||
descriptor.cColorStates[0]->format = kFormat;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ protected:
|
||||
pipelineDescriptor.layout = pipelineLayout;
|
||||
pipelineDescriptor.cVertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.cColorStates[0].format = mRenderPass.colorFormat;
|
||||
pipelineDescriptor.cColorStates[0]->format = mRenderPass.colorFormat;
|
||||
|
||||
mPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class ScissorTest: public DawnTest {
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.cColorStates[0].format = format;
|
||||
descriptor.cColorStates[0]->format = format;
|
||||
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ protected:
|
||||
textureDescriptor.cVertexStage.module = mVSModule;
|
||||
textureDescriptor.cFragmentStage.module = fsModule;
|
||||
textureDescriptor.layout = mPipelineLayout;
|
||||
textureDescriptor.cColorStates[0].format = mRenderPass.colorFormat;
|
||||
textureDescriptor.cColorStates[0]->format = mRenderPass.colorFormat;
|
||||
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
|
||||
|
||||
@@ -516,7 +516,7 @@ class TextureViewRenderingTest : public DawnTest {
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.cVertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = oneColorFsModule;
|
||||
pipelineDescriptor.cColorStates[0].format = kDefaultFormat;
|
||||
pipelineDescriptor.cColorStates[0]->format = kDefaultFormat;
|
||||
|
||||
dawn::RenderPipeline oneColorPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) {
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.primitiveTopology = dawn::PrimitiveTopology::PointList;
|
||||
descriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
descriptor.cColorStates[0]->format = renderPass.colorFormat;
|
||||
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class InputStateTest : public ValidationTest {
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.inputState = inputState;
|
||||
descriptor.cColorStates[0].format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.cColorStates[0]->format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
|
||||
if (!success) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||
|
||||
@@ -154,7 +154,8 @@ TEST_F(WireArgumentTests, CStringArgument) {
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
|
||||
pipelineDescriptor.numColorStates = 1;
|
||||
pipelineDescriptor.colorStates = &colorStateDescriptor;
|
||||
dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
|
||||
pipelineDescriptor.colorStates = colorStatesPtr;
|
||||
|
||||
pipelineDescriptor.sampleCount = 1;
|
||||
pipelineDescriptor.layout = layout;
|
||||
|
||||
@@ -139,7 +139,8 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
|
||||
pipelineDescriptor.numColorStates = 1;
|
||||
pipelineDescriptor.colorStates = &colorStateDescriptor;
|
||||
dawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};
|
||||
pipelineDescriptor.colorStates = colorStatesPtr;
|
||||
|
||||
pipelineDescriptor.sampleCount = 1;
|
||||
pipelineDescriptor.layout = layout;
|
||||
|
||||
Reference in New Issue
Block a user