Add a GetDefaultSamplerDescriptor helper.
This commit is contained in:
parent
5101d57972
commit
b711b9b2c9
|
@ -56,16 +56,8 @@ void initTextures() {
|
|||
.SetAllowedUsage(nxt::TextureUsageBit::TransferDst | nxt::TextureUsageBit::Sampled)
|
||||
.GetResult();
|
||||
|
||||
{
|
||||
nxt::SamplerDescriptor desc;
|
||||
desc.minFilter = nxt::FilterMode::Linear;
|
||||
desc.magFilter = nxt::FilterMode::Linear;
|
||||
desc.mipmapFilter = nxt::FilterMode::Linear;
|
||||
desc.addressModeU = nxt::AddressMode::Repeat;
|
||||
desc.addressModeV = nxt::AddressMode::Repeat;
|
||||
desc.addressModeW = nxt::AddressMode::Repeat;
|
||||
sampler = device.CreateSampler(&desc);
|
||||
}
|
||||
nxt::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
sampler = device.CreateSampler(&samplerDesc);
|
||||
|
||||
// Initialize the texture with arbitrary data until we can load images
|
||||
std::vector<uint8_t> data(4 * 1024 * 1024, 0);
|
||||
|
|
|
@ -64,16 +64,8 @@ void initTextures() {
|
|||
.GetResult();
|
||||
renderTargetView = renderTarget.CreateTextureViewBuilder().GetResult();
|
||||
|
||||
{
|
||||
nxt::SamplerDescriptor desc;
|
||||
desc.minFilter = nxt::FilterMode::Linear;
|
||||
desc.magFilter = nxt::FilterMode::Linear;
|
||||
desc.mipmapFilter = nxt::FilterMode::Linear;
|
||||
desc.addressModeU = nxt::AddressMode::Repeat;
|
||||
desc.addressModeV = nxt::AddressMode::Repeat;
|
||||
desc.addressModeW = nxt::AddressMode::Repeat;
|
||||
samplerPost = device.CreateSampler(&desc);
|
||||
}
|
||||
nxt::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
samplerPost = device.CreateSampler(&samplerDesc);
|
||||
}
|
||||
|
||||
void initPipeline() {
|
||||
|
|
|
@ -336,14 +336,8 @@ namespace {
|
|||
const auto& iSamplerID = s.first;
|
||||
const auto& iSampler = s.second;
|
||||
|
||||
nxt::SamplerDescriptor desc;
|
||||
desc.magFilter = nxt::FilterMode::Nearest;
|
||||
desc.minFilter = nxt::FilterMode::Nearest;
|
||||
desc.mipmapFilter = nxt::FilterMode::Nearest;
|
||||
nxt::SamplerDescriptor desc = utils::GetDefaultSamplerDescriptor();
|
||||
// TODO: wrap modes
|
||||
desc.addressModeU = nxt::AddressMode::Repeat;
|
||||
desc.addressModeV = nxt::AddressMode::Repeat;
|
||||
desc.addressModeW = nxt::AddressMode::Repeat;
|
||||
|
||||
switch (iSampler.magFilter) {
|
||||
case gl::Nearest:
|
||||
|
|
|
@ -137,4 +137,17 @@ namespace utils {
|
|||
return result;
|
||||
}
|
||||
|
||||
nxt::SamplerDescriptor GetDefaultSamplerDescriptor() {
|
||||
nxt::SamplerDescriptor desc;
|
||||
|
||||
desc.minFilter = nxt::FilterMode::Linear;
|
||||
desc.magFilter = nxt::FilterMode::Linear;
|
||||
desc.mipmapFilter = nxt::FilterMode::Linear;
|
||||
desc.addressModeU = nxt::AddressMode::Repeat;
|
||||
desc.addressModeV = nxt::AddressMode::Repeat;
|
||||
desc.addressModeW = nxt::AddressMode::Repeat;
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
} // namespace utils
|
||||
|
|
|
@ -48,4 +48,6 @@ namespace utils {
|
|||
uint32_t width,
|
||||
uint32_t height);
|
||||
|
||||
nxt::SamplerDescriptor GetDefaultSamplerDescriptor();
|
||||
|
||||
} // namespace utils
|
||||
|
|
Loading…
Reference in New Issue