|
2153 | 2153 | // previous passes finish running, including this one. |
2154 | 2154 |
|
2155 | 2155 | // producer queue barrier |
2156 | | - [ptDevice->tRenderEncoder barrierAfterStages:MTLStageFragment |
2157 | | - beforeQueueStages:MTLStageVertex |
2158 | | - visibilityOptions:MTL4VisibilityOptionDevice]; |
| 2156 | + [ptDevice->tRenderEncoder barrierAfterStages:MTLStageFragment beforeQueueStages:MTLStageVertex visibilityOptions:MTL4VisibilityOptionDevice]; |
2159 | 2157 |
|
2160 | 2158 | [ptDevice->tRenderEncoder endEncoding]; |
| 2159 | + // [ptDevice->tRenderEncoder release]; |
| 2160 | + ptDevice->tRenderEncoder = nil; |
2161 | 2161 |
|
2162 | 2162 | id<MTL4RenderCommandEncoder> tNewRenderEncoder = [ptCmdBuffer->tCmdBuffer4 renderCommandEncoderWithDescriptor:ptMetalRenderPass->atRenderPassDescriptors[gptGraphics->uCurrentFrameIndex].sbptRenderPassDescriptor[ptDevice->uCurrentSubpass]]; |
2163 | 2163 | tNewRenderEncoder.label = @"subpass encoder"; |
|
2191 | 2191 |
|
2192 | 2192 | ptDevice->tCurrentRenderPassHandle = tPass; |
2193 | 2193 | ptDevice->uCurrentSubpass = 0; |
2194 | | - |
2195 | | - // Add a consumer queue barrier that blocks any dispatch stages in subsequent passes |
2196 | | - // in the queue, including this one, from running until blit stages in all |
2197 | | - // previous passes finish running, not counting this one. |
2198 | | - // [ptDevice->tRenderEncoder barrierAfterQueueStages:MTLStageAll |
2199 | | - // beforeStages:MTLStageAll |
2200 | | - // visibilityOptions:MTL4VisibilityOptionDevice]; |
2201 | 2194 | } |
2202 | 2195 |
|
2203 | 2196 | void |
|
2207 | 2200 |
|
2208 | 2201 | plRenderPass* ptRenderPass = pl_graphics_get_render_pass(ptDevice, ptDevice->tCurrentRenderPassHandle); |
2209 | 2202 | plMetalRenderPass* ptMetalRenderPass = &ptDevice->sbtRenderPassesHot[ptDevice->tCurrentRenderPassHandle.uIndex]; |
2210 | | - |
2211 | | - // Add a producer queue barrier that blocks any dispatch stages in subsequent passes |
2212 | | - // in the queue, not counting this one, from running until the blit stages in all |
2213 | | - // previous passes finish running, including this one. |
2214 | | - // [ptDevice->tRenderEncoder barrierAfterStages:MTLStageAll |
2215 | | - // beforeQueueStages:MTLStageAll |
2216 | | - // visibilityOptions:MTL4VisibilityOptionDevice]; |
2217 | | - |
2218 | 2203 | [ptDevice->tRenderEncoder endEncoding]; |
| 2204 | + // [ptDevice->tRenderEncoder release]; |
2219 | 2205 | ptDevice->tRenderEncoder = nil; |
2220 | 2206 | } |
2221 | 2207 |
|
|
2264 | 2250 | } |
2265 | 2251 | } |
2266 | 2252 |
|
2267 | | - [queue signalEvent:ptFrame->tFrameBoundaryEvent |
2268 | | - value:ptCmdBuffer->uEventValue]; |
| 2253 | + [queue signalEvent:ptFrame->tFrameBoundaryEvent value:ptCmdBuffer->uEventValue]; |
2269 | 2254 | } |
2270 | 2255 |
|
2271 | 2256 | void |
|
2286 | 2271 | void |
2287 | 2272 | pl_graphics_return_command_buffer(plCommandBuffer* ptCmdBuffer) |
2288 | 2273 | { |
| 2274 | + |
| 2275 | + ptCmdBuffer->tCmdBuffer4.label = nil; |
2289 | 2276 | [ptCmdBuffer->tCmdBuffer4 release]; |
2290 | 2277 | ptCmdBuffer->tCmdBuffer4 = nil; |
2291 | 2278 | ptCmdBuffer->ptNext = ptCmdBuffer->ptPool->ptCommandBufferFreeList; |
|
2297 | 2284 | { |
2298 | 2285 | plDevice* ptDevice = ptCmdBuffer->ptDevice; |
2299 | 2286 | ptDevice->tComputeEncoder = [ptCmdBuffer->tCmdBuffer4 computeCommandEncoder]; |
2300 | | - |
2301 | | - // Add a consumer queue barrier that blocks any dispatch stages in subsequent passes |
2302 | | - // in the queue, including this one, from running until blit stages in all |
2303 | | - // previous passes finish running, not counting this one. |
2304 | | - // [ptDevice->tComputeEncoder barrierAfterQueueStages:MTLStageAll |
2305 | | - // beforeStages:MTLStageAll |
2306 | | - // visibilityOptions:MTL4VisibilityOptionDevice]; |
2307 | 2287 | } |
2308 | 2288 |
|
2309 | 2289 | void |
2310 | 2290 | pl_graphics_end_compute_pass(plCommandBuffer* ptCmdBuffer) |
2311 | 2291 | { |
2312 | 2292 | plDevice* ptDevice = ptCmdBuffer->ptDevice; |
2313 | | - |
2314 | | - // Add a producer queue barrier that blocks any dispatch stages in subsequent passes |
2315 | | - // in the queue, not counting this one, from running until the blit stages in all |
2316 | | - // previous passes finish running, including this one. |
2317 | | - // [ptDevice->tComputeEncoder barrierAfterStages:MTLStageAll |
2318 | | - // beforeQueueStages:MTLStageAll |
2319 | | - // visibilityOptions:MTL4VisibilityOptionDevice]; |
2320 | | - |
2321 | 2293 | [ptDevice->tComputeEncoder endEncoding]; |
| 2294 | + // [ptDevice->tComputeEncoder release]; |
2322 | 2295 | ptDevice->tComputeEncoder = nil; |
2323 | 2296 | } |
2324 | 2297 |
|
|
2346 | 2319 | if(tDstStages & PL_PIPELINE_STAGE_VERTEX) tDstStage |= MTLStageVertex; |
2347 | 2320 | if(tDstStages & PL_PIPELINE_STAGE_FRAGMENT) tDstStage |= MTLStageFragment; |
2348 | 2321 |
|
2349 | | - [ptDevice->tComputeEncoder barrierAfterEncoderStages:tSrcStage |
2350 | | - beforeEncoderStages:tDstStage |
2351 | | - visibilityOptions:tOptions]; |
| 2322 | + [ptDevice->tComputeEncoder barrierAfterEncoderStages:tSrcStage beforeEncoderStages:tDstStage visibilityOptions:tOptions]; |
2352 | 2323 | } |
2353 | 2324 |
|
2354 | 2325 | void |
|
2375 | 2346 | if(tDstStages & PL_PIPELINE_STAGE_VERTEX) tDstStage |= MTLStageVertex; |
2376 | 2347 | if(tDstStages & PL_PIPELINE_STAGE_FRAGMENT) tDstStage |= MTLStageFragment; |
2377 | 2348 |
|
2378 | | - [ptDevice->tComputeEncoder barrierAfterQueueStages:tSrcStage |
2379 | | - beforeStages:tDstStage |
2380 | | - visibilityOptions:tOptions]; |
| 2349 | + [ptDevice->tComputeEncoder barrierAfterQueueStages:tSrcStage beforeStages:tDstStage visibilityOptions:tOptions]; |
2381 | 2350 | } |
2382 | 2351 |
|
2383 | 2352 | void |
|
2404 | 2373 | if(tDstStages & PL_PIPELINE_STAGE_VERTEX) tDstStage |= MTLStageVertex; |
2405 | 2374 | if(tDstStages & PL_PIPELINE_STAGE_FRAGMENT) tDstStage |= MTLStageFragment; |
2406 | 2375 |
|
2407 | | - [ptDevice->tComputeEncoder barrierAfterStages:tSrcStage |
2408 | | - beforeQueueStages:tDstStage |
2409 | | - visibilityOptions:tOptions]; |
| 2376 | + [ptDevice->tComputeEncoder barrierAfterStages:tSrcStage beforeQueueStages:tDstStage visibilityOptions:tOptions]; |
2410 | 2377 | } |
2411 | 2378 |
|
2412 | 2379 | void |
|
2549 | 2516 | indexCount:atDraws[i].uIndexCount |
2550 | 2517 | indexType:MTLIndexTypeUInt32 |
2551 | 2518 | indexBuffer:ptDevice->sbtBuffersHot[atDraws[i].tIndexBuffer.uIndex].tBuffer.gpuAddress + atDraws[i].uIndexStart * sizeof(uint32_t) |
2552 | | - indexBufferLength:atDraws[i].uIndexCount * sizeof(uint32_t) |
| 2519 | + indexBufferLength:ptDevice->sbtBuffersCold[atDraws[i].tIndexBuffer.uIndex].tMemoryRequirements.ulSize |
2553 | 2520 | instanceCount:atDraws[i].uInstanceCount |
2554 | 2521 | baseVertex:atDraws[i].uVertexStart |
2555 | 2522 | baseInstance:atDraws[i].uInstance |
|
2778 | 2745 | indexCount:uTriangleCount * 3 |
2779 | 2746 | indexType:MTLIndexTypeUInt32 |
2780 | 2747 | indexBuffer:ptDevice->sbtBuffersHot[tIndexBuffer.uIndex].tBuffer.gpuAddress + (uint64_t)uIndexBufferOffset * sizeof(uint32_t) |
2781 | | - indexBufferLength:uTriangleCount * 3 * sizeof(uint32_t) |
| 2748 | + indexBufferLength:ptDevice->sbtBuffersCold[tIndexBuffer.uIndex].tMemoryRequirements.ulSize |
2782 | 2749 | instanceCount:uInstanceCount |
2783 | 2750 | baseVertex:uVertexBufferOffset |
2784 | 2751 | baseInstance:uInstanceStart |
|
0 commit comments