33#ifndef DVD_GL_WRAPPER_H_
34#define DVD_GL_WRAPPER_H_
57class glHardwareQueryRing;
58class glHardwareQueryPool;
60struct BufferLockEntry;
99 void idle(
bool fast)
override;
107 void onThreadCreated(
const std::thread::id& threadID,
bool isMainRenderThread )
override;
129 [[nodiscard]] GenericVertexData_ptr
newGVD(
U32 ringBufferLength,
const std::string_view name )
const override;
134 [[nodiscard]] static GLUtil::GLMemory::GLMemoryType
GetMemoryTypeForUsage( gl46core::GLenum usage) noexcept;
135 [[nodiscard]] static GLUtil::GLMemory::DeviceAllocator&
GetMemoryAllocator(GLUtil::GLMemory::GLMemoryType memoryType) noexcept;
143 [[nodiscard]] static
bool DeleteShaderPrograms( gl46core::GLuint count, gl46core::GLuint * programs);
144 [[nodiscard]] static
bool DeleteSamplers( gl46core::GLuint count, gl46core::GLuint* samplers);
145 [[nodiscard]] static
bool DeleteBuffers( gl46core::GLuint count, gl46core::GLuint* buffers);
146 [[nodiscard]] static
bool DeleteFramebuffers( gl46core::GLuint count, gl46core::GLuint* framebuffers);
194 using SamplerObjectMap = eastl::fixed_vector<CachedSamplerEntry, InitialSamplerMapSize, true>;
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
OpenGL implementation of the RenderAPIWrapper.
static eastl::fixed_vector< TexBindEntry, 32, false > s_TexBindQueue
static std::atomic_bool s_glFlushQueued
void onThreadCreated(const std::thread::id &threadID, bool isMainRenderThread) override
static void PopDebugMessage()
static glHardwareQueryPool * GetHardwareQueryPool() noexcept
static void DestroyFenceSync(gl46core::GLsync &sync)
gl46core::GLuint getGLTextureView(ImageView srcView, size_t srcViewHash, U8 lifetimeInFrames) const
void onRenderThreadLoopStart() override
void clearStates(GLStateTracker &stateTracker) const
Reset as much of the GL default state as possible within the limitations given.
static bool DeleteShaderPrograms(gl46core::GLuint count, gl46core::GLuint *programs)
GenericVertexData_ptr newGVD(U32 ringBufferLength, const std::string_view name) const override
static gl46core::GLsync CreateFenceSync()
static std::array< size_t, to_base(GLUtil::GLMemory::GLMemoryType::COUNT)> s_memoryAllocatorSizes
static constexpr U32 s_LockFrameLifetime
static void PushDebugMessage(const char *message, U32 id=U32_MAX)
void postFlushCommandBuffer(Handle< GFX::CommandBuffer > commandBuffer) override
gl46core::GLuint _dummyVAO
bool setScissorInternal(const Rect< I32 > &scissor) override
static GLUtil::GLMemory::DeviceAllocator & GetMemoryAllocator(GLUtil::GLMemory::GLMemoryType memoryType) noexcept
Time::ProfileTimer & _swapBufferTimer
static void AddDebugMessage(const char *message, U32 id=U32_MAX)
eastl::fixed_vector< CachedSamplerEntry, InitialSamplerMapSize, true > SamplerObjectMap
std::array< glHardwareQueryEntry, to_base(QueryType::COUNT)> HardwareQueryContext
GFX::MemoryBarrierCommand _uniformsMemCommand
void closeRenderingAPI() override
Clear everything that was setup in initRenderingAPI()
bool makeTextureViewResident(gl46core::GLubyte bindingSlot, const ImageView &imageView, size_t imageViewHash, SamplerDescriptor sampler, size_t samplerHash) const
static constexpr size_t InitialSamplerMapSize
static SharedMutex s_samplerMapLock
static GLStateTracker & GetStateTracker() noexcept
bool drawToWindow(DisplayWindow &window) override
Prepare the GPU for rendering a frame.
static bool DeleteFramebuffers(gl46core::GLuint count, gl46core::GLuint *framebuffers)
static GLStateTracker s_stateTracker
void onRenderThreadLoopEnd() override
ErrorCode initRenderingAPI(I32 argc, char **argv, Configuration &config) override
Try and create a valid OpenGL context taking in account the specified command line arguments.
static ShaderResult BindPipeline(GFXDevice &context, const Pipeline &pipeline)
void flushPushConstantsLocks()
eastl::stack< HardwareQueryContext > _queryContext
bool frameEnded() override
static GLUtil::GLMemory::GLMemoryType GetMemoryTypeForUsage(gl46core::GLenum usage) noexcept
std::array< glHardwareQueryRing_uptr, to_base(GlobalQueryTypes::COUNT)> _performanceQueries
Hardware query objects used for performance measurements.
static gl46core::GLuint GetSamplerHandle(SamplerDescriptor sampler, size_t &samplerHashInOut)
Return the OpenGL sampler object's handle for the given hash value.
ShaderBuffer_uptr newSB(const ShaderBufferDescriptor &descriptor) const override
void flushCommand(GFX::CommandBase *cmd) override
void flushWindow(DisplayWindow &window) override
void idle(bool fast) override
static bool DeleteBuffers(gl46core::GLuint count, gl46core::GLuint *buffers)
static SamplerObjectMap s_samplerMap
static U32 s_fenceSyncCounter[s_LockFrameLifetime]
@ TESSELLATION_EVAL_INVOCATIONS
static void QueueFlush() noexcept
friend class glVertexArray
void preFlushCommandBuffer(Handle< GFX::CommandBuffer > commandBuffer) override
bool frameStarted() override
static std::array< GLUtil::GLMemory::DeviceAllocator, to_base(GLUtil::GLMemory::GLMemoryType::COUNT)> s_memoryAllocators
void initDescriptorSets() override
static bool DeleteSamplers(gl46core::GLuint count, gl46core::GLuint *samplers)
void endPerformanceQueries()
RenderTarget_uptr newRT(const RenderTargetDescriptor &descriptor) const override
static GLUtil::glTextureViewCache s_textureViewCache
bool bindShaderResources(const DescriptorSetEntries &descriptorSetEntries) override
static std::unique_ptr< glHardwareQueryPool > s_hardwareQueryPool
void prepareFlushWindow(DisplayWindow &window) override
HardwareQueryContext _primitiveQueries
void flushTextureBindQueue()
bool setViewportInternal(const Rect< I32 > &viewport) override
Renderer Programming Interface.
OpenGL implementation of the ShaderProgram entity.
struct FONScontext FONScontext
Handle console commands that start with a forward slash.
std::array< DescriptorSetEntry, to_base(DescriptorSetUsage::COUNT)> DescriptorSetEntries
std::shared_mutex SharedMutex
constexpr gl46core::GLuint GL_NULL_HANDLE
Invalid object value. Used to compare handles and determine if they were properly created.
constexpr U8 INVALID_TEXTURE_BINDING
constexpr auto to_base(const Type value) -> Type
gl46core::GLuint _glHandle
gl46core::GLuint _sampler
glHardwareQueryRing * _query