Vk Immediate: Get Sampler
This commit is contained in:
parent
2ba0ebb4cb
commit
c656d95345
|
@ -651,19 +651,7 @@ std::unique_ptr<ImmediateTexture> VulkanImmediateDrawer::CreateTexture(
|
||||||
const uint8_t* data) {
|
const uint8_t* data) {
|
||||||
auto device = context_->device();
|
auto device = context_->device();
|
||||||
|
|
||||||
VkSampler sampler = nullptr;
|
VkSampler sampler = GetSampler(filter, repeat);
|
||||||
switch (filter) {
|
|
||||||
case ImmediateTextureFilter::kNearest:
|
|
||||||
sampler = repeat ? samplers_.nearest_repeat : samplers_.nearest_clamp;
|
|
||||||
break;
|
|
||||||
case ImmediateTextureFilter::kLinear:
|
|
||||||
sampler = repeat ? samplers_.linear_repeat : samplers_.linear_clamp;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert_unhandled_case(filter);
|
|
||||||
sampler = samplers_.nearest_clamp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto texture = std::make_unique<VulkanImmediateTexture>(
|
auto texture = std::make_unique<VulkanImmediateTexture>(
|
||||||
device, descriptor_pool_, texture_set_layout_, sampler, width, height);
|
device, descriptor_pool_, texture_set_layout_, sampler, width, height);
|
||||||
|
@ -810,6 +798,25 @@ void VulkanImmediateDrawer::EndDrawBatch() {}
|
||||||
|
|
||||||
void VulkanImmediateDrawer::End() { current_cmd_buffer_ = nullptr; }
|
void VulkanImmediateDrawer::End() { current_cmd_buffer_ = nullptr; }
|
||||||
|
|
||||||
|
VkSampler VulkanImmediateDrawer::GetSampler(ImmediateTextureFilter filter,
|
||||||
|
bool repeat) {
|
||||||
|
VkSampler sampler = nullptr;
|
||||||
|
switch (filter) {
|
||||||
|
case ImmediateTextureFilter::kNearest:
|
||||||
|
sampler = repeat ? samplers_.nearest_repeat : samplers_.nearest_clamp;
|
||||||
|
break;
|
||||||
|
case ImmediateTextureFilter::kLinear:
|
||||||
|
sampler = repeat ? samplers_.linear_repeat : samplers_.linear_clamp;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert_unhandled_case(filter);
|
||||||
|
sampler = samplers_.nearest_clamp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sampler;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace vulkan
|
} // namespace vulkan
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
|
@ -44,6 +44,8 @@ class VulkanImmediateDrawer : public ImmediateDrawer {
|
||||||
void EndDrawBatch() override;
|
void EndDrawBatch() override;
|
||||||
void End() override;
|
void End() override;
|
||||||
|
|
||||||
|
VkSampler GetSampler(ImmediateTextureFilter filter, bool repeat);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VulkanContext* context_ = nullptr;
|
VulkanContext* context_ = nullptr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue