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; }
136 {
return myMagFilterMode; }
138 {
return myMinFilterMode; }
140 {
return myMipMode; }
144 { myWrapU = u; myWrapV =
v; myWrapW =
w; }
160 myTextureSwizzle[0] =
r;
161 myTextureSwizzle[1] =
g;
162 myTextureSwizzle[2] =
b;
163 myTextureSwizzle[3] =
a;
167 {
return myTextureSwizzle[0]; }
169 {
return myTextureSwizzle[1]; }
171 {
return myTextureSwizzle[2]; }
173 {
return myTextureSwizzle[3]; }
176 { myUsageAttachmentBit =
b; }
178 {
return myUsageAttachmentBit; }
181 { myUsageSampledBit =
b; }
183 {
return myUsageSampledBit; }
186 { myUsageStorageBit =
b; }
188 {
return myUsageStorageBit; }
192 { myUsageSampleLocations = use; }
194 {
return myUsageSampleLocations; }
198 { myUseLinearTiling = use; }
200 {
return myUseLinearTiling; }
203 { myMemType =
type; }
205 {
return myMemType; }
208 { myCompareEnable = compare_enable; }
210 {
return myCompareEnable; }
213 { myCompareOp = compare_op; }
215 {
return myCompareOp; }
219 {
return &myVkCreateInfo; }
225 virtual bool fillCreateInfo();
241 bool isValidForLinearTiling()
const;
250 myVkCreateInfo.
pNext = p;
258 uint32_t mySamples = 0;
261 bool myUseLinearTiling =
false;
275 bool myIsNormalized =
false;
276 bool myIsTexelSampled =
false;
277 bool myUsageAttachmentBit =
true;
278 bool myUsageSampledBit =
true;
279 bool myUsageStorageBit =
false;
280 bool myUsageSampleLocations =
false;
281 bool myCompareEnable =
false;
325 : myInst(inst), myVkView(vk_view)
334 : myInst(other.myInst), myVkView(other.myVkView)
336 other.myInst =
nullptr;
359 : myInst(nullptr), myVkSampler(VK_NULL_HANDLE)
362 : myInst(inst), myVkSampler(vk_sampler)
366 RV_VKSampler(
const RV_VKSampler&) =
delete;
367 RV_VKSampler&
operator=(RV_VKSampler& ) =
delete;
371 : myInst(other.myInst), myVkSampler(other.myVkSampler)
373 other.myInst =
nullptr;
376 RV_VKSampler&
operator=(RV_VKSampler&& other) noexcept = delete;
383 VkSampler myVkSampler = VK_NULL_HANDLE;
395 const char*
name =
nullptr);
403 const char*
name =
nullptr
414 static bool queryIsUsable(
440 {
return myPrimaryView ? *myPrimaryView :*myView;}
453 void transitionImage(
460 bool keep_data =
true,
482 :
x(xoffset),
width(xsize)
486 :
x(xoffset),
width(xsize)
491 :
x(xoffset),
width(xsize)
493 ,
z(zoffset),
depth(zsize)
518 return uploadData( r,
528 return uploadData( r,
552 const Region ®ion,
561 const Region &dst_region,
570 exint buf_offset = 0,
571 exint buf_size = -1);
579 exint buf_offset = 0,
580 exint buf_size = -1);
584 const Region &dst_region,
587 exint buf_offset = 0,
588 exint buf_size = -1);
594 const Region &dst_region,
597 exint buf_offset = 0,
598 exint buf_size = -1);
603 bool copyData(
RV_Render*
r, RV_VKImage* src_img,
int dest_layer = 0);
608 const Region& dst_region,
614 bool resolveData(
RV_Render*
r, RV_VKImage* src_img);
626 bool primary_aspect =
true);
629 bool downloadSubData(
633 const Region& dst_region,
636 bool primary_aspect =
true);
644 bool primary_aspect =
true);
647 bool downloadSubData(
650 const Region& dst_region,
653 bool primary_aspect =
true);
657 void writeToFile(
RV_Render*
r,
const char *filepath);
659 #ifdef VULKAN_PRESENTATION
660 bool isSwapchainImage()
const
661 {
return myIsSwapchainImage; }
662 void setIsSwapchainImage(
bool is_swapchain_img)
663 { myIsSwapchainImage = is_swapchain_img; }
668 virtual ~RV_VKImage();
688 const char*
name =
nullptr);
701 #ifdef VULKAN_PRESENTATION
702 bool myIsSwapchainImage =
false;
713 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.
GLint GLint GLint yoffset
int getLevelCount() const
constexpr span< ElementType, Extent > make_span(span< ElementType, Extent > s) noexcept
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
const VkImageCreateInfo * getVkInfo() const
Access the vulkan creation structure for this image.
GLsizei const GLfloat * value
const UT_StringHolder & getName() const
GLdouble GLdouble GLdouble z
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_TextureFilter getTextureMinFilter() const
Region(int xoffset, int xsize)
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
RV_TextureFilter getTextureMagFilter() const
UT_UniquePtr< RV_VKSampler > mySampler
#define VK_LOD_CLAMP_NONE
RV_VKSampler(RV_VKSampler &&other) noexcept
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
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
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 GLsizei GLsizei height
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)
RV_TextureMipMode getTextureMipMode() const
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.
GLint GLint GLsizei GLsizei GLsizei depth
void setUsageSampleLocations(bool use)
int getMaxLevelCount() const
RV_ImageDim getRVImageType() const
The RV image type.
Region(int xoffset, int xsize, int yoffset, int ysize, int zoffset, int zsize)
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)
Region(int xoffset, int xsize, int yoffset, int ysize)
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 uploadSubData(RV_Render *r, const T &data, const Region ®ion, int level=0, int index=0)
bool getUsageStorageBit() const
void setUseLinearTiling(bool use)
Use linear tiling (true) or optimal tiling. Not all types support linear.
GLubyte GLubyte GLubyte GLubyte w
void setFormat(VkFormat format)
Set the vulkan image format. RV.
RV_TextureSwizzle getTextureSwizzleA() const
bool getUsageSampleLocations() const
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.
GLint GLint GLint GLint zoffset
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