mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
metal: Improve shader debugging
Having the path to each shader is helpful when debugging the rendering pipeline. The render command encoder label is limited to just the filename of the shader, as the graphics debugging UI in Xcode doesn't handle long names very well. We don't encode the pass number into the string as the shaders can be organized in a graph, not just a linked list, so an indexed order can be misrepresenting the flow.
This commit is contained in:
parent
91caf28bfc
commit
b5cf9b639e
@ -939,6 +939,7 @@ typedef struct MTLALIGN(16)
|
||||
}
|
||||
|
||||
id<MTLCommandBuffer> cb = ctx.blitCommandBuffer;
|
||||
[cb pushDebugGroup:@"shaders"];
|
||||
|
||||
MTLRenderPassDescriptor *rpd = [MTLRenderPassDescriptor new];
|
||||
rpd.colorAttachments[0].loadAction = MTLLoadActionDontCare;
|
||||
@ -960,12 +961,11 @@ typedef struct MTLALIGN(16)
|
||||
rce = [cb renderCommandEncoderWithDescriptor:rpd];
|
||||
}
|
||||
|
||||
#if DEBUG && METAL_DEBUG
|
||||
rce.label = [NSString stringWithFormat:@"pass %d", i];
|
||||
#endif
|
||||
|
||||
[rce setRenderPipelineState:_engine.pass[i]._state];
|
||||
|
||||
NSURL *shaderPath = [NSURL fileURLWithPath:_engine.pass[i]._state.label];
|
||||
rce.label = shaderPath.lastPathComponent.stringByDeletingPathExtension;
|
||||
|
||||
_engine.pass[i].frame_count = (uint32_t)_frameCount;
|
||||
if (_shader->pass[i].frame_count_mod)
|
||||
_engine.pass[i].frame_count %= _shader->pass[i].frame_count_mod;
|
||||
@ -1037,6 +1037,8 @@ typedef struct MTLALIGN(16)
|
||||
_drawState = ViewDrawStateContext;
|
||||
else
|
||||
_drawState = ViewDrawStateAll;
|
||||
|
||||
[cb popDebugGroup];
|
||||
}
|
||||
|
||||
- (void)_updateRenderTargets
|
||||
@ -1181,6 +1183,9 @@ typedef struct MTLALIGN(16)
|
||||
config_file_t *conf = video_shader_read_preset(path.UTF8String);
|
||||
struct video_shader *shader = (struct video_shader *)calloc(1, sizeof(*shader));
|
||||
|
||||
settings_t *settings = config_get_ptr();
|
||||
NSString *shadersPath = [NSString stringWithFormat:@"%s/", settings->paths.directory_video_shader];
|
||||
|
||||
@try
|
||||
{
|
||||
unsigned i;
|
||||
@ -1256,7 +1261,9 @@ typedef struct MTLALIGN(16)
|
||||
vd.layouts[4].stepFunction = MTLVertexStepFunctionPerVertex;
|
||||
|
||||
MTLRenderPipelineDescriptor *psd = [MTLRenderPipelineDescriptor new];
|
||||
psd.label = [NSString stringWithFormat:@"pass %d", i];
|
||||
|
||||
psd.label = [[NSString stringWithUTF8String:shader->pass[i].source.path]
|
||||
stringByReplacingOccurrencesOfString:shadersPath withString:@""];
|
||||
|
||||
MTLRenderPipelineColorAttachmentDescriptor *ca = psd.colorAttachments[0];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user