Skip to content

Commit 363b5cd

Browse files
corporatesharkmeta-codesync[bot]
authored andcommitted
igl | Add Tracy profiler markers to Shader
Reviewed By: rudybear Differential Revision: D115179590 fbshipit-source-id: 77a2f02a3284ba100fd603a9891a4cc851e1a800
1 parent e127682 commit 363b5cd

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/igl/Shader.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <cstring>
1111
#include <type_traits>
1212
#include <igl/IGLSafeC.h>
13+
#include <igl/Macros.h>
1314

1415
static_assert(sizeof(igl::ShaderCompilerOptions) == 2);
1516
static_assert(std::is_trivially_copyable_v<igl::ShaderCompilerOptions>);
@@ -121,6 +122,7 @@ bool ShaderCompilerOptions::operator!=(const ShaderCompilerOptions& other) const
121122
FunctionConstantValues& FunctionConstantValues::setConstantValue(uint8_t index,
122123
ConstantValueType type,
123124
const void* IGL_NONNULL value) {
125+
IGL_PROFILER_FUNCTION();
124126
IGL_DEBUG_ASSERT(type != ConstantValueType::Invalid);
125127
IGL_DEBUG_ASSERT(value);
126128
const size_t dataSize = getConstantValueSize(type);
@@ -228,6 +230,7 @@ bool ShaderModuleDesc::operator!=(const ShaderModuleDesc& other) const {
228230
ShaderLibraryDesc ShaderLibraryDesc::fromStringInput(const char* IGL_NONNULL librarySource,
229231
std::vector<ShaderModuleInfo> moduleInfo,
230232
std::string libraryDebugName) {
233+
IGL_PROFILER_FUNCTION();
231234
ShaderLibraryDesc libraryDesc;
232235
libraryDesc.input.type = ShaderInputType::String;
233236
libraryDesc.input.source = librarySource;
@@ -244,6 +247,7 @@ ShaderLibraryDesc ShaderLibraryDesc::fromBinaryInput(const void* IGL_NONNULL lib
244247
size_t libraryDataLength,
245248
std::vector<ShaderModuleInfo> moduleInfo,
246249
std::string libraryDebugName) {
250+
IGL_PROFILER_FUNCTION();
247251
ShaderLibraryDesc libraryDesc;
248252
libraryDesc.input.type = ShaderInputType::Binary;
249253
libraryDesc.input.data = libraryData;
@@ -275,6 +279,7 @@ IShaderLibrary::IShaderLibrary(std::vector<std::shared_ptr<IShaderModule>> modul
275279
modules_(std::move(modules)) {}
276280

277281
std::shared_ptr<IShaderModule> IShaderLibrary::getShaderModule(const std::string& entryPoint) {
282+
IGL_PROFILER_FUNCTION();
278283
for (const auto& sm : modules_) {
279284
if (sm && sm->info().entryPoint == entryPoint) {
280285
return sm;
@@ -285,6 +290,7 @@ std::shared_ptr<IShaderModule> IShaderLibrary::getShaderModule(const std::string
285290

286291
std::shared_ptr<IShaderModule> IShaderLibrary::getShaderModule(ShaderStage stage,
287292
const std::string& entryPoint) {
293+
IGL_PROFILER_FUNCTION();
288294
for (const auto& sm : modules_) {
289295
if (sm) {
290296
const auto& info = sm->info();
@@ -299,6 +305,7 @@ std::shared_ptr<IShaderModule> IShaderLibrary::getShaderModule(ShaderStage stage
299305
ShaderStagesDesc ShaderStagesDesc::fromRenderModules(
300306
std::shared_ptr<IShaderModule> vertexModule,
301307
std::shared_ptr<IShaderModule> fragmentModule) {
308+
IGL_PROFILER_FUNCTION();
302309
std::string debugName = (vertexModule ? vertexModule->info().debugName : std::string()) + ", " +
303310
(fragmentModule ? fragmentModule->info().debugName : std::string());
304311
return ShaderStagesDesc{
@@ -313,6 +320,7 @@ ShaderStagesDesc ShaderStagesDesc::fromMeshRenderModules(
313320
std::shared_ptr<IShaderModule> taskModule,
314321
std::shared_ptr<IShaderModule> meshModule,
315322
std::shared_ptr<IShaderModule> fragmentModule) {
323+
IGL_PROFILER_FUNCTION();
316324
std::string debugName = (taskModule ? taskModule->info().debugName : std::string()) + ", " +
317325
(meshModule ? meshModule->info().debugName : std::string()) + ", " +
318326
(fragmentModule ? fragmentModule->info().debugName : std::string());
@@ -326,6 +334,7 @@ ShaderStagesDesc ShaderStagesDesc::fromMeshRenderModules(
326334
}
327335

328336
ShaderStagesDesc ShaderStagesDesc::fromComputeModule(std::shared_ptr<IShaderModule> computeModule) {
337+
IGL_PROFILER_FUNCTION();
329338
std::string debugName = computeModule ? computeModule->info().debugName : "igl/Shader.cpp";
330339
return ShaderStagesDesc{
331340
.computeModule = std::move(computeModule),

0 commit comments

Comments
 (0)