Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
5d3c6a3
Initial experiment with Tracy style instrumentation
robertosfield Dec 7, 2023
92442bc
Windows build fix
robertosfield Dec 7, 2023
a1e31cd
Created a vsg::Instrumentation base class
robertosfield Dec 7, 2023
9d7178a
Made vsg::Instrumentation a pure virtual base class and added command…
robertosfield Dec 7, 2023
46870fb
Added assignment of colours
robertosfield Dec 7, 2023
ab2f0be
Implemented a VulkanAnnotation version of vsg::Instrumentation to ena…
robertosfield Dec 7, 2023
ff6487d
Added instrumentation hooks to Viewer, RecordAndSubmitTask & CommandG…
robertosfield Dec 7, 2023
85f8938
Merge pull request #1052 from vsg-dev/Intrumentation
robertosfield Dec 7, 2023
6fece3f
Moved include to address Windows build error
robertosfield Dec 7, 2023
878a944
Ran clang-format
robertosfield Dec 8, 2023
0abb84d
Spelling fix
timoore Dec 8, 2023
a1acda3
Add rump API for initializing Tracy GPU profiling
timoore Dec 8, 2023
2abfa16
Merge branch 'Intrumentation' into Instrumentation
timoore Dec 8, 2023
2e820fd
Merge pull request #1053 from timoore/Instrumentation
robertosfield Dec 8, 2023
b7be59a
Added instrumentation support for TransferTask
robertosfield Dec 8, 2023
614be75
Moved the Instrumentation::init() call to the Viewer::compile().
robertosfield Dec 8, 2023
55fe521
Added support for signally the start and end of command buffer recording
robertosfield Dec 11, 2023
662f627
Added instrumentation of Bin
robertosfield Dec 14, 2023
0bdfc50
Added VertexIndexDraw, VertexDraw and Geometry to list of RecordTrave…
robertosfield Dec 15, 2023
b8513ae
Added Viewer::assignInstrumentation(..) method to help with setting u…
robertosfield Dec 15, 2023
1dff3d8
Added Instrumentation::enterFrame() and leaveFrame().
robertosfield Dec 16, 2023
b46f6ca
Build fix for Windows
robertosfield Dec 16, 2023
fb192ea
Replaced ref_ptr<> with reference
robertosfield Dec 16, 2023
b0b4814
Added VSG_MAX_INSTRUMENTATION_LEVEL cmake controlled #define for cont…
robertosfield Dec 16, 2023
239ec20
Added instrumentation laevel to marco usage
robertosfield Dec 17, 2023
9444521
Renamed instrumentation macros to better reflect that function
robertosfield Dec 17, 2023
4db307f
Added CPU/GPU_INSTRUMENTATION_L1, _L2, _L3 marcros
robertosfield Dec 17, 2023
f96580c
refined class naming and moved GpuAnnotation into it's own header/source
robertosfield Dec 17, 2023
7e5040d
Added header online TracyInstrumentation header to eanble use of Trac…
robertosfield Dec 17, 2023
862fdcf
Removed unneccessary include
robertosfield Dec 17, 2023
c94b532
Added an removal of TracyInstrumentation.h from the build_all_h to pr…
robertosfield Dec 17, 2023
f7fded5
Cleanup and ran clang-format
robertosfield Dec 18, 2023
b85e160
Removed debug message
robertosfield Dec 18, 2023
309dd9e
Implemented support for compiling with/out TRACY_ON_DEMAND enabled
robertosfield Dec 18, 2023
e9790c8
Added CommandBuffer instrumentation
robertosfield Dec 18, 2023
2605b93
Added instrumentation to CompileManager/CompileTraversal/Context
robertosfield Dec 18, 2023
6e74b09
Added vsg::Instrumentation support to DatabasePager
robertosfield Dec 18, 2023
2908031
Added support for duplicating Instrumentation when required to enable…
robertosfield Dec 19, 2023
2be17d6
Ran clang-format
robertosfield Dec 20, 2023
06b9aac
Fixed overrriding of locally assign Instrumentation when is not assigned
robertosfield Dec 20, 2023
76a8018
Added instumentation to vsg::Options
robertosfield Dec 20, 2023
b4b25ad
Added Instrumentation support to IO operations
robertosfield Dec 20, 2023
569ec13
Added timestamp calaibrartion extensions and prelimnary support in Tr…
robertosfield Dec 20, 2023
03d22b7
Removed debug messages
robertosfield Dec 20, 2023
5ff94ec
Added support for TRACY_ENABLE being defined/or not.
robertosfield Dec 20, 2023
0573619
Replaced Device* with ref_ptr<> to prevent Instrumentation not keepig…
robertosfield Dec 20, 2023
9d923ea
Removed debug messages
robertosfield Dec 20, 2023
3d346cf
Added Instrumentation::setThreadName(const std::string&) support.
robertosfield Dec 20, 2023
05834c5
Added name and colour entries for main operations
robertosfield Dec 21, 2023
2b86036
Fixed name
robertosfield Dec 21, 2023
5629cb4
Changed to using more efficient VertexIndexDraw
robertosfield Dec 21, 2023
ecf5884
Removed hardwired enabling of GpuAnnotation.
robertosfield Dec 21, 2023
bbf0206
Introduce a uint_color helper struct to make it easier to manage colo…
robertosfield Dec 21, 2023
ac7e1d5
Ran clang-format
robertosfield Dec 21, 2023
e9094ed
Added GpuAnnotation::labelType to hint which member of SourceLocation…
robertosfield Dec 21, 2023
7b2d7d5
Moved the #define COLOR to sit before the rest of the #define
robertosfield Dec 21, 2023
c733719
Added instrumentation of TileDatabase to RecordTraversal.
robertosfield Dec 21, 2023
ea899d3
Refined colours
robertosfield Dec 21, 2023
ced4238
Added more colour differentiation
robertosfield Dec 22, 2023
3859051
Added instrumentation to ViewDependentState
robertosfield Dec 22, 2023
3708b72
Resutrctured the TracyVkCollect call so it's done once per frame as t…
robertosfield Dec 22, 2023
dfd8316
Merge branch 'master' into Instrumentation
robertosfield Dec 27, 2023
8a4a6ad
Merge branch 'master' into Instrumentation
robertosfield Jan 2, 2024
b6a55c7
Merge branch 'master' into Instrumentation
robertosfield Jan 4, 2024
3644555
Updated version
robertosfield Jan 4, 2024
381ac20
Added const Object* to Instrumentation::enter()/leave() methods
robertosfield Jan 4, 2024
5b0ae00
Added explict
robertosfield Jan 4, 2024
91bb185
Merge branch 'master' into Instrumentation
robertosfield Jan 4, 2024
d47764b
Improved doxygen comments
robertosfield Jan 4, 2024
68cfc70
Merge branch 'Instrumentation' of https://github.com/vsg-dev/VulkanSc…
robertosfield Jan 4, 2024
d995cb4
Added enabledExtensions to vsg::Device and cleaned up placement of ex…
robertosfield Jan 5, 2024
5bbbac8
Changed to using the new Device::supportsDeviceExtensions(..)
robertosfield Jan 5, 2024
5f9deb2
Added vsg::InstrumentationNode
robertosfield Jan 8, 2024
91d36d5
Added InstrumentationNode support and warning fixes
robertosfield Jan 8, 2024
1b35733
Fixed copyright date
robertosfield Jan 8, 2024
8b16b36
Improved comment
robertosfield Jan 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.7)

