mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
Rename setBlendColor->setBlendConstant
Matches most recent spec changes. setBlendColor has been marked as deprecated. Bug: chromium:1199057 Change-Id: I4584ce789bd7d14401244509d5ada62a46236a5d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47901 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
22b923cc91
commit
413dcf8a40
@@ -106,8 +106,8 @@ class ColorStateTest : 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) {
|
||||
wgpu::Color blendColor{triangle.blendFactor[0], triangle.blendFactor[1],
|
||||
triangle.blendFactor[2], triangle.blendFactor[3]};
|
||||
wgpu::Color blendConstant{triangle.blendFactor[0], triangle.blendFactor[1],
|
||||
triangle.blendFactor[2], triangle.blendFactor[3]};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
@@ -120,7 +120,7 @@ class ColorStateTest : 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(&blendColor);
|
||||
pass.SetBlendConstant(&blendConstant);
|
||||
pass.Draw(3);
|
||||
pass.EndPass();
|
||||
}
|
||||
@@ -975,7 +975,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
|
||||
MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(0, 0, 0, 0)}})));
|
||||
pass.Draw(3);
|
||||
pass.SetPipeline(testPipeline);
|
||||
pass.SetBlendColor(&kWhite);
|
||||
pass.SetBlendConstant(&kWhite);
|
||||
pass.SetBindGroup(
|
||||
0, MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(255, 255, 255, 255)}})));
|
||||
pass.Draw(3);
|
||||
@@ -999,7 +999,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
|
||||
MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(0, 0, 0, 0)}})));
|
||||
pass.Draw(3);
|
||||
pass.SetPipeline(testPipeline);
|
||||
pass.SetBlendColor(&kWhite);
|
||||
pass.SetBlendConstant(&kWhite);
|
||||
pass.SetBindGroup(
|
||||
0, MakeBindGroupForColors(std::array<RGBA8, 1>({{RGBA8(255, 255, 255, 255)}})));
|
||||
pass.Draw(3);
|
||||
|
||||
@@ -51,6 +51,18 @@ TEST_P(DeprecationTests, SetIndexBufferWithFormat) {
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
// Test that SetBlendColor is deprecated.
|
||||
TEST_P(DeprecationTests, SetSetBlendColor) {
|
||||
wgpu::Color blendColor{1.0, 0.0, 0.0, 1.0};
|
||||
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
EXPECT_DEPRECATION_WARNING(pass.SetBlendColor(&blendColor));
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
// Test that BindGroupLayoutEntry cannot have a type if buffer, sampler, texture, or storageTexture
|
||||
// are defined.
|
||||
TEST_P(DeprecationTests, BindGroupLayoutEntryTypeConflict) {
|
||||
|
||||
@@ -203,31 +203,31 @@ TEST_F(SetScissorTest, ScissorLargerThanFramebuffer) {
|
||||
TestScissorCall(false, 0, std::numeric_limits<uint32_t>::max(), kWidth, kHeight);
|
||||
}
|
||||
|
||||
class SetBlendColorTest : public ValidationTest {};
|
||||
class SetBlendConstantTest : public ValidationTest {};
|
||||
|
||||
// Test to check basic use of SetBlendColor
|
||||
TEST_F(SetBlendColorTest, Success) {
|
||||
// Test to check basic use of SetBlendConstantTest
|
||||
TEST_F(SetBlendConstantTest, Success) {
|
||||
DummyRenderPass renderPass(device);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
constexpr wgpu::Color kTransparentBlack{0.0f, 0.0f, 0.0f, 0.0f};
|
||||
pass.SetBlendColor(&kTransparentBlack);
|
||||
pass.SetBlendConstant(&kTransparentBlack);
|
||||
pass.EndPass();
|
||||
}
|
||||
encoder.Finish();
|
||||
}
|
||||
|
||||
// Test that SetBlendColor allows any value, large, small or negative
|
||||
TEST_F(SetBlendColorTest, AnyValueAllowed) {
|
||||
// Test that SetBlendConstant allows any value, large, small or negative
|
||||
TEST_F(SetBlendConstantTest, AnyValueAllowed) {
|
||||
DummyRenderPass renderPass(device);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
constexpr wgpu::Color kAnyColorValue{-1.0f, 42.0f, -0.0f, 0.0f};
|
||||
pass.SetBlendColor(&kAnyColorValue);
|
||||
pass.SetBlendConstant(&kAnyColorValue);
|
||||
pass.EndPass();
|
||||
}
|
||||
encoder.Finish();
|
||||
|
||||
Reference in New Issue
Block a user