33 class RV_VKMemAllocInfo;
39 #define RV_MAX_MIP_LEVEL (std::numeric_limits<int>::max())
78 myVkCreateInfo.extent.width =
w;
79 myVkCreateInfo.extent.height =
h;
80 myVkCreateInfo.extent.depth = d;
83 {
return myVkCreateInfo.extent.width; }
85 {
return myVkCreateInfo.extent.height; }
87 {
return myVkCreateInfo.extent.depth; }
102 myVkCreateInfo.arrayLayers =
count;
105 {
return myVkCreateInfo.arrayLayers; }
111 myMaxLevels =
SYSmax(count, 1);
114 {
return myMaxLevels; }
119 int max_level = SYSfloorLog2(max_dim) + 1;
120 return SYSmin(max_level, getMaxLevelCount());
125 { myMagFilterMode =
filter; }
128 { myMinFilterMode =
filter; }
131 { myMipMode =
mode; }
135 { myWrapU = u; myWrapV =
v; myWrapW =
w; }
145 { myUsageStorageBit =
b; }
147 {
return myUsageStorageBit; }
151 { myUseLinearTiling = use; }
153 {
return myUseLinearTiling; }
156 { myMemType =
type; }
158 {
return myMemType; }
162 {
return &myVkCreateInfo; }
168 virtual bool fillCreateInfo();
182 bool isValidForLinearTiling()
const;
191 myVkCreateInfo.
pNext = p;
199 uint32_t mySamples = 0;
202 bool myUseLinearTiling =
false;
209 bool myIsNormalized =
false;
210 bool myIsTexelSampled =
false;
211 bool myUsageStorageBit =
false;
254 : myInst(inst), myVkView(vk_view)
263 : myInst(other.myInst), myVkView(other.myVkView)
265 other.myInst =
nullptr;
297 : myInst(inst), myVkSampler(vk_sampler)
306 : myInst(other.myInst), myVkSampler(other.myVkSampler)
308 other.myInst =
nullptr;
336 const char*
name =
nullptr);
340 static bool queryIsUsable(
355 {
return myPrimaryView ? *myPrimaryView :*myView;}
368 void transitionImage(
375 bool keep_data =
true,
426 bool primary_aspect =
true);
443 static void deleteImage(
446 VkDeviceMemory* mem);
464 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.
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
void setSamples(int samples)
Define the number of samples in a multisampled 2D image.
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.
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.
RV_VKSampler & getSampler()
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.
virtual RV_VKImageCreateInfo * clone() const
RV_VKMemory & getMemory()
int getLayerCount() const
RV_VKSampler(RV_Instance *inst, VkSampler vk_sampler)
GLint GLint GLsizei GLint GLenum format
VkImageType getImageType() const
The Vulkan image type.
VkImageLayout getLayout() const
RV_TextureWrap getTextureWrapV()
void transitionToSampling(RV_VKCommandBuffer *cb)
Record a command to transition the image for sampling in a shader.
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_TextureWrap getTextureWrapU()
RV_VKImageView(RV_VKImageView &&other) noexcept
RV_VKImageView & getFullView()
GLfloat GLfloat GLfloat GLfloat h
RV_MemType getMemoryType() const
UT_UniquePtr< const RV_VKImageCreateInfo > myCreateInfo
void setSize(int w, int h, int d)
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
RV_TextureWrap getTextureWrapW()
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_VKSampler & operator=(RV_VKSampler &)=delete
FMT_INLINE void print(format_string< T...> fmt, T &&...args)
constexpr pointer data() const noexcept
void setTextureMagFilter(RV_TextureFilter filter)
Set the texture filter for texture scales above 1.
UT_UniquePtr< RV_VKImage > RV_VKImagePtr
UT_UniquePtr< RV_VKImageView > myPrimaryView
bool getUseLinearTiling() const
RV_VKImageView(RV_Instance *inst, VkImageView vk_view)
struct VkBaseOutStructure * pNext
RV_VKImageView & getPrimaryView()
RAII wrapper class for VkImageView.
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter