mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-08 17:28:49 -10:00
gfx/drivers/metal: drop dead _toPrimitiveType helper
Companion to 1ee88d08de and 2711c42727 (the d3d and gl helpers).
MenuDisplay's private _toPrimitiveType: maps
GFX_DISPLAY_PRIM_TRIANGLESTRIP -> MTLPrimitiveTypeTriangleStrip
and falls through to MTLPrimitiveTypeTriangle for any other
input. Same dead-code argument: every gfx_display_ctx_draw_t in
the codebase sets prim_type to GFX_DISPLAY_PRIM_TRIANGLESTRIP
before invoking the draw path, so the fallthrough to
MTLPrimitiveTypeTriangle is unreachable.
Inline MTLPrimitiveTypeTriangleStrip at the single -drawPrimitives:
call site, drop the helper. Document at the call site that the
constant assumes TRIANGLESTRIP.
While here: note that the dead fallthrough returned
MTLPrimitiveTypeTriangle (a triangle list) rather than something
nonsensical, so unlike the d3d helpers this was not also a latent
bug -- just dead.
No behavioural change for any existing caller.
This commit is contained in:
1 parent
696efa0f3d
commit
6cd9ea6f0f
1 file changed
+7
-8
+7
-8
@@ -2197,13 +2197,6 @@ static const NSUInteger kConstantAlignment = 4;
|
||||
[_context resetScissorRect];
|
||||
}
|
||||
|
||||
- (MTLPrimitiveType)_toPrimitiveType:(enum gfx_display_prim_type)prim
|
||||
{
|
||||
if (prim == GFX_DISPLAY_PRIM_TRIANGLESTRIP)
|
||||
return MTLPrimitiveTypeTriangleStrip;
|
||||
return MTLPrimitiveTypeTriangle;
|
||||
}
|
||||
|
||||
- (void)drawPipeline:(gfx_display_ctx_draw_t *)draw
|
||||
{
|
||||
static struct video_coords blank_coords;
|
||||
@@ -2312,7 +2305,13 @@ static const NSUInteger kConstantAlignment = 4;
|
||||
[rce setVertexBytes:draw->backend_data length:draw->backend_data_size atIndex:BufferIndexUniforms];
|
||||
[rce setVertexBuffer:range.buffer offset:range.offset atIndex:BufferIndexPositions];
|
||||
[rce setFragmentBytes:draw->backend_data length:draw->backend_data_size atIndex:BufferIndexUniforms];
|
||||
[rce drawPrimitives:[self _toPrimitiveType:draw->prim_type] vertexStart:0 vertexCount:vertex_count];
|
||||
/* Every caller in the codebase sets draw->prim_type to
|
||||
* GFX_DISPLAY_PRIM_TRIANGLESTRIP, so the per-call mapping
|
||||
* to MTLPrimitiveType that used to live in a private
|
||||
* helper was dead. Hard-code MTLPrimitiveTypeTriangleStrip;
|
||||
* if a future caller passes TRIANGLES this will need to
|
||||
* grow back into a switch. */
|
||||
[rce drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:vertex_count];
|
||||
return;
|
||||
#endif
|
||||
default:
|
||||
|
||||
Reference in new issue
Block a user