mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 01:15:39 +00:00
Split AttachmentStateDescriptor, in order to match web idl
AttachmentStateDescriptor was removed in web idl. Its format info for color attachment and depth/stencil attachment were split and added into BlendStateDescriptor (renamed to ColorStateDescriptor) and DepthStencilStateDescriptor (became optional) respectively. This change makes dawn project match the revision in web idl. BUG=dawn:106, dawn:102 Change-Id: If57b060db7b4b5d1124b4a79a3b92a3880047722 Reviewed-on: https://dawn-review.googlesource.com/c/4561 Commit-Queue: Yunchao He <yunchao.he@intel.com> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
4dec7371a2
commit
108bcbd5c9
@@ -130,7 +130,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
||||
textureDescriptor.layout = pipelineLayout;
|
||||
textureDescriptor.cVertexStage.module = vsModule;
|
||||
textureDescriptor.cFragmentStage.module = fsModule;
|
||||
textureDescriptor.cColorAttachments[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.cColorAttachments[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.cColorAttachments[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.cColorAttachments[0]->format = renderPass.colorFormat;
|
||||
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
|
||||
dawn::CommandBufferBuilder builder = device.CreateCommandBufferBuilder();
|
||||
|
||||
@@ -53,7 +53,7 @@ class BlendStateTest : 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::BlendStateDescriptor& blendStateDescriptor) {
|
||||
void SetupSingleSourcePipelines(const dawn::ColorStateDescriptor& colorStateDescriptor) {
|
||||
dawn::ShaderModule fsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Fragment, R"(
|
||||
#version 450
|
||||
layout(set = 0, binding = 0) uniform myBlock {
|
||||
@@ -71,7 +71,7 @@ class BlendStateTest : public DawnTest {
|
||||
baseDescriptor.layout = pipelineLayout;
|
||||
baseDescriptor.cVertexStage.module = vsModule;
|
||||
baseDescriptor.cFragmentStage.module = fsModule;
|
||||
baseDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
|
||||
baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
|
||||
|
||||
@@ -79,8 +79,8 @@ class BlendStateTest : public DawnTest {
|
||||
testDescriptor.layout = pipelineLayout;
|
||||
testDescriptor.cVertexStage.module = vsModule;
|
||||
testDescriptor.cFragmentStage.module = fsModule;
|
||||
testDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
|
||||
testDescriptor.cBlendStates[0] = blendStateDescriptor;
|
||||
testDescriptor.cColorStates[0] = colorStateDescriptor;
|
||||
testDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class BlendStateTest : public DawnTest {
|
||||
blend.srcFactor = dawn::BlendFactor::One;
|
||||
blend.dstFactor = dawn::BlendFactor::One;
|
||||
|
||||
dawn::BlendStateDescriptor descriptor;
|
||||
dawn::ColorStateDescriptor descriptor;
|
||||
descriptor.alphaBlend = blend;
|
||||
descriptor.colorBlend = blend;
|
||||
descriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
||||
@@ -159,7 +159,7 @@ class BlendStateTest : public DawnTest {
|
||||
alphaBlend.srcFactor = alphaSrcFactor;
|
||||
alphaBlend.dstFactor = alphaDstFactor;
|
||||
|
||||
dawn::BlendStateDescriptor descriptor;
|
||||
dawn::ColorStateDescriptor descriptor;
|
||||
descriptor.colorBlend = colorBlend;
|
||||
descriptor.alphaBlend = alphaBlend;
|
||||
descriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
||||
@@ -278,7 +278,7 @@ TEST_P(BlendStateTest, Basic) {
|
||||
blend.operation = dawn::BlendOperation::Add;
|
||||
blend.srcFactor = dawn::BlendFactor::One;
|
||||
blend.dstFactor = dawn::BlendFactor::Zero;
|
||||
dawn::BlendStateDescriptor descriptor;
|
||||
dawn::ColorStateDescriptor descriptor;
|
||||
descriptor.alphaBlend = blend;
|
||||
descriptor.colorBlend = blend;
|
||||
descriptor.colorWriteMask = dawn::ColorWriteMask::All;
|
||||
@@ -633,7 +633,7 @@ TEST_P(BlendStateTest, ColorWriteMask) {
|
||||
blend.srcFactor = dawn::BlendFactor::One;
|
||||
blend.dstFactor = dawn::BlendFactor::One;
|
||||
|
||||
dawn::BlendStateDescriptor descriptor;
|
||||
dawn::ColorStateDescriptor descriptor;
|
||||
descriptor.colorBlend = blend;
|
||||
descriptor.alphaBlend = blend;
|
||||
{
|
||||
@@ -679,7 +679,7 @@ TEST_P(BlendStateTest, ColorWriteMaskBlendingDisabled) {
|
||||
blend.operation = dawn::BlendOperation::Add;
|
||||
blend.srcFactor = dawn::BlendFactor::One;
|
||||
blend.dstFactor = dawn::BlendFactor::Zero;
|
||||
dawn::BlendStateDescriptor descriptor;
|
||||
dawn::ColorStateDescriptor descriptor;
|
||||
descriptor.alphaBlend = blend;
|
||||
descriptor.colorBlend = blend;
|
||||
|
||||
@@ -766,8 +766,7 @@ TEST_P(BlendStateTest, IndependentBlendState) {
|
||||
baseDescriptor.layout = pipelineLayout;
|
||||
baseDescriptor.cVertexStage.module = vsModule;
|
||||
baseDescriptor.cFragmentStage.module = fsModule;
|
||||
baseDescriptor.cAttachmentsState.numColorAttachments = 4;
|
||||
baseDescriptor.numBlendStates = 4;
|
||||
baseDescriptor.numColorStates = 4;
|
||||
|
||||
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
|
||||
|
||||
@@ -775,8 +774,7 @@ TEST_P(BlendStateTest, IndependentBlendState) {
|
||||
testDescriptor.layout = pipelineLayout;
|
||||
testDescriptor.cVertexStage.module = vsModule;
|
||||
testDescriptor.cFragmentStage.module = fsModule;
|
||||
testDescriptor.cAttachmentsState.numColorAttachments = 4;
|
||||
testDescriptor.numBlendStates = 4;
|
||||
testDescriptor.numColorStates = 4;
|
||||
|
||||
// set blend states
|
||||
dawn::BlendDescriptor blend1;
|
||||
@@ -794,14 +792,14 @@ TEST_P(BlendStateTest, IndependentBlendState) {
|
||||
blend3.srcFactor = dawn::BlendFactor::One;
|
||||
blend3.dstFactor = dawn::BlendFactor::One;
|
||||
|
||||
testDescriptor.cBlendStates[0].colorBlend = blend1;
|
||||
testDescriptor.cBlendStates[0].alphaBlend = blend1;
|
||||
testDescriptor.cColorStates[0].colorBlend = blend1;
|
||||
testDescriptor.cColorStates[0].alphaBlend = blend1;
|
||||
|
||||
testDescriptor.cBlendStates[1].colorBlend = blend2;
|
||||
testDescriptor.cBlendStates[1].alphaBlend = blend2;
|
||||
testDescriptor.cColorStates[1].colorBlend = blend2;
|
||||
testDescriptor.cColorStates[1].alphaBlend = blend2;
|
||||
|
||||
testDescriptor.cBlendStates[3].colorBlend = blend3;
|
||||
testDescriptor.cBlendStates[3].alphaBlend = blend3;
|
||||
testDescriptor.cColorStates[3].colorBlend = blend3;
|
||||
testDescriptor.cColorStates[3].alphaBlend = blend3;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||
|
||||
@@ -859,7 +857,7 @@ TEST_P(BlendStateTest, DefaultBlendColor) {
|
||||
baseDescriptor.layout = pipelineLayout;
|
||||
baseDescriptor.cVertexStage.module = vsModule;
|
||||
baseDescriptor.cFragmentStage.module = fsModule;
|
||||
baseDescriptor.cColorAttachments[0]->format = renderPass.colorFormat;
|
||||
baseDescriptor.cColorStates[0].format = renderPass.colorFormat;
|
||||
|
||||
basePipeline = device.CreateRenderPipeline(&baseDescriptor);
|
||||
|
||||
@@ -867,14 +865,14 @@ TEST_P(BlendStateTest, DefaultBlendColor) {
|
||||
testDescriptor.layout = pipelineLayout;
|
||||
testDescriptor.cVertexStage.module = vsModule;
|
||||
testDescriptor.cFragmentStage.module = fsModule;
|
||||
testDescriptor.cColorAttachments[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.cBlendStates[0].colorBlend = blend;
|
||||
testDescriptor.cBlendStates[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};
|
||||
|
||||
@@ -294,9 +294,9 @@ class DepthStencilStateTest : public DawnTest {
|
||||
descriptor.layout = pipelineLayout;
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.cAttachmentsState.hasDepthStencilAttachment = true;
|
||||
descriptor.cDepthStencilAttachment.format = dawn::TextureFormat::D32FloatS8Uint;
|
||||
descriptor.depthStencilState = &test.depthStencilState;
|
||||
descriptor.cDepthStencilState = test.depthStencilState;
|
||||
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
|
||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class DrawIndexedTest : public DawnTest {
|
||||
descriptor.primitiveTopology = dawn::PrimitiveTopology::TriangleStrip;
|
||||
descriptor.indexFormat = dawn::IndexFormat::Uint32;
|
||||
descriptor.inputState = inputState;
|
||||
descriptor.cColorAttachments[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.cColorAttachments[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.cColorAttachments[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.cColorAttachments[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.cColorAttachments[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.cBlendStates[0].alphaBlend = blend;
|
||||
descriptor.cBlendStates[0].colorBlend = blend;
|
||||
descriptor.cColorStates[0].alphaBlend = blend;
|
||||
descriptor.cColorStates[0].colorBlend = blend;
|
||||
|
||||
return device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ protected:
|
||||
pipelineDescriptor.layout = pipelineLayout;
|
||||
pipelineDescriptor.cVertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.cColorAttachments[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.cColorAttachments[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.cColorAttachments[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.cColorAttachments[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.cColorAttachments[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.cColorAttachments[0]->format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.cColorStates[0].format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
|
||||
if (!success) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||
|
||||
@@ -58,26 +58,16 @@ TEST_F(RenderPipelineValidationTest, BlendState) {
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.numBlendStates = 1;
|
||||
descriptor.numColorStates = 1;
|
||||
|
||||
device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
|
||||
{ // Fail because lack of blend states for color attachments
|
||||
{ // Fail because lack of color states (and depth/stencil state)
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.numBlendStates = 0;
|
||||
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||
}
|
||||
|
||||
{
|
||||
// Fail because set blend states for empty color attachments
|
||||
utils::ComboRenderPipelineDescriptor descriptor(device);
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.numBlendStates = 2;
|
||||
descriptor.numColorStates = 0;
|
||||
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||
}
|
||||
|
||||
@@ -88,16 +88,17 @@ TEST_F(WireArgumentTests, CStringArgument) {
|
||||
dawnShaderModule apiVsModule = api.GetNewShaderModule();
|
||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiVsModule));
|
||||
|
||||
// Create the blend state descriptor
|
||||
// Create the color state descriptor
|
||||
dawnBlendDescriptor blendDescriptor;
|
||||
blendDescriptor.operation = DAWN_BLEND_OPERATION_ADD;
|
||||
blendDescriptor.srcFactor = DAWN_BLEND_FACTOR_ONE;
|
||||
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
||||
dawnBlendStateDescriptor blendStateDescriptor;
|
||||
blendStateDescriptor.nextInChain = nullptr;
|
||||
blendStateDescriptor.alphaBlend = blendDescriptor;
|
||||
blendStateDescriptor.colorBlend = blendDescriptor;
|
||||
blendStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||
dawnColorStateDescriptor colorStateDescriptor;
|
||||
colorStateDescriptor.nextInChain = nullptr;
|
||||
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
||||
colorStateDescriptor.alphaBlend = blendDescriptor;
|
||||
colorStateDescriptor.colorBlend = blendDescriptor;
|
||||
colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||
|
||||
// Create the input state
|
||||
dawnInputStateBuilder inputStateBuilder = dawnDeviceCreateInputStateBuilder(device);
|
||||
@@ -119,6 +120,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
|
||||
|
||||
dawnDepthStencilStateDescriptor depthStencilState;
|
||||
depthStencilState.nextInChain = nullptr;
|
||||
depthStencilState.format = DAWN_TEXTURE_FORMAT_D32_FLOAT_S8_UINT;
|
||||
depthStencilState.depthWriteEnabled = false;
|
||||
depthStencilState.depthCompare = DAWN_COMPARE_FUNCTION_ALWAYS;
|
||||
depthStencilState.stencilBack = stencilFace;
|
||||
@@ -151,20 +153,8 @@ TEST_F(WireArgumentTests, CStringArgument) {
|
||||
fragmentStage.entryPoint = "main";
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
|
||||
dawnAttachmentsStateDescriptor attachmentsState;
|
||||
attachmentsState.nextInChain = nullptr;
|
||||
attachmentsState.numColorAttachments = 1;
|
||||
dawnAttachmentDescriptor colorAttachment = {nullptr, DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM};
|
||||
dawnAttachmentDescriptor* colorAttachmentPtr[] = {&colorAttachment};
|
||||
attachmentsState.colorAttachments = colorAttachmentPtr;
|
||||
attachmentsState.hasDepthStencilAttachment = false;
|
||||
// Even with hasDepthStencilAttachment = false, depthStencilAttachment must point to valid
|
||||
// data because we don't have optional substructures yet.
|
||||
attachmentsState.depthStencilAttachment = &colorAttachment;
|
||||
pipelineDescriptor.attachmentsState = &attachmentsState;
|
||||
|
||||
pipelineDescriptor.numBlendStates = 1;
|
||||
pipelineDescriptor.blendStates = &blendStateDescriptor;
|
||||
pipelineDescriptor.numColorStates = 1;
|
||||
pipelineDescriptor.colorStates = &colorStateDescriptor;
|
||||
|
||||
pipelineDescriptor.sampleCount = 1;
|
||||
pipelineDescriptor.layout = layout;
|
||||
|
||||
@@ -73,16 +73,17 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
|
||||
dawnShaderModule apiVsModule = api.GetNewShaderModule();
|
||||
EXPECT_CALL(api, DeviceCreateShaderModule(apiDevice, _)).WillOnce(Return(apiVsModule));
|
||||
|
||||
// Create the blend state descriptor
|
||||
// Create the color state descriptor
|
||||
dawnBlendDescriptor blendDescriptor;
|
||||
blendDescriptor.operation = DAWN_BLEND_OPERATION_ADD;
|
||||
blendDescriptor.srcFactor = DAWN_BLEND_FACTOR_ONE;
|
||||
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
||||
dawnBlendStateDescriptor blendStateDescriptor;
|
||||
blendStateDescriptor.nextInChain = nullptr;
|
||||
blendStateDescriptor.alphaBlend = blendDescriptor;
|
||||
blendStateDescriptor.colorBlend = blendDescriptor;
|
||||
blendStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||
dawnColorStateDescriptor colorStateDescriptor;
|
||||
colorStateDescriptor.nextInChain = nullptr;
|
||||
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
||||
colorStateDescriptor.alphaBlend = blendDescriptor;
|
||||
colorStateDescriptor.colorBlend = blendDescriptor;
|
||||
colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||
|
||||
// Create the input state
|
||||
dawnInputStateBuilder inputStateBuilder = dawnDeviceCreateInputStateBuilder(device);
|
||||
@@ -104,6 +105,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
|
||||
|
||||
dawnDepthStencilStateDescriptor depthStencilState;
|
||||
depthStencilState.nextInChain = nullptr;
|
||||
depthStencilState.format = DAWN_TEXTURE_FORMAT_D32_FLOAT_S8_UINT;
|
||||
depthStencilState.depthWriteEnabled = false;
|
||||
depthStencilState.depthCompare = DAWN_COMPARE_FUNCTION_ALWAYS;
|
||||
depthStencilState.stencilBack = stencilFace;
|
||||
@@ -136,20 +138,8 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
|
||||
fragmentStage.entryPoint = "main";
|
||||
pipelineDescriptor.fragmentStage = &fragmentStage;
|
||||
|
||||
dawnAttachmentsStateDescriptor attachmentsState;
|
||||
attachmentsState.nextInChain = nullptr;
|
||||
attachmentsState.numColorAttachments = 1;
|
||||
dawnAttachmentDescriptor colorAttachment = {nullptr, DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM};
|
||||
dawnAttachmentDescriptor* colorAttachmentPtr[] = {&colorAttachment};
|
||||
attachmentsState.colorAttachments = colorAttachmentPtr;
|
||||
attachmentsState.hasDepthStencilAttachment = false;
|
||||
// Even with hasDepthStencilAttachment = false, depthStencilAttachment must point to valid
|
||||
// data because we don't have optional substructures yet.
|
||||
attachmentsState.depthStencilAttachment = &colorAttachment;
|
||||
pipelineDescriptor.attachmentsState = &attachmentsState;
|
||||
|
||||
pipelineDescriptor.numBlendStates = 1;
|
||||
pipelineDescriptor.blendStates = &blendStateDescriptor;
|
||||
pipelineDescriptor.numColorStates = 1;
|
||||
pipelineDescriptor.colorStates = &colorStateDescriptor;
|
||||
|
||||
pipelineDescriptor.sampleCount = 1;
|
||||
pipelineDescriptor.layout = layout;
|
||||
|
||||
Reference in New Issue
Block a user