mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 16:37:08 +00:00
Complete the sampler object to match WebGPU
WebGPUSampler is much more complete than Dawn's Sampler. This patch implement the missing part. BUG=dawn:47 Change-Id: Ief45cb9710493e9d79ddab60fe3be5a123b76ebd Reviewed-on: https://dawn-review.googlesource.com/c/3540 Commit-Queue: Shaobo Yan <shaobo.yan@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
ea56333c1e
commit
93158ebede
@@ -232,6 +232,11 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||
samplerDescriptor.addressModeU = dawn::AddressMode::ClampToEdge;
|
||||
samplerDescriptor.addressModeV = dawn::AddressMode::ClampToEdge;
|
||||
samplerDescriptor.addressModeW = dawn::AddressMode::ClampToEdge;
|
||||
samplerDescriptor.lodMinClamp = kLodMin;
|
||||
samplerDescriptor.lodMaxClamp = kLodMax;
|
||||
samplerDescriptor.compareFunction = dawn::CompareFunction::Never;
|
||||
samplerDescriptor.borderColor = dawn::BorderColor::TransparentBlack;
|
||||
|
||||
dawn::Sampler sampler = device.CreateSampler(&samplerDescriptor);
|
||||
|
||||
dawn::TextureDescriptor descriptor;
|
||||
|
||||
@@ -126,6 +126,10 @@ protected:
|
||||
descriptor.addressModeU = u.mMode;
|
||||
descriptor.addressModeV = v.mMode;
|
||||
descriptor.addressModeW = w.mMode;
|
||||
descriptor.lodMinClamp = kLodMin;
|
||||
descriptor.lodMaxClamp = kLodMax;
|
||||
descriptor.compareFunction = dawn::CompareFunction::Never;
|
||||
descriptor.borderColor = dawn::BorderColor::TransparentBlack;
|
||||
sampler = device.CreateSampler(&descriptor);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,10 @@ protected:
|
||||
samplerDescriptor.addressModeU = kAddressMode;
|
||||
samplerDescriptor.addressModeV = kAddressMode;
|
||||
samplerDescriptor.addressModeW = kAddressMode;
|
||||
samplerDescriptor.lodMinClamp = kLodMin;
|
||||
samplerDescriptor.lodMaxClamp = kLodMax;
|
||||
samplerDescriptor.compareFunction = dawn::CompareFunction::Never;
|
||||
samplerDescriptor.borderColor = dawn::BorderColor::TransparentBlack;
|
||||
mSampler = device.CreateSampler(&samplerDescriptor);
|
||||
|
||||
mPipelineLayout = utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "mock/mock_dawn.h"
|
||||
|
||||
#include "common/Assert.h"
|
||||
#include "common/Constants.h"
|
||||
#include "dawn_wire/Wire.h"
|
||||
#include "utils/TerribleCommandBuffer.h"
|
||||
|
||||
@@ -496,6 +497,10 @@ TEST_F(WireTests, StructureOfValuesArgument) {
|
||||
descriptor.addressModeU = DAWN_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
descriptor.addressModeV = DAWN_ADDRESS_MODE_REPEAT;
|
||||
descriptor.addressModeW = DAWN_ADDRESS_MODE_MIRRORED_REPEAT;
|
||||
descriptor.lodMinClamp = kLodMin;
|
||||
descriptor.lodMaxClamp = kLodMax;
|
||||
descriptor.compareFunction = DAWN_COMPARE_FUNCTION_NEVER;
|
||||
descriptor.borderColor = DAWN_BORDER_COLOR_TRANSPARENT_BLACK;
|
||||
|
||||
dawnDeviceCreateSampler(device, &descriptor);
|
||||
EXPECT_CALL(api, DeviceCreateSampler(apiDevice, MatchesLambda([](const dawnSamplerDescriptor* desc) -> bool {
|
||||
@@ -505,7 +510,11 @@ TEST_F(WireTests, StructureOfValuesArgument) {
|
||||
desc->mipmapFilter == DAWN_FILTER_MODE_LINEAR &&
|
||||
desc->addressModeU == DAWN_ADDRESS_MODE_CLAMP_TO_EDGE &&
|
||||
desc->addressModeV == DAWN_ADDRESS_MODE_REPEAT &&
|
||||
desc->addressModeW == DAWN_ADDRESS_MODE_MIRRORED_REPEAT;
|
||||
desc->addressModeW == DAWN_ADDRESS_MODE_MIRRORED_REPEAT &&
|
||||
desc->compareFunction == DAWN_COMPARE_FUNCTION_NEVER &&
|
||||
desc->borderColor == DAWN_BORDER_COLOR_TRANSPARENT_BLACK &&
|
||||
desc->lodMinClamp == kLodMin &&
|
||||
desc->lodMaxClamp == kLodMax;
|
||||
})))
|
||||
.WillOnce(Return(nullptr));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user