HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RV_Geometry.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_Geometry.h ( RV Library, C++)
7  *
8  * COMMENTS:
9  * High level class for wrapping geometry for drawing
10  */
11 
12 #ifndef RV_Geometry_h
13 #define RV_Geometry_h
14 
15 #include "RV_API.h"
16 
17 #include <RE/RE_CachedObject.h>
18 #include <SYS/SYS_Types.h>
19 #include <UT/UT_Array.h>
20 #include <UT/UT_Assert.h>
21 #include <UT/UT_ComputeGPU.h>
22 #include <UT/UT_Matrix4.h>
23 #include <UT/UT_StringHolder.h>
24 #include <UT/UT_StringMap.h>
25 #include <UT/UT_UniquePtr.h>
26 #include <UT/UT_ValArray.h>
27 #include <UT/UT_VectorTypes.h>
28 #include <UT/UT_WorkBuffer.h>
29 
30 #include "RV_VK.h"
31 
32 #include "RV_Type.h"
33 #include "RV_VKBuffer.h"
34 #include "RV_VKDescriptorSet.h"
35 #include "RV_ShaderProgram.h"
36 
37 class RV_Render;
38 class RV_ShaderBlock;
39 class RV_ShaderProgram;
43 
44 typedef RV_VKBuffer RV_Buffer;
45 
47 {
49 };
50 
52 {
56 };
57 
59 {
60  switch (t)
61  {
73  default : break;
74  }
75 
76  UT_ASSERT_MSG(false, "RVgetVkPrimType Invalid RV_PrimType");
78 }
79 
81 {
82  switch (t)
83  {
84  case RV_GPU_UINT1: return UT_GPU_UINT1;
85  case RV_GPU_UINT4: return UT_GPU_UINT4;
86  case RV_GPU_UINT8: return UT_GPU_UINT8;
87  case RV_GPU_UINT16: return UT_GPU_UINT16;
88  case RV_GPU_UINT32: return UT_GPU_UINT32;
89 
90  case RV_GPU_INT8: return UT_GPU_INT8;
91  case RV_GPU_INT16: return UT_GPU_INT16;
92  case RV_GPU_INT32: return UT_GPU_INT32;
93 
94  case RV_GPU_FLOAT16: return UT_GPU_FLOAT16;
95  case RV_GPU_FLOAT24: return UT_GPU_FLOAT24;
96  case RV_GPU_FLOAT32: return UT_GPU_FLOAT32;
97  case RV_GPU_FLOAT64: return UT_GPU_FLOAT64;
98 
99  case RV_GPU_MATRIX2: return UT_GPU_MATRIX2;
100  case RV_GPU_MATRIX3: return UT_GPU_MATRIX3;
101  case RV_GPU_MATRIX4: return UT_GPU_MATRIX4;
102  default : break;
103  }
104 
105  UT_ASSERT(!"Unknown RV_GPUType.");
106  return UT_GPU_UINT8;
107 }
108 
110 {
111  switch (t)
112  {
113  case UT_GPU_UINT1: return RV_GPU_UINT1;
114  case UT_GPU_UINT4: return RV_GPU_UINT4;
115  case UT_GPU_UINT8: return RV_GPU_UINT8;
116  case UT_GPU_UINT16: return RV_GPU_UINT16;
117  case UT_GPU_UINT32: return RV_GPU_UINT32;
118 
119  case UT_GPU_INT8: return RV_GPU_INT8;
120  case UT_GPU_INT16: return RV_GPU_INT16;
121  case UT_GPU_INT32: return RV_GPU_INT32;
122 
123  case UT_GPU_FLOAT16: return RV_GPU_FLOAT16;
124  case UT_GPU_FLOAT24: return RV_GPU_FLOAT24;
125  case UT_GPU_FLOAT32: return RV_GPU_FLOAT32;
126  case UT_GPU_FLOAT64: return RV_GPU_FLOAT64;
127 
128  case UT_GPU_MATRIX2: return RV_GPU_MATRIX2;
129  case UT_GPU_MATRIX3: return RV_GPU_MATRIX3;
130  case UT_GPU_MATRIX4: return RV_GPU_MATRIX4;
131  default : break;
132  }
133 
134  UT_ASSERT(!"Unknown UT_GPUType.");
135  return RV_GPU_UNKNOWN;
136 }
137 
138 struct rv_DrawSetInfo;
139 struct rv_DrawInputInfo;
140 struct rv_Attribute;
141 struct rv_Connectivity;
142 struct rv_InstanceGroup;
143 
144 // TODO: use cache for multiple Drawing-Sets
145 //typedef UT_Map<RV_VKDescriptorSetInfo, rv_DrawSetInfo> rv_DrawSetCache;
146 
149 
150 /// @brief Object that represents drawable geometry.
151 /// This object holds vertex, instancing and index buffers for drawing.
152 /// The normal workflow is to:
153 /// - Set the number of points in the geometry with `setNumPoints()`
154 /// - Create all needed attribute definitions (P, N, uv, etc).
155 /// - Create all needed index buffer definitions or connect groups
156 /// - Call populateBuffers()
157 /// - Fetch each attribute with getAttribute() and fill it with
158 /// `RV_Buffer::uploadData()`
159 /// - Fetch each index buffer with getIndexBuffer() and fill it with
160 /// `RV_Buffer::uploadData()`
161 /// - Draw connect groups with any of the draw...() methods.
162 /// Draws must be done inside a begin/endRendering() block; all others must be
163 /// done outside.
165 {
166 public:
167  RV_Geometry();
168  ~RV_Geometry();
169 
170  // Setup and cleanup
171 
172  /// clear & free resources
173  void reset();
174  /// remove from VRAM; move to back in RAM (not implemented yet)
175  void unload();
176 
177  /// Set number of points in geometry for vertex shader inputs
178  void setNumPoints(exint num_points);
179  /// Number of points in geometry for vertex shader inputs
180  exint getNumPoints() const;
181 
182  /// Set number of per-primitive elements, accessed in fragment shader/
183  /// Must match the numver of primitives drawn.
184  void setPrimitiveBufferSize(exint prim_buffer_element_size);
185  /// Number of per-primitive elements, accessed in fragment shader
186  exint getPrimitiveBufferSize() const;
187 
188  // NOTE: Vertex attributes not implemented … would
189  // require barycentric coords in frag
190  //void setVertexBufferSize(exint prim_buffer_element_size);
191  //exint getVertexBufferSize();
192 
193  // ---------------------------------------------------------------
194  // Methods for configuring the structure of the geometry
195 
196  /// @brief Create an attribute definition
197  /// Create an attribute definition for a vertex shader input
198  /// Capacity - optional buffer capacity in elements, in case of resizes
199  bool createAttribute(const UT_StringHolder &name,
200  RV_GPUType data_format, int vector_size,
201  exint capacity = -1, bool allow_gpu_write = false);
202 
203  /// Creates a single value for a vertex shader input.
204  bool createConstant(const UT_StringHolder &name,
205  RV_GPUType data_format, int vector_size);
206 
207  /// Create a buffer view for fragment shader indexing via gl_PrimitiveID
208  bool createPrimitiveBuffer(const UT_StringHolder &name,
209  RV_GPUType data_format, int vector_size);
210 
211  /// Create a random-access attribute for instancing and other random access
212  /// Uses a buffer view.
213  bool createBufferAttribute(const UT_StringHolder &name,
214  RV_GPUType data_format, int vector_size,
215  exint buffer_size);
216 
217  /// Create an attribute that is allocated immediately
218  /// separate from those allocated during 'populateBuffers'
219  RV_Buffer* createAllocatedAttribute(RV_Render* r,
220  const UT_StringHolder &name,
221  RV_GPUType data_format, int vector_size,
223  exint capacity = -1);
224 
225  /// @brief Fetch a buffer for an attribute.
226  /// Return the RV buffer for attribute `name`. Will not exist until
227  /// `populateBuffers()` is called.
228  RV_Buffer* getAttribute(const UT_StringHolder &name) const;
229  /// Tag the attribute with version information.
230  void setAttributeVersion(const UT_StringHolder &name,
231  const RE_CacheVersion &ver);
232  /// Set the attribute type (point, primitive, constant, random).
233  void setAttributeUsage(const UT_StringHolder &name,
234  RV_AttributeType ver);
235 
236  /// Set a vertex shader input to a constant value.
237  void setAttributeConstValue(const UT_StringHolder &name,
238  fpreal64 val);
239 
240  /// Remove attribute and free its resource
241  bool freeAttribute(RV_Render* r, const UT_StringHolder &name);
242 
243  /// @brief Get an attribute's usage
244  /// Get the type of an attribute (point, prim, const, random, null). May be
245  /// null if the attribute was freed.
246  bool getAttributeType(const UT_StringHolder &name,
247  RV_AttributeType& out_type) const;
248  /// Get the format of an attribute (return false if it does not exist).
249  bool getAttributeFormat(const UT_StringHolder &name,
250  RV_GPUType& out_type,
251  int& out_vec_size) const;
252  /// @brief Get the length of an attribute
253  /// Get the length, in elements (not bytes) of an attribute
254  /// (return false if it does not exist).
255  bool getAttributeLength(const UT_StringHolder &name,
256  exint& out_len) const;
257  /// Get the version of an attribute (return false if it does not exist).
258  bool getAttributeVersion(const UT_StringHolder &name,
259  RE_CacheVersion& out_ver) const;
260 
261  /// @brief Get an attribute's usage
262  /// Get the version of an attribute (return false if it does not exist).
263  /// Will always return the usage it was defined with, even if freed.
264  bool getAttributeUsage(const UT_StringHolder &name,
265  RV_AttributeType& out_ver) const;
266 
267  /// Get the constant value for the vertex input 'name'
268  fpreal64 getAttributeConstValue(const UT_StringHolder &name) const;
269 
270  /// True if the attribute exists in the geometry.
271  bool hasAttribute(const UT_StringHolder &name,
272  int instance_group = -1) const;
273 
274  // Instancing support ----------------------------------------------
275 
276  // subsets of instances (for materials)
277 
278  /// Create a instance group for instanced drawing
279  bool createInstanceGroup(int group_index);
280  /// Remove an instance group
281  void removeInstanceGroup(int group_index);
282  /// Return true if the instance group exists
283  bool hasInstanceGroup(int group_index) const;
284  /// Return the maximum index of all instance groups.
285  int getMaxInstanceGroup() const;
286 
287  /// Set the numbers of instances drawn in a group
288  void setInstanceGroupCount(int instance_group, int count);
289  /// Fetch the numbers of instances drawn in a group
290  int getInstanceGroupCount(int instance_group) const;
291 
292  /// Select a subset of instance indices for an instance group (eg, culling)
293  void setInstanceGroupIndexList(int group_index,
294  const UT_IntArray &indices,
295  int max_capacity = -1);
296  /// Draw one instance with a specific index
297  void setInstanceGroupConstIndex(int instance_group,
298  int instance_to_draw);
299  /// Draw all instances
300  void setInstanceGroupDrawEverything(int instance_group);
301  /// Draw none of the instances
302  void setInstanceGroupDrawNothing(int instance_group);
303 
304  // Transforms for instances
305 
306  /// Single transform for all instances (or additional transform if
307  // remove_instanced_xform is false)
308  void setConstInstanceGroupTransform(int instance_group,
309  const UT_Matrix4F &xform,
310  bool remove_instanced_xform);
311 
312  /// @brief Create an per-instance attribute
313  /// Reserve an buffer for per-instance data (call populateBuffers() to
314  /// create the RV_Buffer for it).
315  bool setInstanceGroupAttrib(int instance_group,
316  const UT_StringHolder &name,
317  RV_GPUType data_type,
318  int vector_size,
319  int instance_step,
320  int num_instances,
321  exint capacity = -1);
322 
323  /// Create per-instance attribute that can be shared by multiple RV_Geometrys
324  bool createSharedInstanceGroupAttrib(int instance_group,
325  const UT_StringHolder &name,
326  RV_GPUType data_type,
327  int vector_size,
328  int instance_step,
329  int num_instances,
330  exint capacity = -1);
331 
332  /// Assign a buffer for the per-instance shared attribute
333  bool assignSharedInstanceGroupAttrib(int instance_group,
334  const UT_StringHolder &name,
336 
337  /// Remove per-instance attribute and free its resource
338  bool freeInstanceGroupAttrib(int instance_group,
339  const UT_StringHolder &name);
340 
341  /// Helper to allocate a shared per-instance buffer
342  static RV_VKBuffer* allocateSharedInstanceBuffer(
343  RV_Render* r,
344  RV_GPUType data_type,
345  int vector_size,
346  exint length,
347  const char* name = nullptr);
348 
349  /// Fetch the buffer backing an per-instance attribute, usually to fill it
350  RV_Buffer * getInstanceGroupAttrib(int instance_group,
351  const UT_StringHolder &name) const;
352  /// Fetch the per-instance attribute version (to avoid refilling)
353  bool getInstanceAttribVersion(int instance_group,
354  const UT_StringHolder &name,
355  RE_CacheVersion& out_ver) const;
356  /// Set the per-instance attribute version (to avoid refilling)
357  void setInstanceAttribVersion(int instance_group,
358  const UT_StringHolder& name,
359  const RE_CacheVersion& ver);
360 
361  // ----------------------------------------------------------------------
362  // Connectivity
363 
364  /// Connect all points to form prims of `prim` type
365  void connectAllPrims(int connect_index,
366  RV_PrimType prim,
367  int patch_size = 0);
368  /// Connect a range of points to form prims of `prim` type
369  void connectSomePrims(int connect_index,
370  RV_PrimType prim,
371  int start,
372  int length,
373  unsigned int stride = 0,
374  int patch_size = 0);
375  /// Connect points form `num_prims` prims of `prim` type from a list of
376  /// point indices. The index buffer must be populated after a
377  /// `populateBuffers()` call with `getIndexBuffer()->uploadData()`.
378  void connectIndexedPrims(int connect_index,
379  RV_PrimType prim,
380  int num_prims,
381  bool need_prim_info = false,
382  int patch_size = 0);
383  /// Set the primitive to GPU primitive ratio for acessing primitive
384  /// attrinbutes. For example, if all polygons are quads, the divisor would be
385  /// 2 as the GPU creates 2 triangles for each quad.
386  void setConnectDivisor(int connect_index, int divisor,
387  int base_prim=0);
388  /// Generate a primitive info buffer for accessing primtive attribute data
389  /// if the polygon vertex counts vary (use getPrimVertexBuffer() after
390  // calling populateBuffers() to fill it).
391  void setConnectUsePrimInfo(int connect_index, int base_prim= 0);
392 
393  /// Set a PrimInfo buffer to be shared across connect groups with same
394  /// primitive type. Attribute must already exist in geometry.
395  void setPrimitiveInfoAttrib(RV_TopologyClass prim_type,
396  const UT_StringHolder &name);
397  /// return the number of primitives that are rendered for a connect group
398  int getNumRenderPrims(int connect_index) const;
399 
400  /// return the type of primitives that are rendered for a connect group
401  RV_PrimType getRenderPrimType(int connect_index) const;
402 
403  /// Fetch the index buffer to fill (after populateBuffers())
404  RV_Buffer *getIndexBuffer(int connect_index) const;
405  /// Fetch the primitive buffer to fill (after populateBuffers())
406  RV_Buffer *getPrimBuffer(int connect_index) const;
407  /// Fetch the primitive/vertex buffer to fill (after populateBuffers())
408  RV_Buffer *getPrimVertexBuffer(int connect_index) const;
409 
410  /// Return true if the connect group exists
411  bool hasConnectGroup(int connect_index) const;
412  /// Return true if the connect group isn't empty
413  bool hasNonEmptyConnectGroup(int connect_index) const;
414  /// Return the maximum connect group index
415  int getMaxConnectGroup() const;
416 
417  /// Remove a connect group
418  bool removeConnectedPrims(int connect_index);
419  /// Remove all connect groups.
420  void resetConnectedPrims(); // remove all
421 
422  // -------------------------------------------------------------
423  /// Populates all RV_Buffers declared above which haven't been populated yet.
424  bool populateBuffers(RV_Render *r);
425 
426  // --------------------------------------------------------------
427  // Drawing
428 
429  /// Setup Uniform buffers and Descriptor Set to be used by current shader
430  void prepareForDraw(RV_Render *r,
431  int connect_index,
432  const RV_OverrideList *overrides = nullptr);
433  /// Setup Uniform buffers and Descriptor Set to be used by current shader,
434  /// when drawing with instances
435  void prepareForDrawInstance( RV_Render* r,
436  int connect_index,
437  int instance_group,
438  const RV_OverrideList *overrides = nullptr);
439 
440  /// draw a single connection group
441  void draw(
442  RV_Render *r,
443  int connect_index,
444  const RV_OverrideList *overrides = nullptr,
445  bool force_point_prims = false);
446 
447  /// draw a single connection group using with instancing, using the indices
448  /// in instance_group
449  void drawInstanceGroup(
450  RV_Render *r,
451  int connect_index,
452  int instance_group,
453  const RV_OverrideList *overrides = nullptr,
454  bool force_point_prims = false);
455 
456  /// draw multiple connection groups (really just a loop over draw()).
457  void drawRange(
458  RV_Render *r,
459  int connect_index_start,
460  int num_connect_indexs,
461  const RV_OverrideList *overrides = nullptr,
462  bool force_point_prims = false);
463 
464  /// draw instanced over multiple connection groups.
465  void drawInstanceGroupRange(
466  RV_Render *r,
467  int connect_start,
468  int num_connect,
469  int instance_group,
470  const RV_OverrideList *overrides = nullptr,
471  bool force_point_prims = false);
472 
473  /// draw indirectly from a buffer
474  void drawIndirect(
475  RV_Render *r,
476  int connect_index,
477  RV_Buffer &indirect_buffer);
478 
479  /// dispatch a compute shader for a single connect group
480  void dispatch(RV_Render *r,
481  int connect_index,
482  int instance_group,
483  const RV_OverrideList *overrides = nullptr);
484 
485  /// dispatch compute shader for multiple connect groups
486  void dispatchRange(RV_Render *r,
487  int connect_index,
488  int num_connect,
489  int instance_group,
490  const RV_OverrideList *overrides = nullptr);
491 
492  static void initResources(RV_Instance* inst);
493  static void cleanupResources();
494 
495  // -------------------------------------------------------------------
496  // DEBUG
497 
498  /// @brief Debug output
499  /// Debug methd to print information about all attributes, connect groups,
500  /// and instance groups
501  void print() const;
502  // TODO: setDebugDraw() to print shader state during draw
503 
504 private:
505 
506  // ------------------------------------------------------------------
507  // CONNECTIVITY
508  rv_Connectivity* getConnect(int group_idx, bool do_create);
509 
510  // ------------------------------------------------------------------
511  // INSTANCE
512  static void getInstanceAttribName(UT_WorkBuffer &out_name,
513  const char *base_name,
514  int instance_group);
515 
516  // ------------------------------------------------------------------
517  // ATTRIBUTES
518  const rv_Attribute* findAttribute(const UT_StringRef& name,
519  const RV_OverrideList *overrides,
520  int instance_group,
521  int* out_idx = nullptr) const;
522 
523  bool privCreateAttribute( const UT_StringHolder& name,
524  RV_GPUType data_format,
525  int vector_size,
526  RV_AttributeType usage,
527  exint capacity = -1,
528  int inst_group = -1,
529  bool attr_owned = false,
530  bool allow_gpu_write = false);
531  bool privFreeAttrib(RV_Render* r, rv_Attribute &attr);
532 
533  // ------------------------------------------------------------------
534  // BUFFERS
535  RV_Buffer *allocateAttributeBuffer(
536  RV_Render *r,
537  rv_Attribute &attr,
538  UT_Array<RV_BufferPtr> *opt_old_buffers = nullptr);
539  bool allocateConnectBuffers(RV_Render* r, rv_Connectivity& c,
540  UT_Array<RV_BufferPtr>* opt_old_buffers);
541  bool allocateInstIndexBuffer(RV_Render* r, rv_InstanceGroup& g,
542  UT_Array<RV_BufferPtr>* opt_old_buffers);
543 
544  RV_BufferPtr allocOrReuseBuffer( RV_Render *r, rv_Attribute &attr,
545  exint length, VkBufferUsageFlags vk_usage,
546  UT_Array<RV_BufferPtr> *old_buffers);
547 
548  void resetAttribBuffers(RV_Render* r);
549  void resetConnectBuffers(RV_Render* r);
550  void resetCachedSets(RV_Render* r);
551 
552  bool privPrepareDraw(
553  RV_Render* r,
554  const rv_Connectivity *connect,
555  int instance_group_idx,
556  const RV_OverrideList* overrides
557  );
558 
559  void privDraw(
560  RV_Render *r,
561  const rv_Connectivity *connect,
562  int instance_group_idx,
563  const RV_OverrideList *overrides,
564  RV_Buffer* indirect_buf,
565  bool force_point_prims
566  );
567 
568  void privDispatch(
569  RV_Render *r,
570  const rv_Connectivity *connect,
571  int instance_group_idx,
572  const RV_OverrideList *overrides,
573  RV_Buffer *indirect_buf
574  );
575 
576  void fillInstanceInfoBlock(RV_Render *r, int instance_group_idx, RV_ShaderBlock* block);
577  void fillGeometryInfoBlock(RV_Render *r, const rv_Connectivity* connect, RV_ShaderBlock* geo);
578 
579  // ------------------------------------------------------------------
580  // DATA
581  RV_Render* myR = nullptr;
582 
583  uint32_t myNumPoints = 0;
584  uint32_t myPrimBufferSize = 0;
585 
586  bool myAttributesValid = false;
587 
588  // NOTE: Vertex attributes not implemented
589  //int myVertBufferSize;
590 
591  // TODO: Make sure nothing name-to-idx mapping is stable
592  // (i.e. attrib names can't be removed)
593  UT_StringMap<int> myAttributeTable;
594  UT_Array<int> myDefaultAttribTable;
595  UT_Array<int> myPrimInfoAttribTable;
596  UT_Array<rv_Attribute> myAttributeList;
597 
598  // own directly so helper structs can be passed around more easily
599  UT_Array<RV_BufferPtr> myOwnedAttribBuffers;
600  UT_Array<RV_BufferPtr> myOwnedConnectBuffers;
601  UT_Array<RV_BufferPtr> myOwnedFallbackBuffers;
602 
603  // TODO: allocate buffers from single block of memory
604  //UT_UniquePtr<RV_VKMemory> myMemBlock;
605 
606  UT_Array<rv_Connectivity> myConnectivityGroups;
607 
608  UT_Array<rv_InstanceGroupPtr> myInstanceGroups;
609 
610  struct rv_DrawSetInfo
611  {
612  // track the override list used
613  RV_OverrideList myOverrideList;
614  int myConnectGroupIdx;
615  int myInstanceGroupIdx;
616 
617  bool myIsValid = false;
618 
619  UT_UniquePtr<RV_ShaderVariableSet> myDescriptorSet;
620  UT_UniquePtr<RV_ShaderBlock> myUniformBlock;
621 
622  // TODO: move into connect group
623  UT_UniquePtr<RV_ShaderBlock> myGeometryBlock;
624 
625  int myInstTransformUniformIdx = -1;
626  int myInstNestLevelUniformIdx = -1;
627 
628  // TODO: keep a list of the [attrib ID, binding ID] pairs
629  // and check if they are up-to-date per-frame
630  // TODO: requires RV_Geo and RV_ShaderVariableSet
631  // be setup to refer to attribs by consistent
632  // idx/binding num
633  // currently invalidating any time the interface
634  // may have changed
635  };
636 
637  // Set Used for drawing
638  // cached by (connect group, instance group, set id)
639  typedef UT_Map<std::tuple<int, int, int>, rv_DrawSetInfo> DrawSetCache;
640  DrawSetCache myDrawSet;
641 
642  // Get the set that is compatible with the passed in shader
643  // creating it if necessary
644  rv_DrawSetInfo* getDrawSet(
645  RV_Render* r,
647  const rv_Connectivity *connect,
648  int instance_group_idx,
649  const RV_OverrideList* overrides);
650 
651  // Prepare a set, making sure all attributes are attached and
652  // up-to-date
653  bool prepareDrawSet(
654  RV_Render* r,
655  rv_DrawSetInfo& set_info,
656  const rv_Connectivity *connect,
657  int instance_group_idx,
658  const RV_OverrideList* overrides
659  );
660 
661  bool bindInputAttribute(
662  RV_Render* r,
663  RV_VKPipelineInputInfo& pipe_input,
664  const rv_Attribute *attrib,
665  bool instance,
666  int location,
668  int vec_size);
669  //rv_DrawSetCache myDrawSets;
670 
671  // Zero-valued constant buffers to fill attribs we don't have values for
672  // TODO: use nullDescriptor bindings if VK_EXT_robustness2 is available
673  void populateFallbackAttribs(RV_Render* r);
674  void resetFallbackAttribs(RV_Render* r);
675  rv_Attribute* getFallbackVertAttrib(RV_GPUType type);
676  rv_Attribute* getFallbackTexBufAttrib(RV_UniformType type);
677  UT_UniquePtr<rv_Attribute> myDefaultVertexAttrib;
678  UT_UniquePtr<rv_Attribute> myDefaultIntVertexAttrib;
679  UT_UniquePtr<rv_Attribute> myDefaultUIntVertexAttrib;
680  UT_UniquePtr<rv_Attribute> myDefaultSamplerAttrib;
681  UT_UniquePtr<rv_Attribute> myDefaultIntSamplerAttrib;
682  UT_UniquePtr<rv_Attribute> myDefaultUIntSamplerAttrib;
683  UT_UniquePtr<rv_Attribute> myDefaultIndexSamplerAttrib;
684 };
685 
686 #endif
A collection of Vulkan UBO, SSBO, and Image shader bindings (descriptor set)
RV_ConnectionType
Definition: RV_Geometry.h:51
VkPrimitiveTopology
Definition: vulkan_core.h:1957
GLsizei GLenum const void * indices
Definition: glcorearb.h:406
VkFlags VkBufferUsageFlags
Definition: vulkan_core.h:2515
Unsorted map container.
Definition: UT_Map.h:107
VkPrimitiveTopology RVgetVkPrimType(RV_PrimType t)
Definition: RV_Geometry.h:58
GLuint start
Definition: glcorearb.h:475
GLboolean GLboolean g
Definition: glcorearb.h:1222
int64 exint
Definition: SYS_Types.h:125
Object that represents drawable geometry. This object holds vertex, instancing and index buffers for ...
Definition: RV_Geometry.h:164
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
RV_GPUType RVconvertFromGPUType(UT_GPUType t)
Definition: RV_Geometry.h:109
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
double fpreal64
Definition: SYS_Types.h:201
#define UT_ASSERT_MSG(ZZ,...)
Definition: UT_Assert.h:159
UT_GPUType
Definition: UT_ComputeGPU.h:42
Definition: core.h:760
GLboolean reset
Definition: glad.h:5138
RV_AttributeType
Definition: RV_Type.h:90
RV_UniformType
Definition: RV_Type.h:262
GLint GLenum GLboolean GLsizei stride
Definition: glcorearb.h:872
#define RV_API
Definition: RV_API.h:10
GLint location
Definition: glcorearb.h:805
RV_GenericAttribID
Definition: RV_Geometry.h:46
GLuint const GLchar * name
Definition: glcorearb.h:786
Handle to the main interface of Vulkan.
Definition: RV_Instance.h:36
GLdouble t
Definition: glad.h:2397
UT_GPUType RVconvertToUTGPUType(RV_GPUType t)
Definition: RV_Geometry.h:80
RV_PrimType
Definition: RV_Type.h:345
GLsizeiptr const void GLenum usage
Definition: glcorearb.h:664
UT_UniquePtr< rv_InstanceGroup > rv_InstanceGroupPtr
Definition: RV_Geometry.h:142
RV_TopologyClass
Definition: RV_Type.h:372
RV_GPUType
Definition: RV_Type.h:37
GLuint GLfloat * val
Definition: glcorearb.h:1608
GR_API RE_GPUType getAttributeType(RE_Render *r, const char *attrib_name, int &vsize, const GT_DataArrayHandle &pa, const GR_DisplayOption &opts, RE_ArrayType array_type)
Simple class for a mutli-integer cache tag.
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
RV_VKBuffer RV_Buffer
Definition: RV_Geometry.h:42
GLboolean r
Definition: glcorearb.h:1222
UT_UniquePtr< RV_Buffer > RV_BufferPtr
Definition: RV_Geometry.h:148
A vulkan buffer object.
Definition: RV_VKBuffer.h:80
GLuint divisor
Definition: glcorearb.h:1670
type
Definition: core.h:1059
FMT_INLINE void print(format_string< T...> fmt, T &&...args)
Definition: core.h:2976
GLint GLsizei count
Definition: glcorearb.h:405