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_Type.h"
18 #include "RV_TypePtrs.h"
19 
20 #include <VE/VE_Result.h>
21 #include <VE/VE_VK.h>
22 
23 #include <UT/UT_Assert.h>
24 #include <UT/UT_Span.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  RV_GPUType getGPUType() const;
69  int getVectorSize() const;
70 
71  /// Returns a vulkan subresource object for the full image
72  VkImageSubresourceRange getFullSubRes() const;
73 
74  /// Defines the size of the image (width, height, depth). 1D and 2D images
75  /// ignore some of the sizes.
76  void setSize(int w, int h, int d)
77  {
78  UT_ASSERT(w >= 1);
79  UT_ASSERT(h >= 1);
80  UT_ASSERT(d >= 1);
81 
82  myVkCreateInfo.extent.width = w;
83  myVkCreateInfo.extent.height = h;
84  myVkCreateInfo.extent.depth = d;
85  }
86  int getWidth() const
87  { return myVkCreateInfo.extent.width; }
88  int getHeight() const
89  { return myVkCreateInfo.extent.height; }
90  int getDepth() const
91  { return myVkCreateInfo.extent.depth; }
92 
93  /// Define the number of samples in a multisampled 2D image.
94  void setSamples(int samples)
95  {
96  UT_ASSERT(samples >= 1);
97  mySamples = samples;
98  }
99  int getSamples() const
100  { return mySamples; }
101 
102  /// Define the number of layers in a 1D or 2D array.
103  void setLayerCount(int count )
104  {
105  UT_ASSERT(count >= 1);
106  myVkCreateInfo.arrayLayers = count;
107  }
108  int getLayerCount() const
109  { return myVkCreateInfo.arrayLayers; }
110 
111  /// Set the maximum number of mipmap levels.
113  {
114  UT_ASSERT( count >= 1);
115  myMaxLevels = SYSmax(count, 1);
116  }
117  int getMaxLevelCount() const
118  { return myMaxLevels; }
119 
120  int getLevelCount() const
121  {
122  exint max_dim = SYSmax(SYSmax(getWidth(), getHeight()), getDepth());
123  int max_level = SYSfloorLog2(max_dim) + 1;
124  return SYSmin(max_level, getMaxLevelCount());
125  }
126 
127  /// Set the texture filter for texture scales above 1.
129  { myMagFilterMode = filter; }
130  /// Set the texture filter for texture scales below 1.
132  { myMinFilterMode = filter; }
133  /// Set the mipmapping mode - DISABLED, NEAREST mipmap, or LINEAR blend
135  { myMipMode = mode; }
136 
138  { return myMagFilterMode; }
140  { return myMinFilterMode; }
142  { return myMipMode; }
143 
144  /// Set the wrapping mode when uv is outside [0,1]:REPEAT,CLAMP,BORDER,MIRROR
146  { myWrapU = u; myWrapV = v; myWrapW = w; }
147 
149  { return myWrapU; }
151  { return myWrapV; }
153  { return myWrapW; }
154 
155  /// Set the texture swizzle for each component, when sampled in a shader
156  /// Cannot be combined with storage images or framebuffer attachment images
161  {
162  myTextureSwizzle[0] = r;
163  myTextureSwizzle[1] = g;
164  myTextureSwizzle[2] = b;
165  myTextureSwizzle[3] = a;
166  }
167 
169  { return myTextureSwizzle[0]; }
171  { return myTextureSwizzle[1]; }
173  { return myTextureSwizzle[2]; }
175  { return myTextureSwizzle[3]; }
176 
178  { myUsageAttachmentBit = b; }
180  { return myUsageAttachmentBit; }
181 
183  { myUsageSampledBit = b; }
184  bool getUsageSampledBit() const
185  { return myUsageSampledBit; }
186 
188  { myUsageStorageBit = b; }
189  bool getUsageStorageBit() const
190  { return myUsageStorageBit; }
191 
192  // sets the sample location usage flag. Only needed for Depth textures
193  void setUsageSampleLocations(bool use)
194  { myUsageSampleLocations = use; }
196  { return myUsageSampleLocations; }
197 
198  /// Use linear tiling (true) or optimal tiling. Not all types support linear.
199  void setUseLinearTiling(bool use)
200  { myUseLinearTiling = use; }
201  bool getUseLinearTiling() const
202  { return myUseLinearTiling; }
203 
205  { myMemType = type; }
207  { return myMemType; }
208 
209  void setCompareEnable(bool compare_enable)
210  { myCompareEnable = compare_enable; }
211  bool getCompareEnable() const
212  { return myCompareEnable; }
213 
214  void setCompareOp(RE_ZFunction compare_op)
215  { myCompareOp = compare_op; }
217  { return myCompareOp; }
218 
219  /// Access the vulkan creation structure for this image.
221  { return &myVkCreateInfo; }
222 
223  /// Finalize Create Info struct before being passed to
224  /// Vulkan API, and perform any final checks.
225  /// To Be called by Vulkan Image allocate function.
226  /// Returns false if any checks fail
227  virtual bool fillCreateInfo();
228 
229  // Constructors
230  RV_VKImageCreateInfo() = default;
232  {
234  new RV_VKImageCreateInfo(*this));
235  }
236 
237  virtual ~RV_VKImageCreateInfo();
238 
239 protected:
240  RV_VKImageCreateInfo(const RV_VKImageCreateInfo&) = default;
242 
243  bool isValidForLinearTiling() const;
244 
245  /// Extend Image Create Info struct.
246  /// Used by subclasses to create different
247  /// types of images
249  {
250  UT_ASSERT(p);
251  p->pNext = (VkBaseOutStructure*)myVkCreateInfo.pNext;
252  myVkCreateInfo.pNext = p;
253  }
254 
255  /// Setup allocation info for memory
256  virtual RV_MemType getAllocType(RV_Instance* inst);
257 
258  // ~~~~ Data Members ~~~~
259  // Image format
260  uint32_t mySamples = 0;
261  int myMaxLevels = 1;
262 
263  bool myUseLinearTiling = false;
264  RV_MemType myMemType = RV_MEM_AUTO;
265  RV_ImageDim myRVImageType = RV_IMAGE_2D;
266  RV_TextureSwizzle myTextureSwizzle[4] =
267  {
271  RV_SWIZZLE_IDENTITY
272  };
273 
274  // Sampler Info
275  fpreal32 myMinLOD = 0.0;
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;
284  RE_ZFunction myCompareOp = RE_ZALWAYS;
291  UT_Vector4F myBorderColor = {0.f, 0.f, 0.f, 0.f};
292 
293  // Vk Image Creation Info struct
294  VkImageCreateInfo myVkCreateInfo = {
296  nullptr,
297  0, /* flags */
298  VK_IMAGE_TYPE_2D, /* imageType */
299  VK_FORMAT_UNDEFINED, /* format */
300  {0, 0, 0}, /* extent */
301  1, /* mipLevels */
302  1, /* arrayLayers */
303  VK_SAMPLE_COUNT_1_BIT, /* samples */
304  VK_IMAGE_TILING_OPTIMAL,/* tiling */
305  0, /* usage */
306  VK_SHARING_MODE_EXCLUSIVE, /* sharingMode */
307  0, /* queueFamilyIndexCount */
308  nullptr, /* pQueueFamilyIndices */
309  VK_IMAGE_LAYOUT_UNDEFINED, /* initialLayout */
310  };
311 
312  friend class RV_VKImage;
313 };
314 
315 /// RAII wrapper class for VkImageView
317 {
318 public:
319  /// Access the vulkan resource for the view
320  VkImageView getVkView() { return myVkView; }
321 
322  // CAN have null state
324  : myInst(nullptr), myVkView(VK_NULL_HANDLE)
325  {}
326  RV_VKImageView(RV_Instance* inst, VkImageView vk_view)
327  : myInst(inst), myVkView(vk_view)
328  {}
329 
330  // disable copy semantics
331  RV_VKImageView(const RV_VKImageView&) = delete;
333 
334  // enable move semantics
335  RV_VKImageView(RV_VKImageView&& other) noexcept
336  : myInst(other.myInst), myVkView(other.myVkView)
337  {
338  other.myInst = nullptr;
339  other.myVkView = VK_NULL_HANDLE;
340  }
341  RV_VKImageView& operator=(RV_VKImageView&& other) noexcept = delete;
342 
343  // Destroy Resource Handle on destruction
344  void destroy(RV_Instance* inst);
345  ~RV_VKImageView();
346 
347 private:
348  RV_Instance* myInst = nullptr;
349  VkImageView myVkView = VK_NULL_HANDLE;
350 };
351 
352 // RAII wrapper for sampler
354 {
355 public:
356  /// Access the vulkan resource for the sampler
357  VkSampler getVkSampler() { return myVkSampler; }
358 
359  // CAN have null state
361  : myInst(nullptr), myVkSampler(VK_NULL_HANDLE)
362  {}
363  RV_VKSampler(RV_Instance* inst, VkSampler vk_sampler)
364  : myInst(inst), myVkSampler(vk_sampler)
365  {}
366 
367  // disable copy semantics
368  RV_VKSampler(const RV_VKSampler&) = delete;
369  RV_VKSampler& operator=(RV_VKSampler& ) = delete;
370 
371  // enable move semantics
372  RV_VKSampler(RV_VKSampler&& other) noexcept
373  : myInst(other.myInst), myVkSampler(other.myVkSampler)
374  {
375  other.myInst = nullptr;
376  other.myVkSampler = VK_NULL_HANDLE;
377  }
378  RV_VKSampler& operator=(RV_VKSampler&& other) noexcept = delete;
379 
380  // Destroy Resource Handle on destruction
381  void destroy(RV_Instance* inst);
382  ~RV_VKSampler();
383 private:
384  RV_Instance* myInst = nullptr;
385  VkSampler myVkSampler = VK_NULL_HANDLE;
386 };
387 
388 /// Class hodling VkImage handle and bound Memory allocation
389 /// cleans up resources on destruction
391 {
392 public:
393  /// Creates new Image based on create info
394  static RV_VKImagePtr allocateImage(
395  RV_Instance* inst,
396  RV_VKImageCreateInfo* info,
397  const char* name = nullptr);
398 
399  /// Creates an image from an already existing VkImage, and
400  /// takes ownership of the VkImage but not the memory object
401  static RV_VKImagePtr createFromImage(
402  RV_Instance* inst,
403  VkImage vk_image,
404  const VkImageCreateInfo* info,
405  const char* name = nullptr
406  );
407 
408  /// Allocate a new Image Sampler using parameters from img_info,
409  /// ignoring non-sampler parameters
410  static UT_UniquePtr<RV_VKSampler> allocateSampler(
411  RV_Instance* inst,
412  const RV_VKImageCreateInfo* img_info);
413 
414  /// check whether the format info in pInfo can create
415  /// a valid Vulkan image
416  static bool queryIsUsable(
417  RV_Instance* inst,
418  RV_VKImageCreateInfo* info);
419 
420  /// The image properties
421  const RV_VKImageCreateInfo& getInfo() const { return *myCreateInfo; }
422 
423  // Getters for image members
424  VkImage getVkImage() { return myVkImg; }
425  RV_VKMemory& getMemory() { return *myMemory; }
426  RV_VKSampler* getSampler() { return mySampler.get(); }
427  VkImageLayout getLayout() const { return myLastLayout; }
428  const RV_ResourceID &getID() const { return myId; }
429  const UT_StringHolder &getName() const { return myName; }
430 
431  /// On linux, the returned handle is owned by the caller. The caller can
432  /// either use it to import the texture into another API; or they must close
433  /// it when they're done with it. On windows, the returned handle can only
434  /// be used to import the texture into another API--the caller must never
435  /// close it themself!
436  /// See documentation for VE_Memory::getExternalHandle() for more
437  /// information.
438  VE_Result<SYS_Handle> getExternalHandle();
439 
440  RV_VKImageView& getFullView() { return *myView; }
442  { return myPrimaryView ? *myPrimaryView :*myView;}
443 
444  // Functions to create Image View for image
445  /// Create new VkImageView for whole VkImage range
446  RV_VKImageView createView();
447  /// Create new VkImageView for specific VkImage subresource range
448  RV_VKImageView createView(const VkImageSubresourceRange &subres);
449  /// Create new VkImageView for specific VkImage subresource range, with type
450  RV_VKImageView createView(const VkImageSubresourceRange &subres, VkImageViewType type);
451  /// Create new VkImageView for specific type, trying to use full subresource range
452  RV_VKImageView createView(VkImageViewType type);
453 
454  /// Record a command to transition image into new layout
455  void transitionImage(
456  RV_VKCommandBuffer* cb,
457  VkImageLayout new_layout,
458  VkImageUsageFlags new_usage, // TODO: new struct to encapsulate access, stage, usage
459  // want to be able to specify extra params
460  // (e.g. read vs write access, and specific pipeline shader stage)
461  // without cluttering the function signature
462  bool keep_data = true,
464 
465  /// Record a command to transition the image for sampling in a shader
467  {
468  if (force || myLastLayout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
469  transitionImage(cb, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
471  }
472 
473  struct Region
474  {
475  int32_t x = 0;
476  int32_t y = 0;
477  int32_t z = 0;
478 
479  int32_t width = 1;
480  int32_t height = 1;
481  int32_t depth = 1;
482 
483  Region(int xoffset, int xsize)
484  : x(xoffset), width(xsize)
485  {}
486 
487  Region(int xoffset, int xsize, int yoffset, int ysize)
488  : x(xoffset), width(xsize)
489  , y(yoffset), height(ysize)
490  {}
491 
492  Region(int xoffset, int xsize, int yoffset, int ysize, int zoffset, int zsize)
493  : x(xoffset), width(xsize)
494  , y(yoffset), height(ysize)
495  , z(zoffset), depth(zsize)
496  {}
497  };
498 
499  /// Sets the entire image to the specified values. This signature is for
500  /// colour images. RGBA values beyond the format's tuple size are ignored.
501  /// Must be in a state for upload.
502  bool fillData(RV_Render* render, float r, float g, float b, float a,
503  int index = 0);
504  /// Sets the entire image to the specified values. This signature is for
505  /// signed integer images. RGBA values beyond the format's tuple size are
506  /// ignored. Must be in a state for upload.
507  bool fillData(RV_Render* render, int r, int g, int b, int a, int index = 0);
508  /// Sets the entire image to the specified values. This signature is for
509  /// unsigned integer images. RGBA values beyond the format's tuple size are
510  /// ignored. Must be in a state for upload.
511  bool fillData(RV_Render* render, uint r, uint g, uint b, uint a,
512  int index = 0);
513 
514  /// Upload data to the image. Must be in a state for upload.
516  bool uploadData(RV_Render* r, const T &data, int level = 0, int index = 0)
517  {
518  // `T` must be a `UT_Span` or convertable into a `UT_Span`
520  return uploadData( r,
521  span.data(), span.size_bytes(),
522  level, index);
523  }
524 
526  bool uploadSubData(RV_Render* r, const T &data, const Region &region, int level = 0, int index = 0)
527  {
528  // `T` must be a `UT_Span` or convertable into a `UT_Span`
530  return uploadData( r,
531  span.data(), span.size_bytes(),
532  region, level, index);
533  }
534 
535  bool uploadData(
536  RV_Render* r,
537  const void* data,
538  exint data_size,
539  int level = 0,
540  int index = 0);
541 
542  bool uploadData(
543  RV_Instance* inst,
544  RV_VKCommandBuffer* cb,
545  const void* data,
546  exint data_size,
547  int level = 0,
548  int index = 0);
549 
550  bool uploadSubData(
551  RV_Render* r,
552  const void* data,
553  exint data_size,
554  const Region &region,
555  int level = 0,
556  int index = 0);
557 
558  bool uploadSubData(
559  RV_Instance* inst,
560  RV_VKCommandBuffer* cb,
561  const void* data,
562  exint data_size,
563  const Region &dst_region,
564  int level = 0,
565  int index = 0);
566 
567  /// Copy image data to this image from `buffer`.
568  bool uploadData(RV_Render* r,
569  RV_VKBuffer* src_buf,
570  int level = 0,
571  int index = 0,
572  exint buf_offset = 0,
573  exint buf_size = -1);
574 
575  bool uploadData(
576  RV_Instance* inst,
577  RV_VKCommandBuffer* cb,
578  RV_VKBuffer* src_buf,
579  int level = 0,
580  int index = 0,
581  exint buf_offset = 0,
582  exint buf_size = -1);
583 
584  bool uploadSubData(RV_Render* r,
585  RV_VKBuffer* src_buf,
586  const Region &dst_region,
587  int level = 0,
588  int index = 0,
589  exint buf_offset = 0,
590  exint buf_size = -1);
591 
592  bool uploadSubData(
593  RV_Instance* inst,
594  RV_VKCommandBuffer* cb,
595  RV_VKBuffer* src_buf,
596  const Region &dst_region,
597  int level = 0,
598  int index = 0,
599  exint buf_offset = 0,
600  exint buf_size = -1);
601 
602  // TODO: add options for level, layer, separate aspects, offsets
603  /// Copy image data from `other` into this image.
604  /// images MUST have same size and format
605  bool copyData(RV_Render* r, RV_VKImage* src_img, int dest_layer = 0);
606 
607  bool copySubData(
608  RV_Render* r,
609  RV_VKImage* src_img,
610  const Region& dst_region,
611  int dest_layer = 0);
612 
613  /// Resolves image data from Multisample `other` into this image.
614  /// images MUST have same size and format, and MUST be color images,
615  /// and this MUST be a single-sample image
616  bool resolveData(RV_Render* r, RV_VKImage* src_img);
617 
618  /// Generate higher mipmap levels from the base level
619  void generateMipmaps(RV_Render* r);
620 
621  /// Generate mipmaps for a specific image layer
622  void generateMipmaps(RV_Render* r, exint base_layer, exint layer_count);
623 
624  /// Download image data into `data`.
625  bool downloadData(
626  RV_Render* r,
627  void* dst_data,
628  exint data_size,
629  int level = 0,
630  int index = 0,
631  bool primary_aspect = true);
632 
633  /// Download image data into `data`, from a subregion of this image
634  bool downloadSubData(
635  RV_Render* r,
636  void* dst_data,
637  exint data_size,
638  const Region& dst_region,
639  int level = 0,
640  int index = 0,
641  bool primary_aspect = true);
642 
643  /// Download image data into `buf`.
644  bool downloadData(
645  RV_Render* r,
646  RV_VKBuffer* dst_buf,
647  int level = 0,
648  int index = 0,
649  bool primary_aspect = true);
650 
651  /// Download image data into `buf`, from a subregion of this image
652  bool downloadSubData(
653  RV_Render* r,
654  RV_VKBuffer* dst_buf,
655  const Region& dst_region,
656  int level = 0,
657  int index = 0,
658  bool primary_aspect = true);
659 
660  // Write the image to a file. This will cause a flush and wait
661  // on the RV_Render, to download the data from the GPU
662  void writeToFile(RV_Render* r, const char *filepath);
663 
664 #ifdef VULKAN_PRESENTATION
665  bool isSwapchainImage() const
666  { return myIsSwapchainImage; }
667  void setIsSwapchainImage(bool is_swapchain_img)
668  { myIsSwapchainImage = is_swapchain_img; }
669 #endif
670 
671 
672  void destroy(RV_Instance*);
673  virtual ~RV_VKImage();
674 
675  /// Debug print out of image properties (not image data).
676  void print() const;
677 
678 protected:
679  RV_VKImage(
680  RV_Instance* inst,
681  const RV_VKImageCreateInfo* img_info,
682  VkImage vk_img,
683  RV_VKMemoryPtr mem,
684  RV_VKImageViewPtr view,
685  RV_VKImageViewPtr primary_view,
687 
688  static RV_VKImagePtr createRVImage(
689  RV_Instance* inst,
690  VkImage vk_img,
691  RV_VKMemoryPtr mem,
692  const RV_VKImageCreateInfo* info,
693  const char* name = nullptr);
694 
695  // basic resource handles
696  RV_Instance* myInst = nullptr;
697  VkImage myVkImg = VK_NULL_HANDLE;
700 
705 
706 #ifdef VULKAN_PRESENTATION
707  bool myIsSwapchainImage = false;
708 #endif
709 
710 public: // wip
712 
713  // Vulkan Resource Usage
715  VkAccessFlags myLastAccess = 0;
716  VkImageUsageFlags myLastUsage = 0;
717  VkPipelineStageFlags myLastStage = 0;
718  uint32_t myLastQueueFam = 0;
719 
720  RV_StageGroup myWaitingBarrierStage = RV_STAGE_NONE;
721 
722  friend class RV_VKImageCreateInfo;
723 };
724 
725 #endif
type
Definition: core.h:556
void setTextureMinFilter(RV_TextureFilter filter)
Set the texture filter for texture scales below 1.
Definition: RV_VKImage.h:131
#define SYSmax(a, b)
Definition: SYS_Math.h:1952
UT_UniquePtr< RV_VKMemory > myMemory
Definition: RV_VKImage.h:703
RV_TextureSwizzle
Definition: RV_Type.h:203
void setUsageStorageBit(bool b)
Definition: RV_VKImage.h:187
VkSampler getVkSampler()
Access the vulkan resource for the sampler.
Definition: RV_VKImage.h:357
GLint GLint GLint yoffset
Definition: glcorearb.h:412
int getLevelCount() const
Definition: RV_VKImage.h:120
#define VK_NULL_HANDLE
Definition: vulkan_core.h:45
int getWidth() const
Definition: RV_VKImage.h:86
int getSamples() const
Definition: RV_VKImage.h:99
constexpr span< ElementType, Extent > make_span(span< ElementType, Extent > s) noexcept
Definition: UT_Span.h:559
*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
Definition: thread.h:632
const GLdouble * v
Definition: glcorearb.h:837
const VkImageCreateInfo * getVkInfo() const
Access the vulkan creation structure for this image.
Definition: RV_VKImage.h:220
GLsizei const GLfloat * value
Definition: glcorearb.h:824
const UT_StringHolder & getName() const
Definition: RV_VKImage.h:429
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:848
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:442
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:94
UT_UniquePtr< RV_VKMemory > RV_VKMemoryPtr
Definition: RV_TypePtrs.h:50
RV_TextureFilter getTextureMinFilter() const
Definition: RV_VKImage.h:139
Region(int xoffset, int xsize)
Definition: RV_VKImage.h:483
RV_TextureSwizzle getTextureSwizzleG() const
Definition: RV_VKImage.h:170
void addNext(VkBaseOutStructure *p)
Definition: RV_VKImage.h:248
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:145
GLint y
Definition: glcorearb.h:103
UT_UniquePtr< RV_VKImage > RV_VKImagePtr
Definition: RV_TypePtrs.h:59
VkFlags VkPipelineStageFlags
Definition: vulkan_core.h:2401
RV_TextureFilter getTextureMagFilter() const
Definition: RV_VKImage.h:137
UT_UniquePtr< RV_VKSampler > mySampler
Definition: RV_VKImage.h:704
#define VK_LOD_CLAMP_NONE
Definition: vulkan_core.h:125
RV_VKSampler(RV_VKSampler &&other) noexcept
Definition: RV_VKImage.h:372
GLuint sampler
Definition: glcorearb.h:1656
void setLayerCount(int count)
Define the number of layers in a 1D or 2D array.
Definition: RV_VKImage.h:103
float fpreal32
Definition: SYS_Types.h:200
void setMaxLevelCount(int count)
Set the maximum number of mipmap levels.
Definition: RV_VKImage.h:112
RV_TextureMipMode
Definition: RV_Type.h:143
UT_UniquePtr< RV_VKImageView > myView
Definition: RV_VKImage.h:701
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
Definition: HDK_Image.dox:266
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:134
void setCompareEnable(bool compare_enable)
Definition: RV_VKImage.h:209
bool getCompareEnable() const
Definition: RV_VKImage.h:211
GLint GLsizei GLsizei height
Definition: glcorearb.h:103
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
RV_VKMemory & getMemory()
Definition: RV_VKImage.h:425
RV_TextureWrap getTextureWrapU() const
Definition: RV_VKImage.h:148
UT_UniquePtr< RV_VKImageView > RV_VKImageViewPtr
Definition: RV_TypePtrs.h:60
bool getUsageAttachmentBit() const
Definition: RV_VKImage.h:179
int getLayerCount() const
Definition: RV_VKImage.h:108
RV_VKSampler(RV_Instance *inst, VkSampler vk_sampler)
Definition: RV_VKImage.h:363
RV_TextureMipMode getTextureMipMode() const
Definition: RV_VKImage.h:141
UT_StringHolder myName
Definition: RV_VKImage.h:711
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:466
VkImageLayout getLayout() const
Definition: RV_VKImage.h:427
RV_TextureSwizzle getTextureSwizzleR() const
Definition: RV_VKImage.h:168
void setTextureSwizzle(RV_TextureSwizzle r, RV_TextureSwizzle g, RV_TextureSwizzle b, RV_TextureSwizzle a)
Definition: RV_VKImage.h:157
#define RV_API
Definition: RV_API.h:10
RV_TextureWrap
Definition: RV_Type.h:150
void setMemoryType(RV_MemType type)
Definition: RV_VKImage.h:204
GLint GLint xoffset
Definition: glcorearb.h:411
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:50
GLint GLenum GLint x
Definition: glcorearb.h:409
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:516
VkImageType
Definition: vulkan_core.h:1699
GLsizei samples
Definition: glcorearb.h:1298
GLenum mode
Definition: glcorearb.h:99
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:476
void setUsageSampleLocations(bool use)
Definition: RV_VKImage.h:193
int getMaxLevelCount() const
Definition: RV_VKImage.h:117
RV_ImageDim getRVImageType() const
The RV image type.
Definition: RV_VKImage.h:59
Region(int xoffset, int xsize, int yoffset, int ysize, int zoffset, int zsize)
Definition: RV_VKImage.h:492
RV_VKSampler * getSampler()
Definition: RV_VKImage.h:426
int getHeight() const
Definition: RV_VKImage.h:88
RV_VKImageView(RV_VKImageView &&other) noexcept
Definition: RV_VKImage.h:335
RV_VKImageView & getFullView()
Definition: RV_VKImage.h:440
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
const RV_ResourceID & getID() const
Definition: RV_VKImage.h:428
RV_MemType getMemoryType() const
Definition: RV_VKImage.h:206
VkFlags VkAccessFlags
Definition: vulkan_core.h:2155
int getDepth() const
Definition: RV_VKImage.h:90
RV_TextureWrap getTextureWrapW() const
Definition: RV_VKImage.h:152
SIM_API const UT_StringHolder force
UT_UniquePtr< const RV_VKImageCreateInfo > myCreateInfo
Definition: RV_VKImage.h:699
VkImageLayout
Definition: vulkan_core.h:1250
RV_TextureSwizzle getTextureSwizzleB() const
Definition: RV_VKImage.h:172
RV_GPUType
Definition: RV_Type.h:40
void setSize(int w, int h, int d)
Definition: RV_VKImage.h:76
Region(int xoffset, int xsize, int yoffset, int ysize)
Definition: RV_VKImage.h:487
void setCompareOp(RE_ZFunction compare_op)
Definition: RV_VKImage.h:214
LeafData & operator=(const LeafData &)=delete
GLuint index
Definition: glcorearb.h:786
const RV_VKImageCreateInfo & getInfo() const
The image properties.
Definition: RV_VKImage.h:421
constexpr size_type size_bytes() const noexcept
Definition: span.h:187
VkImageView getVkView()
Access the vulkan resource for the view.
Definition: RV_VKImage.h:320
VkFormat getFormat() const
Definition: RV_VKImage.h:67
RE_ZFunction getCompareOp() const
Definition: RV_VKImage.h:216
VkFormat
Definition: vulkan_core.h:1386
void setUsageSampledBit(bool b)
Definition: RV_VKImage.h:182
RV_TextureWrap getTextureWrapV() const
Definition: RV_VKImage.h:150
GLint GLsizei width
Definition: glcorearb.h:103
bool uploadSubData(RV_Render *r, const T &data, const Region &region, int level=0, int index=0)
Definition: RV_VKImage.h:526
bool getUsageStorageBit() const
Definition: RV_VKImage.h:189
void setUseLinearTiling(bool use)
Use linear tiling (true) or optimal tiling. Not all types support linear.
Definition: RV_VKImage.h:199
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:165
void setFormat(VkFormat format)
Set the vulkan image format. RV.
Definition: RV_VKImage.h:66
VkImage getVkImage()
Definition: RV_VKImage.h:424
GLboolean r
Definition: glcorearb.h:1222
RV_TextureSwizzle getTextureSwizzleA() const
Definition: RV_VKImage.h:174
A vulkan buffer object.
Definition: RV_VKBuffer.h:75
RV_ResourceID myId
Definition: RV_VKImage.h:698
bool getUsageSampleLocations() const
Definition: RV_VKImage.h:195
RV_ImageDim
Definition: RV_Type.h:120
#define SYSmin(a, b)
Definition: SYS_Math.h:1953
FMT_INLINE void print(format_string< T...> fmt, T &&...args)
Definition: core.h:2903
bool getUsageSampledBit() const
Definition: RV_VKImage.h:184
unsigned int uint
Definition: SYS_Types.h:45
virtual UT_UniquePtr< RV_VKImageCreateInfo > clone() const
Definition: RV_VKImage.h:231
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:128
GLint GLint GLint GLint zoffset
Definition: glcorearb.h:477
UT_UniquePtr< RV_VKImageView > myPrimaryView
Definition: RV_VKImage.h:702
GLint GLsizei count
Definition: glcorearb.h:405
Definition: format.h:1821
void setUsageAttachmentBit(bool b)
Definition: RV_VKImage.h:177
bool getUseLinearTiling() const
Definition: RV_VKImage.h:201
RV_VKImageView(RV_Instance *inst, VkImageView vk_view)
Definition: RV_VKImage.h:326
struct VkBaseOutStructure * pNext
Definition: vulkan_core.h:2817
RV_VKImageView & getPrimaryView()
Definition: RV_VKImage.h:441
RAII wrapper class for VkImageView.
Definition: RV_VKImage.h:316
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