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