mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
Make setBlendColor take in a Color instead of 4 floats
BUG= Change-Id: Ic70d5b664c0ea64c038129cdb83f4ba05fb61830 Reviewed-on: https://dawn-review.googlesource.com/c/4341 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
d1be0e7077
commit
00976d0db1
@@ -104,6 +104,8 @@ class BlendStateTest : public DawnTest {
|
||||
|
||||
// Test that after drawing a triangle with the base color, and then the given triangle spec, the color is as expected
|
||||
void DoSingleSourceTest(RGBA8 base, const TriangleSpec& triangle, const RGBA8& expected) {
|
||||
dawn::Color blendColor{triangle.blendFactor[0], triangle.blendFactor[1], triangle.blendFactor[2], triangle.blendFactor[3]};
|
||||
|
||||
dawn::CommandBufferBuilder builder = device.CreateCommandBufferBuilder();
|
||||
{
|
||||
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo);
|
||||
@@ -115,7 +117,7 @@ class BlendStateTest : public DawnTest {
|
||||
// Then use the test pipeline to draw the test triangle with blending
|
||||
pass.SetPipeline(testPipeline);
|
||||
pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({ { triangle.color } })));
|
||||
pass.SetBlendColor(triangle.blendFactor[0], triangle.blendFactor[1], triangle.blendFactor[2], triangle.blendFactor[3]);
|
||||
pass.SetBlendColor(&blendColor);
|
||||
pass.Draw(3, 1, 0, 0);
|
||||
pass.EndPass();
|
||||
}
|
||||
@@ -884,6 +886,7 @@ TEST_P(BlendStateTest, DefaultBlendColor) {
|
||||
testDescriptor.cBlendStates[0].alphaBlend = blend;
|
||||
|
||||
testPipeline = device.CreateRenderPipeline(&testDescriptor);
|
||||
constexpr dawn::Color kWhite{1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
// Check that the initial blend color is (0,0,0,0)
|
||||
{
|
||||
@@ -914,7 +917,7 @@ TEST_P(BlendStateTest, DefaultBlendColor) {
|
||||
pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({ { RGBA8(0, 0, 0, 0) } })));
|
||||
pass.Draw(3, 1, 0, 0);
|
||||
pass.SetPipeline(testPipeline);
|
||||
pass.SetBlendColor(1, 1, 1, 1);
|
||||
pass.SetBlendColor(&kWhite);
|
||||
pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({ { RGBA8(255, 255, 255, 255) } })));
|
||||
pass.Draw(3, 1, 0, 0);
|
||||
pass.EndPass();
|
||||
@@ -935,7 +938,7 @@ TEST_P(BlendStateTest, DefaultBlendColor) {
|
||||
pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({ { RGBA8(0, 0, 0, 0) } })));
|
||||
pass.Draw(3, 1, 0, 0);
|
||||
pass.SetPipeline(testPipeline);
|
||||
pass.SetBlendColor(1, 1, 1, 1);
|
||||
pass.SetBlendColor(&kWhite);
|
||||
pass.SetBindGroup(0, MakeBindGroupForColors(std::array<RGBA8, 1>({ { RGBA8(255, 255, 255, 255) } })));
|
||||
pass.Draw(3, 1, 0, 0);
|
||||
pass.EndPass();
|
||||
|
||||
@@ -68,7 +68,8 @@ TEST_F(SetBlendColorTest, Success) {
|
||||
dawn::CommandBufferBuilder builder = AssertWillBeSuccess(device.CreateCommandBufferBuilder());
|
||||
{
|
||||
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPass);
|
||||
pass.SetBlendColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
constexpr dawn::Color kTransparentBlack{0.0f, 0.0f, 0.0f, 0.0f};
|
||||
pass.SetBlendColor(&kTransparentBlack);
|
||||
pass.EndPass();
|
||||
}
|
||||
builder.GetResult();
|
||||
@@ -81,7 +82,8 @@ TEST_F(SetBlendColorTest, AnyValueAllowed) {
|
||||
dawn::CommandBufferBuilder builder = AssertWillBeSuccess(device.CreateCommandBufferBuilder());
|
||||
{
|
||||
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPass);
|
||||
pass.SetBlendColor(-1.0f, 42.0f, -0.0f, 0.0f);
|
||||
constexpr dawn::Color kAnyColorValue{-1.0f, 42.0f, -0.0f, 0.0f};
|
||||
pass.SetBlendColor(&kAnyColorValue);
|
||||
pass.EndPass();
|
||||
}
|
||||
builder.GetResult();
|
||||
@@ -90,7 +92,7 @@ TEST_F(SetBlendColorTest, AnyValueAllowed) {
|
||||
class SetStencilReferenceTest : public ValidationTest {
|
||||
};
|
||||
|
||||
// Test to check basic use of SetBlendColor
|
||||
// Test to check basic use of SetStencilReferenceTest
|
||||
TEST_F(SetStencilReferenceTest, Success) {
|
||||
DummyRenderPass renderPass = CreateDummyRenderPass();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user