Package icyllis.arc3d.vulkan
Class VulkanCommandBuffer
java.lang.Object
icyllis.arc3d.engine.CommandBuffer
icyllis.arc3d.vulkan.VulkanCommandBuffer
- Direct Known Subclasses:
VulkanPrimaryCommandBuffer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.lwjgl.vulkan.VkCommandBufferprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbegin()booleanbeginRenderPass(RenderPassDesc renderPassDesc, FramebufferDesc framebufferDesc, Rect2ic renderPassBounds, float[] clearColors, float clearDepth, int clearStencil) Begin render pass.booleanbindGraphicsPipeline(GraphicsPipeline graphicsPipeline) Bind graphics pipeline.voidbindIndexBuffer(int indexType, Buffer buffer, long offset) Render pass scope, caller must track the buffer.voidbindTextureSampler(int binding, Image texture, Sampler sampler, short swizzle) Bind texture view and sampler to the same binding point (combined image sampler).voidbindUniformBuffer(int binding, Buffer buffer, long offset, long size) Render pass scope, caller must track the buffer.voidbindVertexBuffer(int binding, Buffer buffer, long offset) Render pass scope, caller must track the buffer.voidprotected booleanvoiddraw(int vertexCount, int baseVertex) Records a non-indexed draw to current command buffer.voiddrawIndexed(int indexCount, int baseIndex, int baseVertex) Records an indexed draw to current command buffer.voiddrawIndexedInstanced(int indexCount, int baseIndex, int instanceCount, int baseInstance, int baseVertex) Records an indexed draw to current command buffer.voiddrawInstanced(int instanceCount, int baseInstance, int vertexCount, int baseVertex) Records a non-indexed draw to current command buffer.voidEnd the current render pass.booleanprotected booleanonCopyBuffer(Buffer srcBuffer, Buffer dstBuffer, long srcOffset, long dstOffset, long size) protected booleanonCopyBufferToImage(Buffer srcBuffer, Image dstImage, int srcColorType, int dstColorType, BufferImageCopyData[] copyData) protected booleanonCopyImage(Image srcImage, int srcL, int srcT, int srcR, int srcB, Image dstImage, int dstX, int dstY, int mipLevel) voidsetScissor(int x, int y, int width, int height) voidsetViewport(int x, int y, int width, int height) protected booleansubmit(QueueManager queueManager) protected voidBlocks the current thread and waits for GPU to finish outstanding works.Methods inherited from class icyllis.arc3d.engine.CommandBuffer
callFinishedCallbacks, copyBuffer, copyBufferToImage, copyImage, releaseResources, trackCommandBufferResource, trackResource, trackResource
-
Field Details
-
mCommandBuffer
protected final org.lwjgl.vulkan.VkCommandBuffer mCommandBuffer -
mIsRecording
protected boolean mIsRecording
-
-
Constructor Details
-
VulkanCommandBuffer
public VulkanCommandBuffer(org.lwjgl.vulkan.VkDevice device, long handle)
-
-
Method Details
-
beginRenderPass
public boolean beginRenderPass(RenderPassDesc renderPassDesc, FramebufferDesc framebufferDesc, Rect2ic renderPassBounds, float[] clearColors, float clearDepth, int clearStencil) Description copied from class:CommandBufferBegin render pass. If successful,CommandBuffer.endRenderPass()must be called.- Specified by:
beginRenderPassin classCommandBuffer- Parameters:
renderPassDesc- descriptor to create a render passframebufferDesc- descriptor to create a framebufferrenderPassBounds- content bounds of this render passclearColors- clear color for each color attachmentclearDepth- clear depthclearStencil- clear stencil (unsigned)- Returns:
- success or not
-
bindGraphicsPipeline
Description copied from class:CommandBufferBind graphics pipeline. Due to async compiling, it may fail. Render pass scope, caller must track the pipeline.- Specified by:
bindGraphicsPipelinein classCommandBuffer- Parameters:
graphicsPipeline- the pipeline object- Returns:
- success or not
-
setViewport
public void setViewport(int x, int y, int width, int height) Description copied from class:CommandBufferSet viewport, must be called afterCommandBuffer.beginRenderPass(icyllis.arc3d.engine.RenderPassDesc, icyllis.arc3d.engine.FramebufferDesc, icyllis.arc3d.core.Rect2ic, float[], float, int).- Specified by:
setViewportin classCommandBuffer
-
setScissor
public void setScissor(int x, int y, int width, int height) Description copied from class:CommandBufferSet scissor, must be called afterCommandBuffer.beginRenderPass(icyllis.arc3d.engine.RenderPassDesc, icyllis.arc3d.engine.FramebufferDesc, icyllis.arc3d.core.Rect2ic, float[], float, int).- Specified by:
setScissorin classCommandBuffer
-
bindIndexBuffer
Description copied from class:CommandBufferRender pass scope, caller must track the buffer.- Specified by:
bindIndexBufferin classCommandBuffer- Parameters:
indexType- seeEngine.IndexType
-
bindVertexBuffer
Description copied from class:CommandBufferRender pass scope, caller must track the buffer.- Specified by:
bindVertexBufferin classCommandBuffer
-
bindUniformBuffer
Description copied from class:CommandBufferRender pass scope, caller must track the buffer.- Specified by:
bindUniformBufferin classCommandBuffer
-
bindTextureSampler
Description copied from class:CommandBufferBind texture view and sampler to the same binding point (combined image sampler). Render pass scope, caller must track the image and sampler.- Specified by:
bindTextureSamplerin classCommandBuffer- Parameters:
binding- the binding indextexture- the texture imagesampler- the sampler stateswizzle- the swizzle of the texture view for shader read, seeSwizzle
-
draw
public void draw(int vertexCount, int baseVertex) Description copied from class:CommandBufferRecords a non-indexed draw to current command buffer. Render pass scope.- Specified by:
drawin classCommandBuffer- Parameters:
vertexCount- the number of vertices to drawbaseVertex- the index of the first vertex to draw
-
drawIndexed
public void drawIndexed(int indexCount, int baseIndex, int baseVertex) Description copied from class:CommandBufferRecords an indexed draw to current command buffer. For OpenGL ES, if base vertex is unavailable, gl_VertexID always begins at 0. Render pass scope.- Specified by:
drawIndexedin classCommandBuffer- Parameters:
indexCount- the number of vertices to drawbaseIndex- the base index within the index bufferbaseVertex- the value added to the vertex index before indexing into the vertex buffer
-
drawInstanced
public void drawInstanced(int instanceCount, int baseInstance, int vertexCount, int baseVertex) Description copied from class:CommandBufferRecords a non-indexed draw to current command buffer. For OpenGL, regardless of the baseInstance value, gl_InstanceID always begins at 0. Render pass scope.- Specified by:
drawInstancedin classCommandBuffer- Parameters:
instanceCount- the number of instances to drawbaseInstance- the instance ID of the first instance to drawvertexCount- the number of vertices to drawbaseVertex- the index of the first vertex to draw
-
drawIndexedInstanced
public void drawIndexedInstanced(int indexCount, int baseIndex, int instanceCount, int baseInstance, int baseVertex) Description copied from class:CommandBufferRecords an indexed draw to current command buffer. For OpenGL ES, if base vertex is unavailable, gl_VertexID always begins at 0. For OpenGL, regardless of the baseInstance value, gl_InstanceID always begins at 0. Render pass scope.- Specified by:
drawIndexedInstancedin classCommandBuffer- Parameters:
indexCount- the number of vertices to drawbaseIndex- the base index within the index bufferinstanceCount- the number of instances to drawbaseInstance- the instance ID of the first instance to drawbaseVertex- the value added to the vertex index before indexing into the vertex buffer
-
endRenderPass
public void endRenderPass()Description copied from class:CommandBufferEnd the current render pass.- Specified by:
endRenderPassin classCommandBuffer
-
onCopyBuffer
protected boolean onCopyBuffer(Buffer srcBuffer, Buffer dstBuffer, long srcOffset, long dstOffset, long size) - Specified by:
onCopyBufferin classCommandBuffer
-
onCopyBufferToImage
protected boolean onCopyBufferToImage(Buffer srcBuffer, Image dstImage, int srcColorType, int dstColorType, BufferImageCopyData[] copyData) - Specified by:
onCopyBufferToImagein classCommandBuffer
-
onCopyImage
protected boolean onCopyImage(Image srcImage, int srcL, int srcT, int srcR, int srcB, Image dstImage, int dstX, int dstY, int mipLevel) - Specified by:
onCopyImagein classCommandBuffer
-
begin
protected void begin()- Specified by:
beginin classCommandBuffer
-
submit
- Specified by:
submitin classCommandBuffer
-
checkFinishedAndReset
protected boolean checkFinishedAndReset()- Specified by:
checkFinishedAndResetin classCommandBuffer
-
waitUntilFinished
protected void waitUntilFinished()Description copied from class:CommandBufferBlocks the current thread and waits for GPU to finish outstanding works.- Specified by:
waitUntilFinishedin classCommandBuffer
-
bindVertexBuffers
public void bindVertexBuffers() -
isRecording
public boolean isRecording()
-