RAMSES Documentation  27.0.130
Information for RAMSES users and developers
RamsesRenderer.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // Copyright (C) 2015 BMW Car IT GmbH
3 // -------------------------------------------------------------------------
4 // This Source Code Form is subject to the terms of the Mozilla Public
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
6 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 // -------------------------------------------------------------------------
8 
9 #ifndef RAMSES_RAMSESRENDERER_H
10 #define RAMSES_RAMSESRENDERER_H
11 
15 
16 namespace ramses
17 {
18  class SystemCompositorController;
19  class DisplayConfig;
20  class IRendererEventHandler;
21  class WarpingMeshData;
22  class RendererSceneControl;
23  class DcsmContentControl;
24 
37  {
38  public:
49 
60 
70 
76  bool isThreadRunning() const;
77 
89  status_t setMaximumFramerate(float maximumFramerate);
90 
104  static status_t setMaximumFramerate(RamsesRenderer& renderer, float maximumFramerate, displayId_t displayId);
105 
111  float getMaximumFramerate() const;
112 
124 
131 
159  status_t setFrameTimerLimits(uint64_t limitForSceneResourcesUpload, uint64_t limitForClientResourcesUpload, uint64_t limitForOffscreenBufferRender);
160 
182  status_t setPendingFlushLimits(uint32_t forceApplyFlushLimit, uint32_t forceUnsubscribeSceneLimit);
183 
198 
212 
225 
235 
253  displayBufferId_t createOffscreenBuffer(displayId_t display, uint32_t width, uint32_t height, uint32_t sampleCount = 0u);
254 
271  static displayBufferId_t createOffscreenBuffer(RamsesRenderer& renderer, displayId_t display, uint32_t width, uint32_t height, uint32_t sampleCount = 0u, EDepthBufferType depthBufferType = EDepthBufferType_DepthStencil);
272 
297  displayBufferId_t createInterruptibleOffscreenBuffer(displayId_t display, uint32_t width, uint32_t height);
298 
325  static displayBufferId_t createInterruptibleOffscreenBuffer(RamsesRenderer& renderer, displayId_t display, uint32_t width, uint32_t height, EDepthBufferType depthBufferType = EDepthBufferType_DepthStencil);
326 
363  displayBufferId_t createDmaOffscreenBuffer(displayId_t display, uint32_t width, uint32_t height, uint32_t bufferFourccFormat, uint32_t usageFlags, uint64_t modifier);
364 
390  status_t getDmaOffscreenBufferFDAndStride(displayId_t display, displayBufferId_t displayBufferId, int& fd, uint32_t& stride) const;
391 
404 
434 
445 
455  bool getExternalBufferGlId(displayId_t display, externalBufferId_t externalBuffer, uint32_t& textureGlId) const;
456 
473  static status_t setDisplayBufferClearFlags(RamsesRenderer& renderer, displayId_t display, displayBufferId_t displayBuffer, uint32_t clearFlags);
474 
492  status_t setDisplayBufferClearColor(displayId_t display, displayBufferId_t displayBuffer, float r, float g, float b, float a);
493 
515  status_t setExternallyOwnedWindowSize(displayId_t display, uint32_t width, uint32_t height);
516 
541  status_t readPixels(displayId_t displayId, displayBufferId_t displayBuffer, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
542 
566 
589 
591  // System Compositor API
593 
601  status_t setSurfaceVisibility(uint32_t surfaceId, bool visibility);
602 
610  status_t setSurfaceOpacity(uint32_t surfaceId, float opacity);
611 
622  status_t setSurfaceRectangle(uint32_t surfaceId, int32_t x, int32_t y, int32_t width, int32_t height);
623 
631  status_t setLayerVisibility(uint32_t layerId, bool visibility);
632 
641  status_t takeSystemCompositorScreenshot(const char* fileName, int32_t screenIviId);
642 
644  // End of System Compositor API
646 
656  status_t updateWarpingMeshData(displayId_t displayId, const WarpingMeshData& newWarpingMeshData);
657 
674 
683 
691 
695  class RamsesRendererImpl& impl;
696 
700  explicit RamsesRenderer(RamsesRendererImpl&);
701 
705  RamsesRenderer() = delete;
706 
711  RamsesRenderer(const RamsesRenderer& other) = delete;
712 
718  RamsesRenderer& operator=(const RamsesRenderer& other) = delete;
719 
720  private:
724  friend class RendererFactory;
725 
729  virtual ~RamsesRenderer();
730  };
731 }
732 
733 #endif
#define RAMSES_API
Definition: APIExport.h:35
DcsmContentControl provides way to interact with both Dcsm (as consumer) and renderer content control...
Definition: DcsmContentControl.h:70
The DisplayConfig holds a set of parameters to be used to initialize a display.
Definition: DisplayConfig.h:22
Provides an interface for handling the result of renderer events. Implementation of this interface mu...
Definition: IRendererEventHandler.h:24
RamsesRenderer is the main renderer component which provides API to configure and control the way con...
Definition: RamsesRenderer.h:37
status_t stopThread()
Stops thread(s) running the update and render of displays.
status_t takeSystemCompositorScreenshot(const char *fileName, int32_t screenIviId)
Trigger the System Compositor to take a screenshot and store it in a file.
status_t setSkippingOfUnmodifiedBuffers(bool enable=true)
Enable or disable skipping of rendering of unmodified buffers. By default the renderer does not re-re...
class RamsesRendererImpl & impl
Definition: RamsesRenderer.h:695
status_t setLoopMode(ELoopMode loopMode)
Sets the mode of operation for render loop.
status_t setSurfaceOpacity(uint32_t surfaceId, float opacity)
Set opacity of given surface at the system compositor.
status_t setPendingFlushLimits(uint32_t forceApplyFlushLimit, uint32_t forceUnsubscribeSceneLimit)
Sets the number of pending flushes accepted before force-applying them to their scene,...
externalBufferId_t createExternalBuffer(displayId_t display)
Creates a buffer using OpenGL External textures for storage.
status_t setLayerVisibility(uint32_t layerId, bool visibility)
Set visibility of given layer at the system compositor.
bool isThreadRunning() const
Get the current state of rendering thread(s) running.
DcsmContentControl * createDcsmContentControl()
Create ramses::DcsmContentControl to control content states.
RamsesRenderer(RamsesRendererImpl &)
Constructor of RamsesRenderer.
static displayBufferId_t createOffscreenBuffer(RamsesRenderer &renderer, displayId_t display, uint32_t width, uint32_t height, uint32_t sampleCount=0u, EDepthBufferType depthBufferType=EDepthBufferType_DepthStencil)
Will create an offscreen buffer that can be used to render scenes into (see ramses::RendererSceneCont...
status_t setExternallyOwnedWindowSize(displayId_t display, uint32_t width, uint32_t height)
Updates display window size after a resize event on windows not owned by renderer.
status_t updateWarpingMeshData(displayId_t displayId, const WarpingMeshData &newWarpingMeshData)
Updates the warping mesh for the warping postprocessing based on the new config.
displayId_t createDisplay(const DisplayConfig &config)
Creates a display based on provided display config. Creation of a display is an asynchronous action a...
bool getExternalBufferGlId(displayId_t display, externalBufferId_t externalBuffer, uint32_t &textureGlId) const
Will query the OpenGL texture Id for the external texture used for a created external buffer.
status_t setDisplayBufferClearColor(displayId_t display, displayBufferId_t displayBuffer, float r, float g, float b, float a)
Sets clear color of a display buffer (display's framebuffer or offscreen buffer).
status_t flush()
Submits renderer commands (API calls on this instance of RamsesRenderer) since previous flush to be e...
status_t setSurfaceVisibility(uint32_t surfaceId, bool visibility)
Set visibility of given surface at the system compositor.
status_t dispatchEvents(IRendererEventHandler &rendererEventHandler)
Most RamsesRenderer methods push commands to an internal queue which is submitted when calling Ramses...
RamsesRenderer(const RamsesRenderer &other)=delete
Deleted copy constructor.
status_t readPixels(displayId_t displayId, displayBufferId_t displayBuffer, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
Triggers an asynchronous read back of a display buffer memory from GPU to system memory.
status_t doOneLoop()
Prepare content to be rendered in next frame and render next frame.
status_t logRendererInfo()
Prints detailed information about renderer state and contents to the log output.
status_t startThread()
Starts update and render loop in threaded mode.
status_t destroyOffscreenBuffer(displayId_t display, displayBufferId_t offscreenBuffer)
Will destroy a previously created offscreen buffer. If there are any consumer texture samplers linked...
status_t setMaximumFramerate(float maximumFramerate)
Sets the maximum frame rate per second for the update/render loop when in threaded mode.
RamsesRenderer()=delete
Deleted default constructor.
displayBufferId_t createDmaOffscreenBuffer(displayId_t display, uint32_t width, uint32_t height, uint32_t bufferFourccFormat, uint32_t usageFlags, uint64_t modifier)
Additional API to create an offscreen buffer using DMA buffer for internal storage....
status_t getDmaOffscreenBufferFDAndStride(displayId_t display, displayBufferId_t displayBufferId, int &fd, uint32_t &stride) const
Get the FD and stride for a DMA offscreen buffer previously created on the given display.
displayBufferId_t createInterruptibleOffscreenBuffer(displayId_t display, uint32_t width, uint32_t height)
Additional API to create an offscreen buffer as interruptible. (see createOffscreenBuffer)
status_t destroyDisplay(displayId_t displayId)
Destroy a display. Destruction of a display is an asynchronous action and the actual display componen...
status_t setFrameTimerLimits(uint64_t limitForSceneResourcesUpload, uint64_t limitForClientResourcesUpload, uint64_t limitForOffscreenBufferRender)
Sets time limits for time-out of different sections of render and update loop.
RamsesRenderer & operator=(const RamsesRenderer &other)=delete
Deleted copy assignment.
static status_t setDisplayBufferClearFlags(RamsesRenderer &renderer, displayId_t display, displayBufferId_t displayBuffer, uint32_t clearFlags)
Sets clear flags for a display buffer (display's framebuffer or offscreen buffer).
float getMaximumFramerate() const
Get the current value for maximum frame rate per second currently set (setMaximumFramerate).
RendererSceneControl * getSceneControlAPI()
Get scene control API.
static status_t setMaximumFramerate(RamsesRenderer &renderer, float maximumFramerate, displayId_t displayId)
Sets the maximum frame rate per second for the update/render loop when in threaded mode for given dis...
status_t setSurfaceRectangle(uint32_t surfaceId, int32_t x, int32_t y, int32_t width, int32_t height)
Set output rectangle of given surface at the system compositor.
displayBufferId_t createOffscreenBuffer(displayId_t display, uint32_t width, uint32_t height, uint32_t sampleCount=0u)
Will create an offscreen buffer that can be used to render scenes into (see ramses::RendererSceneCont...
displayBufferId_t getDisplayFramebuffer(displayId_t displayId) const
Get display's framebuffer ID. Every display upon creation has one framebuffer which can be referenced...
static displayBufferId_t createInterruptibleOffscreenBuffer(RamsesRenderer &renderer, displayId_t display, uint32_t width, uint32_t height, EDepthBufferType depthBufferType=EDepthBufferType_DepthStencil)
Additional API to create an offscreen buffer as interruptible. This allows the renderer to interrupt ...
status_t destroyExternalBuffer(displayId_t display, externalBufferId_t externalBuffer)
Will destroy a previously created external buffer. If there are any consumer texture samplers linked ...
ELoopMode getLoopMode() const
Get the current value for loop mode set using setLoopMode.
Control states of scenes.
Definition: RendererSceneControl.h:33
The StatusObject provides status message handling.
Definition: StatusObject.h:22
The WarpingMeshData holds the vertices and indices needed to create the mesh for display warping.
Definition: WarpingMeshData.h:21
The RAMSES namespace contains all client side objects and functions used to implement RAMSES applicat...
Definition: AnimatedProperty.h:15
EDepthBufferType
Specifies type of depth buffer created within an offscreen buffer.
Definition: Types.h:288
@ EDepthBufferType_DepthStencil
Definition: Types.h:291
uint32_t status_t
Status is a handle to the result of an API call.
Definition: RamsesFrameworkTypes.h:26
ELoopMode
Specifies behavior of render loop.
Definition: Types.h:278