Berserk
Classes | Typedefs | Enumerations | Functions
Rhi

Rendering hardware interface. More...

Classes

class  RHIBufferDesc
 RHI device buffer descriptor. More...
 
class  RHIBuffer
 RHI device buffer. More...
 
class  RHIVertexBuffer
 RHI vertex buffer. More...
 
class  RHIIndexBuffer
 RHI index buffer. More...
 
class  RHIUniformBuffer
 RHI uniform buffer. More...
 
class  RHICommandList
 Command list for commands capturing and submission. More...
 
struct  RHILimits
 RHI common device limits. More...
 
struct  RHIDeviceCaps
 RHI device capabilities. More...
 
class  RHIDevice
 RHI device. More...
 
class  RHIAttachmentDesc
 Describes single render target attachment. More...
 
class  RHIFramebufferDesc
 RHI framebuffer descriptor. More...
 
class  RHIFramebuffer
 Collection of render targets for drawing. More...
 
class  RHIRasterState
 RHI raster state descriptor. More...
 
class  RHIDepthStencilState
 RHI depth stencil state descriptor. More...
 
class  RHIBlendAttachment
 RHI single blend attachment descriptor. More...
 
class  RHIBlendState
 RHI blend state descriptor. More...
 
class  RHIGraphicsPipelineDesc
 Graphics pipeline descriptor. More...
 
class  RHIGraphicsPipeline
 Graphics pipeline. More...
 
class  RHIColorAttachment
 Single render target color attachment descriptor. More...
 
class  RHIDepthStencilAttachment
 Depth-stencil render target attachment descriptor. More...
 
class  RHIViewport
 Area of the render target to draw. More...
 
class  RHIRenderPassDesc
 Full render pass descriptor. More...
 
class  RHIRenderPassBeginInfo
 RHI pass info to begin (initial targets clear values) More...
 
class  RHIRenderPass
 Compiled render pass object. More...
 
class  RHIResource
 Base class for RHI resource. More...
 
class  RHIResourceSetDesc
 Describes single set of GPU resource for shader. More...
 
class  RHIResourceSet
 Set of resource ready to be bound to the pipeline. More...
 
class  RHISamplerDesc
 RHI sample descriptor. More...
 
class  RHISampler
 RHI sampler object. More...
 
class  RHIShaderMeta
 Reflection info about compiled RHI program. More...
 
class  RHIShaderStageDesc
 Single shader stage. More...
 
class  RHIShaderDesc
 Shader creation descriptor. Allows create from byteCode. More...
 
class  RHIShader
 Compiled and linked native shader. More...
 
class  RHITextureDesc
 RHI Texture primitive descriptor. More...
 
class  RHITexture
 RHI Texture primitive. More...
 
class  RHIVertexElement
 Describes a single vertex element in a vertex declaration. More...
 
class  RHIVertexDeclaration
 Contains information about a vertex declaration. More...
 
class  RHIVertexDeclarationDesc
 Describes input vertex layout. More...
 

Typedefs

using RHIVertexDeclarationDesc = std::vector< RHIVertexElement >
 

Enumerations

enum class  RHIType : uint8 { OpenGL , Vulkan , Unknown }
 
enum class  RHIBufferUsage : uint8 { Static , Dynamic }
 
enum class  RHIIndexType : uint8 { Uint32 , Uint16 , Unknown }
 
enum class  RHIVertexFrequency : uint8 { PerVertex = 0 , PerInstance }
 
enum class  RHIVertexElementType : uint8 {
  Float1 = 0 , Float2 , Float3 , Float4 ,
  Int1 , Int2 , Int3 , Int4 ,
  Unknown
}
 
enum class  RHIShaderDataType : uint8 {
  Float1 , Float2 , Float3 , Float4 ,
  Int1 , Int2 , Int3 , Int4 ,
  Uint1 , Uint2 , Uint3 , Uint4 ,
  Bool1 , Bool2 , Bool3 , Bool4 ,
  Mat2 , Mat3 , Mat4 , Unknown
}
 
enum class  RHIShaderParamType : uint8 {
  Sampler2d , Sampler2dArray , Sampler3d , SamplerCube ,
  Unknown
}
 
