HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RV_VKImage.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RV_VKImage.h ( RV Library, C++)
7  *
8  * COMMENTS:
9  * Class for creating Vulkan Image object
10  * Includes Vulkan Handle and memory allocation bound to it
11  */
12 #ifndef RV_VKImage_h
13 #define RV_VKImage_h
14 
15 #include "RV_API.h"
16 #include "RV_Instance.h"
17 #include "RV_Render.h"
18 #include "RV_Type.h"
19 #include "RV_TypePtrs.h"
20 
21 #include <VE/VE_Result.h>
22 #include <VE/VE_VK.h>
23 
24 #include <UT/UT_Assert.h>
25 #include <UT/UT_Swap.h>
26 #include <UT/UT_UniquePtr.h>
27 #include <SYS/SYS_Handle.h>
28 #include <SYS/SYS_Math.h>
29 #include <SYS/SYS_Types.h>
30 
31 #include <limits>
32 
33 class RV_Instance;
34 class RV_Render;
35 class RV_VKCommandBuffer;
36 class RV_VKImage;
37 class RV_VKMemAllocInfo;
38 class RV_VKQueue;
39 class RV_VKMemory;
40 
41 #define RV_MAX_MIP_LEVEL (std::numeric_limits<int>::max())
42 
43 /// Class for Setting up Image Info
44 /// Should be trivially copiable,
45 /// so it can be duplicated or passed around
46 /// Once a VkImage is created, it is immutable
47 /// so changing a parameter means creating
48 /// a new image
50 {
51 public:
52  // set Vulkan Image Creation parameters
53 
54  /// Define if the image is 1D, 2D, or 3D
55  void setImageType(RV_ImageDim img_type);
56  /// The Vulkan image type
57  VkImageType getImageType() const { return myVkCreateInfo.imageType; }
58  /// The RV image type
59  RV_ImageDim getRVImageType() const { return myRVImageType; }
60 
61  // TODO: use similar abstraction to RE_Texture ..
62  // setFormatType (i.e. Depth, vs. Color vs Stencil)
63  // setFormatDataType (int vs signed int vs float vs ...)
64  // setFormatVecSize (1, 2, 3, 4)
65  /// Set the vulkan image format. RV
66  void setFormat(VkFormat format) { myVkCreateInfo.format = format; }
67  VkFormat getFormat() const { return myVkCreateInfo.format; }
68 
69  /// Returns a vulkan subresource object for the full image
70  VkImageSubresourceRange getFullSubRes() const;
71 
72  /// Defines the size of the image (width, height, depth). 1D and 2D images
73  /// ignore some of the sizes.
74  void setSize(int w, int h, int d)
75  {
76  UT_ASSERT(w >= 1);
77  UT_ASSERT(h >= 1);
78  UT_ASSERT(d >= 1);
79 
80  myVkCreateInfo.extent.width = w;
81  myVkCreateInfo.extent.height = h;
82  myVkCreateInfo.extent.depth = d;
83  }
84  int getWidth() const
85  { return myVkCreateInfo.extent.width; }
86  int getHeight() const
87  { return myVkCreateInfo.extent.height; }
88  int getDepth() const
89  { return myVkCreateInfo.extent.depth; }
90 
91  /// Define the number of samples in a multisampled 2D image.
92  void setSamples(int samples)
93  {
94  UT_ASSERT(samples >= 1);
95  mySamples = samples;
96  }
97  int getSamples() const
98  { return mySamples; }
99 
100  /// Define the number of layers in a 1D or 2D array.
101  void setLayerCount(int count )
102  {
103  UT_ASSERT(count >= 1);
104  myVkCreateInfo.arrayLayers = count;
105  }
106  int getLayerCount() const
107  { return myVkCreateInfo.arrayLayers; }
108 
109  /// Set the maximum number of mipmap levels.
111  {
112  UT_ASSERT( count >= 1);
113  myMaxLevels = SYSmax(count, 1);
114  }
115  int getMaxLevelCount() const
116  { return myMaxLevels; }
117 
118  int getLevelCount() const
119  {
120  exint max_dim = SYSmax(SYSmax(getWidth(), getHeight()), getDepth());
121  int max_level = SYSfloorLog2(max_dim) + 1;
122  return SYSmin(max_level, getMaxLevelCount());
123  }
124 
125  /// Set the texture filter for texture scales above 1.
127  { myMagFilterMode = filter; }
128  /// Set the texture filter for texture scales below 1.
130  { myMinFilterMode = filter; }
131  /// Set the mipmapping mode - DISABLED, NEAREST mipmap, or LINEAR blend
133  { myMipMode = mode; }
134 
135  /// Set the wrapping mode when uv is outside [0,1]:REPEAT,CLAMP,BORDER,MIRROR
137  { myWrapU = u; myWrapV = v; myWrapW = w; }
138 
140  { return myWrapU; }
142  { return myWrapV; }
144  { return myWrapW; }
145 
146  /// Set the texture swizzle for each component, when sampled in a shader
147  /// Cannot be combined with storage images or framebuffer attachment images
152  {
153  myTextureSwizzle[0] = r;
154  myTextureSwizzle[1] = g;
155  myTextureSwizzle[2] = b;
156  myTextureSwizzle[3] = a;
157  }
158 
160  { return myTextureSwizzle[0]; }
162  { return myTextureSwizzle[1]; }
164  { return myTextureSwizzle[2]; }
166  { return myTextureSwizzle[3]; }
167 
169  { myUsageAttachmentBit = b; }
171  { return myUsageAttachmentBit; }
172 
174  { myUsageSampledBit = b; }
175  bool getUsageSampledBit() const
176  { return myUsageSampledBit; }
177 
179  { myUsageStorageBit = b; }
180  bool getUsageStorageBit() const
181  { return myUsageStorageBit; }
182 
183  /// Use linear tiling (true) or optimal tiling. Not all types support linear.
184  void setUseLinearTiling(bool use)
185  { myUseLinearTiling = use; }
186  bool getUseLinearTiling() const
187  { return myUseLinearTiling; }
188 
190  { myMemType = type; }
192  { return myMemType; }
193 
194  void setCompareEnable(bool compare_enable)
195  { myCompareEnable = compare_enable; }
196  bool getCompareEnable() const
197  { return myCompareEnable; }
198 
199  void setCompareOp(RE_ZFunction compare_op)
200  { myCompareOp = compare_op; }
202  { return myCompareOp; }
203 
204  /// Access the vulkan creation structure for this image.
206  { return &myVkCreateInfo; }
207 
208  /// Finalize Create Info struct before being passed to
209  /// Vulkan API, and perform any final checks.
210  /// To Be called by Vulkan Image allocate function.
211  /// Returns false if any checks fail
212  virtual bool fillCreateInfo();
213 
214  // Constructors
215  RV_VKImageCreateInfo() = default;
217  {
219  new RV_VKImageCreateInfo(*this));
220  }
221 
222  virtual ~RV_VKImageCreateInfo();
223 
224 protected:
225  RV_VKImageCreateInfo(const RV_VKImageCreateInfo&) = default;
227 
228  bool isValidForLinearTiling() const;
229 
230  /// Extend Image Create Info struct.
231  /// Used by subclasses to create different
232  /// types of images
234  {
235  UT_ASSERT(p);
236  p->pNext = (VkBaseOutStructure*)myVkCreateInfo.pNext;
237  myVkCreateInfo.pNext = p;
238  }
239 
240  /// Setup allocation info for memory
241  virtual RV_MemType getAllocType(RV_Instance* inst);
242 
243  // ~~~~ Data Members ~~~~
244  // Image format
245  uint32_t mySamples = 0;
246  int myMaxLevels = 1;
247 
248  bool myUseLinearTiling = false;
249  RV_MemType myMemType = RV_MEM_AUTO;
250  RV_ImageDim myRVImageType = RV_IMAGE_2D;
251  RV_TextureSwizzle myTextureSwizzle[4] =
252  {
256  RV_SWIZZLE_IDENTITY
257  };
258 
259  // Sampler Info
260  fpreal32 myMinLOD = 0.0;
262  bool myIsNormalized = false;
263  bool myIsTexelSampled = false;
264  bool myUsageAttachmentBit = true;
265  bool myUsageSampledBit = true;
266  bool myUsageStorageBit = false;
267  bool myCompareEnable = false;
268  RE_ZFunction myCompareOp = RE_ZALWAYS;
275  UT_Vector4F myBorderColor = {0.f, 0.f, 0.f, 0.f};
276 
277  // Vk Image Creation Info struct
278  VkImageCreateInfo myVkCreateInfo = {
280  nullptr,
281  0, /* flags */
282  VK_IMAGE_TYPE_2D, /* imageType */
283  VK_FORMAT_UNDEFINED, /* format */
284  {0, 0, 0}, /* extent */
285  1, /* mipLevels */
286  1, /* arrayLayers */
287  VK_SAMPLE_COUNT_1_BIT, /* samples */
288  VK_IMAGE_TILING_OPTIMAL,/* tiling */
289  0, /* usage */
290  VK_SHARING_MODE_EXCLUSIVE, /* sharingMode */
291  0, /* queueFamilyIndexCount */
292  nullptr, /* pQueueFamilyIndices */
293  VK_IMAGE_LAYOUT_UNDEFINED, /* initialLayout */
294  };
295 
296  friend class RV_VKImage;
297 };
298 
299 /// RAII wrapper class for VkImageView
301 {
302 public:
303  /// Access the vulkan resource for the view
304  VkImageView getVkView() { return myVkView; }
305 
306  // CAN have null state
308  : myInst(nullptr), myVkView(VK_NULL_HANDLE)
309  {}
310  RV_VKImageView(RV_Instance* inst, VkImageView vk_view)
311  : myInst(inst), myVkView(vk_view)
312  {}
313 
314  // disable copy semantics
315  RV_VKImageView(const RV_VKImageView&) = delete;
317 
318  // enable move semantics
319  RV_VKImageView(RV_VKImageView&& other) noexcept
320  : myInst(other.myInst), myVkView(other.myVkView)
321  {
322  other.myInst = nullptr;
323  other.myVkView = VK_NULL_HANDLE;
324  }
325  RV_VKImageView& operator=(RV_VKImageView&& other) noexcept = delete;
326 
327  // Destroy Resource Handle on destruction
329  {
330  if (myVkView != VK_NULL_HANDLE)
331  {
332  VkDevice vk_dev = myInst->getDevice();
333  ::vkDestroyImageView(vk_dev, myVkView, nullptr);
334  }
335  }
336 
337 private:
338  RV_Instance* myInst = nullptr;
339  VkImageView myVkView = VK_NULL_HANDLE;
340 };
341 
342 // RAII wrapper for sampler
344 {
345 public:
346  /// Access the vulkan resource for the sampler
347  VkSampler getVkSampler() { return myVkSampler; }
348 
349  // CAN have null state
351  : myInst(nullptr), myVkSampler(VK_NULL_HANDLE)
352  {}
353  RV_VKSampler(RV_Instance* inst, VkSampler vk_sampler)
354  : myInst(inst), myVkSampler(vk_sampler)
355  {}
356 
357  // disable copy semantics
358  RV_VKSampler(const RV_VKSampler&) = delete;
359  RV_VKSampler& operator=(RV_VKSampler& ) = delete;
360 
361  // enable move semantics
362  RV_VKSampler(RV_VKSampler&& other) noexcept
363  : myInst(other.myInst), myVkSampler(other.myVkSampler)
364  {
365  other.myInst = nullptr;
366  other.myVkSampler = VK_NULL_HANDLE;
367  }
368  RV_VKSampler& operator=(RV_VKSampler&& other) noexcept = delete;
369  // Destroy Resource Handle on destruction
371  {
372  if (myVkSampler != VK_NULL_HANDLE)
373  {
374  VkDevice vk_dev = myInst->getDevice();
375  ::vkDestroySampler(vk_dev, myVkSampler, nullptr);
376  }
377  }
378 
379 private:
380  RV_Instance* myInst = nullptr;
381  VkSampler myVkSampler = VK_NULL_HANDLE;
382 };
383 
384 /// Class hodling VkImage handle and bound Memory allocation
385 /// cleans up resources on destruction
387 {
388 public:
389  /// Creates new Image based on create info
390  static RV_VKImagePtr allocateImage(
391  RV_Instance* inst,
392  RV_VKImageCreateInfo* info,
393  const char* name = nullptr);
394 
395  /// Creates an image from an already existing VkImage, and
396  /// takes ownership of the VkImage but not the memory object
397  static RV_VKImagePtr createFromImage(
398  RV_Instance* inst,
399  VkImage vk_image,
400  const VkImageCreateInfo* info,
401  const char* name = nullptr
402  );
403 
404  /// Allocate a new Image Sampler using parameters from img_info,
405  /// ignoring non-sampler parameters
406  static UT_UniquePtr<RV_VKSampler> allocateSampler(
407  RV_Instance* inst,
408  const RV_VKImageCreateInfo* img_info);
409 
410  /// check whether the format info in pInfo can create
411  /// a valid Vulkan image
412  static bool queryIsUsable(
413  RV_Instance* inst,
414  RV_VKImageCreateInfo* info);
415 
416  /// The image properties
417  const RV_VKImageCreateInfo& getInfo() const { return *myCreateInfo; }
418 
419  // Getters for image members
420  VkImage getVkImage() { return myVkImg; }
421  RV_VKMemory& getMemory() { return *myMemory; }
422  RV_VKSampler* getSampler() { return mySampler.get(); }
423  VkImageLayout getLayout() const { return myLastLayout; }
424  const RV_ResourceID &getID() const { return myId; }
425  const UT_StringHolder &getName() const { return myName; }
426 
427  /// On linux, the returned handle is owned by the caller. The caller can
428  /// either use it to import the texture into another API; or they must close
429  /// it when they're done with it. On windows, the returned handle can only
430  /// be used to import the texture into another API--the caller must never
431  /// close it themself!
432  /// See documentation for VE_Memory::getExternalHandle() for more
433  /// information.
434  VE_Result<SYS_Handle> getExternalHandle();
435 
436  RV_VKImageView& getFullView() { return *myView; }
438  { return myPrimaryView ? *myPrimaryView :*myView;}
439 
440  // Functions to create Image View for image
441  /// Create new VkImageView for whole VkImage range
442  RV_VKImageView createView();
443  /// Create new VkImageView for specific VkImage subresource range
444  RV_VKImageView createView(const VkImageSubresourceRange &subres);
445  /// Create new VkImageView for specific VkImage subresource range, with type
446  RV_VKImageView createView(const VkImageSubresourceRange &subres, VkImageViewType type);
447  /// Create new VkImageView for specific type, trying to use full subresource range
448  RV_VKImageView createView(VkImageViewType type);
449 
450  /// Record a command to transition image into new layout
451  void transitionImage(
452  RV_VKCommandBuffer* cb,
453  VkImageLayout new_layout,
454  VkImageUsageFlags new_usage, // TODO: new struct to encapsulate access, stage, usage
455  // want to be able to specify extra params
456  // (e.g. read vs write access, and specific pipeline shader stage)
457  // without cluttering the function signature
458  bool keep_data = true,
460 
461  /// Record a command to transition the image for sampling in a shader
463  {
464  if (force || myLastLayout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
465  transitionImage(cb, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
467  }
468 
469  /// Upload data to the image. Must be in a state for upload.
471  bool uploadData(RV_Render* r, const T &data, int level = 0, int index = 0)
472  {
473  // `T` must be a `UT_Span` or convertable into a `UT_Span`
475  return uploadData(
476  r->instance(), r->getCurrentCB(),
477  span.data(), span.size_bytes(),
478  level, index);
479  }
480 
481  bool uploadData(
482  RV_Render* r,
483  const void* data,
484  exint data_size,
485  int level = 0,
486  int index = 0);
487 
488  bool uploadData(
489  RV_Instance* inst,
490  RV_VKCommandBuffer* cb,
491  const void* data,
492  exint data_size,
493  int level = 0,
494  int index = 0);
495 
496  /// Copy image data to this image from `buffer`.
497  bool uploadData(RV_Render* r,
498  RV_VKBuffer* buf,
499  int level = 0,
500  int index = 0,
501  exint buf_offset = 0,
502  exint buf_size = -1);
503 
504  bool uploadData(
505  RV_Instance* inst,
506  RV_VKCommandBuffer* cb,
507  RV_VKBuffer* buf,
508  int level = 0,
509  int index = 0,
510  exint buf_offset = 0,
511  exint buf_size = -1);
512 
513  // TODO: add options for level, layer, separate aspects, offsets
514  /// Copy image data from `other` into this image.
515  /// images MUST have same size and format
516  bool copyData(RV_Render* r, RV_VKImage* other);
517 
518  /// Resolves image data from Multisample `other` into this image.
519  /// images MUST have same size and format, and MUST be color images,
520  /// and this MUST be a single-sample image
521  bool resolveData(RV_Render* r, RV_VKImage* other);
522 
523  /// Generate higher mipmap levels from the base level
524  void generateMipmaps(RV_Render* r);
525 
526  /// Download image data into `data`.
527  bool downloadData(
528  RV_Render* r,
529  void* data,
530  exint data_size,
531  int level = 0,
532  int index = 0,
533  bool primary_aspect = true);
534 
535  /// Download image data into `buf`.
536  bool downloadData(
537  RV_Render* r,
538  RV_VKBuffer* buf,
539  int level = 0,
540  int index = 0,
541  bool primary_aspect = true);
542 
543 #ifdef VULKAN_PRESENTATION
544  bool isSwapchainImage() const
545  { return myIsSwapchainImage; }
546  void setIsSwapchainImage(bool is_swapchain_img)
547  { myIsSwapchainImage = is_swapchain_img; }
548 #endif
549 
550  virtual ~RV_VKImage();
551 
552  /// Debug print out of image properties (not image data).
553  void print() const;
554 
555 protected:
556  RV_VKImage(
557  RV_Instance* inst,
558  const RV_VKImageCreateInfo* img_info,
559  VkImage vk_img,
560  RV_VKMemoryPtr mem,
561  RV_VKImageViewPtr view,
562  RV_VKImageViewPtr primary_view,
564 
565  static RV_VKImagePtr createRVImage(
566  RV_Instance* inst,
567  VkImage vk_img,
568  RV_VKMemoryPtr mem,
569  const RV_VKImageCreateInfo* info,
570  const char* name = nullptr);
571 
572  static void deleteImage(
573  RV_Instance* inst,
574  VkImage* img,
575  VkDeviceMemory* mem);
576 
577  // basic resource handles
578  RV_Instance* myInst = nullptr;
579  VkImage myVkImg = VK_NULL_HANDLE;
582 
587 
588 #ifdef VULKAN_PRESENTATION
589  bool myIsSwapchainImage = false;
590 #endif
591 
592 public: // wip
594 
595  // Vulkan Resource Usage
597  VkAccessFlags myLastAccess = 0;
598  VkImageUsageFlags myLastUsage = 0;
599  VkPipelineStageFlags myLastStage = 0;
600  uint32_t myLastQueueFam = 0;
601 
602  RV_StageGroup myWaitingBarrierStage = RV_STAGE_NONE;
603 
604  friend class RV_VKImageCreateInfo;
605 };
606 
607 #endif
type
Definition: core.h:556
void setTextureMinFilter(RV_TextureFilter filter)
Set the texture filter for texture scales below 1.
Definition: RV_VKImage.h:129
#define SYSmax(a, b)
Definition: SYS_Math.h:1582
UT_UniquePtr< RV_VKMemory > myMemory
Definition: RV_VKImage.h:585
RV_TextureSwizzle
Definition: RV_Type.h:295
void setUsageStorageBit(bool b)
Definition: RV_VKImage.h:178
VkSampler getVkSampler()
Access the vulkan resource for the sampler.
Definition: RV_VKImage.h:347
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
int getLevelCount() const
Definition: RV_VKImage.h:118
#define VK_NULL_HANDLE
Definition: vulkan_core.h:45
int getWidth() const
Definition: RV_VKImage.h:84
int getSamples() const
Definition: RV_VKImage.h:97
constexpr span< ElementType, Extent > make_span(span< ElementType, Extent > s) noexcept
Definition: UT_Span.h:559
RV_VKImageView & operator=(RV_VKImageView &)=delete
const GLdouble * v
Definition: glcorearb.h:837
const VkImageCreateInfo * getVkInfo() const
Access the vulkan creation structure for this image.
Definition: RV_VKImage.h:205
GLsizei const GLfloat * value
Definition: glcorearb.h:824
const UT_StringHolder & getName() const
Definition: RV_VKImage.h:425
Definition: span.h:74
GLboolean GLboolean g
Definition: glcorearb.h:1222
int64 exint
Definition: SYS_Types.h:125
GLint level
Definition: glcorearb.h:108
RV_StageGroup
Definition: RV_Type.h:508
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
void setSamples(int samples)
Define the number of samples in a multisampled 2D image.
Definition: RV_VKImage.h:92
UT_UniquePtr< RV_VKMemory > RV_VKMemoryPtr
Definition: RV_TypePtrs.h:50
RV_TextureSwizzle getTextureSwizzleG() const
Definition: RV_VKImage.h:161
void addNext(VkBaseOutStructure *p)
Definition: RV_VKImage.h:233
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.
Definition: RV_VKImage.h:136
UT_UniquePtr< RV_VKImage > RV_VKImagePtr
Definition: RV_TypePtrs.h:59
VkFlags VkPipelineStageFlags
Definition: vulkan_core.h:2401
UT_UniquePtr< RV_VKSampler > mySampler
Definition: RV_VKImage.h:586
#define VK_LOD_CLAMP_NONE
Definition: vulkan_core.h:125
RV_VKSampler(RV_VKSampler &&other) noexcept
Definition: RV_VKImage.h:362
GLuint sampler
Definition: glcorearb.h:1656
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.
Definition: RV_VKImage.h:101
float fpreal32
Definition: SYS_Types.h:200
void setMaxLevelCount(int count)
Set the maximum number of mipmap levels.
Definition: RV_VKImage.h:110
RV_TextureMipMode
Definition: RV_Type.h:143
UT_UniquePtr< RV_VKImageView > myView
Definition: RV_VKImage.h:583
RV_VKCommandBuffer * getCurrentCB()
The currently recording command buffer.
VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator)
VkFlags VkImageUsageFlags
Definition: vulkan_core.h:2311
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
void setTextureMipMode(RV_TextureMipMode mode)
Set the mipmapping mode - DISABLED, NEAREST mipmap, or LINEAR blend.
Definition: RV_VKImage.h:132
void setCompareEnable(bool compare_enable)
Definition: RV_VKImage.h:194
bool getCompareEnable() const
Definition: RV_VKImage.h:196
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
RV_VKMemory & getMemory()
Definition: RV_VKImage.h:421
RV_TextureWrap getTextureWrapU() const
Definition: RV_VKImage.h:139
UT_UniquePtr< RV_VKImageView > RV_VKImageViewPtr
Definition: RV_TypePtrs.h:60
bool getUsageAttachmentBit() const
Definition: RV_VKImage.h:170
int getLayerCount() const
Definition: RV_VKImage.h:106
RV_VKSampler(RV_Instance *inst, VkSampler vk_sampler)
Definition: RV_VKImage.h:353
UT_StringHolder myName
Definition: RV_VKImage.h:593
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
VkImageType getImageType() const
The Vulkan image type.
Definition: RV_VKImage.h:57
void transitionToSampling(RV_VKCommandBuffer *cb, bool force=false)
Record a command to transition the image for sampling in a shader.
Definition: RV_VKImage.h:462
VkImageLayout getLayout() const
Definition: RV_VKImage.h:423
RV_TextureSwizzle getTextureSwizzleR() const
Definition: RV_VKImage.h:159
void setTextureSwizzle(RV_TextureSwizzle r, RV_TextureSwizzle g, RV_TextureSwizzle b, RV_TextureSwizzle a)
Definition: RV_VKImage.h:148
#define RV_API
Definition: RV_API.h:10
RV_TextureWrap
Definition: RV_Type.h:150
void setMemoryType(RV_MemType type)
Definition: RV_VKImage.h:189
GLuint const GLchar * name
Definition: glcorearb.h:786
RE_ZFunction
Definition: RE_Types.h:478
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
Handle to the main interface of Vulkan.
Definition: RV_Instance.h:44
GLint void * img
Definition: glcorearb.h:556
RV_TextureFilter
Definition: RV_Type.h:136
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.
Definition: RV_VKImage.h:471
VkImageType
Definition: vulkan_core.h:1699
char size_t buf_size
Definition: SYS_String.h:466
GLsizei samples
Definition: glcorearb.h:1298
GLenum mode
Definition: glcorearb.h:99
RV_Instance * instance()
The instance associated with this render.
Definition: RV_Render.h:92
int getMaxLevelCount() const
Definition: RV_VKImage.h:115
RV_ImageDim getRVImageType() const
The RV image type.
Definition: RV_VKImage.h:59
RV_VKSampler * getSampler()
Definition: RV_VKImage.h:422
int getHeight() const
Definition: RV_VKImage.h:86
RV_VKImageView(RV_VKImageView &&other) noexcept
Definition: RV_VKImage.h:319
RV_VKImageView & getFullView()
Definition: RV_VKImage.h:436
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
const RV_ResourceID & getID() const
Definition: RV_VKImage.h:424
RV_MemType getMemoryType() const
Definition: RV_VKImage.h:191
VkFlags VkAccessFlags
Definition: vulkan_core.h:2155
int getDepth() const
Definition: RV_VKImage.h:88
RV_TextureWrap getTextureWrapW() const
Definition: RV_VKImage.h:143
SIM_API const UT_StringHolder force
UT_UniquePtr< const RV_VKImageCreateInfo > myCreateInfo
Definition: RV_VKImage.h:581
VkImageLayout
Definition: vulkan_core.h:1250
RV_TextureSwizzle getTextureSwizzleB() const
Definition: RV_VKImage.h:163
void setSize(int w, int h, int d)
Definition: RV_VKImage.h:74
void setCompareOp(RE_ZFunction compare_op)
Definition: RV_VKImage.h:199
LeafData & operator=(const LeafData &)=delete
GLuint index
Definition: glcorearb.h:786
const RV_VKImageCreateInfo & getInfo() const
The image properties.
Definition: RV_VKImage.h:417
constexpr size_type size_bytes() const noexcept
Definition: span.h:187
VkImageView getVkView()
Access the vulkan resource for the view.
Definition: RV_VKImage.h:304
VkFormat getFormat() const
Definition: RV_VKImage.h:67
RE_ZFunction getCompareOp() const
Definition: RV_VKImage.h:201
VkFormat
Definition: vulkan_core.h:1386
void setUsageSampledBit(bool b)
Definition: RV_VKImage.h:173
RV_TextureWrap getTextureWrapV() const
Definition: RV_VKImage.h:141
bool getUsageStorageBit() const
Definition: RV_VKImage.h:180
void setUseLinearTiling(bool use)
Use linear tiling (true) or optimal tiling. Not all types support linear.
Definition: RV_VKImage.h:184
VkDevice getDevice()
Get the raw vulkan device assocated with this instance.
RV_MemType
Definition: RV_Type.h:111
VkImageViewType
Definition: vulkan_core.h:1757
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
void setFormat(VkFormat format)
Set the vulkan image format. RV.
Definition: RV_VKImage.h:66
VkImage getVkImage()
Definition: RV_VKImage.h:420
GLboolean r
Definition: glcorearb.h:1222
RV_TextureSwizzle getTextureSwizzleA() const
Definition: RV_VKImage.h:165
A vulkan buffer object.
Definition: RV_VKBuffer.h:81
RV_VKSampler & operator=(RV_VKSampler &)=delete
RV_ResourceID myId
Definition: RV_VKImage.h:580
RV_ImageDim
Definition: RV_Type.h:120
#define SYSmin(a, b)
Definition: SYS_Math.h:1583
FMT_INLINE void print(format_string< T...> fmt, T &&...args)
Definition: core.h:2903
bool getUsageSampledBit() const
Definition: RV_VKImage.h:175
virtual UT_UniquePtr< RV_VKImageCreateInfo > clone() const
Definition: RV_VKImage.h:216
constexpr pointer data() const noexcept
Definition: span.h:190
void setTextureMagFilter(RV_TextureFilter filter)
Set the texture filter for texture scales above 1.
Definition: RV_VKImage.h:126
UT_UniquePtr< RV_VKImageView > myPrimaryView
Definition: RV_VKImage.h:584
GLint GLsizei count
Definition: glcorearb.h:405
Definition: format.h:1821
void setUsageAttachmentBit(bool b)
Definition: RV_VKImage.h:168
bool getUseLinearTiling() const
Definition: RV_VKImage.h:186
RV_VKImageView(RV_Instance *inst, VkImageView vk_view)
Definition: RV_VKImage.h:310
struct VkBaseOutStructure * pNext
Definition: vulkan_core.h:2817
RV_VKImageView & getPrimaryView()
Definition: RV_VKImage.h:437
RAII wrapper class for VkImageView.
Definition: RV_VKImage.h:300
UT_UniquePtr< RV_VKSampler > RV_VKSamplerPtr
Definition: RV_TypePtrs.h:61
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297