8#ifndef GrMtlRenderCommandEncoder_DEFINED
9#define GrMtlRenderCommandEncoder_DEFINED
21#import <Metal/Metal.h>
30 static std::unique_ptr<GrMtlRenderCommandEncoder>
Make(id<MTLRenderCommandEncoder>
encoder) {
49 if (fCurrentRenderPipelineState != pso) {
51 fCurrentRenderPipelineState = pso;
56 if (fCurrentTriangleFillMode != fillMode) {
58 fCurrentTriangleFillMode = fillMode;
71 if (@available(macOS 10.11, iOS 8.3, tvOS 9.0, *)) {
72 if (fCurrentVertexBuffer[index] ==
buffer) {
77 if (fCurrentVertexBuffer[index] !=
buffer || fCurrentVertexOffset[index] !=
offset) {
81 fCurrentVertexBuffer[index] =
buffer;
82 fCurrentVertexOffset[index] =
offset;
87 if (fCurrentVertexOffset[index] !=
offset) {
90 fCurrentVertexOffset[index] =
offset;
95 if (@available(macOS 10.11, iOS 8.3, tvOS 9.0, *)) {
96 if (fCurrentFragmentBuffer[index] ==
buffer) {
101 if (fCurrentFragmentBuffer[index] !=
buffer || fCurrentFragmentOffset[index] !=
offset) {
105 fCurrentFragmentBuffer[index] =
buffer;
106 fCurrentFragmentOffset[index] =
offset;
111 if (fCurrentFragmentOffset[index] !=
offset) {
114 fCurrentFragmentOffset[index] =
offset;
133 if (fCurrentTexture[index] !=
texture) {
136 fCurrentTexture[index] =
texture;
141 if (fCurrentSampler[index] != sampler) {
144 fCurrentSampler[index] = sampler;
149 [fCommandEncoder setBlendColorRed: blendConst.
fR
152 alpha: blendConst.
fA];
156 uint32_t backReferenceValue)
159 setStencilFrontReferenceValue:frontReferenceValue
160 backReferenceValue:backReferenceValue];
166 if (depthStencilState != fCurrentDepthStencilState) {
168 fCurrentDepthStencilState = depthStencilState;
173 if (fCurrentScissorRect.x != scissorRect.x ||
174 fCurrentScissorRect.y != scissorRect.y ||
175 fCurrentScissorRect.width != scissorRect.width ||
176 fCurrentScissorRect.height != scissorRect.height) {
178 fCurrentScissorRect = scissorRect;
183 NSUInteger vertexCount) {
185 vertexStart:vertexStart
186 vertexCount:vertexCount];
189 NSUInteger vertexCount, NSUInteger instanceCount,
190 NSUInteger baseInstance)
193 vertexStart:vertexStart
194 vertexCount:vertexCount
195 instanceCount:instanceCount
196 baseInstance:baseInstance];
198 void drawPrimitives(MTLPrimitiveType primitiveType, id<MTLBuffer> indirectBuffer,
199 NSUInteger indirectBufferOffset)
202 indirectBuffer:indirectBuffer
203 indirectBufferOffset:indirectBufferOffset];
207 MTLIndexType indexType, id<MTLBuffer> indexBuffer,
208 NSUInteger indexBufferOffset) {
210 indexCount:indexCount
212 indexBuffer:indexBuffer
213 indexBufferOffset:indexBufferOffset];
216 MTLIndexType indexType, id<MTLBuffer> indexBuffer,
217 NSUInteger indexBufferOffset,
218 NSUInteger instanceCount,
219 NSInteger baseVertex,
220 NSUInteger baseInstance)
223 indexCount:indexCount
225 indexBuffer:indexBuffer
226 indexBufferOffset:indexBufferOffset
227 instanceCount:instanceCount
228 baseVertex:baseVertex
229 baseInstance:baseInstance];
232 MTLIndexType indexType, id<MTLBuffer> indexBuffer,
233 NSUInteger indexBufferOffset, id<MTLBuffer> indirectBuffer,
234 NSUInteger indirectBufferOffset)
238 indexBuffer:indexBuffer
239 indexBufferOffset:indexBufferOffset
240 indirectBuffer:indirectBuffer
241 indirectBufferOffset:indirectBufferOffset];
252 id<MTLRenderCommandEncoder> fCommandEncoder = nil;
256 static const int kMaxSamplers = 16;
260 static const int kMaxTextures = kMaxSamplers;
262 __weak id<MTLRenderPipelineState> fCurrentRenderPipelineState = nil;
263 __weak id<MTLDepthStencilState> fCurrentDepthStencilState = nil;
268 __weak id<MTLTexture> fCurrentTexture[kMaxTextures];
270 MTLScissorRect fCurrentScissorRect = { 0, 0, 0, 0 };
271 MTLTriangleFillMode fCurrentTriangleFillMode = (MTLTriangleFillMode)-1;
#define SK_API_AVAILABLE(...)
void drawPrimitives(MTLPrimitiveType primitiveType, NSUInteger vertexStart, NSUInteger vertexCount)
void setFragmentBufferOffset(NSUInteger offset, NSUInteger index) SK_API_AVAILABLE(macos(10.11)
void drawPrimitives(MTLPrimitiveType primitiveType, id< MTLBuffer > indirectBuffer, NSUInteger indirectBufferOffset) SK_API_AVAILABLE(macos(10.11)
static std::unique_ptr< GrMtlRenderCommandEncoder > Make(id< MTLRenderCommandEncoder > encoder)
void setDepthStencilState(id< MTLDepthStencilState > depthStencilState)
void setVertexBufferOffset(NSUInteger offset, NSUInteger index) SK_API_AVAILABLE(macos(10.11)
void setFragmentBuffer(id< MTLBuffer > buffer, NSUInteger offset, NSUInteger index)
void setBlendColor(SkPMColor4f blendConst)
void pushDebugGroup(NSString *string)
void drawIndexedPrimitives(MTLPrimitiveType primitiveType, NSUInteger indexCount, MTLIndexType indexType, id< MTLBuffer > indexBuffer, NSUInteger indexBufferOffset, NSUInteger instanceCount, NSInteger baseVertex, NSUInteger baseInstance) SK_API_AVAILABLE(macos(10.11)
void setFragmentBytes(const void *bytes, NSUInteger length, NSUInteger index) SK_API_AVAILABLE(macos(10.11)
void insertDebugSignpost(NSString *string)
void setFragmentTexture(id< MTLTexture > texture, NSUInteger index)
void drawIndexedPrimitives(MTLPrimitiveType primitiveType, NSUInteger indexCount, MTLIndexType indexType, id< MTLBuffer > indexBuffer, NSUInteger indexBufferOffset)
void drawIndexedPrimitives(MTLPrimitiveType primitiveType, MTLIndexType indexType, id< MTLBuffer > indexBuffer, NSUInteger indexBufferOffset, id< MTLBuffer > indirectBuffer, NSUInteger indirectBufferOffset) SK_API_AVAILABLE(macos(10.11)
void setVertexBytes(const void *bytes, NSUInteger length, NSUInteger index) SK_API_AVAILABLE(macos(10.11)
void setScissorRect(const MTLScissorRect &scissorRect)
void setFragmentSamplerState(GrMtlSampler *sampler, NSUInteger index)
void setViewport(const MTLViewport &viewport)
void setTriangleFillMode(MTLTriangleFillMode fillMode)
void setRenderPipelineState(id< MTLRenderPipelineState > pso)
void setVertexBuffer(id< MTLBuffer > buffer, NSUInteger offset, NSUInteger index)
void setStencilReferenceValue(uint32_t referenceValue)
void setFrontFacingWinding(MTLWinding winding)
void drawPrimitives(MTLPrimitiveType primitiveType, NSUInteger vertexStart, NSUInteger vertexCount, NSUInteger instanceCount, NSUInteger baseInstance) SK_API_AVAILABLE(macos(10.11)
void setLabel(NSString *label)
void setStencilFrontBackReferenceValues(uint32_t frontReferenceValue, uint32_t backReferenceValue) SK_API_AVAILABLE(macos(10.11)
id< MTLSamplerState > mtlSampler() const
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer