2018-12-21 01:45:49 +01:00
|
|
|
// Copyright 2018 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <string>
|
2020-02-26 20:13:47 +01:00
|
|
|
#include <string_view>
|
2018-12-21 01:45:49 +01:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "video_core/engines/maxwell_3d.h"
|
2019-11-18 22:35:21 +01:00
|
|
|
#include "video_core/engines/shader_type.h"
|
2020-02-29 07:49:51 +01:00
|
|
|
#include "video_core/shader/registry.h"
|
2018-12-21 01:45:49 +01:00
|
|
|
#include "video_core/shader/shader_ir.h"
|
|
|
|
|
2019-07-15 03:25:13 +02:00
|
|
|
namespace OpenGL {
|
|
|
|
|
2020-02-26 20:13:47 +01:00
|
|
|
class Device;
|
2018-12-21 01:45:49 +01:00
|
|
|
|
|
|
|
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
2020-12-30 06:25:23 +01:00
|
|
|
using SamplerEntry = VideoCommon::Shader::SamplerEntry;
|
|
|
|
using ImageEntry = VideoCommon::Shader::ImageEntry;
|
2018-12-21 01:45:49 +01:00
|
|
|
|
|
|
|
class ConstBufferEntry : public VideoCommon::Shader::ConstBuffer {
|
|
|
|
public:
|
2020-12-05 17:40:14 +01:00
|
|
|
explicit ConstBufferEntry(u32 max_offset_, bool is_indirect_, u32 index_)
|
|
|
|
: ConstBuffer{max_offset_, is_indirect_}, index{index_} {}
|
2018-12-21 01:45:49 +01:00
|
|
|
|
|
|
|
u32 GetIndex() const {
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2020-04-16 06:34:45 +02:00
|
|
|
u32 index = 0;
|
2018-12-21 01:45:49 +01:00
|
|
|
};
|
|
|
|
|
2020-04-16 06:34:45 +02:00
|
|
|
struct GlobalMemoryEntry {
|
2020-12-04 20:39:12 +01:00
|
|
|
constexpr explicit GlobalMemoryEntry(u32 cbuf_index_, u32 cbuf_offset_, bool is_read_,
|
|
|
|
bool is_written_)
|
|
|
|
: cbuf_index{cbuf_index_}, cbuf_offset{cbuf_offset_}, is_read{is_read_}, is_written{
|
|
|
|
is_written_} {}
|
2018-12-29 06:44:54 +01:00
|
|
|
|
2020-04-16 06:34:45 +02:00
|
|
|
u32 cbuf_index = 0;
|
|
|
|
u32 cbuf_offset = 0;
|
|
|
|
bool is_read = false;
|
|
|
|
bool is_written = false;
|
2018-12-29 06:44:54 +01:00
|
|
|
};
|
|
|
|
|
2018-12-21 01:45:49 +01:00
|
|
|
struct ShaderEntries {
|
|
|
|
std::vector<ConstBufferEntry> const_buffers;
|
2019-10-28 06:31:05 +01:00
|
|
|
std::vector<GlobalMemoryEntry> global_memory_entries;
|
2018-12-21 01:45:49 +01:00
|
|
|
std::vector<SamplerEntry> samplers;
|
2019-04-27 07:37:15 +02:00
|
|
|
std::vector<ImageEntry> images;
|
2018-12-21 01:45:49 +01:00
|
|
|
std::size_t shader_length{};
|
2020-05-28 22:06:22 +02:00
|
|
|
u32 clip_distances{};
|
|
|
|
bool use_unified_uniforms{};
|
2018-12-21 01:45:49 +01:00
|
|
|
};
|
|
|
|
|
2020-05-28 22:06:22 +02:00
|
|
|
ShaderEntries MakeEntries(const Device& device, const VideoCommon::Shader::ShaderIR& ir,
|
|
|
|
Tegra::Engines::ShaderType stage);
|
2018-12-21 01:45:49 +01:00
|
|
|
|
2020-02-26 20:13:47 +01:00
|
|
|
std::string DecompileShader(const Device& device, const VideoCommon::Shader::ShaderIR& ir,
|
2020-02-29 07:49:51 +01:00
|
|
|
const VideoCommon::Shader::Registry& registry,
|
2020-02-29 20:30:20 +01:00
|
|
|
Tegra::Engines::ShaderType stage, std::string_view identifier,
|
|
|
|
std::string_view suffix = {});
|
2018-12-21 01:45:49 +01:00
|
|
|
|
2020-02-26 20:13:47 +01:00
|
|
|
} // namespace OpenGL
|