enum class  RHITextureType : uint8 {
  Texture2d , Texture2dArray , Texture3d , TextureCube ,
  Unknown
}
 
enum class  RHIShaderType : uint8 { Vertex = 0 , Fragment = 1 }
 
enum class  RHIShaderLanguage : uint8 { GLSL410GL = 1 , GLSL450GL = 2 , GLSL450VK = 3 , Unknown }
 
enum class  RHITextureFormat : uint8 {
  R8 , R8_SNORM , R16 , R16_SNORM ,
  RG8 , RG8_SNORM , RG16 , RG16_SNORM ,
  RGB8 , RGB8_SNORM , RGB16_SNORM , RGBA8 ,
  RGBA8_SNORM , RGBA16 , SRGB8 , SRGB8_ALPHA8 ,
  R16F , RG16F , RGB16F , RGBA16F ,
  R32F , RG32F , RGB32F , RGBA32F ,
  DEPTH32F , DEPTH32F_STENCIL8 , DEPTH24_STENCIL8 , Unknown
}
 
enum class  RHITextureUsage : uint8 { Sampling = 1 , ColorAttachment = 2 , DepthAttachment = 3 , DepthStencilAttachment = 4 }
 
enum class  RHITextureCubemapFace : uint8 {
  PositiveX = 0 , NegativeX = 1 , PositiveY = 2 , NegativeY = 3 ,
  PositiveZ = 4 , NegativeZ = 5
}
 
enum class  RHISamplerMagFilter : uint8 { Nearest , Linear }
 
enum class  RHISamplerMinFilter : uint8 {
  Nearest , Linear , NearestMipmapNearest , LinearMipmapNearest ,
  NearestMipmapLinear , LinearMipmapLinear
}
 
enum class  RHISamplerRepeatMode : uint8 {
  Repeat , MirroredRepeat , ClampToEdge , ClampToBorder ,
  MirrorClamToEdge
}
 
enum class  RHISamplerBorderColor : uint8 { Black , White }
 
enum class  RHIPrimitivesType : uint8 { Triangles , Lines , Points }
 
enum class  RHIPolygonMode : uint8 { Fill , Line , Point }
 
enum class  RHIPolygonCullMode : uint8 { Disabled , Front , Back , FrontAndBack }
 
enum class  RHIPolygonFrontFace : uint8 { Clockwise , CounterClockwise }
 
enum class  RHICompareFunction : uint8 {
  Never , Less , Equal , LessEqual ,
  Greater , GreaterEqual , NotEqual , Always
}
 
enum class  RHIOperation : uint8 {
  Keep , Zero , Replace , Increment ,
  Decrement , Invert
}
 
enum class  RHIBlendFactor : uint8 {
  Zero , One , SrcColor , OneMinusSrcColor ,
  DstColor , OneMinusDstColor , SrcAlpha , OneMinusSrcAlpha ,
  DstAlpha , OneMinusDstAlpha
}
 
enum class  RHIBlendOperation : uint8 {
  Add , Subtract , ReverseSubtract , Min ,
  Max
}
 
enum class  RHIRenderTargetOption : uint8 {
  ClearStore , ClearDiscard , LoadStore , LoadDiscard ,
  DiscardStore , DiscardDiscard
}
 

Functions

uint32 GetRHIShaderDataTypeSize (RHIShaderDataType type)
 
const char * RHIGetShaderDataIdGLSL (RHIShaderDataType type)
 
const char * RHIGetShaderParamIdGLSL (RHIShaderParamType type)
 
bool RHIIsIntegralBaseType (RHIShaderDataType type)
 
bool RHIIsFloatBaseType (RHIShaderDataType type)
 
bool RHIIsIntegralBaseSignedType (RHIShaderDataType type)
 
bool RHIIsVectorType (RHIShaderDataType type)
 
uint32 RHIGetVectorComponentsCount (RHIShaderDataType type)
 
uint32 RHIGetBaseElementsCount (RHIShaderDataType type)
 
void RHIGetMatrixSize (RHIShaderDataType type, uint32 &rows, uint32 &cols)
 
RHIShaderLanguage RHIParseShaderLanguage (const char *language)
 
uint32 RHIGetIndexSize (RHIIndexType type)
 

