Easy3D 3.0.0
Loading...
Searching...
No Matches
RenderDevice Class Referenceabstract

Backend-independent rendering, capture, and selection interface. More...

#include <render_device.h>

Inheritance diagram for RenderDevice:
PresentationDevice

Public Member Functions

virtual ~RenderDevice ()=default
 Destroy the backend device.
 
virtual Backend backend () const =0
 
virtual const std::string & name () const =0
 
virtual DeviceCapabilities capabilities () const =0
 
virtual const std::string & driver_version () const =0
 
virtual std::uint32_t supported_sample_counts (PointStyle style=PointStyle::plain) const =0
 Query supported MSAA sample counts for a point style.
 
virtual std::uint32_t supported_sample_counts (LineStyle style) const =0
 Query supported MSAA sample counts for a line style.
 
virtual FrameImage render (std::uint32_t width, std::uint32_t height, const std::vector< DrawCommand > &commands, const RenderOptions &options={})=0
 Render commands into an offscreen framebuffer and read back results.
 
virtual ScenePixel sample_pixel (std::uint32_t width, std::uint32_t height, const std::vector< DrawCommand > &commands, std::uint32_t x, std::uint32_t y)=0
 Sample scene depth and IDs at a top-left framebuffer pixel.
 
virtual std::vector< FrameImage::Id > sample_ids (std::uint32_t width, std::uint32_t height, const std::vector< DrawCommand > &commands, std::uint32_t x, std::uint32_t y, std::uint32_t region_width, std::uint32_t region_height)=0
 Sample scene picking IDs over a top-left framebuffer rectangle.
 
virtual unsigned validation_errors () const =0
 
virtual std::vector< std::uint32_t > select_points (const PointSelectionRequest &request)=0
 Select point source slots inside a framebuffer polygon.
 
virtual std::uint64_t point_upload_count () const =0
 
virtual std::uint32_t oit_dropped_fragments () const =0
 

Detailed Description

Backend-independent rendering, capture, and selection interface.

Operations that synchronously access a device require external synchronization per instance. Separate instances are independent.

Member Function Documentation

◆ backend()

virtual Backend backend ( ) const
pure virtual

Return the rendering implementation selected at build time.

Returns
The active backend.

◆ capabilities()

virtual DeviceCapabilities capabilities ( ) const
pure virtual

Return optional effects and implementation choices supported by this device.

Returns
Declared device capabilities.

◆ driver_version()

virtual const std::string & driver_version ( ) const
pure virtual

Return the driver implementation and release, e.g. "MoltenVK 1.4.2".

Returns
Driver name and version, empty when the driver reports neither.

◆ name()

virtual const std::string & name ( ) const
pure virtual

Return a human-readable backend/device name.

Returns
Backend/device name.

◆ oit_dropped_fragments()

virtual std::uint32_t oit_dropped_fragments ( ) const
pure virtual

Return transparent fragments dropped by linked-list OIT pool overflow in the most recent frame. Zero unless that frame used TransparencyMethod::linked_lists and exhausted its node pool; raise the per-pixel fragment capacity (peel_layers) to reduce dropping. Vulkan and offscreen render() calls report the frame just rendered. A presenting OpenGL frame reads the counter asynchronously (no CPU stall), so it may report the latest frame whose GPU work has completed.

Returns
Number of fragments dropped by linked-list OIT overflow last frame.

◆ point_upload_count()

virtual std::uint64_t point_upload_count ( ) const
pure virtual

Return cumulative point-position resource realizations.

Returns
Cumulative number of point-position resource realizations.

◆ render()

virtual FrameImage render ( std::uint32_t  width,
std::uint32_t  height,
const std::vector< DrawCommand > &  commands,
const RenderOptions &  options = {} 
)
pure virtual

Render commands into an offscreen framebuffer and read back results.

Parameters
widthTarget width in pixels.
heightTarget height in pixels.
commandsDraw commands for this frame.
optionsFrame settings, clear color, transparency, and readback mask.
Returns
Color, depth, and picking buffers for the rendered frame, as requested by options.readback.

◆ sample_ids()

virtual std::vector< FrameImage::Id > sample_ids ( std::uint32_t  width,
std::uint32_t  height,
const std::vector< DrawCommand > &  commands,
std::uint32_t  x,
std::uint32_t  y,
std::uint32_t  region_width,
std::uint32_t  region_height 
)
pure virtual

Sample scene picking IDs over a top-left framebuffer rectangle.

The full viewport and draw order are preserved, as in sample_pixel(). The returned IDs carry the same object/primitive words the single-pixel query reports, so callers can map a primitive back through its drawable.

Parameters
widthFull render-target width in pixels.
heightFull render-target height in pixels.
commandsDraw commands for the frame.
xLeft pixel column of the requested region.
yTop pixel row of the requested region.
region_widthRegion width in pixels; at least one.
region_heightRegion height in pixels; at least one.
Returns
Row-major IDs, top row first; background pixels use UINT32_MAX for both.
Exceptions
std::out_of_rangeif the region is empty or exceeds the render target.

◆ sample_pixel()

virtual ScenePixel sample_pixel ( std::uint32_t  width,
std::uint32_t  height,
const std::vector< DrawCommand > &  commands,
std::uint32_t  x,
std::uint32_t  y 
)
pure virtual

Sample scene depth and IDs at a top-left framebuffer pixel.

Parameters
widthFull render-target width in pixels.
heightFull render-target height in pixels.
commandsDraw commands for the frame.
xPixel column.
yPixel row from the top.
Returns
Scene ID and depth at the pixel center.

◆ select_points()

virtual std::vector< std::uint32_t > select_points ( const PointSelectionRequest &  request)
pure virtual

Select point source slots inside a framebuffer polygon.

The shared selection contract is backend-independent. The OpenGL adapter currently evaluates it on the CPU; Vulkan uses a compute shader. Both return the same updated bitset.

Parameters
requestPoint data, polygon, bitset, and transform for selection.
Returns
Updated selection bitset.

◆ supported_sample_counts() [1/2]

virtual std::uint32_t supported_sample_counts ( LineStyle  style) const
pure virtual

Query supported MSAA sample counts for a line style.

Parameters
styleLine style to query for.
Returns
Bit mask containing supported numeric sample counts.

◆ supported_sample_counts() [2/2]

virtual std::uint32_t supported_sample_counts ( PointStyle  style = PointStyle::plain) const
pure virtual

Query supported MSAA sample counts for a point style.

Parameters
stylePoint style to query for.
Returns
Bit mask containing supported numeric sample counts.

◆ validation_errors()

virtual unsigned validation_errors ( ) const
pure virtual

Return the number of validation errors reported by the backend.

Returns
Cumulative backend validation-error count.

The documentation for this class was generated from the following file: