I write an example that using offline render. using frame capture i can get fs invocations number of this offline render, but it is strange that the number is the result of multiplication of render target's width and height.
The example only writes four point on a 128x128 render target. I think this example is simple enough. Here is a piece of my code:
static const AAPLVertex triangleVertices[] =
{
// 2D positions, RGBA colors
{ { 0.5, -0.5 }, { 1, 0, 0, 1 } },
{ { -0.5, -0.5 }, { 0, 1, 0, 1 } },
{ { -0.5, 0.5 }, { 0, 0, 1, 1 } },
{ { 0.5, 0.5 }, { 0, 1, 0, 1 } },
};
id <MTLCommandBuffer> commandBuffer = [_commandQueue commandBuffer];
commandBuffer.label = @"Command Buffer";
id<MTLRenderCommandEncoder> renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:_renderToTextureRenderPassDescriptor];
renderEncoder.label = @"Offscreen Render Pass";
[renderEncoder pushDebugGroup:@"Offscreen Render Group"];
[renderEncoder setRenderPipelineState:_renderToTextureRenderPipeline];
[renderEncoder setVertexBytes:&triangleVertices length:sizeof(triangleVertices) atIndex:AAPLVertexInputIndexVertices];
[renderEncoder drawPrimitives:MTLPrimitiveTypePoint vertexStart:0 vertexCount:4];
[renderEncoder popDebugGroup];
[renderEncoder endEncoding];
I think the fs invocations number is 4, because when i change the fs code to set a fix red color to output, only the four point become red. however, the result of frame capture is the size of rt's size. it seen that the frame capture also calculates the render target fs.
fragment shader:
fragment float4 fragmentShader(RasterizerData in [[stage_in]])
{
// return in.color;
return vector_float4(1.0, 0.0, 0.0, 0.0);
}
anyone can help me distinguish if it is a wrong statistic of frame capture?