mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 23:02:47 +01:00
gl_shader_cache: Address review commentaries
This commit is contained in:
parent
bbecd13697
commit
56bca83bde
4 changed files with 12 additions and 13 deletions
|
@ -727,6 +727,8 @@ void RasterizerOpenGL::DispatchCompute(GPUVAddr code_addr) {
|
|||
SetupComputeConstBuffers(kernel);
|
||||
SetupComputeGlobalMemory(kernel);
|
||||
|
||||
// TODO(Rodrigo): Bind images and samplers
|
||||
|
||||
buffer_cache.Unmap();
|
||||
|
||||
bind_ubo_pushbuffer.Bind();
|
||||
|
|
|
@ -123,9 +123,6 @@ ProgramType GetProgramType(Maxwell::ShaderProgram program) {
|
|||
|
||||
/// Calculates the size of a program stream
|
||||
std::size_t CalculateProgramSize(const GLShader::ProgramCode& program) {
|
||||
if (program.empty()) {
|
||||
return 0;
|
||||
}
|
||||
constexpr std::size_t start_offset = 10;
|
||||
// This is the encoded version of BRA that jumps to itself. All Nvidia
|
||||
// shaders end with one.
|
||||
|
@ -299,8 +296,8 @@ CachedShader::CachedShader(const ShaderParameters& params, ProgramType program_t
|
|||
|
||||
Shader CachedShader::CreateStageFromMemory(const ShaderParameters& params,
|
||||
Maxwell::ShaderProgram program_type,
|
||||
const ProgramCode& program_code,
|
||||
const ProgramCode& program_code_b) {
|
||||
ProgramCode&& program_code,
|
||||
ProgramCode&& program_code_b) {
|
||||
const auto code_size{CalculateProgramSize(program_code)};
|
||||
const auto code_size_b{CalculateProgramSize(program_code_b)};
|
||||
auto result{
|
||||
|
@ -327,7 +324,7 @@ Shader CachedShader::CreateStageFromCache(const ShaderParameters& params,
|
|||
}
|
||||
|
||||
Shader CachedShader::CreateKernelFromMemory(const ShaderParameters& params,
|
||||
const ProgramCode& code) {
|
||||
ProgramCode&& code) {
|
||||
auto result{CreateProgram(params.device, ProgramType::Compute, code, {})};
|
||||
|
||||
const auto code_size{CalculateProgramSize(code)};
|
||||
|
@ -683,7 +680,7 @@ Shader ShaderCacheOpenGL::GetComputeKernel(GPUVAddr code_addr) {
|
|||
}
|
||||
|
||||
// No kernel found - create a new one
|
||||
const auto code{GetShaderCode(memory_manager, code_addr, host_ptr)};
|
||||
auto code{GetShaderCode(memory_manager, code_addr, host_ptr)};
|
||||
const auto unique_identifier{GetUniqueIdentifier(ProgramType::Compute, code, {})};
|
||||
const auto cpu_addr{*memory_manager.GpuToCpuAddress(code_addr)};
|
||||
const ShaderParameters params{disk_cache, precompiled_programs, device, cpu_addr,
|
||||
|
|
|
@ -55,14 +55,14 @@ class CachedShader final : public RasterizerCacheObject {
|
|||
public:
|
||||
static Shader CreateStageFromMemory(const ShaderParameters& params,
|
||||
Maxwell::ShaderProgram program_type,
|
||||
const ProgramCode& program_code,
|
||||
const ProgramCode& program_code_b);
|
||||
ProgramCode&& program_code,
|
||||
ProgramCode&& program_code_b);
|
||||
|
||||
static Shader CreateStageFromCache(const ShaderParameters& params,
|
||||
Maxwell::ShaderProgram program_type,
|
||||
GLShader::ProgramResult result);
|
||||
|
||||
static Shader CreateKernelFromMemory(const ShaderParameters& params, const ProgramCode& code);
|
||||
static Shader CreateKernelFromMemory(const ShaderParameters& params, ProgramCode&& code);
|
||||
|
||||
static Shader CreateKernelFromCache(const ShaderParameters& params,
|
||||
GLShader::ProgramResult result);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
namespace OpenGL::GLShader {
|
||||
|
||||
namespace {
|
||||
constexpr const char* GetStageDebugName(GLenum type) {
|
||||
const char* GetStageDebugName(GLenum type) {
|
||||
switch (type) {
|
||||
case GL_VERTEX_SHADER:
|
||||
return "vertex";
|
||||
|
@ -21,9 +21,9 @@ constexpr const char* GetStageDebugName(GLenum type) {
|
|||
return "fragment";
|
||||
case GL_COMPUTE_SHADER:
|
||||
return "compute";
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
UNIMPLEMENTED();
|
||||
return "unknown";
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
|
|
Loading…
Reference in a new issue