diff --git a/src/xrt/compositor/render/render_compute.c b/src/xrt/compositor/render/render_compute.c index 17a0b423a..92fa5bd55 100644 --- a/src/xrt/compositor/render/render_compute.c +++ b/src/xrt/compositor/render/render_compute.c @@ -580,7 +580,7 @@ render_compute_projection_timewarp(struct render_compute *crc, VK_IMAGE_LAYOUT_GENERAL, // subresource_range); // - VkSampler sampler = r->compute.default_sampler; + VkSampler sampler = r->samplers.clamp_to_edge; VkSampler distortion_samplers[6] = { sampler, sampler, sampler, sampler, sampler, sampler, }; @@ -700,7 +700,7 @@ render_compute_projection(struct render_compute *crc, VK_IMAGE_LAYOUT_GENERAL, // subresource_range); // - VkSampler sampler = r->compute.default_sampler; + VkSampler sampler = r->samplers.clamp_to_edge; VkSampler distortion_samplers[6] = { sampler, sampler, sampler, sampler, sampler, sampler, }; @@ -821,7 +821,7 @@ render_compute_clear(struct render_compute *crc, // VK_IMAGE_LAYOUT_GENERAL, // subresource_range); // - VkSampler sampler = r->compute.default_sampler; + VkSampler sampler = r->samplers.mock; VkSampler src_samplers[2] = {sampler, sampler}; VkImageView src_image_views[2] = {r->mock.color.image_view, r->mock.color.image_view}; VkSampler distortion_samplers[6] = {sampler, sampler, sampler, sampler, sampler, sampler}; diff --git a/src/xrt/compositor/render/render_interface.h b/src/xrt/compositor/render/render_interface.h index 30de348b6..62762bf26 100644 --- a/src/xrt/compositor/render/render_interface.h +++ b/src/xrt/compositor/render/render_interface.h @@ -237,6 +237,21 @@ struct render_resources //! Command buffer for recording everything. VkCommandBuffer cmd; + struct + { + //! Sampler for mock/null images. + VkSampler mock; + + //! Sampler that repeats the texture in all directions. + VkSampler repeat; + + //! Sampler that clamps the coordinates to the edge in all directions. + VkSampler clamp_to_edge; + + //! Sampler that clamps color samples to black in all directions. + VkSampler clamp_to_border_black; + } samplers; + struct { //! The binding index for the source texture. diff --git a/src/xrt/compositor/render/render_resources.c b/src/xrt/compositor/render/render_resources.c index e80931baf..ed7d41554 100644 --- a/src/xrt/compositor/render/render_resources.c +++ b/src/xrt/compositor/render/render_resources.c @@ -575,6 +575,31 @@ render_resources_init(struct render_resources *r, } + /* + * Common samplers. + */ + + C(vk_create_sampler( // + vk, // vk_bundle + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, // clamp_mode + &r->samplers.mock)); // out_sampler + + C(vk_create_sampler( // + vk, // vk_bundle + VK_SAMPLER_ADDRESS_MODE_REPEAT, // clamp_mode + &r->samplers.repeat)); // out_sampler + + C(vk_create_sampler( // + vk, // vk_bundle + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, // clamp_mode + &r->samplers.clamp_to_edge)); // out_sampler + + C(vk_create_sampler( // + vk, // vk_bundle + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, // clamp_mode + &r->samplers.clamp_to_border_black)); // out_sampler + + /* * Command buffer pool, needs to go first. */ @@ -961,6 +986,11 @@ render_resources_close(struct render_resources *r) struct vk_bundle *vk = r->vk; + D(Sampler, r->samplers.mock); + D(Sampler, r->samplers.repeat); + D(Sampler, r->samplers.clamp_to_edge); + D(Sampler, r->samplers.clamp_to_border_black); + D(ImageView, r->mock.color.image_view); D(Image, r->mock.color.image); DF(Memory, r->mock.color.memory);