53 class RV_VKCommandBufferAllocator;
59 class rv_ThreadedRenders;
64 typedef std::pair<VkPipelineStageFlags,VkPipelineStageFlags>
RV_BarrierScope;
82 VkDevice
device() {
return myInst->getDevice(); }
97 void endFrame(
int frame_depth);
123 void resetRenderState();
139 void resetPipeState();
141 void commitPipeState();
144 void pushPipeState();
154 void setCullMode(
bool enable,
bool back_face =
true,
bool is_ccw =
true);
156 void setLineWidth(
float width);
172 void setDepthBias(
bool enable,
float zconst,
float zslope,
float clamp = 0.
f);
175 bool isDepthBiasEnabled()
const;
182 void setReverseDepth(
bool reverse);
189 void setStencilEnable(
bool enable);
195 bool set_back =
true);
203 bool set_back =
true);
205 void setStencilBackTest(
210 void setStencilBackOp(
219 void setViewport2DI(
bool enable,
const UT_DimRect &rect);
222 void setScissor2DI(
bool enable,
const UT_DimRect &rect);
229 void setBlendEnable(
bool blend);
277 , myConnectGroup(connect)
279 , myInstanceGroup(inst)
290 , myConnectGroup(connect)
291 , myConnectRange(connect_num)
292 , myInstanceGroup(inst)
310 #define WIP_VULKAN_DEFER_DRAW
311 #ifdef WIP_VULKAN_DEFER_DRAW
313 bool myIsDeferring =
false;
335 #ifdef WIP_VULKAN_DEFER_DRAW
337 "Called while in deferred mode, bound values will likely "
340 return myPushConstants;
388 { myCurOccludeQuery =
q; }
401 void flush(
bool wait_for_finish);
405 bool runCompute(
int wg_x,
int wg_y,
int wg_z);
462 #define WIP_VULKAN_DEFER_BARRIERS
463 #ifdef WIP_VULKAN_DEFER_BARRIERS
511 int myFrameExecBarrierCount = 0;
512 int myFrameMemBarrierCount = 0;
517 void privSubmitCB(
bool wait_for_finish);
533 static const int theMaxSets = 8;
543 exint myFrameDepth = 0;
544 bool myIsRendering =
false;
545 bool myIsReverseDepth =
false;
552 friend rv_ThreadedRenders;
554 bool isMainRender()
const;
563 myFrameDepth = myR.beginFrame();
567 myR.endFrame(myFrameDepth);
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.
RV_VKPipelineStateInfo * getPipelineState()
Return the current pipeline State.
GLenum GLuint GLenum GLsizei const GLchar * buf
bool runCompute(int wg_x, int wg_y, int wg_z)
bool isDeferringDraws() const
RV_PushConstants & getPushConstants()
VkDevice device()
The raw vulkan device.
void addBufferBarrier(RV_BarrierScope scope, const VkBufferMemoryBarrier &barrier, RV_VKBuffer *buf)
Add a barrier for buffer synchronization.
RV_ShaderProgram * getGraphicsShader()
void pushShader()
Store the current shader.
UT_UniquePtr< DrawTask > myTask
void executeAllBarriers()
Execute all commands with barriers.
RV_RenderAutoFrame(RV_Render &r)
void pushDrawFramebuffer()
Save the current render framebuffer.
RV_ShaderVariableSet * getSet(int set_num)
Return the bound variable set at index 'set_num'.
void setQuery(RV_OcclusionQuery *q)
Make occlusion query 'q' the active query (only 1 can be active at once)
void draw(RV_Geometry *geo, int connect_index, const RV_OverrideList *override_list=nullptr)
Draw the geometry 'geo' with the given connectivity group.
Object that represents drawable geometry. This object holds vertex, instancing and index buffers for ...
void executeBarriers(RV_StageGroup stages)
Execute all commands on some queues (graphics, compute, transfer).
void reverse(I begin, I end)
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
RV_VKCommandBuffer::Callback RVmakeDestroyPtrTask(UT_UniquePtr< T > obj)
void flush(bool wait_for_finish)
VkFlags VkPipelineStageFlags
GLdouble GLdouble GLdouble q
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)
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.
#define UT_ASSERT_MSG(ZZ,...)
vint4 blend(const vint4 &a, const vint4 &b, const vbool4 &mask)
bool isInFrame()
Returns true if currently rendering a frame.
std::array< T, N > UT_FixedArray
UT_Array< DrawState > myRecordedDraws
DefaultDrawTask(RV_Geometry *geo, int connect, int connect_num, const RV_OverrideList *override_list, int inst=-1)
void setShader(RV_ShaderProgramBase *sh)
Set the current shader to 'sh'.
UT_Array< RV_ShaderVariableSet * > mySets
const RV_OcclusionQuery * getQuery() const
Return the currently active occlusion query.
RV_VKPipelineStateInfo myPipelineState
RV_StageGroup RVgetStageGroup(VkPipelineStageFlags stage_bits)
#define SYS_NO_DISCARD_RESULT
GLfloat GLfloat GLfloat alpha
std::function< T > UT_Function
bool isReverseDepth() const
Query if reverse depth mapping is enabled.
Handle to the main interface of Vulkan.
bool runComputeIndirect(RV_VKBuffer *buf, exint offset=0)
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)
~DefaultDrawTask() override
void addCompletionCallback(const Callback &callback)
RV_Instance * instance()
The instance associated with this render.
void popShader()
Restore the previous shader saved by pushShader()
RV_Framebuffer * getDrawFramebuffer()
Get the current framebuffer (may be null)
UT_FixedArray< rv_MemoryBarriers, RV_STAGE_NUM > myWaitingBarriers
UT_FixedArray< RV_BarrierScope, RV_STAGE_NUM > myActiveBarriers
RV_ShaderProgram * myShader
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.
const RV_PushConstants & pushConstants() const
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
RV_OverrideList myOverrides
RV_ShaderCompute * getComputeShader()
png_structrp int png_fixed_point red
bool bindSet(RV_ShaderVariableSet *set, const RV_ShaderProgramBase *shr)
Bind a variable set to the specific shader program.