18#ifndef INCLUDED_RENDERER_BACKEND_GL_DEVICE
19#define INCLUDED_RENDERER_BACKEND_GL_DEVICE
33#include <unordered_map>
48class CDeviceCommandContext;
88 const char* name,
const uint32_t usage,
121 const uint32_t usage,
const bool depth,
const bool stencil)
const override;
struct SDL_Window SDL_Window
Definition: VideoMode.h:26
Represents a mapping of name strings to value strings, for use with #if and #ifdef and similar condit...
Definition: ShaderDefines.h:147
Simplifed version of std::span (C++20) as we don't support the original one yet.
Definition: Span.h:37
Definition: DeviceCommandContext.h:50
std::string m_Version
Definition: Device.h:135
void Present() override
Presents the backbuffer to the swapchain queue to be flipped on a screen.
Definition: Device.cpp:955
Capabilities m_Capabilities
Definition: Device.h:159
bool AcquireNextBackbuffer() override
Acquires a backbuffer for rendering a frame.
Definition: Device.cpp:918
std::vector< std::string > m_Extensions
Definition: Device.h:137
std::unordered_map< BackbufferKey, std::unique_ptr< CFramebuffer >, BackbufferKeyHash > m_Backbuffers
Definition: Device.h:155
std::unique_ptr< IDeviceCommandContext > CreateCommandContext() override
Definition: Device.cpp:855
Format GetPreferredDepthStencilFormat(const uint32_t usage, const bool depth, const bool stencil) const override
Returns the most suitable format for the usage.
Definition: Device.cpp:1057
int m_SurfaceDrawableHeight
Definition: Device.h:130
~CDevice() override
Definition: Device.cpp:457
std::unique_ptr< ITexture > CreateTexture(const char *name, const ITexture::Type type, const uint32_t usage, const Format format, const uint32_t width, const uint32_t height, const Sampler::Desc &defaultSamplerDesc, const uint32_t MIPLevelCount, const uint32_t sampleCount) override
Definition: Device.cpp:880
bool m_ARB
Definition: Device.h:132
SDL_Window * m_Window
Definition: Device.h:128
const std::string & GetDriverInformation() const override
Definition: Device.h:64
std::unique_ptr< IGraphicsPipelineState > CreateGraphicsPipelineState(const SGraphicsPipelineStateDesc &pipelineStateDesc) override
Creates a graphics pipeline state.
Definition: Device.cpp:862
SDL_GLContext m_Context
Definition: Device.h:129
std::unique_ptr< IBuffer > CreateBuffer(const char *name, const IBuffer::Type type, const uint32_t size, const uint32_t usage) override
Definition: Device.cpp:906
std::unique_ptr< IVertexInputLayout > CreateVertexInputLayout(const PS::span< const SVertexAttributeFormat > attributes) override
Creates a vertex input layout.
Definition: Device.cpp:874
std::string m_Name
Definition: Device.h:134
bool UseFramebufferInvalidating() const
Definition: Device.h:114
CDeviceCommandContext * GetActiveCommandContext()
Definition: Device.h:80
void OnWindowResize(const uint32_t width, const uint32_t height) override
Should be called on window surface resize.
Definition: Device.cpp:980
const std::string & GetName() const override
Definition: Device.h:62
CDeviceCommandContext * m_ActiveCommandContext
Definition: Device.h:142
static std::unique_ptr< IDevice > Create(SDL_Window *window, const bool arb)
Creates the GL device and the GL context for the window if it presents.
Definition: Device.cpp:210
bool m_UseFramebufferInvalidating
Definition: Device.h:157
bool IsFramebufferFormatSupported(const Format format) const override
Definition: Device.cpp:1036
std::unique_ptr< IFramebuffer > CreateFramebuffer(const char *name, SColorAttachment *colorAttachment, SDepthStencilAttachment *depthStencilAttachment) override
Definition: Device.cpp:898
std::unique_ptr< IShaderProgram > CreateShaderProgram(const CStr &name, const CShaderDefines &defines) override
Definition: Device.cpp:912
const Capabilities & GetCapabilities() const override
Definition: Device.h:123
std::unique_ptr< ITexture > CreateTexture2D(const char *name, const uint32_t usage, const Format format, const uint32_t width, const uint32_t height, const Sampler::Desc &defaultSamplerDesc, const uint32_t MIPLevelCount=1, const uint32_t sampleCount=1) override
Definition: Device.cpp:889
std::tuple< AttachmentLoadOp, AttachmentStoreOp, AttachmentLoadOp, AttachmentStoreOp > BackbufferKey
Definition: Device.h:146
std::string m_DriverInformation
Definition: Device.h:136
const std::string & GetVersion() const override
Definition: Device.h:63
IFramebuffer * GetCurrentBackbuffer(const AttachmentLoadOp colorAttachmentLoadOp, const AttachmentStoreOp colorAttachmentStoreOp, const AttachmentLoadOp depthStencilAttachmentLoadOp, const AttachmentStoreOp depthStencilAttachmentStoreOp) override
Returns a framebuffer for the current backbuffer with the required attachment operations.
Definition: Device.cpp:935
bool IsTextureFormatSupported(const Format format) const override
Definition: Device.cpp:988
Backend GetBackend() const override
Definition: Device.h:60
const std::vector< std::string > & GetExtensions() const override
Definition: Device.h:65
void Report(const ScriptRequest &rq, JS::HandleValue settings) override
Definition: Device.cpp:463
int m_SurfaceDrawableWidth
Definition: Device.h:130
bool m_BackbufferAcquired
Definition: Device.h:156
std::unique_ptr< IComputePipelineState > CreateComputePipelineState(const SComputePipelineStateDesc &pipelineStateDesc) override
Creates a compute pipeline state.
Definition: Device.cpp:868
Type
Definition: IBuffer.h:35
IFramebuffer stores attachments which should be used by backend as rendering destinations.
Definition: IFramebuffer.h:85
Type
Definition: ITexture.h:37
Spidermonkey maintains some 'local' state via the JSContext* object.
Definition: ScriptRequest.h:60
void * SDL_GLContext
Definition: Device.h:37
Format
Definition: Format.h:28
AttachmentStoreOp
Store operation is set for each attachment, what should be done with its content on EndFramebufferPas...
Definition: IFramebuffer.h:52
Backend
Definition: Backend.h:28
AttachmentLoadOp
Load operation is set for each attachment, what should be done with its content on BeginFramebufferPa...
Definition: IFramebuffer.h:37
Definition: VideoMode.h:29
size_t operator()(const BackbufferKey &key) const
Definition: Device.cpp:925
Definition: IFramebuffer.h:60
Definition: PipelineState.h:175
Definition: IFramebuffer.h:68
Definition: PipelineState.h:165
unsigned int uint32_t
Definition: wposix_types.h:53
pthread_key_t key
Definition: wpthread.cpp:140