37 class RV_VKMemAllocInfo;
41 #define RV_MAX_MIP_LEVEL (std::numeric_limits<int>::max())
69 int getVectorSize()
const;
82 myVkCreateInfo.extent.width =
w;
83 myVkCreateInfo.extent.height =
h;
84 myVkCreateInfo.extent.depth = d;
87 {
return myVkCreateInfo.extent.width; }
89 {
return myVkCreateInfo.extent.height; }
91 {
return myVkCreateInfo.extent.depth; }
100 {
return mySamples; }
106 myVkCreateInfo.arrayLayers =
count;
109 {
return myVkCreateInfo.arrayLayers; }
115 myMaxLevels =
SYSmax(count, 1);
118 {
return myMaxLevels; }
123 int max_level = SYSfloorLog2(max_dim) + 1;
124 return SYSmin(max_level, getMaxLevelCount());
129 { myMagFilterMode =
filter; }
132 { myMinFilterMode =
filter; }
135 { myMipMode =
mode; }
138 {
return myMagFilterMode; }
140 {
return myMinFilterMode; }
142 {
return myMipMode; }
146 { myWrapU = u; myWrapV =
v; myWrapW =
w; }
162 myTextureSwizzle[0] =
r;
163 myTextureSwizzle[1] =
g;
164 myTextureSwizzle[2] =
b;
165 myTextureSwizzle[3] =
a;
169 {
return myTextureSwizzle[0]; }
171 {
return myTextureSwizzle[1]; }
173 {
return myTextureSwizzle[2]; }
175 {
return myTextureSwizzle[3]; }
178 { myUsageAttachmentBit =
b; }
180 {
return myUsageAttachmentBit; }
183 { myUsageSampledBit =
b; }
185 {
return myUsageSampledBit; }
188 { myUsageStorageBit =
b; }
190 {
return myUsageStorageBit; }
194 { myUsageSampleLocations = use; }
196 {
return myUsageSampleLocations; }
200 { myUseLinearTiling = use; }
202 {
return myUseLinearTiling; }
205 { myMemType =
type; }
207 {
return myMemType; }
210 { myCompareEnable = compare_enable; }
212 {
return myCompareEnable; }
215 { myCompareOp = compare_op; }
217 {
return myCompareOp; }
221 {
return &myVkCreateInfo; }
227 virtual bool fillCreateInfo();
243 bool isValidForLinearTiling()
const;
252 myVkCreateInfo.
pNext = p;
260 uint32_t mySamples = 0;
263 bool myUseLinearTiling =
false;
277 bool myIsNormalized =
false;
278 bool myIsTexelSampled =
false;
279 bool myUsageAttachmentBit =
true;
280 bool myUsageSampledBit =
true;
281 bool myUsageStorageBit =
false;
282 bool myUsageSampleLocations =
false;
283 bool myCompareEnable =
false;
327 : myInst(inst), myVkView(vk_view)
336 : myInst(other.myInst), myVkView(other.myVkView)
338 other.myInst =
nullptr;
361 : myInst(nullptr), myVkSampler(VK_NULL_HANDLE)
364 : myInst(inst), myVkSampler(vk_sampler)
368 RV_VKSampler(
const RV_VKSampler&) =
delete;
369 RV_VKSampler&
operator=(RV_VKSampler& ) =
delete;
373 : myInst(other.myInst), myVkSampler(other.myVkSampler)
375 other.myInst =
nullptr;
378 RV_VKSampler&
operator=(RV_VKSampler&& other) noexcept = delete;
385 VkSampler myVkSampler = VK_NULL_HANDLE;
397 const char*
name =
nullptr);
405 const char*
name =
nullptr
416 static bool queryIsUsable(
442 {
return myPrimaryView ? *myPrimaryView :*myView;}
455 void transitionImage(
462 bool keep_data =
true,
484 :
x(xoffset),
width(xsize)
488 :
x(xoffset),
width(xsize)
493 :
x(xoffset),
width(xsize)
495 ,
z(zoffset),
depth(zsize)
520 return uploadData( r,
530 return uploadData( r,
554 const Region ®ion,
563 const Region &dst_region,
572 exint buf_offset = 0,
573 exint buf_size = -1);
581 exint buf_offset = 0,
582 exint buf_size = -1);
586 const Region &dst_region,
589 exint buf_offset = 0,
590 exint buf_size = -1);
596 const Region &dst_region,
599 exint buf_offset = 0,
600 exint buf_size = -1);
605 bool copyData(
RV_Render*
r, RV_VKImage* src_img,
int dest_layer = 0);
610 const Region& dst_region,
616 bool resolveData(
RV_Render*
r, RV_VKImage* src_img);
631 bool primary_aspect =
true);
634 bool downloadSubData(
638 const Region& dst_region,
641 bool primary_aspect =
true);
649 bool primary_aspect =
true);
652 bool downloadSubData(
655 const Region& dst_region,
658 bool primary_aspect =
true);
662 void writeToFile(
RV_Render*
r,
const char *filepath);
664 #ifdef VULKAN_PRESENTATION
665 bool isSwapchainImage()
const
666 {
return myIsSwapchainImage; }
667 void setIsSwapchainImage(
bool is_swapchain_img)
668 { myIsSwapchainImage = is_swapchain_img; }
673 virtual ~RV_VKImage();
693 const char*
name =
nullptr);
706 #ifdef VULKAN_PRESENTATION
707 bool myIsSwapchainImage =
false;
718 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