HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RV_Render.h
Go to the documentation of this file.
1 
2 /*
3  * PROPRIETARY INFORMATION. This software is proprietary to
4  * Side Effects Software Inc., and is not to be reproduced,
5  * transmitted, or disclosed in any way without written permission.
6  *
7  * NAME: RV_Render.h ( RV Library, C++)
8  *
9  * COMMENTS:
10  * Class to do render work with RV library
11  * Represents the set of resources and render state
12  * for a single frame/thread
13  */
14 
15 #ifndef RV_Render_h
16 #define RV_Render_h
17 
18 #include "RV_API.h"
19 
20 #include <UT/UT_FixedArray.h>
21 #include <UT/UT_Map.h>
22 #include <UT/UT_Rect.h>
23 #include <UT/UT_Set.h>
24 #include <UT/UT_SharedPtr.h>
26 #include <UT/UT_UniquePtr.h>
27 #include <RE/RE_Types.h>
28 #include <SYS/SYS_Compiler.h>
29 
30 #include <UT/UT_Function.h>
31 
32 #include <utility>
33 
34 #include <VE/VE_VK.h>
35 #include "RV_Instance.h"
36 #include "RV_ShaderBlock.h"
37 #include "RV_Type.h"
38 #include "RV_VKCommandBuffer.h"
39 #include "RV_VKDescriptorSet.h"
40 #include "RV_VKPipeline.h"
41 
42 class GR_GeoRenderVK;
43 
44 class RV_Instance;
45 class RV_Geometry;
47 class RV_ShaderProgram;
48 class RV_ShaderCompute;
50 class RV_OcclusionQuery;
51 
52 class RV_VKBuffer;
53 class RV_VKCommandBufferAllocator;
54 class RV_VKCommandBuffer;
55 class RV_Framebuffer;
56 class RV_VKImage;
58 
59 class rv_ThreadedRenders;
60 
63 
64 typedef std::pair<VkPipelineStageFlags,VkPipelineStageFlags> RV_BarrierScope;
65 
67 
68 /// Per-thread object for rendering Vulkan objects, which maintains the state
69 /// and a cache of various Vulkan entities
71 {
72 public:
73  RV_Render(RV_Instance* inst);
74  ~RV_Render();
75 
76  RV_Render(const RV_Render&) = delete;
77  RV_Render(RV_Render&&) = delete;
78 
79  /// The instance associated with this render
80  RV_Instance* instance() { return myInst; }
81  /// The raw vulkan device
82  VkDevice device() { return myInst->getDevice(); }
83 
84  // Current Command buffer
85  // - separate Compute + Transfer + Main CB?
86  // - functions to start command buffer
87  // - functions to flush command buffer
88  // - function to get command buffer
89  /// The currently recording command buffer
90  RV_VKCommandBuffer* getCurrentCB();
91 
92  /// Start rendering a single frame, returns the current nesting level
93  /// See `RV_RenderAutoFrame` for RAII wrapper
94  int beginFrame();
95  /// End rendering a single frame, takes the nesting level returned from begin
96  /// for error checking
97  void endFrame(int frame_depth);
98  /// Returns true if currently rendering a frame
99  bool isInFrame() { return myFrameDepth > 0; }
100 
101  /// Begin rendering to the current framebuffer. 'img_op' can be LOAD (keep
102  /// contents), CLEAR (discard and set to a constant) or DONT_CARE.
103  bool beginRendering(RV_ImageOp img_op = RV_IMAGE_LOAD);
104  /// End rendering.
105  void endRendering();
106  /// Query if Vulkan is rendering. Cannot upload buffers or textures while
107  /// rendering.
108  bool isRendering();
109 
110  // --------------------------------
111  // Render State
112  // helper class to hold the required render state
113  // Includes (TODO):
114  // - current command buffer
115  // - pipeline state (all elements provided in pipeline creation
116  // - current bound pipeline
117  // - current descriptor sets
118  // - current framebuffer + render pass
119  // - current vertex state (i.e. which vert buffers bound)
120  // - current clear color / clear depth
121 
122  /// Reset the cached render state in this object to Vulkan defaults.
123  void resetRenderState();
124 
125  /// Copy render state from another RV_Render
126  void copyRenderState(RV_Render* other);
127 
128  /// Return the current pipeline State
129  RV_VKPipelineStateInfo* getPipelineState() { return &pipeState(); }
130 
131  // shader state
132 
133  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134  // Pipeline State
135 
136  // state management
137 
138  /// Reset the pipeline state to Vulkan defaults.
139  void resetPipeState();
140  /// Send the current pipeline state to the GPU.
141  void commitPipeState();
142  /// Save the existing state so that the state can be modified, then restored
143  /// to its previous state with popPipeState()
144  void pushPipeState();
145  /// Restore the pipeline state from a previous pushPipeState().
146  void popPipeState();
147 
148  // Poly Raster + Sample State
149  /// Set the sample mask for multisample rendering
150  void setSampleMask(uint32 mask);
151  /// Set the color channel mask
152  void setColorMask(bool red, bool green, bool blue, bool alpha);
153  /// Set the primitive culling mode, for backface or frontface culling
154  void setCullMode(bool enable, bool back_face = true, bool is_ccw = true);
155  /// Set the width of line primitives (may not be supported on all platforms)
156  void setLineWidth(float width);
157  /// Set the polygon draw mode - FILL (normal), LINES (outline),
158  /// POINTS (vertices).
159  void setPolygonMode(RV_PolygonMode mode);
160 
161  // Depth State
162 
163  /// Set the depth state for zbuffer operations.
164  void setDepthState(
165  bool enable,
167  bool writing = true,
168  float near = 0.0,
169  float far = 1.0,
170  bool clamp = false);
171  /// Set the polygon depth bias to reduce z-fighting for overlapping objects
172  void setDepthBias(bool enable, float zconst, float zslope, float clamp = 0.f);
173 
174  /// Whether there is a depth bias set
175  bool isDepthBiasEnabled() const;
176 
177  // If true, depth is reversed (near at 1.0, far at 0.0). Any calls to set
178  // depth state will reverse the z function.
179 
180  /// Convenience method to map near to 1.0 and far to 0.0 so that the depth
181  /// state will be converted to the correct comparisons (LESS -> GREATER)
182  void setReverseDepth(bool reverse);
183  /// Query if reverse depth mapping is enabled.
184  bool isReverseDepth() const { return myIsReverseDepth; }
185 
186  // Stencil State
187 
188  /// Enable stencil buffer rendering. Framebuffer must have a stencil buffer.
189  void setStencilEnable(bool enable);
190  /// Define the stencil test
191  void setStencilTest(
193  uint8 ref,
194  uint8 compare_mask,
195  bool set_back = true);
196  /// Define the stencil operation based on the stencil test result. If
197  /// 'set_back' is true, also set the same values for backfacing polygons.
198  void setStencilOp(
199  RE_SOperation stencil_fail,
200  RE_SOperation depth_fail,
201  RE_SOperation pass,
202  uint8 write_mask,
203  bool set_back = true);
204  /// Define the stencil test for backfacing polygons
205  void setStencilBackTest(
207  uint8 ref,
208  uint8 compare_mask);
209  /// Define the stencil operation for backfacing polygons
210  void setStencilBackOp(
211  RE_SOperation stencil_fail,
212  RE_SOperation depth_fail,
213  RE_SOperation pass,
214  uint8 write_mask);
215 
216  // TODO: logic state set
217 
218  /// Define the viewport for rendering
219  void setViewport2DI(bool enable, const UT_DimRect &rect);
220 
221  /// Define the scissor (clip) area
222  void setScissor2DI(bool enable, const UT_DimRect &rect);
223 
224  /// Enable logic operations instead of color, plus the operation (AND,OR,etc)
225  void setLogicOp(bool enable, RV_LogicOp = RV_LOGIC_NO_OP);
226 
227  // Blend State
228  /// Enable framebuffer blending
229  void setBlendEnable(bool blend);
230 
231  // functions to set color/alpha separately
232 
233  /// Set the blending weights for color and alpha
234  void setBlendFunction(RE_BlendSourceFactor source_factor,
235  RE_BlendDestFactor dest_factor);
236  /// Set the blending weights for color only
237  void setColorBlendFunction(RE_BlendSourceFactor source_factor,
238  RE_BlendDestFactor dest_factor);
239  /// Set the blending weights for alpha only
240  void setAlphaBlendFunction(RE_BlendSourceFactor source_factor,
241  RE_BlendDestFactor dest_factor);
242  /// Set the blending operator (add, subtract, multiply, etc)
243  void setBlendEquation(RE_BlendEquation eq);
244 
245 
246  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
247  // Command Buffer Binding State
248 
250  {
251  DrawTask() = default;
252  virtual ~DrawTask() {};
253 
254  virtual bool runDraw(RV_Render* r) = 0;
255  };
256 
257  struct DrawState
258  {
259  // Bound sets
261 
262  // Bound pipeline
265 
266  // TODO: convert to use UT_Function object
268  };
269 
271  {
273  int connect,
274  const RV_OverrideList* override_list,
275  int inst = -1)
276  : myGeo(geo)
277  , myConnectGroup(connect)
278  , myConnectRange(1)
279  , myInstanceGroup(inst)
280  , myOverrides(override_list ? *override_list : RV_OverrideList())
281  {
282  }
283 
285  int connect,
286  int connect_num,
287  const RV_OverrideList* override_list,
288  int inst = -1)
289  : myGeo(geo)
290  , myConnectGroup(connect)
291  , myConnectRange(connect_num)
292  , myInstanceGroup(inst)
293  , myOverrides(override_list ? *override_list : RV_OverrideList())
294  {
295  }
296 
297  ~DefaultDrawTask() override {}
298 
299  bool runDraw(RV_Render* r) override;
300 
301  // Bound Vertex state + Input State
302  // plus draw params needed for geo to get vert + idx buffers
308  };
309 // WIP: allow recording bind state for deferring draws
310 #define WIP_VULKAN_DEFER_DRAW
311 #ifdef WIP_VULKAN_DEFER_DRAW
313  bool myIsDeferring = false;
314 
315  bool isDeferringDraws() const { return myIsDeferring; }
316  void clearDraws();
317  void queueDraw(
318  RV_Geometry* geo,
319  int connect,
320  int connect_num,
321  const RV_OverrideList* override_list,
322  int inst = -1);
324  void runDraws();
325 #endif
326 
327  // call vkCmdBind functions for all bound state
328  void refreshBindings();
329 
330  // should be called before a draw
331  bool prepareForDraw();
332 
334  {
335 #ifdef WIP_VULKAN_DEFER_DRAW
336  UT_ASSERT_MSG(!myIsDeferring, "RV_Render::getPushConstants "
337  "Called while in deferred mode, bound values will likely "
338  "be lost");
339 #endif
340  return myPushConstants;
341  }
342 
343  const RV_PushConstants &pushConstants() const { return myPushConstants; }
344 
345  /// Return the bound variable set at index 'set_num'
346  RV_ShaderVariableSet* getSet(int set_num);
347  /// Remove a bound variable set by index
348  void unbindSet(int set_num);
349  /// Remove a bound variable set by object
350  void unbindSet(const RV_ShaderVariableSet* set);
351  /// Bind a variable set to the specific shader program
352  bool bindSet(RV_ShaderVariableSet* set,
353  const RV_ShaderProgramBase* shr);
354  /// Bind a variable set to the current shader program
356  /// Store the current shader
357  void pushShader();
358  /// Store the current shader and set the new shader to 'sh'
360  /// Restore the previous shader saved by pushShader()
361  void popShader();
362  /// Set the current shader to 'sh'
364  /// Get the current shader.
366  /// Get the current graphics shader. If the current shader is compute, return
367  /// null.
369  /// Get the current compute shader. If the current shader is graphics, return
370  /// null.
372 
373  /// Save the current render framebuffer
374  void pushDrawFramebuffer();
375  /// Save the current render framebuffer and make a new framebuffer active
377  /// Restore the previously pushed framebuffer from pushDrawFramebuffer().
378  void popDrawFramebuffer();
379  /// Make a new framebuffer active
381  /// Get the current framebuffer (may be null)
383 
384  /// Return the currently active occlusion query
385  const RV_OcclusionQuery* getQuery() const { return myCurOccludeQuery; }
386  /// Make occlusion query 'q' the active query (only 1 can be active at once)
388  { myCurOccludeQuery = q; }
389 
390  /// get the number of parallel command buffers within our pool
391  int getNumCommandBuffers() const;
392 
393  // TODO:
394  // void bindVertexState();
395 
396  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
397  // Actions
398 
399  /// End the current command buffer and start a new one. Wait until it is
400  /// executed if 'wait_for_finish' is true.
401  void flush(bool wait_for_finish);
402 
403  /// Run the current compute shader with explicit workgroup sizes. Returns
404  /// false if there is no compute shader bound.
405  bool runCompute(int wg_x, int wg_y, int wg_z);
406  /// Run the current compute shader with workgroup sizes stored in the given
407  /// buffer. Returns false if there is no compute shader bound.
409 
410  /// Draw the geometry 'geo' with the given connectivity group
411  void draw(
412  RV_Geometry* geo,
413  int connect_index,
414  const RV_OverrideList* override_list = nullptr);
415  /// Draw the geometry 'geo' with instancing with the given connectivity group
416  /// abd given instance group
417  void drawInstanced(
418  RV_Geometry* geo,
419  int connect_index,
420  int instance_group,
421  const RV_OverrideList* override_list = nullptr);
422 
423  /// Draw a range of connectivity groups
424  void drawRange(
425  RV_Geometry* geo,
426  int connect_index,
427  int connect_num,
428  const RV_OverrideList* override_list = nullptr);
429 
430  /// Draw using instancing a range of connectivity groups
431  void drawInstancedRange(
432  RV_Geometry* geo,
433  int connect_index,
434  int connect_num,
435  int inst_group,
436  const RV_OverrideList* override_list= nullptr);
437 
438  /// Render a deferred draw task
439  void draw(UT_UniquePtr<DrawTask> task);
440 
441  /// Render deferred draw using lambda
442  void draw(const UT_Function<bool(RV_Render*)> &task);
443 
444  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
445  // Thread-local Renders
446 
447  /// Get desired number of threads to use for parallel rendering
448  int getNumRenderThreads() const;
449  /// Call before using `getThreadedRender` and rendering from a new thread
450  void enableThreadedRender();
451  /// Associate a unique RV_Render with the current thread and return it
453  /// Finish rendering with multiple threads, and disassociates all per-thread
454  /// RV_Renders from the thread they were used on
455  void endThreadedRender();
456 
457 
458  void dumpBoundState();
459 
460  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
461  // Sync
462 #define WIP_VULKAN_DEFER_BARRIERS
463 #ifdef WIP_VULKAN_DEFER_BARRIERS
464 
465  /// Add a barrier for buffer synchronization
466  void addBufferBarrier(
467  RV_BarrierScope scope,
468  const VkBufferMemoryBarrier& barrier,
469  RV_VKBuffer* buf);
470  /// Add a barrier for image synchronization
471  void addImageBarrier(
472  RV_BarrierScope scope,
473  const VkImageMemoryBarrier& barrier,
474  RV_VKImage* img);
475 
476  /// Remove all currently added barriers
477  void clearBarriers();
478  /// Execute all commands with barriers
479  void executeAllBarriers();
480  /// Execute all commands on some queues (graphics, compute, transfer).
482 
483  // called when setting up render for a frame
484  void initBarriers();
485 
487  {
489  VkMemoryBarrier myGenBarrier =
490  {
492  nullptr,
495  };
496  };
497 
498  // List of barriers waiting to be added to the commandbuffer
499  // -- any barrier MUST be added before a command in its DST stage is run
500  // inserted by DST RV_STAGE_GROUP
502 
503  // List of barriers that have been added, and were added later than ALL
504  // cmds included from their src stage -- inserted by SRC RV_STAGE_GROUP
506 
507  // List of IDs for each batch of barriers that was submitted
508  UT_FixedArray<exint, RV_STAGE_NUM> myBarrierGroupID = {};
509 
510  // counters for debugging
511  int myFrameExecBarrierCount = 0;
512  int myFrameMemBarrierCount = 0;
513 #endif
514 
515 private:
516  void privInitCB();
517  void privSubmitCB(bool wait_for_finish);
518 
519  // Vulkan Instance used to create this render
520  RV_Instance* myInst;
521 
523  RV_VKCommandBuffer* myCurrentCB = nullptr;
524 
525  // Pipeline state -- i.e. state that is part of dynamic state
526  // compiled into graphics pipeline
527  UT_Array<RV_VKPipelineStateInfo> myPipeStateStack;
528  RV_VKPipelineStateInfo& pipeState();
529  const RV_VKPipelineStateInfo& pipeState() const;
530 
531  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
532  // Binding State
533  static const int theMaxSets = 8;
535  UT_Array<bool> myDirtySetFlags;
536 
537  UT_Array<RV_ShaderProgramBase*> myShaderStack;
538  UT_Array<RV_Framebuffer*> myFramebufferStack;
539  RV_OcclusionQuery* myCurOccludeQuery = nullptr;
540 
541  RV_PushConstants myPushConstants;
542 
543  exint myFrameDepth = 0;
544  bool myIsRendering = false;
545  bool myIsReverseDepth = false;
546 
547  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
548  // Multi-Threading
549  int myRenderThreads;
550  RV_Render* myMainRender = nullptr;
551  UT_UniquePtr<rv_ThreadedRenders> myThreadedRenders;
552  friend rv_ThreadedRenders;
553 
554  bool isMainRender() const;
555 };
556 
557 /// RAII wrapper for RV_Render beginFrame/EndFrame calls
559 {
560 public:
562  {
563  myFrameDepth = myR.beginFrame();
564  }
566  {
567  myR.endFrame(myFrameDepth);
568  }
569 private:
570  RV_Render& myR;
571  int myFrameDepth;
572 };
573 
574 /// Destroy VK resource after command buffer is executed,
575 /// when it will no longer be in-use by the GPU
576 template<class T>
578 {
579  if (v)
581  RVmakeDestroyPtrTask(std::move(v)));
582 }
583 
584 #endif
A collection of Vulkan UBO, SSBO, and Image shader bindings (descriptor set)
void drawInstanced(RV_Geometry *geo, int connect_index, int instance_group, const RV_OverrideList *override_list=nullptr)
RAII wrapper for RV_Render beginFrame/EndFrame calls.
Definition: RV_Render.h:558
RV_VKPipelineStateInfo * getPipelineState()
Return the current pipeline State.
Definition: RV_Render.h:129
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
bool runCompute(int wg_x, int wg_y, int wg_z)
bool isDeferringDraws() const
Definition: RV_Render.h:315
RV_PushConstants & getPushConstants()
Definition: RV_Render.h:333
VkDevice device()
The raw vulkan device.
Definition: RV_Render.h:82
void addBufferBarrier(RV_BarrierScope scope, const VkBufferMemoryBarrier &barrier, RV_VKBuffer *buf)
Add a barrier for buffer synchronization.
RV_ImageOp
Definition: RV_Type.h:406
RV_ShaderProgram * getGraphicsShader()
void pushShader()
Store the current shader.
UT_UniquePtr< DrawTask > myTask
Definition: RV_Render.h:267
GLbitfield stages
Definition: glcorearb.h:1931
GLenum clamp
Definition: glcorearb.h:1234
void executeAllBarriers()
Execute all commands with barriers.
RV_RenderAutoFrame(RV_Render &r)
Definition: RV_Render.h:561
const GLdouble * v
Definition: glcorearb.h:837
void pushDrawFramebuffer()
Save the current render framebuffer.
RV_ShaderVariableSet * getSet(int set_num)
Return the bound variable set at index 'set_num'.
void dumpBoundState()
void setQuery(RV_OcclusionQuery *q)
Make occlusion query 'q' the active query (only 1 can be active at once)
Definition: RV_Render.h:387
void draw(RV_Geometry *geo, int connect_index, const RV_OverrideList *override_list=nullptr)
Draw the geometry 'geo' with the given connectivity group.
int64 exint
Definition: SYS_Types.h:125
RV_StageGroup
Definition: RV_Type.h:445
Object that represents drawable geometry. This object holds vertex, instancing and index buffers for ...
Definition: RV_Geometry.h:165
void executeBarriers(RV_StageGroup stages)
Execute all commands on some queues (graphics, compute, transfer).
void reverse(I begin, I end)
Definition: pugixml.cpp:7190
RV_ShaderProgramBase * getShader()
Get the current shader.
void drawInstancedRange(RV_Geometry *geo, int connect_index, int connect_num, int inst_group, const RV_OverrideList *override_list=nullptr)
Draw using instancing a range of connectivity groups.
std::pair< VkPipelineStageFlags, VkPipelineStageFlags > RV_BarrierScope
Definition: RV_Render.h:62
RV_VKCommandBuffer::Callback RVmakeDestroyPtrTask(UT_UniquePtr< T > obj)
void flush(bool wait_for_finish)
VkFlags VkPipelineStageFlags
Definition: vulkan_core.h:2401
GLdouble GLdouble GLdouble q
Definition: glad.h:2445
GLdouble far
Definition: glcorearb.h:143
void unbindSet(int set_num)
Remove a bound variable set by index.
DefaultDrawTask(RV_Geometry *geo, int connect, const RV_OverrideList *override_list, int inst=-1)
Definition: RV_Render.h:272
int getNumCommandBuffers() const
get the number of parallel command buffers within our pool
void clearBarriers()
Remove all currently added barriers.
int getNumRenderThreads() const
Get desired number of threads to use for parallel rendering.
RV_VKCommandBuffer * getCurrentCB()
The currently recording command buffer.
void enableThreadedRender()
Call before using getThreadedRender and rendering from a new thread.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
#define UT_ASSERT_MSG(ZZ,...)
Definition: UT_Assert.h:159
unsigned char uint8
Definition: SYS_Types.h:36
vint4 blend(const vint4 &a, const vint4 &b, const vbool4 &mask)
Definition: simd.h:4784
virtual ~DrawTask()
Definition: RV_Render.h:252
bool prepareForDraw()
GLfloat f
Definition: glcorearb.h:1926
bool isInFrame()
Returns true if currently rendering a frame.
Definition: RV_Render.h:99
Compute shader object.
GLintptr offset
Definition: glcorearb.h:665
std::array< T, N > UT_FixedArray
Definition: UT_FixedArray.h:19
UT_Array< DrawState > myRecordedDraws
Definition: RV_Render.h:312
GLint ref
Definition: glcorearb.h:124
DefaultDrawTask(RV_Geometry *geo, int connect, int connect_num, const RV_OverrideList *override_list, int inst=-1)
Definition: RV_Render.h:284
void setShader(RV_ShaderProgramBase *sh)
Set the current shader to 'sh'.
UT_Array< RV_ShaderVariableSet * > mySets
Definition: RV_Render.h:260
const RV_OcclusionQuery * getQuery() const
Return the currently active occlusion query.
Definition: RV_Render.h:385
Occlusion query object.
Definition: RV_Query.h:31
RV_VKPipelineStateInfo myPipelineState
Definition: RV_Render.h:264
GLfloat green
Definition: glcorearb.h:112
RV_PolygonMode
Definition: RV_Type.h:429
GLint GLuint mask
Definition: glcorearb.h:124
#define RV_API
Definition: RV_API.h:10
RV_StageGroup RVgetStageGroup(VkPipelineStageFlags stage_bits)
RE_BlendEquation
Definition: RE_Types.h:532
#define SYS_NO_DISCARD_RESULT
Definition: SYS_Compiler.h:93
GLfloat GLfloat GLfloat alpha
Definition: glcorearb.h:112
RE_ZFunction
Definition: RE_Types.h:471
std::function< T > UT_Function
Definition: UT_Function.h:37
bool isReverseDepth() const
Query if reverse depth mapping is enabled.
Definition: RV_Render.h:184
Handle to the main interface of Vulkan.
Definition: RV_Instance.h:38
bool runComputeIndirect(RV_VKBuffer *buf, exint offset=0)
GLint void * img
Definition: glcorearb.h:556
void initBarriers()
void bindDrawFramebuffer(RV_Framebuffer *fb)
Make a new framebuffer active.
RV_Render * getThreadedRender()
Associate a unique RV_Render with the current thread and return it.
void popDrawFramebuffer()
Restore the previously pushed framebuffer from pushDrawFramebuffer().
void RVdestroyVKPtr(RV_Render *r, UT_UniquePtr< T > v)
Definition: RV_Render.h:577
void addCompletionCallback(const Callback &callback)
GLenum mode
Definition: glcorearb.h:99
RV_Instance * instance()
The instance associated with this render.
Definition: RV_Render.h:80
void popShader()
Restore the previous shader saved by pushShader()
GLenum func
Definition: glcorearb.h:783
RV_Framebuffer * getDrawFramebuffer()
Get the current framebuffer (may be null)
UT_FixedArray< rv_MemoryBarriers, RV_STAGE_NUM > myWaitingBarriers
Definition: RV_Render.h:501
RV_LogicOp
Definition: RV_Type.h:436
RE_SOperation
Definition: RE_Types.h:495
UT_FixedArray< RV_BarrierScope, RV_STAGE_NUM > myActiveBarriers
Definition: RV_Render.h:505
RE_BlendSourceFactor
Definition: RE_Types.h:507
RV_ShaderProgram * myShader
Definition: RV_Render.h:263
unsigned int uint32
Definition: SYS_Types.h:40
GLint GLsizei width
Definition: glcorearb.h:103
void runDraws()
void queueDraw(RV_Geometry *geo, int connect, int connect_num, const RV_OverrideList *override_list, int inst=-1)
void addImageBarrier(RV_BarrierScope scope, const VkImageMemoryBarrier &barrier, RV_VKImage *img)
Add a barrier for image synchronization.
GLboolean r
Definition: glcorearb.h:1222
GLfloat GLfloat blue
Definition: glcorearb.h:112
const RV_PushConstants & pushConstants() const
Definition: RV_Render.h:343
A vulkan buffer object.
Definition: RV_VKBuffer.h:81
void drawRange(RV_Geometry *geo, int connect_index, int connect_num, const RV_OverrideList *override_list=nullptr)
Draw a range of connectivity groups.
virtual bool runDraw(RV_Render *r)=0
bool myIsDeferring
Definition: RV_Render.h:313
RV_OverrideList myOverrides
Definition: RV_Render.h:307
RV_ShaderCompute * getComputeShader()
RE_SFunction
Definition: RE_Types.h:483
png_structrp int png_fixed_point red
Definition: png.h:1083
void endThreadedRender()
void refreshBindings()
void clearDraws()
bool bindSet(RV_ShaderVariableSet *set, const RV_ShaderProgramBase *shr)
Bind a variable set to the specific shader program.
RE_BlendDestFactor
Definition: RE_Types.h:520