Remove utils::GetDefaultSamplerDescriptor
This helper is no longer needed now that the descriptor has full defaults and is even optional in CreateSampler. Bug: dawn:599 Change-Id: I0d25233ebb1e817ad27f3ddaca988e01e2a5298c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40520 Commit-Queue: Stephen White <senorblanco@chromium.org> Auto-Submit: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
14a2398e71
commit
fb2e77106a
|
@ -62,8 +62,7 @@ void initTextures() {
|
|||
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
|
||||
texture = device.CreateTexture(&descriptor);
|
||||
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
sampler = device.CreateSampler(&samplerDesc);
|
||||
sampler = device.CreateSampler();
|
||||
|
||||
// Initialize the texture with arbitrary data until we can load images
|
||||
std::vector<uint8_t> data(4 * 1024 * 1024, 0);
|
||||
|
|
|
@ -117,7 +117,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
|||
uint32_t baseMipLevel = 0) {
|
||||
ASSERT(IsBCFormatSupported());
|
||||
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor samplerDesc;
|
||||
samplerDesc.minFilter = wgpu::FilterMode::Nearest;
|
||||
samplerDesc.magFilter = wgpu::FilterMode::Nearest;
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||
|
|
|
@ -307,8 +307,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
|||
|
||||
wgpu::TextureView textureView = wrappingTexture.CreateView();
|
||||
|
||||
wgpu::SamplerDescriptor samplerDescriptor = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDescriptor);
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||
{{0, sampler}, {1, textureView}});
|
||||
|
|
|
@ -311,45 +311,45 @@ TEST_P(ObjectCachingTest, RenderPipelineDeduplicationOnFragmentModule) {
|
|||
|
||||
// Test that Samplers are correctly deduplicated.
|
||||
TEST_P(ObjectCachingTest, SamplerDeduplication) {
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor samplerDesc;
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||
|
||||
wgpu::SamplerDescriptor sameSamplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor sameSamplerDesc;
|
||||
wgpu::Sampler sameSampler = device.CreateSampler(&sameSamplerDesc);
|
||||
|
||||
wgpu::SamplerDescriptor otherSamplerDescAddressModeU = utils::GetDefaultSamplerDescriptor();
|
||||
otherSamplerDescAddressModeU.addressModeU = wgpu::AddressMode::ClampToEdge;
|
||||
wgpu::SamplerDescriptor otherSamplerDescAddressModeU;
|
||||
otherSamplerDescAddressModeU.addressModeU = wgpu::AddressMode::Repeat;
|
||||
wgpu::Sampler otherSamplerAddressModeU = device.CreateSampler(&otherSamplerDescAddressModeU);
|
||||
|
||||
wgpu::SamplerDescriptor otherSamplerDescAddressModeV = utils::GetDefaultSamplerDescriptor();
|
||||
otherSamplerDescAddressModeV.addressModeV = wgpu::AddressMode::ClampToEdge;
|
||||
wgpu::SamplerDescriptor otherSamplerDescAddressModeV;
|
||||
otherSamplerDescAddressModeV.addressModeV = wgpu::AddressMode::Repeat;
|
||||
wgpu::Sampler otherSamplerAddressModeV = device.CreateSampler(&otherSamplerDescAddressModeV);
|
||||
|
||||
wgpu::SamplerDescriptor otherSamplerDescAddressModeW = utils::GetDefaultSamplerDescriptor();
|
||||
otherSamplerDescAddressModeW.addressModeW = wgpu::AddressMode::ClampToEdge;
|
||||
wgpu::SamplerDescriptor otherSamplerDescAddressModeW;
|
||||
otherSamplerDescAddressModeW.addressModeW = wgpu::AddressMode::Repeat;
|
||||
wgpu::Sampler otherSamplerAddressModeW = device.CreateSampler(&otherSamplerDescAddressModeW);
|
||||
|
||||
wgpu::SamplerDescriptor otherSamplerDescMagFilter = utils::GetDefaultSamplerDescriptor();
|
||||
otherSamplerDescMagFilter.magFilter = wgpu::FilterMode::Nearest;
|
||||
wgpu::SamplerDescriptor otherSamplerDescMagFilter;
|
||||
otherSamplerDescMagFilter.magFilter = wgpu::FilterMode::Linear;
|
||||
wgpu::Sampler otherSamplerMagFilter = device.CreateSampler(&otherSamplerDescMagFilter);
|
||||
|
||||
wgpu::SamplerDescriptor otherSamplerDescMinFilter = utils::GetDefaultSamplerDescriptor();
|
||||
otherSamplerDescMinFilter.minFilter = wgpu::FilterMode::Nearest;
|
||||
wgpu::SamplerDescriptor otherSamplerDescMinFilter;
|
||||
otherSamplerDescMinFilter.minFilter = wgpu::FilterMode::Linear;
|
||||
wgpu::Sampler otherSamplerMinFilter = device.CreateSampler(&otherSamplerDescMinFilter);
|
||||
|
||||
wgpu::SamplerDescriptor otherSamplerDescMipmapFilter = utils::GetDefaultSamplerDescriptor();
|
||||
otherSamplerDescMipmapFilter.mipmapFilter = wgpu::FilterMode::Nearest;
|
||||
wgpu::SamplerDescriptor otherSamplerDescMipmapFilter;
|
||||
otherSamplerDescMipmapFilter.mipmapFilter = wgpu::FilterMode::Linear;
|
||||
wgpu::Sampler otherSamplerMipmapFilter = device.CreateSampler(&otherSamplerDescMipmapFilter);
|
||||
|
||||
wgpu::SamplerDescriptor otherSamplerDescLodMinClamp = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor otherSamplerDescLodMinClamp;
|
||||
otherSamplerDescLodMinClamp.lodMinClamp += 1;
|
||||
wgpu::Sampler otherSamplerLodMinClamp = device.CreateSampler(&otherSamplerDescLodMinClamp);
|
||||
|
||||
wgpu::SamplerDescriptor otherSamplerDescLodMaxClamp = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor otherSamplerDescLodMaxClamp;
|
||||
otherSamplerDescLodMaxClamp.lodMaxClamp += 1;
|
||||
wgpu::Sampler otherSamplerLodMaxClamp = device.CreateSampler(&otherSamplerDescLodMaxClamp);
|
||||
|
||||
wgpu::SamplerDescriptor otherSamplerDescCompareFunction = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor otherSamplerDescCompareFunction;
|
||||
otherSamplerDescCompareFunction.compare = wgpu::CompareFunction::Always;
|
||||
wgpu::Sampler otherSamplerCompareFunction =
|
||||
device.CreateSampler(&otherSamplerDescCompareFunction);
|
||||
|
|
|
@ -853,8 +853,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
|||
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
||||
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
// Create render pipeline
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor(device);
|
||||
|
@ -923,8 +922,7 @@ TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
|
|||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
|
||||
// Create bindgroup
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, renderPipeline.GetBindGroupLayout(0),
|
||||
{{0, sampler}, {1, sampleView}});
|
||||
|
@ -972,8 +970,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
|
|||
uint32_t data = 100;
|
||||
queue.WriteBuffer(bufferTex, 0, &data, sizeof(data));
|
||||
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
// Create compute pipeline
|
||||
wgpu::ComputePipelineDescriptor computePipelineDescriptor;
|
||||
|
@ -1131,8 +1128,7 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
|
|||
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
||||
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
// Fill the sample texture with data
|
||||
std::vector<uint8_t> data(kFormatBlockByteSize * kSize * kSize, 1);
|
||||
|
@ -1274,8 +1270,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
|
|||
kColorFormat);
|
||||
wgpu::Texture sampleTexture = device.CreateTexture(&sampleTextureDescriptor);
|
||||
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
||||
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
||||
|
@ -1356,8 +1351,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
|
|||
kColorFormat);
|
||||
wgpu::Texture sampleTexture = device.CreateTexture(&sampleTextureDescriptor);
|
||||
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
||||
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
|
||||
|
|
|
@ -51,10 +51,7 @@ class BindGroupValidationTest : public ValidationTest {
|
|||
descriptor.usage = wgpu::BufferUsage::Storage;
|
||||
mSSBO = device.CreateBuffer(&descriptor);
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor descriptor = utils::GetDefaultSamplerDescriptor();
|
||||
mSampler = device.CreateSampler(&descriptor);
|
||||
}
|
||||
{ mSampler = device.CreateSampler(); }
|
||||
{
|
||||
mSampledTexture =
|
||||
CreateTexture(wgpu::TextureUsage::Sampled, wgpu::TextureFormat::RGBA8Unorm, 1);
|
||||
|
@ -164,7 +161,7 @@ TEST_F(BindGroupValidationTest, SamplerBindingType) {
|
|||
|
||||
// Setting the sampler to an error sampler is an error.
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor samplerDesc;
|
||||
samplerDesc.minFilter = static_cast<wgpu::FilterMode>(0xFFFFFFFF);
|
||||
|
||||
wgpu::Sampler errorSampler;
|
||||
|
|
|
@ -24,27 +24,24 @@ namespace {
|
|||
|
||||
// Test NaN and INFINITY values are not allowed
|
||||
TEST_F(SamplerValidationTest, InvalidLOD) {
|
||||
{ device.CreateSampler(); }
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
device.CreateSampler(&samplerDesc);
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor samplerDesc;
|
||||
samplerDesc.lodMinClamp = NAN;
|
||||
ASSERT_DEVICE_ERROR(device.CreateSampler(&samplerDesc));
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor samplerDesc;
|
||||
samplerDesc.lodMaxClamp = NAN;
|
||||
ASSERT_DEVICE_ERROR(device.CreateSampler(&samplerDesc));
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor samplerDesc;
|
||||
samplerDesc.lodMaxClamp = INFINITY;
|
||||
device.CreateSampler(&samplerDesc);
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::SamplerDescriptor samplerDesc;
|
||||
samplerDesc.lodMaxClamp = INFINITY;
|
||||
samplerDesc.lodMinClamp = INFINITY;
|
||||
device.CreateSampler(&samplerDesc);
|
||||
|
|
|
@ -617,8 +617,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureBindingTypeInBindGroup) {
|
|||
|
||||
// Samplers are not allowed to be used as storage textures in a bind group.
|
||||
{
|
||||
wgpu::SamplerDescriptor descriptor = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::Sampler sampler = device.CreateSampler(&descriptor);
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, bindGroupLayout, {{0, sampler}}));
|
||||
}
|
||||
|
||||
|
|
|
@ -187,8 +187,7 @@ TEST_P(D3D12DescriptorHeapTests, NoSwitchOverSamplerHeap) {
|
|||
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
Device* d3dDevice = reinterpret_cast<Device*>(device.Get());
|
||||
ShaderVisibleDescriptorAllocator* allocator =
|
||||
|
|
|
@ -357,8 +357,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) {
|
|||
constexpr uint32_t kSize = 512;
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kSize, kSize);
|
||||
|
||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||
wgpu::Sampler sampler = device.CreateSampler();
|
||||
|
||||
dawn_native::d3d12::Device* d3dDevice =
|
||||
reinterpret_cast<dawn_native::d3d12::Device*>(device.Get());
|
||||
|
|
|
@ -303,19 +303,6 @@ namespace utils {
|
|||
return textureDataLayout;
|
||||
}
|
||||
|
||||
wgpu::SamplerDescriptor GetDefaultSamplerDescriptor() {
|
||||
wgpu::SamplerDescriptor desc = {};
|
||||
|
||||
desc.minFilter = wgpu::FilterMode::Linear;
|
||||
desc.magFilter = wgpu::FilterMode::Linear;
|
||||
desc.mipmapFilter = wgpu::FilterMode::Linear;
|
||||
desc.addressModeU = wgpu::AddressMode::Repeat;
|
||||
desc.addressModeV = wgpu::AddressMode::Repeat;
|
||||
desc.addressModeW = wgpu::AddressMode::Repeat;
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
wgpu::PipelineLayout MakeBasicPipelineLayout(const wgpu::Device& device,
|
||||
const wgpu::BindGroupLayout* bindGroupLayout) {
|
||||
wgpu::PipelineLayoutDescriptor descriptor;
|
||||
|
|
|
@ -98,7 +98,6 @@ namespace utils {
|
|||
uint32_t width,
|
||||
uint32_t height);
|
||||
|
||||
wgpu::SamplerDescriptor GetDefaultSamplerDescriptor();
|
||||
wgpu::PipelineLayout MakeBasicPipelineLayout(const wgpu::Device& device,
|
||||
const wgpu::BindGroupLayout* bindGroupLayout);
|
||||
|
||||
|
|
Loading…
Reference in New Issue