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  // sets the sample location usage flag. Only needed for Depth textures
184  void setUsageSampleLocations(bool use)
185  { myUsageSampleLocations = use; }
187  { return myUsageSampleLocations; }
188 
189  /// Use linear tiling (true) or optimal tiling. Not all types support linear.
190  void setUseLinearTiling(bool use)
191  { myUseLinearTiling = use; }
192  bool getUseLinearTiling() const
193  { return myUseLinearTiling; }
194 
196  { myMemType = type; }
198  { return myMemType; }
199 
200  void setCompareEnable(bool compare_enable)
201  { myCompareEnable = compare_enable; }
202  bool getCompareEnable() const
203  { return myCompareEnable; }
204 
205  void setCompareOp(RE_ZFunction compare_op)
206  { myCompareOp = compare_op; }
208  { return myCompareOp; }
209 
210  /// Access the vulkan creation structure for this image.
212  { return &myVkCreateInfo; }
213 
214  /// Finalize Create Info struct before being passed to
215  /// Vulkan API, and perform any final checks.
216  /// To Be called by Vulkan Image allocate function.
217  /// Returns false if any checks fail
218  virtual bool fillCreateInfo();
219 
220  // Constructors
221  RV_VKImageCreateInfo() = default;
223  {
225  new RV_VKImageCreateInfo(*this));
226  }
227 
228  virtual ~RV_VKImageCreateInfo();
229 
230 protected:
231  RV_VKImageCreateInfo(const RV_VKImageCreateInfo&) = default;
233 
234  bool isValidForLinearTiling() const;
235 
236  /// Extend Image Create Info struct.
237  /// Used by subclasses to create different
238  /// types of images
240  {
241  UT_ASSERT(p);
242  p->pNext = (VkBaseOutStructure*)myVkCreateInfo.pNext;
243  myVkCreateInfo.pNext = p;
244  }
245 
246  /// Setup allocation info for memory
247  virtual RV_MemType getAllocType(RV_Instance* inst);
248 
249  // ~~~~ Data Members ~~~~
250  // Image format
251  uint32_t mySamples = 0;
252  int myMaxLevels = 1;
253 
254  bool myUseLinearTiling = false;
255  RV_MemType myMemType = RV_MEM_AUTO;
256  RV_ImageDim myRVImageType = RV_IMAGE_2D;
257  RV_TextureSwizzle myTextureSwizzle[4] =
258  {
262  RV_SWIZZLE_IDENTITY
263  };
264 
265  // Sampler Info
266  fpreal32 myMinLOD = 0.0;
268  bool myIsNormalized = false;
269  bool myIsTexelSampled = false;
270  bool myUsageAttachmentBit = true;
271  bool myUsageSampledBit = true;
272  bool myUsageStorageBit = false;
273  bool myUsageSampleLocations = false;
274  bool myCompareEnable = false;
275  RE_ZFunction myCompareOp = RE_ZALWAYS;
282  UT_Vector4F myBorderColor = {0.f, 0.f, 0.f, 0.f};
283 
284  // Vk Image Creation Info struct
285  VkImageCreateInfo myVkCreateInfo = {
287  nullptr,
288  0, /* flags */
289  VK_IMAGE_TYPE_2D, /* imageType */
290  VK_FORMAT_UNDEFINED, /* format */
291  {0, 0, 0}, /* extent */
292  1, /* mipLevels */
293  1, /* arrayLayers */
294  VK_SAMPLE_COUNT_1_BIT, /* samples */
295  VK_IMAGE_TILING_OPTIMAL,/* tiling */
296  0, /* usage */
297  VK_SHARING_MODE_EXCLUSIVE, /* sharingMode */
298  0, /* queueFamilyIndexCount */
299  nullptr, /* pQueueFamilyIndices */
300  VK_IMAGE_LAYOUT_UNDEFINED, /* initialLayout */
301  };
302 
303  friend class RV_VKImage;
304 };
305 
306 /// RAII wrapper class for VkImageView
308 {
309 public:
310  /// Access the vulkan resource for the view
311  VkImageView getVkView() { return myVkView; }
312 
313  // CAN have null state
315  : myInst(nullptr), myVkView(VK_NULL_HANDLE)
316  {}
317  RV_VKImageView(RV_Instance* inst, VkImageView vk_view)
318  : myInst(inst), myVkView(vk_view)
319  {}
320 
321  // disable copy semantics
322  RV_VKImageView(const RV_VKImageView&) = delete;
324 
325  // enable move semantics
326  RV_VKImageView(RV_VKImageView&& other) noexcept
327  : myInst(other.myInst), myVkView(other.myVkView)
328  {
329  other.myInst = nullptr;
330  other.myVkView = VK_NULL_HANDLE;
331  }
332  RV_VKImageView& operator=(RV_VKImageView&& other) noexcept = delete;
333 
334  // Destroy Resource Handle on destruction
336  {
337  if (myVkView != VK_NULL_HANDLE)
338  {
339  VkDevice vk_dev = myInst->getDevice();
340  ::vkDestroyImageView(vk_dev, myVkView, nullptr);
341  }
342  }
343 
344 private:
345  RV_Instance* myInst = nullptr;
346  VkImageView myVkView = VK_NULL_HANDLE;
347 };
348 
349 // RAII wrapper for sampler
351 {
352 public:
353  /// Access the vulkan resource for the sampler
354  VkSampler getVkSampler() { return myVkSampler; }
355 
356  // CAN have null state
358  : myInst(nullptr), myVkSampler(VK_NULL_HANDLE)
359  {}
360  RV_VKSampler(RV_Instance* inst, VkSampler vk_sampler)
361  : myInst(inst), myVkSampler(vk_sampler)
362  {}
363 
364  // disable copy semantics
365  RV_VKSampler(const RV_VKSampler&) = delete;
366  RV_VKSampler& operator=(RV_VKSampler& ) = delete;
367 
368  // enable move semantics
369  RV_VKSampler(RV_VKSampler&& other) noexcept
370  : myInst(other.myInst), myVkSampler(other.myVkSampler)
371  {
372  other.myInst = nullptr;
373  other.myVkSampler = VK_NULL_HANDLE;
374  }
375  RV_VKSampler& operator=(RV_VKSampler&& other) noexcept = delete;
376  // Destroy Resource Handle on destruction
378  {
379  if (myVkSampler != VK_NULL_HANDLE)
380  {
381  VkDevice vk_dev = myInst->getDevice();
382  ::vkDestroySampler(vk_dev, myVkSampler, nullptr);
383  }
384  }
385 
386 private:
387  RV_Instance* myInst = nullptr;
388  VkSampler myVkSampler = VK_NULL_HANDLE;
389 };
390 
391 /// Class hodling VkImage handle and bound Memory allocation
392 /// cleans up resources on destruction
394 {
395 public:
396  /// Creates new Image based on create info
397  static RV_VKImagePtr allocateImage(
398  RV_Instance* inst,
399  RV_VKImageCreateInfo* info,
400  const char* name = nullptr);
401 
402  /// Creates an image from an already existing VkImage, and
403  /// takes ownership of the VkImage but not the memory object
404  static RV_VKImagePtr createFromImage(
405  RV_Instance* inst,
406  VkImage vk_image,
407  const VkImageCreateInfo* info,
408  const char* name = nullptr
409  );
410 
411  /// Allocate a new Image Sampler using parameters from img_info,
412  /// ignoring non-sampler parameters
413  static UT_UniquePtr<RV_VKSampler> allocateSampler(
414  RV_Instance* inst,
415  const RV_VKImageCreateInfo* img_info);
416 
417  /// check whether the format info in pInfo can create
418  /// a valid Vulkan image
419  static bool queryIsUsable(
420  RV_Instance* inst,
421  RV_VKImageCreateInfo* info);
422 
423  /// The image properties
424  const RV_VKImageCreateInfo& getInfo() const { return *myCreateInfo; }
425 
426  // Getters for image members
427  VkImage getVkImage() { return myVkImg; }
428  RV_VKMemory& getMemory() { return *myMemory; }
429  RV_VKSampler* getSampler() { return mySampler.get(); }
430  VkImageLayout getLayout() const { return myLastLayout; }
431  const RV_ResourceID &getID() const { return myId; }
432  const UT_StringHolder &getName() const { return myName; }
433 
434  /// On linux, the returned handle is owned by the caller. The caller can
435  /// either use it to import the texture into another API; or they must close
436  /// it when they're done with it. On windows, the returned handle can only
437  /// be used to import the texture into another API--the caller must never
438  /// close it themself!
439  /// See documentation for VE_Memory::getExternalHandle() for more
440  /// information.
441  VE_Result<SYS_Handle> getExternalHandle();
442 
443  RV_VKImageView& getFullView() { return *myView; }
445  { return myPrimaryView ? *myPrimaryView :*myView;}
446 
447  // Functions to create Image View for image
448  /// Create new VkImageView for whole VkImage range
449  RV_VKImageView createView();
450  /// Create new VkImageView for specific VkImage subresource range
451  RV_VKImageView createView(const VkImageSubresourceRange &subres);
452  /// Create new VkImageView for specific VkImage subresource range, with type
453  RV_VKImageView createView(const VkImageSubresourceRange &subres, VkImageViewType type);
454  /// Create new VkImageView for specific type, trying to use full subresource range
455  RV_VKImageView createView(VkImageViewType type);
456 
457  /// Record a command to transition image into new layout
458  void transitionImage(
459  RV_VKCommandBuffer* cb,
460  VkImageLayout new_layout,
461  VkImageUsageFlags new_usage, // TODO: new struct to encapsulate access, stage, usage
462  // want to be able to specify extra params
463  // (e.g. read vs write access, and specific pipeline shader stage)
464  // without cluttering the function signature
465  bool keep_data = true,
467 
468  /// Record a command to transition the image for sampling in a shader
470  {
471  if (force || myLastLayout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
472  transitionImage(cb, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
474  }
475 
476  /// Upload data to the image. Must be in a state for upload.
478  bool uploadData(RV_Render* r, const T &data, int level = 0, int index = 0)
479  {
480  // `T` must be a `UT_Span` or convertable into a `UT_Span`
482  return uploadData(
483  r->instance(), r->getCurrentCB(),
484  span.data(), span.size_bytes(),
485  level, index);
486  }
487 
488  bool uploadData(
489  RV_Render* r,
490  const void* data,
491  exint data_size,
492  int level = 0,
493  int index = 0);
494 
495  bool uploadData(
496  RV_Instance* inst,
497  RV_VKCommandBuffer* cb,
498  const void* data,
499  exint data_size,
500  int level = 0,
501  int index = 0);
502 
503  /// Copy image data to this image from `buffer`.
504  bool uploadData(RV_Render* r,
505  RV_VKBuffer* buf,
506  int level = 0,
507  int index = 0,
508  exint buf_offset = 0,
509  exint buf_size = -1);
510 
511  bool uploadData(
512  RV_Instance* inst,
513  RV_VKCommandBuffer* cb,
514  RV_VKBuffer* buf,
515  int level = 0,
516  int index = 0,
517  exint buf_offset = 0,
518  exint buf_size = -1);
519 
520  // TODO: add options for level, layer, separate aspects, offsets
521  /// Copy image data from `other` into this image.
522  /// images MUST have same size and format
523  bool copyData(RV_Render* r, RV_VKImage* other);
524 
525  /// Resolves image data from Multisample `other` into this image.
526  /// images MUST have same size and format, and MUST be color images,
527  /// and this MUST be a single-sample image
528  bool resolveData(RV_Render* r, RV_VKImage* other);
529 
530  /// Generate higher mipmap levels from the base level
531  void generateMipmaps(RV_Render* r);
532 
533  /// Download image data into `data`.
534  bool downloadData(
535  RV_Render* r,
536  void* data,
537  exint data_size,
538  int level = 0,
539  int index = 0,
540  bool primary_aspect = true);
541 
542  /// Download image data into `buf`.
543  bool downloadData(
544  RV_Render* r,
545  RV_VKBuffer* buf,
546  int level = 0,
547  int index = 0,
548  bool primary_aspect = true);
549 
550 #ifdef VULKAN_PRESENTATION
551  bool isSwapchainImage() const
552  { return myIsSwapchainImage; }
553  void setIsSwapchainImage(bool is_swapchain_img)
554  { myIsSwapchainImage = is_swapchain_img; }
555 #endif
556 
557  virtual ~RV_VKImage();
558 
559  /// Debug print out of image properties (not image data).
560  void print() const;
561 
562 protected:
563  RV_VKImage(
564  RV_Instance* inst,
565  const RV_VKImageCreateInfo* img_info,
566  VkImage vk_img,
567  RV_VKMemoryPtr mem,
568  RV_VKImageViewPtr view,
569  RV_VKImageViewPtr primary_view,
571 
572  static RV_VKImagePtr createRVImage(
573  RV_Instance* inst,
574  VkImage vk_img,
575  RV_VKMemoryPtr mem,
576  const RV_VKImageCreateInfo* info,
577  const char* name = nullptr);
578 
579  static void deleteImage(
580  RV_Instance* inst,
581  VkImage* img,
582  VkDeviceMemory* mem);
583 
584  // basic resource handles
585  RV_Instance* myInst = nullptr;
586  VkImage myVkImg = VK_NULL_HANDLE;
589 
594 
595 #ifdef VULKAN_PRESENTATION
596  bool myIsSwapchainImage = false;
597 #endif
598 
599 public: // wip
601 
602  // Vulkan Resource Usage
604  VkAccessFlags myLastAccess = 0;
605  VkImageUsageFlags myLastUsage = 0;
606  VkPipelineStageFlags myLastStage = 0;
607  uint32_t myLastQueueFam = 0;
608 
609  RV_StageGroup myWaitingBarrierStage = RV_STAGE_NONE;
610 
611  friend class RV_VKImageCreateInfo;
612 };
613 
614 #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:592
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:354
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:211
GLsizei const GLfloat * value
Definition: glcorearb.h:824
const UT_StringHolder & getName() const
Definition: RV_VKImage.h:432
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:239
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:593
#define VK_LOD_CLAMP_NONE
Definition: vulkan_core.h:125
RV_VKSampler(RV_VKSampler &&other) noexcept
Definition: RV_VKImage.h:369
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:590
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:200
bool getCompareEnable() const
Definition: RV_VKImage.h:202
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
RV_VKMemory & getMemory()
Definition: RV_VKImage.h:428
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:360
UT_StringHolder myName
Definition: RV_VKImage.h:600
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:469
VkImageLayout getLayout() const
Definition: RV_VKImage.h:430
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:195
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:478
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
void setUsageSampleLocations(bool use)
Definition: RV_VKImage.h:184
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:429
int getHeight() const
Definition: RV_VKImage.h:86
RV_VKImageView(RV_VKImageView &&other) noexcept
Definition: RV_VKImage.h:326
RV_VKImageView & getFullView()
Definition: RV_VKImage.h:443
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
const RV_ResourceID & getID() const
Definition: RV_VKImage.h:431
RV_MemType getMemoryType() const
Definition: RV_VKImage.h:197
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:588
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:205
LeafData & operator=(const LeafData &)=delete
GLuint index
Definition: glcorearb.h:786
const RV_VKImageCreateInfo & getInfo() const
The image properties.
Definition: RV_VKImage.h:424
constexpr size_type size_bytes() const noexcept
Definition: span.h:187
VkImageView getVkView()
Access the vulkan resource for the view.
Definition: RV_VKImage.h:311
VkFormat getFormat() const
Definition: RV_VKImage.h:67
RE_ZFunction getCompareOp() const
Definition: RV_VKImage.h:207
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:190
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:427
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:587
bool getUsageSampleLocations() const
Definition: RV_VKImage.h:186
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:222
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:591
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:192
RV_VKImageView(RV_Instance *inst, VkImageView vk_view)
Definition: RV_VKImage.h:317
struct VkBaseOutStructure * pNext
Definition: vulkan_core.h:2817
RV_VKImageView & getPrimaryView()
Definition: RV_VKImage.h:444
RAII wrapper class for VkImageView.
Definition: RV_VKImage.h:307
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