From ab185e1383b5b6496431b09fec411f4170008d56 Mon Sep 17 00:00:00 2001 From: tomhog Date: Tue, 12 Feb 2019 18:44:09 +0000 Subject: [PATCH] Allow external sampler to be passed to transferImageData function --- include/vsg/vk/Descriptor.h | 2 +- src/vsg/vk/Descriptor.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/vsg/vk/Descriptor.h b/include/vsg/vk/Descriptor.h index b68475db64..b22df69904 100644 --- a/include/vsg/vk/Descriptor.h +++ b/include/vsg/vk/Descriptor.h @@ -83,7 +83,7 @@ namespace vsg }; /// transfer Data to graphics memory, returning ImageData configuration. - extern VSG_DECLSPEC vsg::ImageData transferImageData(Device* device, CommandPool* commandPool, VkQueue graphicsQueue, const Data* data); + extern VSG_DECLSPEC vsg::ImageData transferImageData(Device* device, CommandPool* commandPool, VkQueue graphicsQueue, const Data* data, Sampler* sampler = nullptr); using ImageDataList = std::vector; diff --git a/src/vsg/vk/Descriptor.cpp b/src/vsg/vk/Descriptor.cpp index 8d475e7102..3bddb64ad4 100644 --- a/src/vsg/vk/Descriptor.cpp +++ b/src/vsg/vk/Descriptor.cpp @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI using namespace vsg; -ImageData vsg::transferImageData(Device* device, CommandPool* commandPool, VkQueue graphicsQueue, const Data* data) +ImageData vsg::transferImageData(Device* device, CommandPool* commandPool, VkQueue graphicsQueue, const Data* data, Sampler* sampler) { if (!data) { @@ -107,7 +107,7 @@ ImageData vsg::transferImageData(Device* device, CommandPool* commandPool, VkQue imageStagingBuffer = 0; imageStagingMemory = 0; - ref_ptr textureSampler = Sampler::create(device); + ref_ptr textureSampler = sampler != nullptr ? Sampler::Result(sampler) : Sampler::create(device); ref_ptr textureImageView = ImageView::create(device, textureImage, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_ASPECT_COLOR_BIT); return ImageData(textureSampler, textureImageView, VK_IMAGE_LAYOUT_UNDEFINED);