mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-27 14:21:21 -08:00
gl_shader_cache: Rename Program abstractions into Pipeline
This commit is contained in:
parent
48aafe0961
commit
eacf18cce9
@ -67,14 +67,14 @@ add_library(video_core STATIC
|
||||
renderer_base.h
|
||||
renderer_opengl/gl_buffer_cache.cpp
|
||||
renderer_opengl/gl_buffer_cache.h
|
||||
renderer_opengl/gl_compute_program.cpp
|
||||
renderer_opengl/gl_compute_program.h
|
||||
renderer_opengl/gl_compute_pipeline.cpp
|
||||
renderer_opengl/gl_compute_pipeline.h
|
||||
renderer_opengl/gl_device.cpp
|
||||
renderer_opengl/gl_device.h
|
||||
renderer_opengl/gl_fence_manager.cpp
|
||||
renderer_opengl/gl_fence_manager.h
|
||||
renderer_opengl/gl_graphics_program.cpp
|
||||
renderer_opengl/gl_graphics_program.h
|
||||
renderer_opengl/gl_graphics_pipeline.cpp
|
||||
renderer_opengl/gl_graphics_pipeline.h
|
||||
renderer_opengl/gl_rasterizer.cpp
|
||||
renderer_opengl/gl_rasterizer.h
|
||||
renderer_opengl/gl_resource_manager.cpp
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <cstring>
|
||||
|
||||
#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"
|
||||
|
||||
namespace OpenGL {
|
||||
@ -17,20 +17,20 @@ using VideoCommon::ImageId;
|
||||
constexpr u32 MAX_TEXTURES = 64;
|
||||
constexpr u32 MAX_IMAGES = 16;
|
||||
|
||||
size_t ComputeProgramKey::Hash() const noexcept {
|
||||
size_t ComputePipelineKey::Hash() const noexcept {
|
||||
return static_cast<size_t>(
|
||||
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;
|
||||
}
|
||||
|
||||
ComputeProgram::ComputeProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_,
|
||||
Tegra::MemoryManager& gpu_memory_,
|
||||
Tegra::Engines::KeplerCompute& kepler_compute_,
|
||||
ProgramManager& program_manager_, const Shader::Info& info_,
|
||||
OGLProgram source_program_, OGLAssemblyProgram assembly_program_)
|
||||
ComputePipeline::ComputePipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_,
|
||||
Tegra::MemoryManager& gpu_memory_,
|
||||
Tegra::Engines::KeplerCompute& kepler_compute_,
|
||||
ProgramManager& program_manager_, const Shader::Info& info_,
|
||||
OGLProgram source_program_, OGLAssemblyProgram assembly_program_)
|
||||
: texture_cache{texture_cache_}, buffer_cache{buffer_cache_}, gpu_memory{gpu_memory_},
|
||||
kepler_compute{kepler_compute_}, program_manager{program_manager_}, info{info_},
|
||||
source_program{std::move(source_program_)}, assembly_program{std::move(assembly_program_)} {
|
||||
@ -53,7 +53,7 @@ ComputeProgram::ComputeProgram(TextureCache& texture_cache_, BufferCache& buffer
|
||||
ASSERT(num_images <= MAX_IMAGES);
|
||||
}
|
||||
|
||||
void ComputeProgram::Configure() {
|
||||
void ComputePipeline::Configure() {
|
||||
buffer_cache.SetEnabledComputeUniformBuffers(info.constant_buffer_mask);
|
||||
buffer_cache.UnbindComputeStorageBuffers();
|
||||
size_t ssbo_index{};
|
@ -30,30 +30,30 @@ namespace OpenGL {
|
||||
|
||||
class ProgramManager;
|
||||
|
||||
struct ComputeProgramKey {
|
||||
struct ComputePipelineKey {
|
||||
u64 unique_hash;
|
||||
u32 shared_memory_size;
|
||||
std::array<u32, 3> workgroup_size;
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
static_assert(std::has_unique_object_representations_v<ComputeProgramKey>);
|
||||
static_assert(std::is_trivially_copyable_v<ComputeProgramKey>);
|
||||
static_assert(std::is_trivially_constructible_v<ComputeProgramKey>);
|
||||
static_assert(std::has_unique_object_representations_v<ComputePipelineKey>);
|
||||
static_assert(std::is_trivially_copyable_v<ComputePipelineKey>);
|
||||
static_assert(std::is_trivially_constructible_v<ComputePipelineKey>);
|
||||
|
||||
class ComputeProgram {
|
||||
class ComputePipeline {
|
||||
public:
|
||||
explicit ComputeProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_,
|
||||
Tegra::MemoryManager& gpu_memory_,
|
||||
Tegra::Engines::KeplerCompute& kepler_compute_,
|
||||
ProgramManager& program_manager_, const Shader::Info& info_,
|
||||
OGLProgram source_program_, OGLAssemblyProgram assembly_program_);
|
||||
explicit ComputePipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_,
|
||||
Tegra::MemoryManager& gpu_memory_,
|
||||
Tegra::Engines::KeplerCompute& kepler_compute_,
|
||||
ProgramManager& program_manager_, const Shader::Info& info_,
|
||||
OGLProgram source_program_, OGLAssemblyProgram assembly_program_);
|
||||
|
||||
void Configure();
|
||||
|
||||
@ -76,8 +76,8 @@ private:
|
||||
|
||||
namespace std {
|
||||
template <>
|
||||
struct hash<OpenGL::ComputeProgramKey> {
|
||||
size_t operator()(const OpenGL::ComputeProgramKey& k) const noexcept {
|
||||
struct hash<OpenGL::ComputePipelineKey> {
|
||||
size_t operator()(const OpenGL::ComputePipelineKey& k) const noexcept {
|
||||
return k.Hash();
|
||||
}
|
||||
};
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "common/cityhash.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_state_tracker.h"
|
||||
#include "video_core/texture_cache/texture_cache.h"
|
||||
@ -62,22 +62,22 @@ std::pair<GLint, GLint> TransformFeedbackEnum(u8 location) {
|
||||
}
|
||||
} // 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()));
|
||||
}
|
||||
|
||||
bool GraphicsProgramKey::operator==(const GraphicsProgramKey& rhs) const noexcept {
|
||||
bool GraphicsPipelineKey::operator==(const GraphicsPipelineKey& rhs) const noexcept {
|
||||
return std::memcmp(this, &rhs, Size()) == 0;
|
||||
}
|
||||
|
||||
GraphicsProgram::GraphicsProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_,
|
||||
Tegra::MemoryManager& gpu_memory_,
|
||||
Tegra::Engines::Maxwell3D& maxwell3d_,
|
||||
ProgramManager& program_manager_, StateTracker& state_tracker_,
|
||||
OGLProgram program_,
|
||||
std::array<OGLAssemblyProgram, 5> assembly_programs_,
|
||||
const std::array<const Shader::Info*, 5>& infos,
|
||||
const VideoCommon::TransformFeedbackState* xfb_state)
|
||||
GraphicsPipeline::GraphicsPipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_,
|
||||
Tegra::MemoryManager& gpu_memory_,
|
||||
Tegra::Engines::Maxwell3D& maxwell3d_,
|
||||
ProgramManager& program_manager_, StateTracker& state_tracker_,
|
||||
OGLProgram program_,
|
||||
std::array<OGLAssemblyProgram, 5> assembly_programs_,
|
||||
const std::array<const Shader::Info*, 5>& infos,
|
||||
const VideoCommon::TransformFeedbackState* xfb_state)
|
||||
: texture_cache{texture_cache_}, buffer_cache{buffer_cache_},
|
||||
gpu_memory{gpu_memory_}, maxwell3d{maxwell3d_}, program_manager{program_manager_},
|
||||
state_tracker{state_tracker_}, program{std::move(program_)}, assembly_programs{std::move(
|
||||
@ -126,7 +126,7 @@ struct Spec {
|
||||
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<u32, MAX_TEXTURES + MAX_IMAGES> image_view_indices;
|
||||
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) {
|
||||
// TODO(Rodrigo): Inject SKIP_COMPONENTS*_NV when required. An unimplemented message will signal
|
||||
// when this is required.
|
||||
@ -394,7 +394,7 @@ void GraphicsProgram::GenerateTransformFeedbackState(
|
||||
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,
|
||||
xfb_streams.data(), GL_INTERLEAVED_ATTRIBS);
|
||||
}
|
@ -24,7 +24,7 @@ class ProgramManager;
|
||||
|
||||
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
||||
|
||||
struct GraphicsProgramKey {
|
||||
struct GraphicsPipelineKey {
|
||||
std::array<u64, 6> unique_hashes;
|
||||
union {
|
||||
u32 raw;
|
||||
@ -40,34 +40,34 @@ struct GraphicsProgramKey {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
[[nodiscard]] size_t Size() const noexcept {
|
||||
if (xfb_enabled != 0) {
|
||||
return sizeof(GraphicsProgramKey);
|
||||
return sizeof(GraphicsPipelineKey);
|
||||
} else {
|
||||
return offsetof(GraphicsProgramKey, padding);
|
||||
return offsetof(GraphicsPipelineKey, padding);
|
||||
}
|
||||
}
|
||||
};
|
||||
static_assert(std::has_unique_object_representations_v<GraphicsProgramKey>);
|
||||
static_assert(std::is_trivially_copyable_v<GraphicsProgramKey>);
|
||||
static_assert(std::is_trivially_constructible_v<GraphicsProgramKey>);
|
||||
static_assert(std::has_unique_object_representations_v<GraphicsPipelineKey>);
|
||||
static_assert(std::is_trivially_copyable_v<GraphicsPipelineKey>);
|
||||
static_assert(std::is_trivially_constructible_v<GraphicsPipelineKey>);
|
||||
|
||||
class GraphicsProgram {
|
||||
class GraphicsPipeline {
|
||||
public:
|
||||
explicit GraphicsProgram(TextureCache& texture_cache_, BufferCache& buffer_cache_,
|
||||
Tegra::MemoryManager& gpu_memory_,
|
||||
Tegra::Engines::Maxwell3D& maxwell3d_,
|
||||
ProgramManager& program_manager_, StateTracker& state_tracker_,
|
||||
OGLProgram program_,
|
||||
std::array<OGLAssemblyProgram, 5> assembly_programs_,
|
||||
const std::array<const Shader::Info*, 5>& infos,
|
||||
const VideoCommon::TransformFeedbackState* xfb_state);
|
||||
explicit GraphicsPipeline(TextureCache& texture_cache_, BufferCache& buffer_cache_,
|
||||
Tegra::MemoryManager& gpu_memory_,
|
||||
Tegra::Engines::Maxwell3D& maxwell3d_,
|
||||
ProgramManager& program_manager_, StateTracker& state_tracker_,
|
||||
OGLProgram program_,
|
||||
std::array<OGLAssemblyProgram, 5> assembly_programs_,
|
||||
const std::array<const Shader::Info*, 5>& infos,
|
||||
const VideoCommon::TransformFeedbackState* xfb_state);
|
||||
|
||||
void Configure(bool is_indexed);
|
||||
|
||||
@ -110,8 +110,8 @@ private:
|
||||
|
||||
namespace std {
|
||||
template <>
|
||||
struct hash<OpenGL::GraphicsProgramKey> {
|
||||
size_t operator()(const OpenGL::GraphicsProgramKey& k) const noexcept {
|
||||
struct hash<OpenGL::GraphicsPipelineKey> {
|
||||
size_t operator()(const OpenGL::GraphicsPipelineKey& k) const noexcept {
|
||||
return k.Hash();
|
||||
}
|
||||
};
|
@ -218,13 +218,13 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
|
||||
|
||||
SyncState();
|
||||
|
||||
GraphicsProgram* const program{shader_cache.CurrentGraphicsProgram()};
|
||||
GraphicsPipeline* const pipeline{shader_cache.CurrentGraphicsPipeline()};
|
||||
|
||||
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);
|
||||
BeginTransformFeedback(program, primitive_mode);
|
||||
BeginTransformFeedback(pipeline, primitive_mode);
|
||||
|
||||
const GLuint base_instance = static_cast<GLuint>(maxwell3d.regs.vb_base_instance);
|
||||
const GLsizei num_instances =
|
||||
@ -271,7 +271,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::DispatchCompute() {
|
||||
ComputeProgram* const program{shader_cache.CurrentComputeProgram()};
|
||||
ComputePipeline* const program{shader_cache.CurrentComputePipeline()};
|
||||
if (!program) {
|
||||
return;
|
||||
}
|
||||
@ -996,7 +996,7 @@ void RasterizerOpenGL::SyncFramebufferSRGB() {
|
||||
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;
|
||||
if (regs.tfb_enabled == 0) {
|
||||
return;
|
||||
|
@ -194,7 +194,7 @@ private:
|
||||
void SyncVertexInstances();
|
||||
|
||||
/// Begin a transform feedback
|
||||
void BeginTransformFeedback(GraphicsProgram* program, GLenum primitive_mode);
|
||||
void BeginTransformFeedback(GraphicsPipeline* pipeline, GLenum primitive_mode);
|
||||
|
||||
/// End a transform feedback
|
||||
void EndTransformFeedback();
|
||||
|
@ -152,7 +152,7 @@ GLenum AssemblyStage(size_t stage_index) {
|
||||
return GL_NONE;
|
||||
}
|
||||
|
||||
Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsProgramKey& key,
|
||||
Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsPipelineKey& key,
|
||||
const Shader::IR::Program& program) {
|
||||
UNIMPLEMENTED_IF_MSG(key.xfb_enabled != 0, "Transform feedbacks");
|
||||
|
||||
@ -282,7 +282,7 @@ ShaderCache::ShaderCache(RasterizerOpenGL& rasterizer_, Core::Frontend::EmuWindo
|
||||
|
||||
ShaderCache::~ShaderCache() = default;
|
||||
|
||||
GraphicsProgram* ShaderCache::CurrentGraphicsProgram() {
|
||||
GraphicsPipeline* ShaderCache::CurrentGraphicsPipeline() {
|
||||
if (!RefreshStages(graphics_key.unique_hashes)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -302,18 +302,18 @@ GraphicsProgram* ShaderCache::CurrentGraphicsProgram() {
|
||||
const auto [pair, is_new]{graphics_cache.try_emplace(graphics_key)};
|
||||
auto& program{pair->second};
|
||||
if (is_new) {
|
||||
program = CreateGraphicsProgram();
|
||||
program = CreateGraphicsPipeline();
|
||||
}
|
||||
return program.get();
|
||||
}
|
||||
|
||||
ComputeProgram* ShaderCache::CurrentComputeProgram() {
|
||||
ComputePipeline* ShaderCache::CurrentComputePipeline() {
|
||||
const VideoCommon::ShaderInfo* const shader{ComputeShader()};
|
||||
if (!shader) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto& qmd{kepler_compute.launch_description};
|
||||
const ComputeProgramKey key{
|
||||
const ComputePipelineKey key{
|
||||
.unique_hash = shader->unique_hash,
|
||||
.shared_memory_size = qmd.shared_alloc,
|
||||
.workgroup_size{qmd.block_dim_x, qmd.block_dim_y, qmd.block_dim_z},
|
||||
@ -323,20 +323,20 @@ ComputeProgram* ShaderCache::CurrentComputeProgram() {
|
||||
if (!is_new) {
|
||||
return pipeline.get();
|
||||
}
|
||||
pipeline = CreateComputeProgram(key, shader);
|
||||
pipeline = CreateComputePipeline(key, shader);
|
||||
return pipeline.get();
|
||||
}
|
||||
|
||||
std::unique_ptr<GraphicsProgram> ShaderCache::CreateGraphicsProgram() {
|
||||
std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline() {
|
||||
GraphicsEnvironments environments;
|
||||
GetGraphicsEnvironments(environments, graphics_key.unique_hashes);
|
||||
|
||||
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(
|
||||
ShaderPools& pools, const GraphicsProgramKey& key, std::span<Shader::Environment* const> envs,
|
||||
std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline(
|
||||
ShaderPools& pools, const GraphicsPipelineKey& key, std::span<Shader::Environment* const> envs,
|
||||
bool build_in_parallel) {
|
||||
LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash());
|
||||
size_t env_index{0};
|
||||
@ -382,27 +382,27 @@ std::unique_ptr<GraphicsProgram> ShaderCache::CreateGraphicsProgram(
|
||||
if (!device.UseAssemblyShaders()) {
|
||||
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,
|
||||
std::move(source_program), std::move(assembly_programs), infos,
|
||||
key.xfb_enabled != 0 ? &key.xfb_state : nullptr);
|
||||
}
|
||||
|
||||
std::unique_ptr<ComputeProgram> ShaderCache::CreateComputeProgram(
|
||||
const ComputeProgramKey& key, const VideoCommon::ShaderInfo* shader) {
|
||||
std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline(
|
||||
const ComputePipelineKey& key, const VideoCommon::ShaderInfo* shader) {
|
||||
const GPUVAddr program_base{kepler_compute.regs.code_loc.Address()};
|
||||
const auto& qmd{kepler_compute.launch_description};
|
||||
ComputeEnvironment env{kepler_compute, gpu_memory, program_base, qmd.program_start};
|
||||
env.SetCachedSize(shader->size_bytes);
|
||||
|
||||
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,
|
||||
const ComputeProgramKey& key,
|
||||
Shader::Environment& env,
|
||||
bool build_in_parallel) {
|
||||
std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline(ShaderPools& pools,
|
||||
const ComputePipelineKey& key,
|
||||
Shader::Environment& env,
|
||||
bool build_in_parallel) {
|
||||
LOG_INFO(Render_OpenGL, "0x{:016x}", key.Hash());
|
||||
|
||||
Shader::Maxwell::Flow::CFG cfg{env, pools.flow_block, env.StartAddress()};
|
||||
@ -418,9 +418,9 @@ std::unique_ptr<ComputeProgram> ShaderCache::CreateComputeProgram(ShaderPools& p
|
||||
AddShader(GL_COMPUTE_SHADER, source_program.handle, code);
|
||||
LinkProgram(source_program.handle);
|
||||
}
|
||||
return std::make_unique<ComputeProgram>(texture_cache, buffer_cache, gpu_memory, kepler_compute,
|
||||
program_manager, program.info,
|
||||
std::move(source_program), std::move(asm_program));
|
||||
return std::make_unique<ComputePipeline>(texture_cache, buffer_cache, gpu_memory,
|
||||
kepler_compute, program_manager, program.info,
|
||||
std::move(source_program), std::move(asm_program));
|
||||
}
|
||||
|
||||
} // namespace OpenGL
|
||||
|
@ -15,8 +15,8 @@
|
||||
#include "shader_recompiler/frontend/maxwell/control_flow.h"
|
||||
#include "shader_recompiler/object_pool.h"
|
||||
#include "video_core/engines/shader_type.h"
|
||||
#include "video_core/renderer_opengl/gl_compute_program.h"
|
||||
#include "video_core/renderer_opengl/gl_graphics_program.h"
|
||||
#include "video_core/renderer_opengl/gl_compute_pipeline.h"
|
||||
#include "video_core/renderer_opengl/gl_graphics_pipeline.h"
|
||||
#include "video_core/shader_cache.h"
|
||||
|
||||
namespace Tegra {
|
||||
@ -55,24 +55,24 @@ public:
|
||||
ProgramManager& program_manager_, StateTracker& state_tracker_);
|
||||
~ShaderCache();
|
||||
|
||||
[[nodiscard]] GraphicsProgram* CurrentGraphicsProgram();
|
||||
[[nodiscard]] GraphicsPipeline* CurrentGraphicsPipeline();
|
||||
|
||||
[[nodiscard]] ComputeProgram* CurrentComputeProgram();
|
||||
[[nodiscard]] ComputePipeline* CurrentComputePipeline();
|
||||
|
||||
private:
|
||||
std::unique_ptr<GraphicsProgram> CreateGraphicsProgram();
|
||||
std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline();
|
||||
|
||||
std::unique_ptr<GraphicsProgram> CreateGraphicsProgram(
|
||||
ShaderPools& pools, const GraphicsProgramKey& key,
|
||||
std::unique_ptr<GraphicsPipeline> CreateGraphicsPipeline(
|
||||
ShaderPools& pools, const GraphicsPipelineKey& key,
|
||||
std::span<Shader::Environment* const> envs, bool build_in_parallel);
|
||||
|
||||
std::unique_ptr<ComputeProgram> CreateComputeProgram(const ComputeProgramKey& key,
|
||||
const VideoCommon::ShaderInfo* shader);
|
||||
std::unique_ptr<ComputePipeline> CreateComputePipeline(const ComputePipelineKey& key,
|
||||
const VideoCommon::ShaderInfo* shader);
|
||||
|
||||
std::unique_ptr<ComputeProgram> CreateComputeProgram(ShaderPools& pools,
|
||||
const ComputeProgramKey& key,
|
||||
Shader::Environment& env,
|
||||
bool build_in_parallel);
|
||||
std::unique_ptr<ComputePipeline> CreateComputePipeline(ShaderPools& pools,
|
||||
const ComputePipelineKey& key,
|
||||
Shader::Environment& env,
|
||||
bool build_in_parallel);
|
||||
|
||||
Core::Frontend::EmuWindow& emu_window;
|
||||
const Device& device;
|
||||
@ -81,11 +81,11 @@ private:
|
||||
ProgramManager& program_manager;
|
||||
StateTracker& state_tracker;
|
||||
|
||||
GraphicsProgramKey graphics_key{};
|
||||
GraphicsPipelineKey graphics_key{};
|
||||
|
||||
ShaderPools main_pools;
|
||||
std::unordered_map<GraphicsProgramKey, std::unique_ptr<GraphicsProgram>> graphics_cache;
|
||||
std::unordered_map<ComputeProgramKey, std::unique_ptr<ComputeProgram>> compute_cache;
|
||||
std::unordered_map<GraphicsPipelineKey, std::unique_ptr<GraphicsPipeline>> graphics_cache;
|
||||
std::unordered_map<ComputePipelineKey, std::unique_ptr<ComputePipeline>> compute_cache;
|
||||
|
||||
Shader::Profile profile;
|
||||
};
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#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_resource_manager.h"
|
||||
|
||||
namespace OpenGL {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user