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  /// return the current near and far plane in NDC space,
187  /// based on if reverse Depth is enabled
188  int getNDCNearPlane() const { return isReverseDepth() ? 1.0 : 0.0; }
189  int getNDCFarPlane() const { return isReverseDepth() ? 0.0 : 1.0; }
190 
191  // Stencil State
192 
193  /// Enable stencil buffer rendering. Framebuffer must have a stencil buffer.
194  void setStencilEnable(bool enable);
195  /// Define the stencil test
196  void setStencilTest(
198  uint8 ref,
199  uint8 compare_mask,
200  bool set_back = true);
201  /// Define the stencil operation based on the stencil test result. If
202  /// 'set_back' is true, also set the same values for backfacing polygons.
203  void setStencilOp(
204  RE_SOperation stencil_fail,
205  RE_SOperation depth_fail,
206  RE_SOperation pass,
207  uint8 write_mask,
208  bool set_back = true);
209  /// Define the stencil test for backfacing polygons
210  void setStencilBackTest(
212  uint8 ref,
213  uint8 compare_mask);
214  /// Define the stencil operation for backfacing polygons
215  void setStencilBackOp(
216  RE_SOperation stencil_fail,
217  RE_SOperation depth_fail,
218  RE_SOperation pass,
219  uint8 write_mask);
220 
221  // TODO: logic state set
222 
223  /// Define the viewport for rendering
224  void setViewport2DI(bool enable, const UT_DimRect &rect);
225 
226  /// Define the scissor (clip) area
227  void setScissor2DI(bool enable, const UT_DimRect &rect);
228 
229  /// Enable logic operations instead of color, plus the operation (AND,OR,etc)
230  void setLogicOp(bool enable, RV_LogicOp = RV_LOGIC_NO_OP);
231 
232  // Blend State
233  /// Enable framebuffer blending
234  void setBlendEnable(bool blend);
235 
236  // functions to set color/alpha separately
237 
238  /// Set the blending weights for color and alpha
239  void setBlendFunction(RE_BlendSourceFactor source_factor,
240  RE_BlendDestFactor dest_factor);
241  /// Set the blending weights for color only
242  void setColorBlendFunction(RE_BlendSourceFactor source_factor,
243  RE_BlendDestFactor dest_factor);
244  /// Set the blending weights for alpha only
245  void setAlphaBlendFunction(RE_BlendSourceFactor source_factor,
246  RE_BlendDestFactor dest_factor);
247  /// Set the blending operator (add, subtract, multiply, etc)
248  void setBlendEquation(RE_BlendEquation eq);
249 
250 
251  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252  // Command Buffer Binding State
253 
255  {
256  DrawTask() = default;
257  virtual ~DrawTask() {};
258 
259  virtual bool runDraw(RV_Render* r) = 0;
260  };
261 
262  struct DrawState
263  {
264  // Bound sets
266 
267  // Bound pipeline
270 
271  // TODO: convert to use UT_Function object
273  };
274 
276  {
278  int connect,
279  const RV_OverrideList* override_list,
280  int inst = -1)
281  : myGeo(geo)
282  , myConnectGroup(connect)
283  , myConnectRange(1)
284  , myInstanceGroup(inst)
285  , myOverrides(override_list ? *override_list : RV_OverrideList())
286  {
287  }
288 
290  int connect,
291  int connect_num,
292  const RV_OverrideList* override_list,
293  int inst = -1)
294  : myGeo(geo)
295  , myConnectGroup(connect)
296  , myConnectRange(connect_num)
297  , myInstanceGroup(inst)
298  , myOverrides(override_list ? *override_list : RV_OverrideList())
299  {
300  }
301 
302  ~DefaultDrawTask() override {}
303 
304  bool runDraw(RV_Render* r) override;
305 
306  // Bound Vertex state + Input State
307  // plus draw params needed for geo to get vert + idx buffers
313  };
314 // WIP: allow recording bind state for deferring draws
315 #define WIP_VULKAN_DEFER_DRAW
316 #ifdef WIP_VULKAN_DEFER_DRAW
318  bool myIsDeferring = false;
319 
320  bool isDeferringDraws() const { return myIsDeferring; }
321  void clearDraws();
322  void queueDraw(
323  RV_Geometry* geo,
324  int connect,
325  int connect_num,
326  const RV_OverrideList* override_list,
327  int inst = -1);
329  void runDraws();
330 #endif
331 
332  // call vkCmdBind functions for all bound state
333  void refreshBindings();
334 
335  // should be called before a draw
336  bool prepareForDraw();
337 
339  {
340 #ifdef WIP_VULKAN_DEFER_DRAW
341  UT_ASSERT_MSG(!myIsDeferring, "RV_Render::getPushConstants "
342  "Called while in deferred mode, bound values will likely "
343  "be lost");
344 #endif
345  return myPushConstants;
346  }
347 
348  const RV_PushConstants &pushConstants() const { return myPushConstants; }
349 
350  /// Return the bound variable set at index 'set_num'
351  RV_ShaderVariableSet* getSet(int set_num);
352  /// Remove a bound variable set by index
353  void unbindSet(int set_num);
354  /// Remove a bound variable set by object
355  void unbindSet(const RV_ShaderVariableSet* set);
356  /// Bind a variable set to the specific shader program
357  bool bindSet(RV_ShaderVariableSet* set,
358  const RV_ShaderProgramBase* shr);
359  /// Bind a variable set to the current shader program
361  /// Store the current shader
362  void pushShader();
363  /// Store the current shader and set the new shader to 'sh'
365  /// Restore the previous shader saved by pushShader()
366  void popShader();
367  /// Set the current shader to 'sh'
369  /// Get the current shader.
371  /// Get the current graphics shader. If the current shader is compute, return
372  /// null.
374  /// Get the current compute shader. If the current shader is graphics, return
375  /// null.
377 
378  /// Save the current render framebuffer
379  void pushDrawFramebuffer();
380  /// Save the current render framebuffer and make a new framebuffer active
382  /// Restore the previously pushed framebuffer from pushDrawFramebuffer().
383  void popDrawFramebuffer();
384  /// Make a new framebuffer active
386  /// Get the current framebuffer (may be null)
388 
389  /// Return the currently active occlusion query
390  const RV_OcclusionQuery* getQuery() const { return myCurOccludeQuery; }
391  /// Make occlusion query 'q' the active query (only 1 can be active at once)
393  { myCurOccludeQuery = q; }
394 
395  /// get the number of parallel command buffers within our pool
396  int getNumCommandBuffers() const;
397 
398  // TODO:
399  // void bindVertexState();
400 
401  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
402  // Actions
403 
404  /// End the current command buffer and start a new one. Wait until it is
405  /// executed if 'wait_for_finish' is true.
406  void flush(bool wait_for_finish);
407 
408  /// Run the current compute shader with explicit workgroup sizes. Returns
409  /// false if there is no compute shader bound.
410  bool runCompute(int wg_x, int wg_y, int wg_z);
411  /// Run the current compute shader with workgroup sizes stored in the given
412  /// buffer. Returns false if there is no compute shader bound.
414 
415  /// Draw the geometry 'geo' with the given connectivity group
416  void draw(
417  RV_Geometry* geo,
418  int connect_index,
419  const RV_OverrideList* override_list = nullptr);
420  /// Draw the geometry 'geo' with instancing with the given connectivity group
421  /// abd given instance group
422  void drawInstanced(
423  RV_Geometry* geo,
424  int connect_index,
425  int instance_group,
426  const RV_OverrideList* override_list = nullptr);
427 
428  /// Draw a range of connectivity groups
429  void drawRange(
430  RV_Geometry* geo,
431  int connect_index,
432  int connect_num,
433  const RV_OverrideList* override_list = nullptr);
434 
435  /// Draw using instancing a range of connectivity groups
436  void drawInstancedRange(
437  RV_Geometry* geo,
438  int connect_index,
439  int connect_num,
440  int inst_group,
441  const RV_OverrideList* override_list= nullptr);
442 
443  /// Render a deferred draw task
444  void draw(UT_UniquePtr<DrawTask> task);
445 
446  /// Render deferred draw using lambda
447  void draw(const UT_Function<bool(RV_Render*)> &task);
448 
449  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
450  // Thread-local Renders
451 
452  /// Get desired number of threads to use for parallel rendering
453  int getNumRenderThreads() const;
454  /// Call before using `getThreadedRender` and rendering from a new thread
455  void enableThreadedRender();
456  /// Associate a unique RV_Render with the current thread and return it
458  /// Finish rendering with multiple threads, and disassociates all per-thread
459  /// RV_Renders from the thread they were used on
460  void endThreadedRender();
461 
462 
463  void dumpBoundState();
464 
465  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
466  // Sync
467 #define WIP_VULKAN_DEFER_BARRIERS
468 #ifdef WIP_VULKAN_DEFER_BARRIERS
469 
470  /// Add a barrier for buffer synchronization
471  void addBufferBarrier(
472  RV_BarrierScope scope,
473  const VkBufferMemoryBarrier& barrier,
474  RV_VKBuffer* buf);
475  /// Add a barrier for image synchronization
476  void addImageBarrier(
477  RV_BarrierScope scope,
478  const VkImageMemoryBarrier& barrier,
479  RV_VKImage* img);
480 
481  /// Remove all currently added barriers
482  void clearBarriers();
483  /// Execute all commands with barriers
484  void executeAllBarriers();
485  /// Execute all commands on some queues (graphics, compute, transfer).
487 
488  // called when setting up render for a frame
489  void initBarriers();
490 
492  {
494  VkMemoryBarrier myGenBarrier =
495  {
497  nullptr,
500  };
501  };
502 
503  // List of barriers waiting to be added to the commandbuffer
504  // -- any barrier MUST be added before a command in its DST stage is run
505  // inserted by DST RV_STAGE_GROUP
507 
508  // List of barriers that have been added, and were added later than ALL
509  // cmds included from their src stage -- inserted by SRC RV_STAGE_GROUP
511 
512  // List of IDs for each batch of barriers that was submitted
513  UT_FixedArray<exint, RV_STAGE_NUM> myBarrierGroupID = {};
514 
515  // counters for debugging
516  int myFrameExecBarrierCount = 0;
517  int myFrameMemBarrierCount = 0;
518 #endif
519 
520 private:
521  void privInitCB();
522  void privSubmitCB(bool wait_for_finish);
523 
524  // Vulkan Instance used to create this render
525  RV_Instance* myInst;
526 
528  RV_VKCommandBuffer* myCurrentCB = nullptr;
529 
530  // Pipeline state -- i.e. state that is part of dynamic state
531  // compiled into graphics pipeline
532  UT_Array<RV_VKPipelineStateInfo> myPipeStateStack;
533  RV_VKPipelineStateInfo& pipeState();
534  const RV_VKPipelineStateInfo& pipeState() const;
535 
536  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
537  // Binding State
538  static const int theMaxSets = 8;
540  UT_Array<bool> myDirtySetFlags;
541 
542  UT_Array<RV_ShaderProgramBase*> myShaderStack;
543  UT_Array<RV_Framebuffer*> myFramebufferStack;
544  RV_OcclusionQuery* myCurOccludeQuery = nullptr;
545 
546  RV_PushConstants myPushConstants;
547 
548  exint myFrameDepth = 0;
549  bool myIsRendering = false;
550  bool myIsReverseDepth = false;
551 
552  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
553  // Multi-Threading
554  int myRenderThreads;
555  RV_Render* myMainRender = nullptr;
556  UT_UniquePtr<rv_ThreadedRenders> myThreadedRenders;
557  friend rv_ThreadedRenders;
558 
559  bool isMainRender() const;
560 };
561 
562 /// RAII wrapper for RV_Render beginFrame/EndFrame calls
564 {
565 public:
567  {
568  myFrameDepth = myR.beginFrame();
569  }
571  {
572  myR.endFrame(myFrameDepth);
573  }
574 private:
575  RV_Render& myR;
576  int myFrameDepth;
577 };
578 
579 /// Destroy VK resource after command buffer is executed,
580 /// when it will no longer be in-use by the GPU
581 template<class T>
583 {
584  if (v)
586  RVmakeDestroyPtrTask(std::move(v)));
587 }
588 
589 #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:563
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:320
RV_PushConstants & getPushConstants()
Definition: RV_Render.h:338
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:412
RV_ShaderProgram * getGraphicsShader()
void pushShader()
Store the current shader.
UT_UniquePtr< DrawTask > myTask
Definition: RV_Render.h:272
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:566
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:392
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:451
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:277
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.
int getNDCNearPlane() const
Definition: RV_Render.h:188
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:257
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:317
int getNDCFarPlane() const
Definition: RV_Render.h:189
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:289
void setShader(RV_ShaderProgramBase *sh)
Set the current shader to 'sh'.
UT_Array< RV_ShaderVariableSet * > mySets
Definition: RV_Render.h:265
const RV_OcclusionQuery * getQuery() const
Return the currently active occlusion query.
Definition: RV_Render.h:390
Occlusion query object.
Definition: RV_Query.h:31
RV_VKPipelineStateInfo myPipelineState
Definition: RV_Render.h:269
GLfloat green
Definition: glcorearb.h:112
RV_PolygonMode
Definition: RV_Type.h:435
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:582
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:506
RV_LogicOp
Definition: RV_Type.h:442
RE_SOperation
Definition: RE_Types.h:495
UT_FixedArray< RV_BarrierScope, RV_STAGE_NUM > myActiveBarriers
Definition: RV_Render.h:510
RE_BlendSourceFactor
Definition: RE_Types.h:507
RV_ShaderProgram * myShader
Definition: RV_Render.h:268
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:348
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:318
RV_OverrideList myOverrides
Definition: RV_Render.h:312
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