Files
parallel-gx1/Source/Core/VideoBackends/OGL/OGLPipeline.h
T
LibretroAdmin bc09a84dd1 GL: programs compiled on the driver's threads, drawn with once linked
Where the driver compiles on threads of its own
(GL_KHR_parallel_shader_compile or the ARB one), the asynchronous
shader modes on OpenGL compile in the background on the frontend's
context alone: a missing program's compile and link are started, a
couple of work items a frame, and its draws use the ubershaders, or
are skipped, until GL_COMPLETION_STATUS says the link is done; its
link is checked, its variables set and its binary written to the cache
then. A program drawn with before it is done is waited for there. A
software rasterizer, which compiles when it first draws, compiles on
the spot as before.

The shader compiler gets a deferred mode for it, without threads,
compiling the items waiting a few at a time, and AbstractPipeline tells
whether a pipeline's compile is still running and whether it can be
drawn with. With the driver's threads alone, every ubershader pipeline
there can be is not built in the background.
2026-11-07 02:05:36 +01:00

49 lines
1.8 KiB
C++

// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <memory>
#include "VideoBackends/OGL/ProgramShaderCache.h"
#include "VideoCommon/AbstractPipeline.h"
#include "VideoCommon/RenderState.h"
namespace OGL
{
class OGLPipeline final : public AbstractPipeline
{
public:
explicit OGLPipeline(const AbstractPipelineConfig& config, const GLVertexFormat* vertex_format,
RasterizationState rasterization_state, DepthState depth_state,
BlendingState blending_state, PipelineProgram* program, GLenum gl_primitive);
~OGLPipeline() override;
const GLVertexFormat* GetVertexFormat() const { return m_vertex_format; }
const RasterizationState& GetRasterizationState() const { return m_rasterization_state; }
const DepthState& GetDepthState() const { return m_depth_state; }
const BlendingState& GetBlendingState() const { return m_blending_state; }
const PipelineProgram* GetProgram() const { return m_program; }
bool HasVertexInput() const { return m_vertex_format != nullptr; }
GLenum GetGLPrimitive() const { return m_gl_primitive; }
CacheData GetCacheData() const override;
bool IsReady() const override { return ProgramShaderCache::FinishLink(m_program, false); }
bool IsBuilding() const override
{
ProgramShaderCache::FinishLink(m_program, false);
return m_program->link_pending;
}
static std::unique_ptr<OGLPipeline> Create(const AbstractPipelineConfig& config,
const void* cache_data, size_t cache_data_size);
private:
const GLVertexFormat* m_vertex_format;
RasterizationState m_rasterization_state;
DepthState m_depth_state;
BlendingState m_blending_state;
PipelineProgram* m_program;
GLenum m_gl_primitive;
};
} // namespace OGL