Cocos2d-x
4.0.0
|
Store encoded commands for the GPU to execute. More...
Inherits CommandBuffer.
Public Member Functions | |
Constructor, Destructor and Initializers | |
CommandBufferMTL (DeviceMTL *deviceMTL) | |
~CommandBufferMTL () | |
![]() | |
void | setStencilReferenceValue (unsigned int value) |
Update both front and back stencil reference value. | |
void | setStencilReferenceValue (unsigned int frontRef, unsigned int backRef) |
Update stencil reference value. | |
Setters & Getters | |
virtual void | beginFrame () override |
Indicate the begining of a frame Wait until the inflight command buffer has completed its work. | |
virtual void | beginRenderPass (const RenderPassDescriptor &descriptor) override |
Create a MTLRenderCommandEncoder object for graphics rendering to an attachment in a RenderPassDescriptor. | |
virtual void | setRenderPipeline (RenderPipeline *renderPipeline) override |
Sets the current render pipeline state object. | |
virtual void | setViewport (int x, int y, unsigned int w, unsigned int h) override |
Fixed-function state. | |
virtual void | setCullMode (CullMode mode) override |
Fixed-function state. | |
virtual void | setWinding (Winding winding) override |
Fixed-function state. | |
virtual void | setVertexBuffer (Buffer *buffer) override |
Set a global buffer for all vertex shaders at the given bind point index 0. | |
virtual void | setProgramState (ProgramState *programState) override |
Set the uniform data at a given vertex and fragment buffer binding point 1 Set a global texture for all vertex and fragment shaders at the given bind location. | |
virtual void | setIndexBuffer (Buffer *buffer) override |
Set indexes when drawing primitives with index list @ buffer A buffer object that the device will read indexes from. | |
virtual void | drawArrays (PrimitiveType primitiveType, std::size_t start, std::size_t count) override |
Draw primitives without an index list. | |
virtual void | drawElements (PrimitiveType primitiveType, IndexFormat indexType, std::size_t count, std::size_t offset) override |
Draw primitives with an index list. | |
virtual void | endRenderPass () override |
Do some resources release. | |
virtual void | endFrame () override |
Present a drawable and commit a command buffer so it can be executed as soon as possible. | |
virtual void | setLineWidth (float lineWidth) override |
Fixed-function state. | |
virtual void | setScissorRect (bool isEnabled, float x, float y, float width, float height) override |
Fixed-function state. | |
virtual void | setDepthStencilState (DepthStencilState *depthStencilState) override |
Set depthStencil status. | |
virtual void | captureScreen (std::function< void(const unsigned char *, int, int)> callback) override |
Get a screen snapshot. | |
Additional Inherited Members | |
![]() | |
unsigned int | _ID |
object id, ScriptSupport need public _ID | |
int | _luaID |
Lua reference id. | |
void * | _scriptObject |
scriptObject, support for swift | |
bool | _rooted |
When true, it means that the object was already rooted. | |
Store encoded commands for the GPU to execute.
A command buffer stores encoded commands until the buffer is committed for execution by the GPU
CommandBufferMTL | ( | DeviceMTL * | deviceMTL | ) |
deviceMTL | The device for which MTLCommandQueue object was created. |
|
overridevirtual |
Indicate the begining of a frame Wait until the inflight command buffer has completed its work.
Then create MTLCommandBuffer and enqueue it to MTLCommandQueue. Then start schedule available MTLBuffer
Implements CommandBuffer.
|
overridevirtual |
Create a MTLRenderCommandEncoder object for graphics rendering to an attachment in a RenderPassDescriptor.
MTLRenderCommandEncoder is cached if current RenderPassDescriptor is identical to previous one.
descriptor | Specifies a group of render targets that hold the results of a render pass. |
Implements CommandBuffer.
|
overridevirtual |
Sets the current render pipeline state object.
renderPipeline | An object that contains the graphics functions and configuration state used in a render pass. |
Implements CommandBuffer.
|
overridevirtual |
Fixed-function state.
x | The x coordinate of the upper-left corner of the viewport. |
y | The y coordinate of the upper-left corner of the viewport. |
w | The width of the viewport, in pixels. |
h | The height of the viewport, in pixels. |
Implements CommandBuffer.
|
overridevirtual |
Fixed-function state.
mode | Controls if primitives are culled when front facing, back facing, or not culled at all. |
Implements CommandBuffer.
|
overridevirtual |
Fixed-function state.
winding | The winding order of front-facing primitives. |
Implements CommandBuffer.
|
overridevirtual |
Set a global buffer for all vertex shaders at the given bind point index 0.
buffer | The buffer to set in the buffer argument table. |
Implements CommandBuffer.
|
overridevirtual |
Set the uniform data at a given vertex and fragment buffer binding point 1 Set a global texture for all vertex and fragment shaders at the given bind location.
programState | A programState object that hold the uniform and texture data. |
Implements CommandBuffer.
|
overridevirtual |
Set indexes when drawing primitives with index list @ buffer A buffer object that the device will read indexes from.
@ see drawElements(PrimitiveType primitiveType, IndexFormat indexType, unsigned int count, unsigned int offset)
Implements CommandBuffer.
|
overridevirtual |
Draw primitives without an index list.
primitiveType | The type of primitives that elements are assembled into. |
start | For each instance, the first index to draw |
count | For each instance, the number of indexes to draw |
drawElements(PrimitiveType primitiveType, IndexFormat indexType, unsigned int count, unsigned int offset)
Implements CommandBuffer.
|
overridevirtual |
Draw primitives with an index list.
primitiveType | The type of primitives that elements are assembled into. |
indexType | The type if indexes, either 16 bit integer or 32 bit integer. |
count | The number of indexes to read from the index buffer for each instance. |
offset | Byte offset within indexBuffer to start reading indexes from. |
setIndexBuffer(Buffer* buffer)
drawArrays(PrimitiveType primitiveType, unsigned int start, unsigned int count)
Implements CommandBuffer.
|
overridevirtual |
Fixed-function state.
lineWidth | Specifies the width of rasterized lines. |
Implements CommandBuffer.
|
overridevirtual |
Fixed-function state.
x,y | Specifies the lower left corner of the scissor box |
wdith | Specifies the width of the scissor box |
height | Specifies the height of the scissor box |
Implements CommandBuffer.
|
overridevirtual |
Set depthStencil status.
depthStencilState | Specifies the depth and stencil status |
Implements CommandBuffer.
|
overridevirtual |
Get a screen snapshot.
callback | A callback to deal with screen snapshot image. |
Implements CommandBuffer.