project(vsg
VERSION 1.1.0
VERSION 1.1.1
DESCRIPTION "VulkanSceneGraph library"
LANGUAGES CXX
)
Expand Down Expand Up @@ -37,6 +37,9 @@ find_package(Vulkan ${Vulkan_MIN_VERSION} REQUIRED)

find_package(Threads REQUIRED)

# Set the instrumentation level to compile into sources
set(VSG_MAX_INSTRUMENTATION_LEVEL 1 CACHE STRING "Set the instrumentation level to build into the VSG ibrary, 0 for off, 1 coarse grained, 2 medium, 3 fine grained." )

# Enable/disable shader compilation support that pulls in glslang
set(VSG_SUPPORTS_ShaderCompiler 1 CACHE STRING "Optional shader compiler support, 0 for off, 1 for enabled." )
if (VSG_SUPPORTS_ShaderCompiler)
Expand Down
3 changes: 3 additions & 0 deletions cmake/build_all_h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ macro(BUILD_ALL_H)
file(GLOB RAYTRACING_HEADERS RELATIVE ${INCLUDE_DIR} ${INCLUDE_DIR}/vsg/raytracing/*.h )
file(GLOB MESHSHADERS_HEADERS RELATIVE ${INCLUDE_DIR} ${INCLUDE_DIR}/vsg/meshshaders/*.h )

# remove items that are inapprorpiate to include in all.h as they are optional have external dependencies not provided by the VSG itself.
list (REMOVE_ITEM UTILS_HEADERS "vsg/utils/TracyInstrumentation.h")

file(READ ${VSG_SOURCE_DIR}/cmake/header_license_preamble.txt ALL_H_CONTENTS)
APPEND_INCLUDES(ALL_H_CONTENTS CORE_HEADERS "// Core header files\n")
APPEND_INCLUDES(ALL_H_CONTENTS MATHS_HEADERS "// Maths header files\n")
Expand Down
3 changes: 3 additions & 0 deletions include/vsg/all.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/nodes/DepthSorted.h>
#include <vsg/nodes/Geometry.h>
#include <vsg/nodes/Group.h>
#include <vsg/nodes/InstrumentationNode.h>
#include <vsg/nodes/LOD.h>
#include <vsg/nodes/Light.h>
#include <vsg/nodes/MatrixTransform.h>
Expand Down Expand Up @@ -257,7 +258,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/utils/Builder.h>
#include <vsg/utils/CommandLine.h>
#include <vsg/utils/ComputeBounds.h>
#include <vsg/utils/GpuAnnotation.h>
#include <vsg/utils/GraphicsPipelineConfigurator.h>
#include <vsg/utils/Instrumentation.h>
#include <vsg/utils/Intersector.h>
#include <vsg/utils/LineSegmentIntersector.h>
#include <vsg/utils/LoadPagedLOD.h>
Expand Down
10 changes: 5 additions & 5 deletions include/vsg/app/CommandGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/core/Export.h>
#include <vsg/nodes/Bin.h>
#include <vsg/nodes/Group.h>
#include <vsg/utils/Instrumentation.h>
#include <vsg/vk/CommandBuffer.h>

namespace vsg
Expand All @@ -41,18 +42,17 @@ namespace vsg
uint32_t maxSlot = 2;
int submitOrder = 0;

inline ref_ptr<RecordTraversal> getOrCreateRecordTraversal()
{
if (!recordTraversal) recordTraversal = RecordTraversal::create(maxSlot);
return recordTraversal;
}
ref_ptr<RecordTraversal> getOrCreateRecordTraversal();

ref_ptr<RecordTraversal> recordTraversal;

virtual VkCommandBufferLevel level() const;
virtual void reset();
virtual void record(ref_ptr<RecordedCommandBuffers> recordedCommandBuffers, ref_ptr<FrameStamp> frameStamp = {}, ref_ptr<DatabasePager> databasePager = {});

/// hook for assigning Instrumentation to enable profiling of record traversal.
ref_ptr<Instrumentation> instrumentation;

protected:
virtual ~CommandGraph();

Expand Down
3 changes: 3 additions & 0 deletions include/vsg/app/CompileManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ namespace vsg
/// add a compile Context for all the Views assigned to a Viewer
void add(const Viewer& viewer, const ResourceRequirements& resourceRequirements = {});

/// assign Instrumentation to all CompileTraversal and their associated Context
void assignInstrumentation(ref_ptr<Instrumentation> in_instrumentation);

using ContextSelectionFunction = std::function<bool(vsg::Context&)>;

/// compile object
Expand Down
9 changes: 9 additions & 0 deletions include/vsg/app/CompileTraversal.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/state/BufferInfo.h>
#include <vsg/state/Descriptor.h>
#include <vsg/state/ResourceHints.h>
#include <vsg/utils/Instrumentation.h>
#include <vsg/vk/CommandPool.h>
#include <vsg/vk/Context.h>
#include <vsg/vk/DescriptorPool.h>
Expand All @@ -45,6 +46,9 @@ namespace vsg
/// list of Context that Vulkan objects should be compiled for.
std::list<ref_ptr<Context>> contexts;

/// Hook for assigning Instrumentation to enable profiling
ref_ptr<Instrumentation> instrumentation;

/// add a compile Context for device
void add(ref_ptr<Device> device, const ResourceRequirements& resourceRequirements = {});

Expand All @@ -60,6 +64,11 @@ namespace vsg
/// add a compile Context for all the Views assigned to a Viewer
void add(const Viewer& viewer, const ResourceRequirements& resourceRequirements = {});

/// assign Instrumentation to all Context
void assignInstrumentation(ref_ptr<Instrumentation> in_instrumentation);

Instrumentation* getInstrumentation() override { return instrumentation.get(); }

virtual bool record();
virtual void waitForCompletion();

Expand Down
7 changes: 7 additions & 0 deletions include/vsg/app/RecordAndSubmitTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/app/Window.h>
#include <vsg/io/DatabasePager.h>
#include <vsg/nodes/Group.h>
#include <vsg/utils/Instrumentation.h>
#include <vsg/vk/CommandBuffer.h>

namespace vsg
Expand Down Expand Up @@ -59,6 +60,12 @@ namespace vsg

ref_ptr<DatabasePager> databasePager;

/// hook for assigning Instrumentation to enable profiling of record traversal.
ref_ptr<Instrumentation> instrumentation;

/// Convenience method for assigning Instrumentation to the viewer and any associated objects.
void assignInstrumentation(ref_ptr<Instrumentation> in_instrumentation);

protected:
size_t _currentFrameIndex;
std::vector<size_t> _indices;
Expand Down
17 changes: 17 additions & 0 deletions include/vsg/app/RecordTraversal.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ namespace vsg
class DepthSorted;
class Transform;
class MatrixTransform;
class TileDatabase;
class VertexDraw;
class VertexIndexDraw;
class Geometry;
class Command;
class Commands;
class CommandBuffer;
Expand All @@ -53,6 +57,7 @@ namespace vsg
class SpotLight;
class CommandGraph;
class RecordedCommandBuffers;
class Instrumentation;

VSG_type_name(vsg::RecordTraversal);

Expand All @@ -77,6 +82,8 @@ namespace vsg
Mask traversalMask = MASK_ALL;
Mask overrideMask = MASK_OFF;

ref_ptr<Instrumentation> instrumentation;

/// Container for CommandBuffers that have been recorded in current frame
ref_ptr<RecordedCommandBuffers> recordedCommandBuffers;

Expand All @@ -102,11 +109,17 @@ namespace vsg
void apply(const QuadGroup& quadGroup);
void apply(const LOD& lod);
void apply(const PagedLOD& pagedLOD);
void apply(const TileDatabase& tileDatabase);
void apply(const CullGroup& cullGroup);
void apply(const CullNode& cullNode);
void apply(const DepthSorted& depthSorted);
void apply(const Switch& sw);

// leaf node
void apply(const VertexDraw& vid);
void apply(const VertexIndexDraw& vid);
void apply(const Geometry& vid);

// positional state
void apply(const Light& light);
void apply(const AmbientLight& light);
Expand All @@ -118,16 +131,20 @@ namespace vsg
void apply(const Transform& transform);
void apply(const MatrixTransform& mt);
void apply(const StateGroup& object);

// Commands
void apply(const Commands& commands);
void apply(const Command& command);

// Viewer level nodes
void apply(const Bin& bin);
void apply(const View& view);
void apply(const CommandGraph& commandGraph);

// clear the bins to record a new frame.
void clearBins();


protected:
virtual ~RecordTraversal();

Expand Down
3 changes: 3 additions & 0 deletions include/vsg/app/TransferTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ namespace vsg
ref_ptr<Queue> transferQueue;
ref_ptr<Semaphore> currentTransferCompletedSemaphore;

/// hook for assigning Instrumentation to enable profiling of record traversal.
ref_ptr<Instrumentation> instrumentation;

protected:
using OffsetBufferInfoMap = std::map<VkDeviceSize, ref_ptr<BufferInfo>>;
using BufferMap = std::map<ref_ptr<Buffer>, OffsetBufferInfoMap>;
Expand Down
7 changes: 7 additions & 0 deletions include/vsg/app/Viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/app/Window.h>
#include <vsg/threading/Barrier.h>
#include <vsg/threading/FrameBlock.h>
#include <vsg/utils/Instrumentation.h>

#include <map>

Expand Down Expand Up @@ -133,6 +134,12 @@ namespace vsg
/// Call vkDeviceWaitIdle on all the devices associated with this Viewer
virtual void deviceWaitIdle() const;

/// Hook for assigning Instrumentation to enable profiling of record traversal.
ref_ptr<Instrumentation> instrumentation;

/// Convenience method for assigning Instrumentation to the viewer and any associated objects.
void assignInstrumentation(ref_ptr<Instrumentation> in_instrumentation);

protected:
virtual ~Viewer();

Expand Down
5 changes: 5 additions & 0 deletions include/vsg/core/ConstVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace vsg
class DirectionalLight;
class PointLight;
class SpotLight;
class InstrumentationNode;

// forward declare text classes
class Text;
Expand Down Expand Up @@ -142,6 +143,7 @@ namespace vsg

// forward declare general classes
class FrameStamp;
class Instrumentation;

class VSG_DECLSPEC ConstVisitor : public Object
{
Expand All @@ -151,6 +153,8 @@ namespace vsg
Mask traversalMask = MASK_ALL;
Mask overrideMask = MASK_OFF;

virtual Instrumentation* getInstrumentation() { return nullptr; }

virtual void apply(const Object&);
virtual void apply(const Objects&);
virtual void apply(const External&);
Expand Down Expand Up @@ -302,6 +306,7 @@ namespace vsg
virtual void apply(const DirectionalLight&);
virtual void apply(const PointLight&);
virtual void apply(const SpotLight&);
virtual void apply(const InstrumentationNode&);

// text
virtual void apply(const Text&);
Expand Down
5 changes: 5 additions & 0 deletions include/vsg/core/Visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace vsg
class DirectionalLight;
class PointLight;
class SpotLight;
class InstrumentationNode;

// forward declare text classes
class Text;
Expand Down Expand Up @@ -142,6 +143,7 @@ namespace vsg

// forward declare general classes
class FrameStamp;
class Instrumentation;

class VSG_DECLSPEC Visitor : public Object
{
Expand All @@ -151,6 +153,8 @@ namespace vsg
Mask traversalMask = MASK_ALL;
Mask overrideMask = MASK_OFF;

virtual Instrumentation* getInstrumentation() { return nullptr; }

virtual void apply(Object&);
virtual void apply(Objects&);
virtual void apply(External&);
Expand Down Expand Up @@ -302,6 +306,7 @@ namespace vsg
virtual void apply(DirectionalLight&);
virtual void apply(PointLight&);
virtual void apply(SpotLight&);
virtual void apply(InstrumentationNode&);

// text
virtual void apply(Text&);
Expand Down
14 changes: 8 additions & 6 deletions include/vsg/io/DatabasePager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

</editor-fold> */

#include <vsg/app/CompileManager.h>
#include <vsg/core/Inherit.h>
#include <vsg/core/observer_ptr.h>
#include <vsg/io/FileSystem.h>
#include <vsg/io/Options.h>

#include <vsg/nodes/PagedLOD.h>

#include <vsg/threading/ActivityStatus.h>

#include <vsg/app/CompileManager.h>
#include <vsg/utils/Instrumentation.h>

#include <condition_variable>
#include <list>
Expand Down Expand Up @@ -96,8 +94,6 @@ namespace vsg

virtual void updateSceneGraph(FrameStamp* frameStamp, CompileResult& cr);

ref_ptr<const Options> options;

ref_ptr<CompileManager> compileManager;

std::atomic_uint numActiveRequests{0};
Expand All @@ -112,6 +108,12 @@ namespace vsg

ref_ptr<PagedLODContainer> pagedLODContainer;

/// Hook for assigning Instrumentation to enable profiling
ref_ptr<Instrumentation> instrumentation;

/// assign Instrumentation to all CompileTraversal and their associated Context
void assignInstrumentation(ref_ptr<Instrumentation> in_instrumentation);

protected:
virtual ~DatabasePager();

Expand Down
4 changes: 4 additions & 0 deletions include/vsg/io/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/io/FileSystem.h>
#include <vsg/maths/transform.h>
#include <vsg/state/StateCommand.h>
#include <vsg/utils/Instrumentation.h>

namespace vsg
{
Expand Down Expand Up @@ -96,6 +97,9 @@ namespace vsg
/// scene graph creation routines can use the inherited state information to avoid setting state in the local subgraph.
StateCommands inheritedState;

/// Hook for assigning Instrumentation to enable profiling of record traversal.
ref_ptr<Instrumentation> instrumentation;

protected:
virtual ~Options();
};
Expand Down
8 changes: 4 additions & 4 deletions include/vsg/maths/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,28 @@ namespace vsg
template<typename T>
constexpr t_vec4<T> linear_to_sRGB(const t_vec4<T>& src)
{
const T exponent = 2.2;
const T exponent = static_cast<T>(2.2);
return t_vec4<T>(std::pow(src.r, exponent), std::pow(src.g, exponent), std::pow(src.b, exponent), src.a);
}

template<typename T>
constexpr t_vec4<T> linear_to_sRGB(T r, T g, T b, T a)
{
const T exponent = 2.2;
const T exponent = static_cast<T>(2.2);
return t_vec4<T>(std::pow(r, exponent), std::pow(g, exponent), std::pow(b, exponent), a);
}

template<typename T>
constexpr t_vec4<T> sRGB_to_linear(const t_vec4<T>& src)
{
const T exponent = 1.0 / 2.2;
const T exponent = static_cast<T>(1.0 / 2.2);
return t_vec4<T>(std::pow(src.r, exponent), std::pow(src.g, exponent), std::pow(src.b, exponent), src.a);
}

template<typename T>
constexpr t_vec4<T> sRGB_to_linear(T r, T g, T b, T a)
{
const T exponent = 1.0 / 2.2;
const T exponent = static_cast<T>(1.0 / 2.2);
return t_vec4<T>(std::pow(r, exponent), std::pow(g, exponent), std::pow(b, exponent), a);
}

Expand Down
Loading