Detailed Description

Rendering hardware interface.

Provides unified interface for the rendering hardware, required for lower level rendering. Abstracts such primitives, as texture, sample, shader, framebuffer, render pass, pipeline etc.

Interface is designed as verbose API with minimum number of global state variables, requires explicit pre-creation of rendering objects.

Intended for implementation by OpenGL and Vulkan APIs.

Typedef Documentation

◆ RHIVertexDeclarationDesc

Enumeration Type Documentation

◆ RHIBlendFactor

enum RHIBlendFactor : uint8
strong
Enumerator
Zero 

= 0

One 

= 1

SrcColor 

= src

OneMinusSrcColor 

= 1 - src

DstColor 

= dst

OneMinusDstColor 

= 1 - dst

SrcAlpha 

= src.a

OneMinusSrcAlpha 

= 1 - src.a

DstAlpha 

= dst.a

OneMinusDstAlpha 

= 1 - dst.a

◆ RHIBlendOperation

enum RHIBlendOperation : uint8
strong
Enumerator
Add 

Fragment color added to the color buffer

Subtract 

Fragment color subtracted from the color buffer

ReverseSubtract 

Color buffer color is subtracted from fragment color

Min 

The min between the fragment and color buffer

Max 

The max between the fragment and color buffer

◆ RHIBufferUsage

enum RHIBufferUsage : uint8
strong

Hint for device to allocate internally buffer memory in optimised way

Enumerator
Static 

Update once, use many time

Dynamic 

Update many times, use many times

◆ RHICompareFunction

enum RHICompareFunction : uint8
strong
Enumerator
Never 
Less 
Equal 
LessEqual 
Greater 
GreaterEqual 
NotEqual 
Always 

◆ RHIIndexType

enum RHIIndexType : uint8
strong
Enumerator
Uint32 
Uint16 
Unknown 

◆ RHIOperation

enum RHIOperation : uint8
strong
Enumerator
Keep 
Zero 
Replace 
Increment 
Decrement 
Invert 

◆ RHIPolygonCullMode

enum RHIPolygonCullMode : uint8
strong
Enumerator
Disabled 
Front 
Back 
FrontAndBack 

◆ RHIPolygonFrontFace

enum RHIPolygonFrontFace : uint8
strong

How front of the primitive is defined

Enumerator
Clockwise 
CounterClockwise 

◆ RHIPolygonMode

enum RHIPolygonMode : uint8
strong

How primitives rasterized

Enumerator
Fill 
Line 
Point 

◆ RHIPrimitivesType

enum RHIPrimitivesType : uint8
strong

Types of the geometry formed by input vertex data

Enumerator
Triangles 
Lines 
Points 

◆ RHIRenderTargetOption

Enumerator
ClearStore 
ClearDiscard 
LoadStore 
LoadDiscard 
DiscardStore 
DiscardDiscard 

◆ RHISamplerBorderColor

Enumerator
Black 
White 

◆ RHISamplerMagFilter

enum RHISamplerMagFilter : uint8
strong
Enumerator
Nearest 
Linear 

◆ RHISamplerMinFilter

enum RHISamplerMinFilter : uint8
strong
Enumerator
Nearest 

Returns the value of the texture element that is nearest

Linear 

Returns the weighted average of the four texture elements that are closest to the center of the pixel being textured

NearestMipmapNearest 

Chooses the mipmap that most closely matches the size of the pixel being textured and uses the Nearest criterion

LinearMipmapNearest 

Chooses the mipmap that most closely matches the size of the pixel being textured and uses the Linear criterion

NearestMipmapLinear 

Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the Nearest criterion

LinearMipmapLinear 

Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the Linear criterion

◆ RHISamplerRepeatMode

enum RHISamplerRepeatMode : uint8
strong
Enumerator
Repeat 
MirroredRepeat 
ClampToEdge 
ClampToBorder 
MirrorClamToEdge 

◆ RHIShaderDataType

enum RHIShaderDataType : uint8
strong
Enumerator
Float1 
Float2 
Float3 
Float4 
Int1 
Int2 
Int3 
Int4 
Uint1 
Uint2 
Uint3 
Uint4 
Bool1 
Bool2 
Bool3 
Bool4 
Mat2 
Mat3 
Mat4 
Unknown 

