Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ include(CoinCMakeUtilities)

option(COIN_BUILD_SHARED_LIBS "Build shared library when ON (default), static when OFF." ON)
option(COIN_BUILD_TESTS "Build unit tests when ON (default), skips them when OFF." ON)
option(COIN_BUILD_BENCHMARKS
"Build deterministic renderer benchmarks and stress tests with COIN_BUILD_TESTS." OFF)
option(COIN_BUILD_VISUAL_TESTS "Enable visual regression test tooling and CLI helpers." OFF)
option(COIN_FETCH_TEST_DEPENDENCIES
"Fetch missing test-only dependencies from pinned upstream sources." OFF)
Expand Down Expand Up @@ -174,6 +176,7 @@ cmake_dependent_option(COIN_DEBUG_CHECK_THREAD "Enable thread check in several c
report_prepare(
COIN_BUILD_SHARED_LIBS
COIN_BUILD_TESTS
COIN_BUILD_BENCHMARKS
COIN_FETCH_TEST_DEPENDENCIES
COIN_BUILD_VISUAL_TESTS
COIN_BUILD_DOCUMENTATION
Expand Down
37 changes: 37 additions & 0 deletions include/Inventor/SoRenderManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,38 @@ class COIN_DLL_API SoRenderManager {
SbBool rendered;
};

/*! Optional CPU timings for the most recent retained render and pick.

Timing is disabled by default. When enabled, the manager records coarse
orchestration phases without changing backend behavior. A zero duration
means that the phase did not run, for example when a pick reused its
existing pick buffer.
*/
struct RenderPhaseStatistics {
uint64_t drawListConstructionNanoseconds = 0;
uint64_t drawListPrimitiveGenerationNanoseconds = 0;
uint64_t drawListGeometryPackingNanoseconds = 0;
uint64_t drawListCommandEmissionNanoseconds = 0;
uint64_t planConstructionNanoseconds = 0;
uint64_t backendSubmissionNanoseconds = 0;
uint64_t backendFrameSetupNanoseconds = 0;
uint64_t backendResourcePreparationNanoseconds = 0;
uint64_t backendCommandExecutionNanoseconds = 0;
uint64_t backendSelectionNanoseconds = 0;
uint64_t pickPlanConstructionNanoseconds = 0;
uint64_t pickBufferUpdateNanoseconds = 0;
uint64_t pickQueryNanoseconds = 0;
uint64_t pickResultResolutionNanoseconds = 0;
uint64_t backendPickTargetPreparationNanoseconds = 0;
uint64_t backendPickTargetRenderingNanoseconds = 0;
uint64_t backendPickDepthRenderingNanoseconds = 0;
uint64_t backendPickDepthPeelingNanoseconds = 0;
uint64_t backendPickReadbackNanoseconds = 0;
uint64_t backendPickHitProcessingNanoseconds = 0;
uint64_t backendPickTargetRestoreNanoseconds = 0;
uint64_t pickBufferRefreshes = 0;
};

class COIN_DLL_API Superimposition {
public:
enum StateFlags {
Expand Down Expand Up @@ -264,6 +296,11 @@ class COIN_DLL_API SoRenderManager {
SbBool isRenderPipelineAvailable(RenderPipeline pipeline) const;
const RenderResult & getLastRenderResult(void) const;

//! Enable coarse retained-renderer CPU timing for diagnostics.
void setRenderPhaseTimingEnabled(SbBool enabled);
SbBool isRenderPhaseTimingEnabled(void) const;
RenderPhaseStatistics getRenderPhaseStatistics(void) const;

/*! Return the closest renderer-neutral scene hit. The caller owns result. */
SbBool pickClosest(int x, int y, int radius, SoPickedPoint *& result);
/*! Return front-to-back renderer-neutral scene hits around a cursor. */
Expand Down
13 changes: 13 additions & 0 deletions include/Inventor/actions/SoIRRenderAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ class COIN_DLL_API SoIRRenderAction : public SoAction {
SO_ACTION_HEADER(SoIRRenderAction);

public:
struct ConstructionStatistics {
uint64_t primitiveGenerationNanoseconds = 0;
uint64_t geometryPackingNanoseconds = 0;
uint64_t commandEmissionNanoseconds = 0;
};

/*! Camera state policy used when starting a root traversal. */
enum class CameraPolicy {
//! Initialize the traversal from the camera configured on this action.
Expand Down Expand Up @@ -160,6 +166,13 @@ class COIN_DLL_API SoIRRenderAction : public SoAction {
void popPrimitiveCollector(PrimitiveCollector * collector);
//! Return the currently active primitive collector, or NULL.
PrimitiveCollector * getActivePrimitiveCollector(void) const;
//! Enable intrusive construction attribution for benchmark diagnostics.
void setConstructionTimingEnabled(SbBool enabled);
SbBool isConstructionTimingEnabled() const;
const ConstructionStatistics & getConstructionStatistics() const;
void recordPrimitiveGenerationNanoseconds(uint64_t nanoseconds);
void recordGeometryPackingNanoseconds(uint64_t nanoseconds);
void recordCommandEmissionNanoseconds(uint64_t nanoseconds);

protected:
virtual void beginTraversal(SoNode * node) override;
Expand Down
27 changes: 27 additions & 0 deletions include/Inventor/system/gl-fallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@
#ifndef GL_COLOR_ATTACHMENT0_EXT
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
#endif
#ifndef GL_COLOR_ATTACHMENT0
#define GL_COLOR_ATTACHMENT0 0x8CE0
#endif

#ifndef GL_COLOR_TABLE_WIDTH
#define GL_COLOR_TABLE_WIDTH 0x80D9
Expand Down Expand Up @@ -219,6 +222,9 @@
#ifndef GL_DEPTH_ATTACHMENT_EXT
#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
#endif
#ifndef GL_DEPTH_ATTACHMENT
#define GL_DEPTH_ATTACHMENT 0x8D00
#endif

#ifndef GL_DEPTH_COMPONENT24
#define GL_DEPTH_COMPONENT24 0x81A6
Expand Down Expand Up @@ -413,10 +419,22 @@
#ifndef GL_FRAMEBUFFER_COMPLETE_EXT
#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
#endif
#ifndef GL_FRAMEBUFFER_COMPLETE
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
#endif

#ifndef GL_FRAMEBUFFER_EXT
#define GL_FRAMEBUFFER_EXT 0x8D40
#endif
#ifndef GL_FRAMEBUFFER
#define GL_FRAMEBUFFER 0x8D40
#endif
#ifndef GL_READ_FRAMEBUFFER
#define GL_READ_FRAMEBUFFER 0x8CA8
#endif
#ifndef GL_DRAW_FRAMEBUFFER
#define GL_DRAW_FRAMEBUFFER 0x8CA9
#endif

#ifndef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
Expand Down Expand Up @@ -573,6 +591,9 @@
#ifndef GL_RENDERBUFFER_EXT
#define GL_RENDERBUFFER_EXT 0x8D41
#endif
#ifndef GL_RENDERBUFFER
#define GL_RENDERBUFFER 0x8D41
#endif

#ifndef GL_RGB16F_ARB
#define GL_RGB16F_ARB 0x881B
Expand Down Expand Up @@ -709,6 +730,12 @@
#ifndef GL_PACK_IMAGE_HEIGHT
#define GL_PACK_IMAGE_HEIGHT 0x806C
#endif
#ifndef GL_PIXEL_PACK_BUFFER
#define GL_PIXEL_PACK_BUFFER 0x88EB
#endif
#ifndef GL_PIXEL_PACK_BUFFER_BINDING
#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
#endif

#ifndef GL_PACK_SKIP_IMAGES
#define GL_PACK_SKIP_IMAGES 0x806B
Expand Down
42 changes: 42 additions & 0 deletions src/actions/SoIRRenderAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class SoIRRenderActionP {
SoIRBuffer geometryPool;
std::vector<TextureStorage> textureStorage;
SbList<SoIRRenderAction::PrimitiveCollector *> collectorStack;
bool constructionTimingEnabled = false;
SoIRRenderAction::ConstructionStatistics constructionStatistics;
};

#define PRIVATE(obj) (obj->pimpl)
Expand Down Expand Up @@ -416,6 +418,45 @@ SoIRRenderAction::getActivePrimitiveCollector(void) const
return PRIVATE(this)->collectorStack[count - 1];
}

void
SoIRRenderAction::setConstructionTimingEnabled(const SbBool enabled)
{
PRIVATE(this)->constructionTimingEnabled = enabled != FALSE;
}

SbBool
SoIRRenderAction::isConstructionTimingEnabled() const
{
return PRIVATE(this)->constructionTimingEnabled ? TRUE : FALSE;
}

const SoIRRenderAction::ConstructionStatistics &
SoIRRenderAction::getConstructionStatistics() const
{
return PRIVATE(this)->constructionStatistics;
}

void
SoIRRenderAction::recordPrimitiveGenerationNanoseconds(uint64_t nanoseconds)
{
PRIVATE(this)->constructionStatistics.primitiveGenerationNanoseconds +=
nanoseconds;
}

void
SoIRRenderAction::recordGeometryPackingNanoseconds(uint64_t nanoseconds)
{
PRIVATE(this)->constructionStatistics.geometryPackingNanoseconds +=
nanoseconds;
}

void
SoIRRenderAction::recordCommandEmissionNanoseconds(uint64_t nanoseconds)
{
PRIVATE(this)->constructionStatistics.commandEmissionNanoseconds +=
nanoseconds;
}

void *
SoIRRenderAction::allocateGeometryStorage(size_t bytes, size_t alignment)
{
Expand Down Expand Up @@ -531,6 +572,7 @@ SoIRRenderAction::resetFrameResources()
PRIVATE(this)->geometryPool.clear();
PRIVATE(this)->textureStorage.clear();
PRIVATE(this)->collectorStack.truncate(0);
PRIVATE(this)->constructionStatistics = ConstructionStatistics();
}

void
Expand Down
Loading
Loading