1
0
Fork 0
forked from suyu/suyu

gl_shader_cache: Rename Program abstractions into Pipeline

This commit is contained in:
ReinUsesLisp 2021-05-25 18:58:28 -03:00 committed by ameerj
parent 48aafe0961
commit eacf18cce9
10 changed files with 104 additions and 104 deletions

View file

@ -67,14 +67,14 @@ add_library(video_core STATIC
renderer_base.h renderer_base.h
renderer_opengl/gl_buffer_cache.cpp renderer_opengl/gl_buffer_cache.cpp
renderer_opengl/gl_buffer_cache.h renderer_opengl/gl_buffer_cache.h
renderer_opengl/gl_compute_program.cpp renderer_opengl/gl_compute_pipeline.cpp
renderer_opengl/gl_compute_program.h renderer_opengl/gl_compute_pipeline.h
renderer_opengl/gl_device.cpp renderer_opengl/gl_device.cpp
renderer_opengl/gl_device.h renderer_opengl/gl_device.h
renderer_opengl/gl_fence_manager.cpp renderer_opengl/gl_fence_manager.cpp
renderer_opengl/gl_fence_manager.h renderer_opengl/gl_fence_manager.h
renderer_opengl/gl_graphics_program.cpp renderer_opengl/gl_graphics_pipeline.cpp
renderer_opengl/gl_graphics_program.h renderer_opengl/gl_graphics_pipeline.h
renderer_opengl/gl_rasterizer.cpp renderer_opengl/gl_rasterizer.cpp
renderer_opengl/gl_rasterizer.h renderer_opengl/gl_rasterizer.h
renderer_opengl/gl_resource_manager.cpp renderer_opengl/gl_resource_manager.cpp

View file

@ -5,7 +5,7 @@
#include <cstring> #include <cstring>
#include "common/cityhash.h" #include "common/cityhash.h"
#include "video_core/renderer_opengl/gl_compute_program.h" #include "video_core/renderer_opengl/gl_compute_pipeline.h"
#include "video_core/renderer_opengl/gl_shader_manager.h" #include "video_core/renderer_opengl/gl_shader_manager.h"
namespace OpenGL { namespace OpenGL {
@ -17,16 +17,16 @@ using VideoCommon::ImageId;
constexpr u32 MAX_TEXTURES = 64; constexpr u32 MAX_TEXTURES = 64;
constexpr u32 MAX_IMAGES = 16; constexpr u32 MAX_IMAGES = 16;
size_t ComputeProgramKey::Hash() const noexcept { size_t ComputePipelineKey::Hash() const noexcept {
return static_cast<size_t>( return static_cast<size_t>(
Common::CityHash64(reinterpret_cast<const char*>(this), sizeof *this)); Common::CityHash64(reinterpret_cast<const char*>(this), sizeof *this));
} }
bool ComputeProgramKey::operator==(const ComputeProgramKey& rhs) const noexcept { bool ComputePipelineKey::operator==(const ComputePipelineKey& rhs) const noexcept {
return std::memcmp(this, &rhs, sizeof *this) == 0; return std::memcmp(this, &rhs, sizeof *this) == 0;
} }
ComputeProgram::ComputeProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_, ComputePipeline::ComputePipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_,
Tegra::MemoryManager& gpu_memory_, Tegra::MemoryManager& gpu_memory_,
Tegra::Engines::KeplerCompute& kepler_compute_, Tegra::Engines::KeplerCompute& kepler_compute_,
ProgramManager& program_manager_, const Shader::Info& info_, ProgramManager& program_manager_, const Shader::Info& info_,
@ -53,7 +53,7 @@ ComputeProgram::ComputeProgram(TextureCache& texture_cache_, BufferCache& buffer
ASSERT(num_images <= MAX_IMAGES); ASSERT(num_images <= MAX_IMAGES);
} }
void ComputeProgram::Configure() { void ComputePipeline::Configure() {
buffer_cache.SetEnabledComputeUniformBuffers(info.constant_buffer_mask); buffer_cache.SetEnabledComputeUniformBuffers(info.constant_buffer_mask);
buffer_cache.UnbindComputeStorageBuffers(); buffer_cache.UnbindComputeStorageBuffers();
size_t ssbo_index{}; size_t ssbo_index{};

View file

@ -30,26 +30,26 @@ namespace OpenGL {
class ProgramManager; class ProgramManager;
struct ComputeProgramKey { struct ComputePipelineKey {
u64 unique_hash; u64 unique_hash;
u32 shared_memory_size; u32 shared_memory_size;
std::array<u32, 3> workgroup_size; std::array<u32, 3> workgroup_size;
size_t Hash() const noexcept; size_t Hash() const noexcept;
bool operator==(const ComputeProgramKey&) const noexcept; bool operator==(const ComputePipelineKey&) const noexcept;
bool operator!=(const ComputeProgramKey& rhs) const noexcept { bool operator!=(const ComputePipelineKey& rhs) const noexcept {
return !operator==(rhs); return !operator==(rhs);
} }
}; };
static_assert(std::has_unique_object_representations_v<ComputeProgramKey>); static_assert(std::has_unique_object_representations_v<ComputePipelineKey>);
static_assert(std::is_trivially_copyable_v<ComputeProgramKey>); static_assert(std::is_trivially_copyable_v<ComputePipelineKey>);
static_assert(std::is_trivially_constructible_v<ComputeProgramKey>); static_assert(std::is_trivially_constructible_v<ComputePipelineKey>);
class ComputeProgram { class ComputePipeline {
public: public:
explicit ComputeProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_, explicit ComputePipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_,
Tegra::MemoryManager& gpu_memory_, Tegra::MemoryManager& gpu_memory_,
Tegra::Engines::KeplerCompute& kepler_compute_, Tegra::Engines::KeplerCompute& kepler_compute_,
ProgramManager& program_manager_, const Shader::Info& info_, ProgramManager& program_manager_, const Shader::Info& info_,
@ -76,8 +76,8 @@ private:
namespace std { namespace std {
template <> template <>
struct hash<OpenGL::ComputeProgramKey> { struct hash<OpenGL::ComputePipelineKey> {
size_t operator()(const OpenGL::ComputeProgramKey& k) const noexcept { size_t operator()(const OpenGL::ComputePipelineKey& k) const noexcept {
return k.Hash(); return k.Hash();
} }
}; };

View file

@ -7,7 +7,7 @@
#include "common/cityhash.h" #include "common/cityhash.h"
#include "shader_recompiler/shader_info.h" #include "shader_recompiler/shader_info.h"
#include "video_core/renderer_opengl/gl_graphics_program.h" #include "video_core/renderer_opengl/gl_graphics_pipeline.h"
#include "video_core/renderer_opengl/gl_shader_manager.h" #include "video_core/renderer_opengl/gl_shader_manager.h"
#include "video_core/renderer_opengl/gl_state_tracker.h" #include "video_core/renderer_opengl/gl_state_tracker.h"
#include "video_core/texture_cache/texture_cache.h" #include "video_core/texture_cache/texture_cache.h"
@ -62,15 +62,15 @@ std::pair<GLint, GLint> TransformFeedbackEnum(u8 location) {
} }
} // Anonymous namespace } // Anonymous namespace
size_t GraphicsProgramKey::Hash() const noexcept { size_t GraphicsPipelineKey::Hash() const noexcept {
return static_cast<size_t>(Common::CityHash64(reinterpret_cast<const char*>(this), Size())); return static_cast<size_t>(Common::CityHash64(reinterpret_cast<const char*>(this), Size()));
} }
bool GraphicsProgramKey::operator==(const GraphicsProgramKey& rhs) const noexcept { bool GraphicsPipelineKey::operator==(const GraphicsPipelineKey& rhs) const noexcept {
return std::memcmp(this, &rhs, Size()) == 0; return std::memcmp(this, &rhs, Size()) == 0;
} }
GraphicsProgram::GraphicsProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_, GraphicsPipeline::GraphicsPipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_,
Tegra::MemoryManager& gpu_memory_, Tegra::MemoryManager& gpu_memory_,
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::Engines::Maxwell3D& maxwell3d_,
ProgramManager& program_manager_, StateTracker& state_tracker_, ProgramManager& program_manager_, StateTracker& state_tracker_,
@ -126,7 +126,7 @@ struct Spec {
static constexpr bool has_images = true; static constexpr bool has_images = true;
}; };
void GraphicsProgram::Configure(bool is_indexed) { void GraphicsPipeline::Configure(bool is_indexed) {
std::array<ImageId, MAX_TEXTURES + MAX_IMAGES> image_view_ids; std::array<ImageId, MAX_TEXTURES + MAX_IMAGES> image_view_ids;
std::array<u32, MAX_TEXTURES + MAX_IMAGES> image_view_indices; std::array<u32, MAX_TEXTURES + MAX_IMAGES> image_view_indices;
std::array<GLuint, MAX_TEXTURES> samplers; std::array<GLuint, MAX_TEXTURES> samplers;
@ -347,7 +347,7 @@ void GraphicsProgram::Configure(bool is_indexed) {
} }
} }
void GraphicsProgram::GenerateTransformFeedbackState( void GraphicsPipeline::GenerateTransformFeedbackState(
const VideoCommon::TransformFeedbackState& xfb_state) { const VideoCommon::TransformFeedbackState& xfb_state) {
// TODO(Rodrigo): Inject SKIP_COMPONENTS*_NV when required. An unimplemented message will signal // TODO(Rodrigo): Inject SKIP_COMPONENTS*_NV when required. An unimplemented message will signal
// when this is required. // when this is required.
@ -394,7 +394,7 @@ void GraphicsProgram::GenerateTransformFeedbackState(
num_xfb_strides = static_cast<GLsizei>(current_stream - xfb_streams.data()); num_xfb_strides = static_cast<GLsizei>(current_stream - xfb_streams.data());
} }
void GraphicsProgram::ConfigureTransformFeedbackImpl() const { void GraphicsPipeline::ConfigureTransformFeedbackImpl() const {
glTransformFeedbackStreamAttribsNV(num_xfb_attribs, xfb_attribs.data(), num_xfb_strides, glTransformFeedbackStreamAttribsNV(num_xfb_attribs, xfb_attribs.data(), num_xfb_strides,
xfb_streams.data(), GL_INTERLEAVED_ATTRIBS); xfb_streams.data(), GL_INTERLEAVED_ATTRIBS);
} }

View file

@ -24,7 +24,7 @@ class ProgramManager;
using Maxwell = Tegra::Engines::Maxwell3D::Regs; using Maxwell = Tegra::Engines::Maxwell3D::Regs;
struct GraphicsProgramKey { struct GraphicsPipelineKey {
std::array<u64, 6> unique_hashes; std::array<u64, 6> unique_hashes;
union { union {
u32 raw; u32 raw;
@ -40,27 +40,27 @@ struct GraphicsProgramKey {
size_t Hash() const noexcept; size_t Hash() const noexcept;
bool operator==(const GraphicsProgramKey&) const noexcept; bool operator==(const GraphicsPipelineKey&) const noexcept;
bool operator!=(const GraphicsProgramKey& rhs) const noexcept { bool operator!=(const GraphicsPipelineKey& rhs) const noexcept {
return !operator==(rhs); return !operator==(rhs);
} }
[[nodiscard]] size_t Size() const noexcept { [[nodiscard]] size_t Size() const noexcept {
if (xfb_enabled != 0) { if (xfb_enabled != 0) {
return sizeof(GraphicsProgramKey); return sizeof(GraphicsPipelineKey);
} else { } else {
return offsetof(GraphicsProgramKey, padding); return offsetof(GraphicsPipelineKey, padding);
} }
} }
}; };
static_assert(std::has_unique_object_representations_v<GraphicsProgramKey>); static_assert(std::has_unique_object_representations_v<GraphicsPipelineKey>);
static_assert(std::is_trivially_copyable_v<GraphicsProgramKey>); static_assert(std::is_trivially_copyable_v<GraphicsPipelineKey>);
static_assert(std::is_trivially_constructible_v<GraphicsProgramKey>); static_assert(std::is_trivially_constructible_v<GraphicsPipelineKey>);
class GraphicsProgram { class GraphicsPipeline {
public: public:
explicit GraphicsProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_, explicit GraphicsPipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_,
Tegra::MemoryManager& gpu_memory_, Tegra::MemoryManager& gpu_memory_,
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::Engines::Maxwell3D& maxwell3d_,
ProgramManager& program_manager_, StateTracker& state_tracker_, ProgramManager& program_manager_, StateTracker& state_tracker_,
@ -110,8 +110,8 @@ private:
namespace std { namespace std {
template <> template <>
struct hash<OpenGL::GraphicsProgramKey> { struct hash<OpenGL::GraphicsPipelineKey> {
size_t operator()(const OpenGL::GraphicsProgramKey& k) const noexcept { size_t operator()(const OpenGL::GraphicsPipelineKey& k) const noexcept {
return k.Hash(); return k.Hash();
} }
}; };

View file

@ -218,13 +218,13 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
SyncState(); SyncState();
GraphicsProgram* const program{shader_cache.CurrentGraphicsProgram()}; GraphicsPipeline* const pipeline{shader_cache.CurrentGraphicsPipeline()};
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
program->Configure(is_indexed); pipeline->Configure(is_indexed);
const GLenum primitive_mode = MaxwellToGL::PrimitiveTopology(maxwell3d.regs.draw.topology); const GLenum primitive_mode = MaxwellToGL::PrimitiveTopology(maxwell3d.regs.draw.topology);
BeginTransformFeedback(program, primitive_mode); BeginTransformFeedback(pipeline, primitive_mode);
const GLuint base_instance = static_cast<GLuint>(maxwell3d.regs.vb_base_instance); const GLuint base_instance = static_cast<GLuint>(maxwell3d.regs.vb_base_instance);
const GLsizei num_instances = const GLsizei num_instances =
@ -271,7 +271,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
} }
void RasterizerOpenGL::DispatchCompute() { void RasterizerOpenGL::DispatchCompute() {
ComputeProgram* const program{shader_cache.CurrentComputeProgram()}; ComputePipeline* const program{shader_cache.CurrentComputePipeline()};
if (!program) { if (!program) {
return; return;
} }
@ -996,7 +996,7 @@ void RasterizerOpenGL::SyncFramebufferSRGB() {
oglEnable(GL_FRAMEBUFFER_SRGB, maxwell3d.regs.framebuffer_srgb); oglEnable(GL_FRAMEBUFFER_SRGB, maxwell3d.regs.framebuffer_srgb);
} }
void RasterizerOpenGL::BeginTransformFeedback(GraphicsProgram* program, GLenum primitive_mode) { void RasterizerOpenGL::BeginTransformFeedback(GraphicsPipeline* program, GLenum primitive_mode) {
const auto& regs = maxwell3d.regs; const auto& regs = maxwell3d.regs;
if (regs.tfb_enabled == 0) { if (regs.tfb_enabled == 0) {
return; return;

View file

@ -194,7 +194,7 @@ private:
void SyncVertexInstances(); void SyncVertexInstances();
/// Begin a transform feedback /// Begin a transform feedback
void BeginTransformFeedback(GraphicsProgram* program, GLenum primitive_mode); void BeginTransformFeedback(GraphicsPipeline* pipeline, GLenum primitive_mode);
/// End a transform feedback /// End a transform feedback
void EndTransformFeedback(); void EndTransformFeedback();

View file

@ -152,7 +152,7 @@ GLenum AssemblyStage(size_t stage_index) {
return GL_NONE; return GL_NONE;
} }
Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsProgramKey& key, Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsPipelineKey& key,
const Shader::IR::Program& program) { const Shader::IR::Program& program) {
UNIMPLEMENTED_IF_MSG(key.xfb_enabled != 0, "Transform feedbacks"); UNIMPLEMENTED_IF_MSG(key.xfb_enabled != 0, "Transform feedbacks");
@ -282,7 +282,7 @@ ShaderCache::ShaderCache(RasterizerOpenGL& rasterizer_, Core::Frontend::EmuWindo
ShaderCache::~ShaderCache() = default; ShaderCache::~ShaderCache() = default;
GraphicsProgram* ShaderCache::CurrentGraphicsProgram() { GraphicsPipeline* ShaderCache::CurrentGraphicsPipeline() {
if (!RefreshStages(graphics_key.unique_hashes)) { if (!RefreshStages(graphics_key.unique_hashes)) {
return nullptr; return nullptr;
} }
@ -302,18 +302,18 @@ GraphicsProgram* ShaderCache::CurrentGraphicsProgram() {
const auto [pair, is_new]{graphics_cache.try_emplace(graphics_key)}; const auto [pair, is_new]{graphics_cache.try_emplace(graphics_key)};
auto& program{pair->second}; auto& program{pair->second};
if (is_new) { if (is_new) {
program = CreateGraphicsProgram(); program = CreateGraphicsPipeline();
} }
return program.get(); return program.get();
} }
ComputeProgram* ShaderCache::CurrentComputeProgram() { ComputePipeline* ShaderCache::CurrentComputePipeline() {
const VideoCommon::ShaderInfo* const shader{ComputeShader()}; const VideoCommon::ShaderInfo* const shader{ComputeShader()};
if (!shader) { if (!shader) {
return nullptr; return nullptr;
} }
const auto& qmd{kepler_compute.launch_description}; const auto& qmd{kepler_compute.launch_description};
const ComputeProgramKey key{ const ComputePipelineKey key{
.unique_hash = shader->unique_hash, .unique_hash = shader->unique_hash,
.shared_memory_size = qmd.shared_alloc, .shared_memory_size = qmd.shared_alloc,
.workgroup_size{qmd.block_dim_x, qmd.block_dim_y, qmd.block_dim_z}, .workgroup_size{qmd.block_dim_x, qmd.block_dim_y, qmd.block_dim_z},
@ -323,20 +323,20 @@ ComputeProgram* ShaderCache::CurrentComputeProgram() {
if (!is_new) { if (!is_new) {
return pipeline.get(); return pipeline.get();
} }
pipeline = CreateComputeProgram(key, shader); pipeline = CreateComputePipeline(key, shader);
return pipeline.get(); return pipeline.get();
} }
std::unique_ptr<GraphicsProgram> ShaderCache::CreateGraphicsProgram() { std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline() {
GraphicsEnvironments environments; GraphicsEnvironments environments;
GetGraphicsEnvironments(environments, graphics_key.unique_hashes); GetGraphicsEnvironments(environments, graphics_key.unique_hashes);
main_pools.ReleaseContents(); main_pools.ReleaseContents();
return CreateGraphicsProgram(main_pools, graphics_key, environments.Span(), true); return CreateGraphicsPipeline(main_pools, graphics_key, environments.Span(), true);
} }
std::unique_ptr<GraphicsProgram> ShaderCache::CreateGraphicsProgram( std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline(
ShaderPools& pools, const GraphicsProgramKey& key, std::span<Shader::Environment* const> envs, ShaderPools& pools, const GraphicsPipelineKey& key, std::span<Shader::Environment* const> envs,
bool build_in_parallel) { bool build_in_parallel) {
LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash()); LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash());
size_t env_index{0}; size_t env_index{0};
@ -382,25 +382,25 @@ std::unique_ptr<GraphicsProgram> ShaderCache::CreateGraphicsProgram(
if (!device.UseAssemblyShaders()) { if (!device.UseAssemblyShaders()) {
LinkProgram(source_program.handle); LinkProgram(source_program.handle);
} }
return std::make_unique<GraphicsProgram>( return std::make_unique<GraphicsPipeline>(
texture_cache, buffer_cache, gpu_memory, maxwell3d, program_manager, state_tracker, texture_cache, buffer_cache, gpu_memory, maxwell3d, program_manager, state_tracker,
std::move(source_program), std::move(assembly_programs), infos, std::move(source_program), std::move(assembly_programs), infos,
key.xfb_enabled != 0 ? &key.xfb_state : nullptr); key.xfb_enabled != 0 ? &key.xfb_state : nullptr);
} }
std::unique_ptr<ComputeProgram> ShaderCache::CreateComputeProgram( std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline(
const ComputeProgramKey& key, const VideoCommon::ShaderInfo* shader) { const ComputePipelineKey& key, const VideoCommon::ShaderInfo* shader) {
const GPUVAddr program_base{kepler_compute.regs.code_loc.Address()}; const GPUVAddr program_base{kepler_compute.regs.code_loc.Address()};
const auto& qmd{kepler_compute.launch_description}; const auto& qmd{kepler_compute.launch_description};
ComputeEnvironment env{kepler_compute, gpu_memory, program_base, qmd.program_start}; ComputeEnvironment env{kepler_compute, gpu_memory, program_base, qmd.program_start};
env.SetCachedSize(shader->size_bytes); env.SetCachedSize(shader->size_bytes);
main_pools.ReleaseContents(); main_pools.ReleaseContents();
return CreateComputeProgram(main_pools, key, env, true); return CreateComputePipeline(main_pools, key, env, true);
} }
std::unique_ptr<ComputeProgram> ShaderCache::CreateComputeProgram(ShaderPools& pools, std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline(ShaderPools& pools,
const ComputeProgramKey& key, const ComputePipelineKey& key,
Shader::Environment& env, Shader::Environment& env,
bool build_in_parallel) { bool build_in_parallel) {
LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash()); LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash());
@ -418,8 +418,8 @@ std::unique_ptr<ComputeProgram> ShaderCache::CreateComputeProgram(ShaderPools& p
AddShader(GL_COMPUTE_SHADER, source_program.handle, code); AddShader(GL_COMPUTE_SHADER, source_program.handle, code);
LinkProgram(source_program.handle); LinkProgram(source_program.handle);
} }
return std::make_unique<ComputeProgram>(texture_cache, buffer_cache, gpu_memory, kepler_compute, return std::make_unique<ComputePipeline>(texture_cache, buffer_cache, gpu_memory,
program_manager, program.info, kepler_compute, program_manager, program.info,
std::move(source_program), std::move(asm_program)); std::move(source_program), std::move(asm_program));
} }

View file

@ -15,8 +15,8 @@
#include "shader_recompiler/frontend/maxwell/control_flow.h" #include "shader_recompiler/frontend/maxwell/control_flow.h"
#include "shader_recompiler/object_pool.h" #include "shader_recompiler/object_pool.h"
#include "video_core/engines/shader_type.h" #include "video_core/engines/shader_type.h"
#include "video_core/renderer_opengl/gl_compute_program.h" #include "video_core/renderer_opengl/gl_compute_pipeline.h"
#include "video_core/renderer_opengl/gl_graphics_program.h" #include "video_core/renderer_opengl/gl_graphics_pipeline.h"
#include "video_core/shader_cache.h" #include "video_core/shader_cache.h"
namespace Tegra { namespace Tegra {
@ -55,22 +55,22 @@ public:
ProgramManager& program_manager_, StateTracker& state_tracker_); ProgramManager& program_manager_, StateTracker& state_tracker_);
~ShaderCache(); ~ShaderCache();
[[nodiscard]] GraphicsProgram* CurrentGraphicsProgram(); [[nodiscard]] GraphicsPipeline* CurrentGraphicsPipeline();
[[nodiscard]] ComputeProgram* CurrentComputeProgram(); [[nodiscard]] ComputePipeline* CurrentComputePipeline();
private: private:
std::unique_ptr<GraphicsProgram> CreateGraphicsProgram(); std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline();
std::unique_ptr<GraphicsProgram> CreateGraphicsProgram( std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline(
ShaderPools& pools, const GraphicsProgramKey& key, ShaderPools& pools, const GraphicsPipelineKey& key,
std::span<Shader::Environment* const> envs, bool build_in_parallel); std::span<Shader::Environment* const> envs, bool build_in_parallel);
std::unique_ptr<ComputeProgram> CreateComputeProgram(const ComputeProgramKey& key, std::unique_ptr<ComputePipeline> CreateComputePipeline(const ComputePipelineKey& key,
const VideoCommon::ShaderInfo* shader); const VideoCommon::ShaderInfo* shader);
std::unique_ptr<ComputeProgram> CreateComputeProgram(ShaderPools& pools, std::unique_ptr<ComputePipeline> CreateComputePipeline(ShaderPools& pools,
const ComputeProgramKey& key, const ComputePipelineKey& key,
Shader::Environment& env, Shader::Environment& env,
bool build_in_parallel); bool build_in_parallel);
@ -81,11 +81,11 @@ private:
ProgramManager& program_manager; ProgramManager& program_manager;
StateTracker& state_tracker; StateTracker& state_tracker;
GraphicsProgramKey graphics_key{}; GraphicsPipelineKey graphics_key{};
ShaderPools main_pools; ShaderPools main_pools;
std::unordered_map<GraphicsProgramKey, std::unique_ptr<GraphicsProgram>> graphics_cache; std::unordered_map<GraphicsPipelineKey, std::unique_ptr<GraphicsPipeline>> graphics_cache;
std::unordered_map<ComputeProgramKey, std::unique_ptr<ComputeProgram>> compute_cache; std::unordered_map<ComputePipelineKey, std::unique_ptr<ComputePipeline>> compute_cache;
Shader::Profile profile; Shader::Profile profile;
}; };

View file

@ -9,8 +9,8 @@
#include <glad/glad.h> #include <glad/glad.h>
#include "video_core/renderer_opengl/gl_resource_manager.h"
#include "video_core/renderer_opengl/gl_device.h" #include "video_core/renderer_opengl/gl_device.h"
#include "video_core/renderer_opengl/gl_resource_manager.h"
namespace OpenGL { namespace OpenGL {