37 class RV_VKMemAllocInfo;
41 #define RV_MAX_MIP_LEVEL (std::numeric_limits<int>::max())
80 myVkCreateInfo.extent.width =
w;
81 myVkCreateInfo.extent.height =
h;
82 myVkCreateInfo.extent.depth = d;
85 {
return myVkCreateInfo.extent.width; }
87 {
return myVkCreateInfo.extent.height; }
89 {
return myVkCreateInfo.extent.depth; }
104 myVkCreateInfo.arrayLayers =
count;
107 {
return myVkCreateInfo.arrayLayers; }
113 myMaxLevels =
SYSmax(count, 1);
116 {
return myMaxLevels; }
121 int max_level = SYSfloorLog2(max_dim) + 1;
122 return SYSmin(max_level, getMaxLevelCount());
127 { myMagFilterMode =
filter; }
130 { myMinFilterMode =
filter; }
133 { myMipMode =
mode; }
137 { myWrapU = u; myWrapV =
v; myWrapW =
w; }
153 myTextureSwizzle[0] =
r;
154 myTextureSwizzle[1] =
g;
155 myTextureSwizzle[2] =
b;
156 myTextureSwizzle[3] =
a;
160 {
return myTextureSwizzle[0]; }
162 {
return myTextureSwizzle[1]; }
164 {
return myTextureSwizzle[2]; }
166 {
return myTextureSwizzle[3]; }
169 { myUsageAttachmentBit =
b; }
171 {
return myUsageAttachmentBit; }
174 { myUsageSampledBit =
b; }
176 {
return myUsageSampledBit; }
179 { myUsageStorageBit =
b; }
181 {
return myUsageStorageBit; }
185 { myUseLinearTiling = use; }
187 {
return myUseLinearTiling; }
190 { myMemType =
type; }
192 {
return myMemType; }
195 { myCompareEnable = compare_enable; }
197 {
return myCompareEnable; }
200 { myCompareOp = compare_op; }
202 {
return myCompareOp; }
206 {
return &myVkCreateInfo; }
212 virtual bool fillCreateInfo();
228 bool isValidForLinearTiling()
const;
237 myVkCreateInfo.
pNext = p;
245 uint32_t mySamples = 0;
248 bool myUseLinearTiling =
false;
262 bool myIsNormalized =
false;
263 bool myIsTexelSampled =
false;
264 bool myUsageAttachmentBit =
true;
265 bool myUsageSampledBit =
true;
266 bool myUsageStorageBit =
false;
267 bool myCompareEnable =
false;
311 : myInst(inst), myVkView(vk_view)
320 : myInst(other.myInst), myVkView(other.myVkView)
322 other.myInst =
nullptr;
354 : myInst(inst), myVkSampler(vk_sampler)
363 : myInst(other.myInst), myVkSampler(other.myVkSampler)
365 other.myInst =
nullptr;
393 const char*
name =
nullptr);
401 const char*
name =
nullptr
412 static bool queryIsUsable(
438 {
return myPrimaryView ? *myPrimaryView :*myView;}
451 void transitionImage(
458 bool keep_data =
true,
501 exint buf_offset = 0,
510 exint buf_offset = 0,
533 bool primary_aspect =
true);
541 bool primary_aspect =
true);
543 #ifdef VULKAN_PRESENTATION
544 bool isSwapchainImage()
const
545 {
return myIsSwapchainImage; }
546 void setIsSwapchainImage(
bool is_swapchain_img)
547 { myIsSwapchainImage = is_swapchain_img; }
570 const char*
name =
nullptr);
572 static void deleteImage(
575 VkDeviceMemory* mem);
588 #ifdef VULKAN_PRESENTATION
589 bool myIsSwapchainImage =
false;
600 uint32_t myLastQueueFam = 0;
void setTextureMinFilter(RV_TextureFilter filter)
Set the texture filter for texture scales below 1.
UT_UniquePtr< RV_VKMemory > myMemory
void setUsageStorageBit(bool b)
VkSampler getVkSampler()
Access the vulkan resource for the sampler.
GLenum GLuint GLenum GLsizei const GLchar * buf
int getLevelCount() const
constexpr span< ElementType, Extent > make_span(span< ElementType, Extent > s) noexcept
RV_VKImageView & operator=(RV_VKImageView &)=delete
const VkImageCreateInfo * getVkInfo() const
Access the vulkan creation structure for this image.
GLsizei const GLfloat * value
const UT_StringHolder & getName() const
GLboolean GLboolean GLboolean GLboolean a
void setSamples(int samples)
Define the number of samples in a multisampled 2D image.
UT_UniquePtr< RV_VKMemory > RV_VKMemoryPtr
RV_TextureSwizzle getTextureSwizzleG() const
void addNext(VkBaseOutStructure *p)
void setTextureWrap(RV_TextureWrap u, RV_TextureWrap v, RV_TextureWrap w)
Set the wrapping mode when uv is outside [0,1]:REPEAT,CLAMP,BORDER,MIRROR.
UT_UniquePtr< RV_VKImage > RV_VKImagePtr
VkFlags VkPipelineStageFlags
UT_UniquePtr< RV_VKSampler > mySampler
#define VK_LOD_CLAMP_NONE
RV_VKSampler(RV_VKSampler &&other) noexcept
VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator)
void setLayerCount(int count)
Define the number of layers in a 1D or 2D array.
void setMaxLevelCount(int count)
Set the maximum number of mipmap levels.
UT_UniquePtr< RV_VKImageView > myView
RV_VKCommandBuffer * getCurrentCB()
The currently recording command buffer.
VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator)
VkFlags VkImageUsageFlags
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
void setTextureMipMode(RV_TextureMipMode mode)
Set the mipmapping mode - DISABLED, NEAREST mipmap, or LINEAR blend.
void setCompareEnable(bool compare_enable)
bool getCompareEnable() const
GLint GLint GLsizei GLint GLenum GLenum type
RV_VKMemory & getMemory()
RV_TextureWrap getTextureWrapU() const
UT_UniquePtr< RV_VKImageView > RV_VKImageViewPtr
bool getUsageAttachmentBit() const
int getLayerCount() const
RV_VKSampler(RV_Instance *inst, VkSampler vk_sampler)
GLint GLint GLsizei GLint GLenum format
VkImageType getImageType() const
The Vulkan image type.
void transitionToSampling(RV_VKCommandBuffer *cb, bool force=false)
Record a command to transition the image for sampling in a shader.
VkImageLayout getLayout() const
RV_TextureSwizzle getTextureSwizzleR() const
void setTextureSwizzle(RV_TextureSwizzle r, RV_TextureSwizzle g, RV_TextureSwizzle b, RV_TextureSwizzle a)
void setMemoryType(RV_MemType type)
GLuint const GLchar * name
GLboolean GLboolean GLboolean b
Handle to the main interface of Vulkan.
bool uploadData(RV_Render *r, const T &data, int level=0, int index=0)
Upload data to the image. Must be in a state for upload.
RV_Instance * instance()
The instance associated with this render.
int getMaxLevelCount() const
RV_ImageDim getRVImageType() const
The RV image type.
RV_VKSampler * getSampler()
RV_VKImageView(RV_VKImageView &&other) noexcept
RV_VKImageView & getFullView()
GLfloat GLfloat GLfloat GLfloat h
const RV_ResourceID & getID() const
RV_MemType getMemoryType() const
RV_TextureWrap getTextureWrapW() const
SIM_API const UT_StringHolder force
UT_UniquePtr< const RV_VKImageCreateInfo > myCreateInfo
RV_TextureSwizzle getTextureSwizzleB() const
void setSize(int w, int h, int d)
void setCompareOp(RE_ZFunction compare_op)
LeafData & operator=(const LeafData &)=delete
const RV_VKImageCreateInfo & getInfo() const
The image properties.
constexpr size_type size_bytes() const noexcept
VkImageView getVkView()
Access the vulkan resource for the view.
VkFormat getFormat() const
RE_ZFunction getCompareOp() const
void setUsageSampledBit(bool b)
RV_TextureWrap getTextureWrapV() const
bool getUsageStorageBit() const
void setUseLinearTiling(bool use)
Use linear tiling (true) or optimal tiling. Not all types support linear.
VkDevice getDevice()
Get the raw vulkan device assocated with this instance.
GLubyte GLubyte GLubyte GLubyte w
void setFormat(VkFormat format)
Set the vulkan image format. RV.
RV_TextureSwizzle getTextureSwizzleA() const
RV_VKSampler & operator=(RV_VKSampler &)=delete
FMT_INLINE void print(format_string< T...> fmt, T &&...args)
bool getUsageSampledBit() const
virtual UT_UniquePtr< RV_VKImageCreateInfo > clone() const
constexpr pointer data() const noexcept
void setTextureMagFilter(RV_TextureFilter filter)
Set the texture filter for texture scales above 1.
UT_UniquePtr< RV_VKImageView > myPrimaryView
void setUsageAttachmentBit(bool b)
bool getUseLinearTiling() const
RV_VKImageView(RV_Instance *inst, VkImageView vk_view)
struct VkBaseOutStructure * pNext
RV_VKImageView & getPrimaryView()
RAII wrapper class for VkImageView.
UT_UniquePtr< RV_VKSampler > RV_VKSamplerPtr
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter