From 35b4fef38ec21bd77c493374bc72deabfb9960de Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 17 Jan 2006 01:24:40 +0000 Subject: [PATCH] add concurrent rendering hooks --- stepmania/src/RageDisplay.h | 5 +++++ stepmania/src/RageDisplay_OGL.cpp | 15 +++++++++++++++ stepmania/src/RageDisplay_OGL.h | 4 ++++ .../src/arch/LowLevelWindow/LowLevelWindow.h | 4 ++++ 4 files changed, 28 insertions(+) diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index 2263416c63..0f6328594b 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -157,6 +157,11 @@ public: virtual bool SupportsThreadedRendering() { return false; } virtual bool SupportsPerVertexMatrixScale() = 0; + // If threaded rendering is supported, these will be called from the rendering + // thread before and after rendering. + virtual void BeginConcurrentRendering() { } + virtual void EndConcurrentRendering() { } + /* return 0 if failed or internal texture resource handle * (unsigned in OpenGL, texture pointer in D3D) */ virtual unsigned CreateTexture( diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 106678dfdd..cfab73257d 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -1606,6 +1606,21 @@ const RageDisplay::PixelFormatDesc *RageDisplay_OGL::GetPixelFormatDesc(PixelFor return &PIXEL_FORMAT_DESC[pf]; } +bool RageDisplay_OGL::SupportsThreadedRendering() +{ + return g_pWind->SupportsThreadedRendering(); +} + +void RageDisplay_OGL::BeginConcurrentRendering() +{ + g_pWind->BeginConcurrentRendering(); +} + +void RageDisplay_OGL::EndConcurrentRendering() +{ + g_pWind->EndConcurrentRendering(); +} + void RageDisplay_OGL::DeleteTexture( unsigned uTexHandle ) { unsigned int uTexID = uTexHandle; diff --git a/stepmania/src/RageDisplay_OGL.h b/stepmania/src/RageDisplay_OGL.h index 6395698626..112b7ce30a 100644 --- a/stepmania/src/RageDisplay_OGL.h +++ b/stepmania/src/RageDisplay_OGL.h @@ -15,6 +15,10 @@ public: void ResolutionChanged(); const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const; + bool SupportsThreadedRendering(); + void BeginConcurrentRendering(); + void EndConcurrentRendering(); + bool BeginFrame(); void EndFrame(); VideoModeParams GetActualVideoModeParams() const; diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h b/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h index 69c7bf82db..47e3d7e352 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h @@ -25,6 +25,10 @@ public: virtual void Update() { } virtual VideoModeParams GetActualVideoModeParams() const = 0; + + virtual bool SupportsThreadedRendering() { return false; } + virtual void BeginConcurrentRendering() { } + virtual void EndConcurrentRendering() { } }; #endif