◆ RHIShaderLanguage

enum RHIShaderLanguage : uint8
strong
Enumerator
GLSL410GL 
GLSL450GL 
GLSL450VK 
Unknown 

◆ RHIShaderParamType

enum RHIShaderParamType : uint8
strong
Enumerator
Sampler2d 
Sampler2dArray 
Sampler3d 
SamplerCube 
Unknown 

◆ RHIShaderType

enum RHIShaderType : uint8
strong
Enumerator
Vertex 
Fragment 

◆ RHITextureCubemapFace

Enumerator
PositiveX 
NegativeX 
PositiveY 
NegativeY 
PositiveZ 
NegativeZ 

◆ RHITextureFormat

enum RHITextureFormat : uint8
strong

Formats used to specify internal texture storage format

Enumerator
R8 
R8_SNORM 
R16 
R16_SNORM 
RG8 
RG8_SNORM 
RG16 
RG16_SNORM 
RGB8 
RGB8_SNORM 
RGB16_SNORM 
RGBA8 
RGBA8_SNORM 
RGBA16 
SRGB8 
SRGB8_ALPHA8 
R16F 
RG16F 
RGB16F 
RGBA16F 
R32F 
RG32F 
RGB32F 
RGBA32F 
DEPTH32F 
DEPTH32F_STENCIL8 
DEPTH24_STENCIL8 
Unknown 

◆ RHITextureType

enum RHITextureType : uint8
strong
Enumerator
Texture2d 
Texture2dArray 
Texture3d 
TextureCube 
Unknown 

◆ RHITextureUsage

enum RHITextureUsage : uint8
strong
Enumerator
Sampling 

Texture can be sampled within shader

ColorAttachment 

Texture can be used as render target color attachment

DepthAttachment 

Texture can be used as render target depth attachment

DepthStencilAttachment 

Texture can be used as render target depth stencil attachment

◆ RHIType

enum RHIType : uint8
strong
Enumerator
OpenGL 
Vulkan 
Unknown 

◆ RHIVertexElementType

enum RHIVertexElementType : uint8
strong
Enumerator
Float1 
Float2 
Float3 
Float4 
Int1 
Int2 
Int3 
Int4 
Unknown 

◆ RHIVertexFrequency

enum RHIVertexFrequency : uint8
strong

Iterating of the elements in the vertex buffer

Enumerator
PerVertex 

Element index changes per vertex

PerInstance 

Element index changes per instance

Function Documentation

◆ GetRHIShaderDataTypeSize()

uint32 GetRHIShaderDataTypeSize ( RHIShaderDataType  type)
inline
Returns
Host data size of value of specified type

◆ RHIGetBaseElementsCount()

uint32 RHIGetBaseElementsCount ( RHIShaderDataType  type)
inline

◆ RHIGetIndexSize()

uint32 RHIGetIndexSize ( RHIIndexType  type)
inline

◆ RHIGetMatrixSize()

void RHIGetMatrixSize ( RHIShaderDataType  type,
uint32 rows,
uint32 cols 
)
inline

◆ RHIGetShaderDataIdGLSL()

const char* RHIGetShaderDataIdGLSL ( RHIShaderDataType  type)
inline

◆ RHIGetShaderParamIdGLSL()

const char* RHIGetShaderParamIdGLSL ( RHIShaderParamType  type)
inline

◆ RHIGetVectorComponentsCount()

uint32 RHIGetVectorComponentsCount ( RHIShaderDataType  type)
inline

◆ RHIIsFloatBaseType()

bool RHIIsFloatBaseType ( RHIShaderDataType  type)
inline

◆ RHIIsIntegralBaseSignedType()

bool RHIIsIntegralBaseSignedType ( RHIShaderDataType  type)
inline

◆ RHIIsIntegralBaseType()

bool RHIIsIntegralBaseType ( RHIShaderDataType  type)
inline

◆ RHIIsVectorType()

bool RHIIsVectorType ( RHIShaderDataType  type)
inline

◆ RHIParseShaderLanguage()

RHIShaderLanguage RHIParseShaderLanguage ( const char *  language)
inline