34 class RV_VKMemAllocInfo;
38 #define RV_MAX_MIP_LEVEL (std::numeric_limits<int>::max())
77 myVkCreateInfo.extent.width =
w;
78 myVkCreateInfo.extent.height =
h;
79 myVkCreateInfo.extent.depth = d;
82 {
return myVkCreateInfo.extent.width; }
84 {
return myVkCreateInfo.extent.height; }
86 {
return myVkCreateInfo.extent.depth; }
101 myVkCreateInfo.arrayLayers =
count;
104 {
return myVkCreateInfo.arrayLayers; }
110 myMaxLevels =
SYSmax(count, 1);
113 {
return myMaxLevels; }
118 int max_level = SYSfloorLog2(max_dim) + 1;
119 return SYSmin(max_level, getMaxLevelCount());
124 { myMagFilterMode =
filter; }
127 { myMinFilterMode =
filter; }
130 { myMipMode =
mode; }
134 { myWrapU = u; myWrapV =
v; myWrapW =
w; }
150 myTextureSwizzle[0] =
r;
151 myTextureSwizzle[1] =
g;
152 myTextureSwizzle[2] =
b;
153 myTextureSwizzle[3] =
a;
157 {
return myTextureSwizzle[0]; }
159 {
return myTextureSwizzle[1]; }
161 {
return myTextureSwizzle[2]; }
163 {
return myTextureSwizzle[3]; }
166 { myUsageAttachmentBit =
b; }
168 {
return myUsageAttachmentBit; }
171 { myUsageSampledBit =
b; }
173 {
return myUsageSampledBit; }
176 { myUsageStorageBit =
b; }
178 {
return myUsageStorageBit; }
182 { myUseLinearTiling = use; }
184 {
return myUseLinearTiling; }
187 { myMemType =
type; }
189 {
return myMemType; }
192 { myCompareEnable = compare_enable; }
194 {
return myCompareEnable; }
197 { myCompareOp = compare_op; }
199 {
return myCompareOp; }
203 {
return &myVkCreateInfo; }
209 virtual bool fillCreateInfo();
223 bool isValidForLinearTiling()
const;
232 myVkCreateInfo.
pNext = p;
240 uint32_t mySamples = 0;
243 bool myUseLinearTiling =
false;
257 bool myIsNormalized =
false;
258 bool myIsTexelSampled =
false;
259 bool myUsageAttachmentBit =
true;
260 bool myUsageSampledBit =
true;
261 bool myUsageStorageBit =
false;
262 bool myCompareEnable =
false;
306 : myInst(inst), myVkView(vk_view)
315 : myInst(other.myInst), myVkView(other.myVkView)
317 other.myInst =
nullptr;
349 : myInst(inst), myVkSampler(vk_sampler)
358 : myInst(other.myInst), myVkSampler(other.myVkSampler)
360 other.myInst =
nullptr;
388 const char*
name =
nullptr);
398 static bool queryIsUsable(
414 {
return myPrimaryView ? *myPrimaryView :*myView;}
427 void transitionImage(
434 bool keep_data =
true,
497 bool primary_aspect =
true);
514 static void deleteImage(
517 VkDeviceMemory* mem);
538 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
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)
virtual RV_VKImageCreateInfo * clone() const
bool getCompareEnable() const
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.
VkImageLayout getLayout() const
RV_TextureSwizzle getTextureSwizzleR() const
void setTextureSwizzle(RV_TextureSwizzle r, RV_TextureSwizzle g, RV_TextureSwizzle b, RV_TextureSwizzle a)
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_VKSampler * getSampler()
RV_VKImageView(RV_VKImageView &&other) noexcept
RV_VKImageView & getFullView()
GLfloat GLfloat GLfloat GLfloat h
RV_MemType getMemoryType() const
RV_TextureWrap getTextureWrapW() const
UT_UniquePtr< const RV_VKImageCreateInfo > myCreateInfo
RV_TextureSwizzle getTextureSwizzleB() const
void setSize(int w, int h, int d)
void setCompareOp(RE_ZFunction compare_op)
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
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