Skip to content

Commit

Permalink
[api,mtl] add debug name to compute_pipeline_info
Browse files Browse the repository at this point in the history
  • Loading branch information
dBagrat authored Dec 17, 2024
1 parent 264ee99 commit 626a489
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/nicegraf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,7 @@ typedef struct ngf_compute_pipeline_info {
ngf_shader_stage shader_stage; /**< The (only) stage for this pipeline. */
const ngf_specialization_info*
spec_info; /**< Specifies the value of specialization consts used by this pipeline. */
const char* debug_name;
} ngf_compute_pipeline_info;

/**
Expand Down
11 changes: 10 additions & 1 deletion source/ngf-mtl/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1446,9 +1446,18 @@ ngf_error ngf_create_compute_pipeline(
info->shader_stage->entry_point_name.c_str(),
func_const_values.get());
if (!function) { return NGF_ERROR_OBJECT_CREATION_FAILED; }

ngf_id<MTL::ComputePipelineDescriptor> mtl_compute_desc = id_default;
mtl_compute_desc->setComputeFunction(function.get());

if (info->debug_name != nullptr) {
mtl_compute_desc->setLabel(NS::String::string(info->debug_name, NS::UTF8StringEncoding));
}

NS::Error* err = nullptr;
ngf_id<MTL::ComputePipelineState> computePSO =
CURRENT_CONTEXT->device->newComputePipelineState(function.get(), &err);
CURRENT_CONTEXT->device->newComputePipelineState(mtl_compute_desc.get(), MTL::PipelineOptionNone, nullptr, &err);

if (err) {
NGFI_DIAG_ERROR(err->localizedDescription()->utf8String());
return NGF_ERROR_OBJECT_CREATION_FAILED;
Expand Down

0 comments on commit 626a489

Please sign in to comment.