video_core: Resolve more variable shadowing scenarios pt.3

Cleans out the rest of the occurrences of variable shadowing and makes
any further occurrences of shadowing compiler errors.
This commit is contained in:
Lioncash 2020-12-05 11:40:14 -05:00
parent f2f346e110
commit f95602f152
49 changed files with 303 additions and 290 deletions

View file

@ -10,7 +10,7 @@
namespace detail { namespace detail {
template <typename Func> template <typename Func>
struct ScopeExitHelper { struct ScopeExitHelper {
explicit ScopeExitHelper(Func&& func) : func(std::move(func)) {} explicit ScopeExitHelper(Func&& func_) : func(std::move(func_)) {}
~ScopeExitHelper() { ~ScopeExitHelper() {
if (active) { if (active) {
func(); func();

View file

@ -52,8 +52,8 @@ public:
template <typename T> template <typename T>
class Field : public FieldInterface { class Field : public FieldInterface {
public: public:
Field(FieldType type, std::string name, T value) Field(FieldType type_, std::string name_, T value_)
: name(std::move(name)), type(type), value(std::move(value)) {} : name(std::move(name_)), type(type_), value(std::move(value_)) {}
Field(const Field&) = default; Field(const Field&) = default;
Field& operator=(const Field&) = default; Field& operator=(const Field&) = default;

View file

@ -17,9 +17,9 @@ namespace FileSys {
template <std::size_t size> template <std::size_t size>
class ArrayVfsFile : public VfsFile { class ArrayVfsFile : public VfsFile {
public: public:
explicit ArrayVfsFile(const std::array<u8, size>& data, std::string name = "", explicit ArrayVfsFile(const std::array<u8, size>& data_, std::string name_ = "",
VirtualDir parent = nullptr) VirtualDir parent_ = nullptr)
: data(data), name(std::move(name)), parent(std::move(parent)) {} : data(data_), name(std::move(name_)), parent(std::move(parent_)) {}
std::string GetName() const override { std::string GetName() const override {
return name; return name;
@ -51,12 +51,12 @@ public:
return read; return read;
} }
std::size_t Write(const u8* data, std::size_t length, std::size_t offset) override { std::size_t Write(const u8* data_, std::size_t length, std::size_t offset) override {
return 0; return 0;
} }
bool Rename(std::string_view name) override { bool Rename(std::string_view new_name) override {
this->name = name; name = new_name;
return true; return true;
} }

View file

@ -222,9 +222,9 @@ public:
public: public:
constexpr MemoryBlock() = default; constexpr MemoryBlock() = default;
constexpr MemoryBlock(VAddr addr, std::size_t num_pages, MemoryState state, constexpr MemoryBlock(VAddr addr_, std::size_t num_pages_, MemoryState state_,
MemoryPermission perm, MemoryAttribute attribute) MemoryPermission perm_, MemoryAttribute attribute_)
: addr{addr}, num_pages(num_pages), state{state}, perm{perm}, attribute{attribute} {} : addr{addr_}, num_pages(num_pages_), state{state_}, perm{perm_}, attribute{attribute_} {}
constexpr VAddr GetAddress() const { constexpr VAddr GetAddress() const {
return addr; return addr;

View file

@ -297,13 +297,20 @@ if (ENABLE_NSIGHT_AFTERMATH)
endif() endif()
if (MSVC) if (MSVC)
target_compile_options(video_core PRIVATE /we4267) target_compile_options(video_core PRIVATE
/we4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data
/we4456 # Declaration of 'identifier' hides previous local declaration
/we4457 # Declaration of 'identifier' hides function parameter
/we4458 # Declaration of 'identifier' hides class member
/we4459 # Declaration of 'identifier' hides global declaration
)
else() else()
target_compile_options(video_core PRIVATE target_compile_options(video_core PRIVATE
-Werror=conversion -Werror=conversion
-Wno-error=sign-conversion -Wno-error=sign-conversion
-Werror=pessimizing-move -Werror=pessimizing-move
-Werror=redundant-move -Werror=redundant-move
-Werror=shadow
-Werror=switch -Werror=switch
-Werror=type-limits -Werror=type-limits
-Werror=unused-variable -Werror=unused-variable

View file

@ -28,8 +28,8 @@ namespace VideoCommon {
template <class QueryCache, class HostCounter> template <class QueryCache, class HostCounter>
class CounterStreamBase { class CounterStreamBase {
public: public:
explicit CounterStreamBase(QueryCache& cache, VideoCore::QueryType type) explicit CounterStreamBase(QueryCache& cache_, VideoCore::QueryType type_)
: cache{cache}, type{type} {} : cache{cache_}, type{type_} {}
/// Updates the state of the stream, enabling or disabling as needed. /// Updates the state of the stream, enabling or disabling as needed.
void Update(bool enabled) { void Update(bool enabled) {
@ -334,8 +334,8 @@ private:
template <class HostCounter> template <class HostCounter>
class CachedQueryBase { class CachedQueryBase {
public: public:
explicit CachedQueryBase(VAddr cpu_addr, u8* host_ptr) explicit CachedQueryBase(VAddr cpu_addr_, u8* host_ptr_)
: cpu_addr{cpu_addr}, host_ptr{host_ptr} {} : cpu_addr{cpu_addr_}, host_ptr{host_ptr_} {}
virtual ~CachedQueryBase() = default; virtual ~CachedQueryBase() = default;
CachedQueryBase(CachedQueryBase&&) noexcept = default; CachedQueryBase(CachedQueryBase&&) noexcept = default;

View file

@ -22,11 +22,11 @@ using Maxwell = Tegra::Engines::Maxwell3D::Regs;
MICROPROFILE_DEFINE(OpenGL_Buffer_Download, "OpenGL", "Buffer Download", MP_RGB(192, 192, 128)); MICROPROFILE_DEFINE(OpenGL_Buffer_Download, "OpenGL", "Buffer Download", MP_RGB(192, 192, 128));
Buffer::Buffer(const Device& device, VAddr cpu_addr, std::size_t size) Buffer::Buffer(const Device& device_, VAddr cpu_addr_, std::size_t size_)
: VideoCommon::BufferBlock{cpu_addr, size} { : BufferBlock{cpu_addr_, size_} {
gl_buffer.Create(); gl_buffer.Create();
glNamedBufferData(gl_buffer.handle, static_cast<GLsizeiptr>(size), nullptr, GL_DYNAMIC_DRAW); glNamedBufferData(gl_buffer.handle, static_cast<GLsizeiptr>(size_), nullptr, GL_DYNAMIC_DRAW);
if (device.UseAssemblyShaders() || device.HasVertexBufferUnifiedMemory()) { if (device_.UseAssemblyShaders() || device_.HasVertexBufferUnifiedMemory()) {
glMakeNamedBufferResidentNV(gl_buffer.handle, GL_READ_WRITE); glMakeNamedBufferResidentNV(gl_buffer.handle, GL_READ_WRITE);
glGetNamedBufferParameterui64vNV(gl_buffer.handle, GL_BUFFER_GPU_ADDRESS_NV, &gpu_address); glGetNamedBufferParameterui64vNV(gl_buffer.handle, GL_BUFFER_GPU_ADDRESS_NV, &gpu_address);
} }
@ -34,14 +34,14 @@ Buffer::Buffer(const Device& device, VAddr cpu_addr, std::size_t size)
Buffer::~Buffer() = default; Buffer::~Buffer() = default;
void Buffer::Upload(std::size_t offset, std::size_t size, const u8* data) { void Buffer::Upload(std::size_t offset, std::size_t data_size, const u8* data) {
glNamedBufferSubData(Handle(), static_cast<GLintptr>(offset), static_cast<GLsizeiptr>(size), glNamedBufferSubData(Handle(), static_cast<GLintptr>(offset),
data); static_cast<GLsizeiptr>(data_size), data);
} }
void Buffer::Download(std::size_t offset, std::size_t size, u8* data) { void Buffer::Download(std::size_t offset, std::size_t data_size, u8* data) {
MICROPROFILE_SCOPE(OpenGL_Buffer_Download); MICROPROFILE_SCOPE(OpenGL_Buffer_Download);
const GLsizeiptr gl_size = static_cast<GLsizeiptr>(size); const GLsizeiptr gl_size = static_cast<GLsizeiptr>(data_size);
const GLintptr gl_offset = static_cast<GLintptr>(offset); const GLintptr gl_offset = static_cast<GLintptr>(offset);
if (read_buffer.handle == 0) { if (read_buffer.handle == 0) {
read_buffer.Create(); read_buffer.Create();
@ -54,16 +54,16 @@ void Buffer::Download(std::size_t offset, std::size_t size, u8* data) {
} }
void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset,
std::size_t size) { std::size_t copy_size) {
glCopyNamedBufferSubData(src.Handle(), Handle(), static_cast<GLintptr>(src_offset), glCopyNamedBufferSubData(src.Handle(), Handle(), static_cast<GLintptr>(src_offset),
static_cast<GLintptr>(dst_offset), static_cast<GLsizeiptr>(size)); static_cast<GLintptr>(dst_offset), static_cast<GLsizeiptr>(copy_size));
} }
OGLBufferCache::OGLBufferCache(VideoCore::RasterizerInterface& rasterizer, OGLBufferCache::OGLBufferCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_,
const Device& device_, std::size_t stream_size) const Device& device_, std::size_t stream_size_)
: GenericBufferCache{rasterizer, gpu_memory, cpu_memory, : GenericBufferCache{rasterizer_, gpu_memory_, cpu_memory_,
std::make_unique<OGLStreamBuffer>(device_, stream_size, true)}, std::make_unique<OGLStreamBuffer>(device_, stream_size_, true)},
device{device_} { device{device_} {
if (!device.HasFastBufferSubData()) { if (!device.HasFastBufferSubData()) {
return; return;

View file

@ -25,15 +25,15 @@ class RasterizerOpenGL;
class Buffer : public VideoCommon::BufferBlock { class Buffer : public VideoCommon::BufferBlock {
public: public:
explicit Buffer(const Device& device, VAddr cpu_addr, std::size_t size); explicit Buffer(const Device& device_, VAddr cpu_addr_, std::size_t size_);
~Buffer(); ~Buffer();
void Upload(std::size_t offset, std::size_t size, const u8* data); void Upload(std::size_t offset, std::size_t data_size, const u8* data);
void Download(std::size_t offset, std::size_t size, u8* data); void Download(std::size_t offset, std::size_t data_size, u8* data);
void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset,
std::size_t size); std::size_t copy_size);
GLuint Handle() const noexcept { GLuint Handle() const noexcept {
return gl_buffer.handle; return gl_buffer.handle;
@ -52,9 +52,9 @@ private:
using GenericBufferCache = VideoCommon::BufferCache<Buffer, GLuint, OGLStreamBuffer>; using GenericBufferCache = VideoCommon::BufferCache<Buffer, GLuint, OGLStreamBuffer>;
class OGLBufferCache final : public GenericBufferCache { class OGLBufferCache final : public GenericBufferCache {
public: public:
explicit OGLBufferCache(VideoCore::RasterizerInterface& rasterizer, explicit OGLBufferCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_,
const Device& device, std::size_t stream_size); const Device& device_, std::size_t stream_size_);
~OGLBufferCache(); ~OGLBufferCache();
BufferInfo GetEmptyBuffer(std::size_t) override; BufferInfo GetEmptyBuffer(std::size_t) override;

View file

@ -30,11 +30,9 @@ constexpr GLenum GetTarget(VideoCore::QueryType type) {
} // Anonymous namespace } // Anonymous namespace
QueryCache::QueryCache(RasterizerOpenGL& rasterizer, Tegra::Engines::Maxwell3D& maxwell3d, QueryCache::QueryCache(RasterizerOpenGL& rasterizer_, Tegra::Engines::Maxwell3D& maxwell3d_,
Tegra::MemoryManager& gpu_memory) Tegra::MemoryManager& gpu_memory_)
: VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter>( : QueryCacheBase(rasterizer_, maxwell3d_, gpu_memory_), gl_rasterizer{rasterizer_} {}
rasterizer, maxwell3d, gpu_memory),
gl_rasterizer{rasterizer} {}
QueryCache::~QueryCache() = default; QueryCache::~QueryCache() = default;
@ -59,10 +57,11 @@ bool QueryCache::AnyCommandQueued() const noexcept {
return gl_rasterizer.AnyCommandQueued(); return gl_rasterizer.AnyCommandQueued();
} }
HostCounter::HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency, HostCounter::HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency_,
VideoCore::QueryType type_) VideoCore::QueryType type_)
: HostCounterBase<QueryCache, HostCounter>{std::move(dependency)}, cache{cache_}, type{type_}, : HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_}, query{
query{cache.AllocateQuery(type)} { cache.AllocateQuery(
type)} {
glBeginQuery(GetTarget(type), query.handle); glBeginQuery(GetTarget(type), query.handle);
} }
@ -86,14 +85,14 @@ u64 HostCounter::BlockingQuery() const {
return static_cast<u64>(value); return static_cast<u64>(value);
} }
CachedQuery::CachedQuery(QueryCache& cache_, VideoCore::QueryType type_, VAddr cpu_addr, CachedQuery::CachedQuery(QueryCache& cache_, VideoCore::QueryType type_, VAddr cpu_addr_,
u8* host_ptr) u8* host_ptr_)
: CachedQueryBase<HostCounter>{cpu_addr, host_ptr}, cache{&cache_}, type{type_} {} : CachedQueryBase{cpu_addr_, host_ptr_}, cache{&cache_}, type{type_} {}
CachedQuery::~CachedQuery() = default; CachedQuery::~CachedQuery() = default;
CachedQuery::CachedQuery(CachedQuery&& rhs) noexcept CachedQuery::CachedQuery(CachedQuery&& rhs) noexcept
: CachedQueryBase<HostCounter>(std::move(rhs)), cache{rhs.cache}, type{rhs.type} {} : CachedQueryBase(std::move(rhs)), cache{rhs.cache}, type{rhs.type} {}
CachedQuery& CachedQuery::operator=(CachedQuery&& rhs) noexcept { CachedQuery& CachedQuery::operator=(CachedQuery&& rhs) noexcept {
cache = rhs.cache; cache = rhs.cache;

View file

@ -29,8 +29,8 @@ using CounterStream = VideoCommon::CounterStreamBase<QueryCache, HostCounter>;
class QueryCache final class QueryCache final
: public VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter> { : public VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter> {
public: public:
explicit QueryCache(RasterizerOpenGL& rasterizer, Tegra::Engines::Maxwell3D& maxwell3d, explicit QueryCache(RasterizerOpenGL& rasterizer_, Tegra::Engines::Maxwell3D& maxwell3d_,
Tegra::MemoryManager& gpu_memory); Tegra::MemoryManager& gpu_memory_);
~QueryCache(); ~QueryCache();
OGLQuery AllocateQuery(VideoCore::QueryType type); OGLQuery AllocateQuery(VideoCore::QueryType type);
@ -46,7 +46,7 @@ private:
class HostCounter final : public VideoCommon::HostCounterBase<QueryCache, HostCounter> { class HostCounter final : public VideoCommon::HostCounterBase<QueryCache, HostCounter> {
public: public:
explicit HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency, explicit HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency_,
VideoCore::QueryType type_); VideoCore::QueryType type_);
~HostCounter(); ~HostCounter();
@ -62,8 +62,8 @@ private:
class CachedQuery final : public VideoCommon::CachedQueryBase<HostCounter> { class CachedQuery final : public VideoCommon::CachedQueryBase<HostCounter> {
public: public:
explicit CachedQuery(QueryCache& cache_, VideoCore::QueryType type_, VAddr cpu_addr, explicit CachedQuery(QueryCache& cache_, VideoCore::QueryType type_, VAddr cpu_addr_,
u8* host_ptr); u8* host_ptr_);
~CachedQuery() override; ~CachedQuery() override;
CachedQuery(CachedQuery&& rhs) noexcept; CachedQuery(CachedQuery&& rhs) noexcept;

View file

@ -149,19 +149,19 @@ void UpdateBindlessSSBOs(GLenum target, const BindlessSSBO* ssbos, size_t num_ss
} // Anonymous namespace } // Anonymous namespace
RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window, Tegra::GPU& gpu_, RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
Core::Memory::Memory& cpu_memory, const Device& device_, Core::Memory::Memory& cpu_memory_, const Device& device_,
ScreenInfo& screen_info_, ProgramManager& program_manager_, ScreenInfo& screen_info_, ProgramManager& program_manager_,
StateTracker& state_tracker_) StateTracker& state_tracker_)
: RasterizerAccelerated{cpu_memory}, gpu(gpu_), maxwell3d(gpu.Maxwell3D()), : RasterizerAccelerated{cpu_memory_}, gpu(gpu_), maxwell3d(gpu.Maxwell3D()),
kepler_compute(gpu.KeplerCompute()), gpu_memory(gpu.MemoryManager()), device(device_), kepler_compute(gpu.KeplerCompute()), gpu_memory(gpu.MemoryManager()), device(device_),
screen_info(screen_info_), program_manager(program_manager_), state_tracker(state_tracker_), screen_info(screen_info_), program_manager(program_manager_), state_tracker(state_tracker_),
texture_cache(*this, maxwell3d, gpu_memory, device, state_tracker), texture_cache(*this, maxwell3d, gpu_memory, device, state_tracker),
shader_cache(*this, emu_window, gpu, maxwell3d, kepler_compute, gpu_memory, device), shader_cache(*this, emu_window_, gpu, maxwell3d, kepler_compute, gpu_memory, device),
query_cache(*this, maxwell3d, gpu_memory), query_cache(*this, maxwell3d, gpu_memory),
buffer_cache(*this, gpu_memory, cpu_memory, device, STREAM_BUFFER_SIZE), buffer_cache(*this, gpu_memory, cpu_memory_, device, STREAM_BUFFER_SIZE),
fence_manager(*this, gpu, texture_cache, buffer_cache, query_cache), fence_manager(*this, gpu, texture_cache, buffer_cache, query_cache),
async_shaders(emu_window) { async_shaders(emu_window_) {
CheckExtensions(); CheckExtensions();
unified_uniform_buffer.Create(); unified_uniform_buffer.Create();

View file

@ -62,10 +62,10 @@ static_assert(sizeof(BindlessSSBO) * CHAR_BIT == 128);
class RasterizerOpenGL : public VideoCore::RasterizerAccelerated { class RasterizerOpenGL : public VideoCore::RasterizerAccelerated {
public: public:
explicit RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window, Tegra::GPU& gpu, explicit RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
Core::Memory::Memory& cpu_memory, const Device& device, Core::Memory::Memory& cpu_memory_, const Device& device_,
ScreenInfo& screen_info, ProgramManager& program_manager, ScreenInfo& screen_info_, ProgramManager& program_manager_,
StateTracker& state_tracker); StateTracker& state_tracker_);
~RasterizerOpenGL() override; ~RasterizerOpenGL() override;
void Draw(bool is_indexed, bool is_instanced) override; void Draw(bool is_indexed, bool is_instanced) override;

View file

@ -318,14 +318,13 @@ std::unique_ptr<Shader> Shader::CreateFromCache(const ShaderParameters& params,
precompiled_shader.registry, precompiled_shader.entries, precompiled_shader.program)); precompiled_shader.registry, precompiled_shader.entries, precompiled_shader.program));
} }
ShaderCacheOpenGL::ShaderCacheOpenGL(RasterizerOpenGL& rasterizer, ShaderCacheOpenGL::ShaderCacheOpenGL(RasterizerOpenGL& rasterizer_,
Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::Engines::Maxwell3D& maxwell3d_,
Tegra::Engines::KeplerCompute& kepler_compute_, Tegra::Engines::KeplerCompute& kepler_compute_,
Tegra::MemoryManager& gpu_memory_, const Device& device_) Tegra::MemoryManager& gpu_memory_, const Device& device_)
: VideoCommon::ShaderCache<Shader>{rasterizer}, emu_window{emu_window_}, gpu{gpu_}, : ShaderCache{rasterizer_}, emu_window{emu_window_}, gpu{gpu_}, gpu_memory{gpu_memory_},
gpu_memory{gpu_memory_}, maxwell3d{maxwell3d_}, maxwell3d{maxwell3d_}, kepler_compute{kepler_compute_}, device{device_} {}
kepler_compute{kepler_compute_}, device{device_} {}
ShaderCacheOpenGL::~ShaderCacheOpenGL() = default; ShaderCacheOpenGL::~ShaderCacheOpenGL() = default;

View file

@ -119,10 +119,11 @@ private:
class ShaderCacheOpenGL final : public VideoCommon::ShaderCache<Shader> { class ShaderCacheOpenGL final : public VideoCommon::ShaderCache<Shader> {
public: public:
explicit ShaderCacheOpenGL(RasterizerOpenGL& rasterizer, Core::Frontend::EmuWindow& emu_window, explicit ShaderCacheOpenGL(RasterizerOpenGL& rasterizer_,
Tegra::GPU& gpu, Tegra::Engines::Maxwell3D& maxwell3d, Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu,
Tegra::Engines::KeplerCompute& kepler_compute, Tegra::Engines::Maxwell3D& maxwell3d_,
Tegra::MemoryManager& gpu_memory, const Device& device); Tegra::Engines::KeplerCompute& kepler_compute_,
Tegra::MemoryManager& gpu_memory_, const Device& device_);
~ShaderCacheOpenGL() override; ~ShaderCacheOpenGL() override;
/// Loads disk cache for the current game /// Loads disk cache for the current game

View file

@ -25,8 +25,8 @@ using ImageEntry = VideoCommon::Shader::Image;
class ConstBufferEntry : public VideoCommon::Shader::ConstBuffer { class ConstBufferEntry : public VideoCommon::Shader::ConstBuffer {
public: public:
explicit ConstBufferEntry(u32 max_offset, bool is_indirect, u32 index_) explicit ConstBufferEntry(u32 max_offset_, bool is_indirect_, u32 index_)
: ConstBuffer{max_offset, is_indirect}, index{index_} {} : ConstBuffer{max_offset_, is_indirect_}, index{index_} {}
u32 GetIndex() const { u32 GetIndex() const {
return index; return index;

View file

@ -347,14 +347,14 @@ void CachedSurface::UploadTextureMipmap(u32 level, const std::vector<u8>& stagin
internal_format, image_size, buffer); internal_format, image_size, buffer);
break; break;
case SurfaceTarget::TextureCubemap: { case SurfaceTarget::TextureCubemap: {
const std::size_t layer_size{params.GetHostLayerSize(level)}; const std::size_t host_layer_size{params.GetHostLayerSize(level)};
for (std::size_t face = 0; face < params.depth; ++face) { for (std::size_t face = 0; face < params.depth; ++face) {
glCompressedTextureSubImage3D(texture.handle, level, 0, 0, static_cast<GLint>(face), glCompressedTextureSubImage3D(texture.handle, level, 0, 0, static_cast<GLint>(face),
static_cast<GLsizei>(params.GetMipWidth(level)), static_cast<GLsizei>(params.GetMipWidth(level)),
static_cast<GLsizei>(params.GetMipHeight(level)), 1, static_cast<GLsizei>(params.GetMipHeight(level)), 1,
internal_format, static_cast<GLsizei>(layer_size), internal_format,
buffer); static_cast<GLsizei>(host_layer_size), buffer);
buffer += layer_size; buffer += host_layer_size;
} }
break; break;
} }
@ -532,12 +532,12 @@ OGLTextureView CachedSurfaceView::CreateTextureView() const {
return texture_view; return texture_view;
} }
TextureCacheOpenGL::TextureCacheOpenGL(VideoCore::RasterizerInterface& rasterizer, TextureCacheOpenGL::TextureCacheOpenGL(VideoCore::RasterizerInterface& rasterizer_,
Tegra::Engines::Maxwell3D& maxwell3d, Tegra::Engines::Maxwell3D& maxwell3d_,
Tegra::MemoryManager& gpu_memory, const Device& device, Tegra::MemoryManager& gpu_memory_, const Device& device_,
StateTracker& state_tracker_) StateTracker& state_tracker_)
: TextureCacheBase{rasterizer, maxwell3d, gpu_memory, device.HasASTC()}, state_tracker{ : TextureCacheBase{rasterizer_, maxwell3d_, gpu_memory_, device_.HasASTC()},
state_tracker_} { state_tracker{state_tracker_} {
src_framebuffer.Create(); src_framebuffer.Create();
dst_framebuffer.Create(); dst_framebuffer.Create();
} }

View file

@ -130,9 +130,9 @@ private:
class TextureCacheOpenGL final : public TextureCacheBase { class TextureCacheOpenGL final : public TextureCacheBase {
public: public:
explicit TextureCacheOpenGL(VideoCore::RasterizerInterface& rasterizer, explicit TextureCacheOpenGL(VideoCore::RasterizerInterface& rasterizer_,
Tegra::Engines::Maxwell3D& maxwell3d, Tegra::Engines::Maxwell3D& maxwell3d_,
Tegra::MemoryManager& gpu_memory, const Device& device, Tegra::MemoryManager& gpu_memory_, const Device& device_,
StateTracker& state_tracker); StateTracker& state_tracker);
~TextureCacheOpenGL(); ~TextureCacheOpenGL();

View file

@ -130,8 +130,8 @@ void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severit
RendererOpenGL::RendererOpenGL(Core::TelemetrySession& telemetry_session_, RendererOpenGL::RendererOpenGL(Core::TelemetrySession& telemetry_session_,
Core::Frontend::EmuWindow& emu_window_, Core::Frontend::EmuWindow& emu_window_,
Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_, Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_,
std::unique_ptr<Core::Frontend::GraphicsContext> context) std::unique_ptr<Core::Frontend::GraphicsContext> context_)
: RendererBase{emu_window_, std::move(context)}, telemetry_session{telemetry_session_}, : RendererBase{emu_window_, std::move(context_)}, telemetry_session{telemetry_session_},
emu_window{emu_window_}, cpu_memory{cpu_memory_}, gpu{gpu_}, program_manager{device} {} emu_window{emu_window_}, cpu_memory{cpu_memory_}, gpu{gpu_}, program_manager{device} {}
RendererOpenGL::~RendererOpenGL() = default; RendererOpenGL::~RendererOpenGL() = default;

View file

@ -57,10 +57,10 @@ struct ScreenInfo {
class RendererOpenGL final : public VideoCore::RendererBase { class RendererOpenGL final : public VideoCore::RendererBase {
public: public:
explicit RendererOpenGL(Core::TelemetrySession& telemetry_session, explicit RendererOpenGL(Core::TelemetrySession& telemetry_session_,
Core::Frontend::EmuWindow& emu_window, Core::Memory::Memory& cpu_memory, Core::Frontend::EmuWindow& emu_window_,
Tegra::GPU& gpu, Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_,
std::unique_ptr<Core::Frontend::GraphicsContext> context); std::unique_ptr<Core::Frontend::GraphicsContext> context_);
~RendererOpenGL() override; ~RendererOpenGL() override;
bool Init() override; bool Init() override;

View file

@ -38,13 +38,13 @@ std::unique_ptr<VKStreamBuffer> CreateStreamBuffer(const VKDevice& device, VKSch
} // Anonymous namespace } // Anonymous namespace
Buffer::Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKScheduler& scheduler_, Buffer::Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKScheduler& scheduler_,
VKStagingBufferPool& staging_pool_, VAddr cpu_addr, std::size_t size) VKStagingBufferPool& staging_pool_, VAddr cpu_addr_, std::size_t size_)
: BufferBlock{cpu_addr, size}, scheduler{scheduler_}, staging_pool{staging_pool_} { : BufferBlock{cpu_addr_, size_}, scheduler{scheduler_}, staging_pool{staging_pool_} {
const VkBufferCreateInfo ci{ const VkBufferCreateInfo ci{
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.pNext = nullptr, .pNext = nullptr,
.flags = 0, .flags = 0,
.size = static_cast<VkDeviceSize>(size), .size = static_cast<VkDeviceSize>(size_),
.usage = BUFFER_USAGE | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, .usage = BUFFER_USAGE | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE, .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
.queueFamilyIndexCount = 0, .queueFamilyIndexCount = 0,
@ -57,69 +57,71 @@ Buffer::Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKSchedu
Buffer::~Buffer() = default; Buffer::~Buffer() = default;
void Buffer::Upload(std::size_t offset, std::size_t size, const u8* data) { void Buffer::Upload(std::size_t offset, std::size_t data_size, const u8* data) {
const auto& staging = staging_pool.GetUnusedBuffer(size, true); const auto& staging = staging_pool.GetUnusedBuffer(data_size, true);
std::memcpy(staging.commit->Map(size), data, size); std::memcpy(staging.commit->Map(data_size), data, data_size);
scheduler.RequestOutsideRenderPassOperationContext(); scheduler.RequestOutsideRenderPassOperationContext();
const VkBuffer handle = Handle(); const VkBuffer handle = Handle();
scheduler.Record([staging = *staging.handle, handle, offset, size](vk::CommandBuffer cmdbuf) { scheduler.Record(
cmdbuf.CopyBuffer(staging, handle, VkBufferCopy{0, offset, size}); [staging = *staging.handle, handle, offset, data_size](vk::CommandBuffer cmdbuf) {
cmdbuf.CopyBuffer(staging, handle, VkBufferCopy{0, offset, data_size});
const VkBufferMemoryBarrier barrier{ const VkBufferMemoryBarrier barrier{
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
.pNext = nullptr, .pNext = nullptr,
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT, .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
.dstAccessMask = UPLOAD_ACCESS_BARRIERS, .dstAccessMask = UPLOAD_ACCESS_BARRIERS,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.buffer = handle, .buffer = handle,
.offset = offset, .offset = offset,
.size = size, .size = data_size,
}; };
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, UPLOAD_PIPELINE_STAGE, 0, {}, cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, UPLOAD_PIPELINE_STAGE, 0, {},
barrier, {}); barrier, {});
}); });
} }
void Buffer::Download(std::size_t offset, std::size_t size, u8* data) { void Buffer::Download(std::size_t offset, std::size_t data_size, u8* data) {
const auto& staging = staging_pool.GetUnusedBuffer(size, true); const auto& staging = staging_pool.GetUnusedBuffer(data_size, true);
scheduler.RequestOutsideRenderPassOperationContext(); scheduler.RequestOutsideRenderPassOperationContext();
const VkBuffer handle = Handle(); const VkBuffer handle = Handle();
scheduler.Record([staging = *staging.handle, handle, offset, size](vk::CommandBuffer cmdbuf) { scheduler.Record(
const VkBufferMemoryBarrier barrier{ [staging = *staging.handle, handle, offset, data_size](vk::CommandBuffer cmdbuf) {
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, const VkBufferMemoryBarrier barrier{
.pNext = nullptr, .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT, .pNext = nullptr,
.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT, .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.buffer = handle, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.offset = offset, .buffer = handle,
.size = size, .offset = offset,
}; .size = data_size,
};
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_VERTEX_SHADER_BIT |
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_PIPELINE_STAGE_TRANSFER_BIT, 0, {}, barrier, {}); VK_PIPELINE_STAGE_TRANSFER_BIT, 0, {}, barrier, {});
cmdbuf.CopyBuffer(handle, staging, VkBufferCopy{offset, 0, size}); cmdbuf.CopyBuffer(handle, staging, VkBufferCopy{offset, 0, data_size});
}); });
scheduler.Finish(); scheduler.Finish();
std::memcpy(data, staging.commit->Map(size), size); std::memcpy(data, staging.commit->Map(data_size), data_size);
} }
void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset,
std::size_t size) { std::size_t copy_size) {
scheduler.RequestOutsideRenderPassOperationContext(); scheduler.RequestOutsideRenderPassOperationContext();
const VkBuffer dst_buffer = Handle(); const VkBuffer dst_buffer = Handle();
scheduler.Record([src_buffer = src.Handle(), dst_buffer, src_offset, dst_offset, scheduler.Record([src_buffer = src.Handle(), dst_buffer, src_offset, dst_offset,
size](vk::CommandBuffer cmdbuf) { copy_size](vk::CommandBuffer cmdbuf) {
cmdbuf.CopyBuffer(src_buffer, dst_buffer, VkBufferCopy{src_offset, dst_offset, size}); cmdbuf.CopyBuffer(src_buffer, dst_buffer, VkBufferCopy{src_offset, dst_offset, copy_size});
std::array<VkBufferMemoryBarrier, 2> barriers; std::array<VkBufferMemoryBarrier, 2> barriers;
barriers[0].sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; barriers[0].sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
@ -130,7 +132,7 @@ void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst
barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
barriers[0].buffer = src_buffer; barriers[0].buffer = src_buffer;
barriers[0].offset = src_offset; barriers[0].offset = src_offset;
barriers[0].size = size; barriers[0].size = copy_size;
barriers[1].sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; barriers[1].sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
barriers[1].pNext = nullptr; barriers[1].pNext = nullptr;
barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
@ -139,19 +141,17 @@ void Buffer::CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst
barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
barriers[1].buffer = dst_buffer; barriers[1].buffer = dst_buffer;
barriers[1].offset = dst_offset; barriers[1].offset = dst_offset;
barriers[1].size = size; barriers[1].size = copy_size;
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, UPLOAD_PIPELINE_STAGE, 0, {}, cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_TRANSFER_BIT, UPLOAD_PIPELINE_STAGE, 0, {},
barriers, {}); barriers, {});
}); });
} }
VKBufferCache::VKBufferCache(VideoCore::RasterizerInterface& rasterizer, VKBufferCache::VKBufferCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_,
const VKDevice& device_, VKMemoryManager& memory_manager_, const VKDevice& device_, VKMemoryManager& memory_manager_,
VKScheduler& scheduler_, VKStagingBufferPool& staging_pool_) VKScheduler& scheduler_, VKStagingBufferPool& staging_pool_)
: VideoCommon::BufferCache<Buffer, VkBuffer, VKStreamBuffer>{rasterizer, gpu_memory, cpu_memory, : BufferCache{rasterizer_, gpu_memory_, cpu_memory_, CreateStreamBuffer(device_, scheduler_)},
CreateStreamBuffer(device_,
scheduler_)},
device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_}, staging_pool{ device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_}, staging_pool{
staging_pool_} {} staging_pool_} {}

View file

@ -22,15 +22,15 @@ class VKScheduler;
class Buffer final : public VideoCommon::BufferBlock { class Buffer final : public VideoCommon::BufferBlock {
public: public:
explicit Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKScheduler& scheduler, explicit Buffer(const VKDevice& device, VKMemoryManager& memory_manager, VKScheduler& scheduler,
VKStagingBufferPool& staging_pool, VAddr cpu_addr, std::size_t size); VKStagingBufferPool& staging_pool, VAddr cpu_addr_, std::size_t size_);
~Buffer(); ~Buffer();
void Upload(std::size_t offset, std::size_t size, const u8* data); void Upload(std::size_t offset, std::size_t data_size, const u8* data);
void Download(std::size_t offset, std::size_t size, u8* data); void Download(std::size_t offset, std::size_t data_size, u8* data);
void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset, void CopyFrom(const Buffer& src, std::size_t src_offset, std::size_t dst_offset,
std::size_t size); std::size_t copy_size);
VkBuffer Handle() const { VkBuffer Handle() const {
return *buffer.handle; return *buffer.handle;
@ -49,10 +49,10 @@ private:
class VKBufferCache final : public VideoCommon::BufferCache<Buffer, VkBuffer, VKStreamBuffer> { class VKBufferCache final : public VideoCommon::BufferCache<Buffer, VkBuffer, VKStreamBuffer> {
public: public:
explicit VKBufferCache(VideoCore::RasterizerInterface& rasterizer, explicit VKBufferCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_,
const VKDevice& device, VKMemoryManager& memory_manager, const VKDevice& device_, VKMemoryManager& memory_manager_,
VKScheduler& scheduler, VKStagingBufferPool& staging_pool); VKScheduler& scheduler_, VKStagingBufferPool& staging_pool_);
~VKBufferCache(); ~VKBufferCache();
BufferInfo GetEmptyBuffer(std::size_t size) override; BufferInfo GetEmptyBuffer(std::size_t size) override;

View file

@ -17,8 +17,8 @@ struct CommandPool::Pool {
vk::CommandBuffers cmdbufs; vk::CommandBuffers cmdbufs;
}; };
CommandPool::CommandPool(MasterSemaphore& master_semaphore, const VKDevice& device_) CommandPool::CommandPool(MasterSemaphore& master_semaphore_, const VKDevice& device_)
: ResourcePool(master_semaphore, COMMAND_BUFFER_POOL_SIZE), device{device_} {} : ResourcePool(master_semaphore_, COMMAND_BUFFER_POOL_SIZE), device{device_} {}
CommandPool::~CommandPool() = default; CommandPool::~CommandPool() = default;

View file

@ -17,7 +17,7 @@ class VKDevice;
class CommandPool final : public ResourcePool { class CommandPool final : public ResourcePool {
public: public:
explicit CommandPool(MasterSemaphore& master_semaphore, const VKDevice& device_); explicit CommandPool(MasterSemaphore& master_semaphore_, const VKDevice& device_);
~CommandPool() override; ~CommandPool() override;
void Allocate(size_t begin, size_t end) override; void Allocate(size_t begin, size_t end) override;

View file

@ -136,26 +136,25 @@ bool ComputePipelineCacheKey::operator==(const ComputePipelineCacheKey& rhs) con
return std::memcmp(&rhs, this, sizeof *this) == 0; return std::memcmp(&rhs, this, sizeof *this) == 0;
} }
Shader::Shader(Tegra::Engines::ConstBufferEngineInterface& engine, Tegra::Engines::ShaderType stage, Shader::Shader(Tegra::Engines::ConstBufferEngineInterface& engine_, ShaderType stage_,
GPUVAddr gpu_addr_, VAddr cpu_addr, VideoCommon::Shader::ProgramCode program_code_, GPUVAddr gpu_addr_, VAddr cpu_addr_, ProgramCode program_code_, u32 main_offset_)
u32 main_offset) : gpu_addr(gpu_addr_), program_code(std::move(program_code_)), registry(stage_, engine_),
: gpu_addr(gpu_addr_), program_code(std::move(program_code_)), registry(stage, engine), shader_ir(program_code, main_offset_, compiler_settings, registry),
shader_ir(program_code, main_offset, compiler_settings, registry),
entries(GenerateShaderEntries(shader_ir)) {} entries(GenerateShaderEntries(shader_ir)) {}
Shader::~Shader() = default; Shader::~Shader() = default;
VKPipelineCache::VKPipelineCache(RasterizerVulkan& rasterizer, Tegra::GPU& gpu_, VKPipelineCache::VKPipelineCache(RasterizerVulkan& rasterizer_, Tegra::GPU& gpu_,
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::Engines::Maxwell3D& maxwell3d_,
Tegra::Engines::KeplerCompute& kepler_compute_, Tegra::Engines::KeplerCompute& kepler_compute_,
Tegra::MemoryManager& gpu_memory_, const VKDevice& device_, Tegra::MemoryManager& gpu_memory_, const VKDevice& device_,
VKScheduler& scheduler_, VKDescriptorPool& descriptor_pool_, VKScheduler& scheduler_, VKDescriptorPool& descriptor_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue_, VKUpdateDescriptorQueue& update_descriptor_queue_,
VKRenderPassCache& renderpass_cache_) VKRenderPassCache& renderpass_cache_)
: VideoCommon::ShaderCache<Shader>{rasterizer}, gpu{gpu_}, maxwell3d{maxwell3d_}, : ShaderCache{rasterizer_}, gpu{gpu_}, maxwell3d{maxwell3d_}, kepler_compute{kepler_compute_},
kepler_compute{kepler_compute_}, gpu_memory{gpu_memory_}, device{device_}, gpu_memory{gpu_memory_}, device{device_}, scheduler{scheduler_},
scheduler{scheduler_}, descriptor_pool{descriptor_pool_}, descriptor_pool{descriptor_pool_}, update_descriptor_queue{update_descriptor_queue_},
update_descriptor_queue{update_descriptor_queue_}, renderpass_cache{renderpass_cache_} {} renderpass_cache{renderpass_cache_} {}
VKPipelineCache::~VKPipelineCache() = default; VKPipelineCache::~VKPipelineCache() = default;

View file

@ -84,9 +84,9 @@ namespace Vulkan {
class Shader { class Shader {
public: public:
explicit Shader(Tegra::Engines::ConstBufferEngineInterface& engine, explicit Shader(Tegra::Engines::ConstBufferEngineInterface& engine_,
Tegra::Engines::ShaderType stage, GPUVAddr gpu_addr, VAddr cpu_addr, Tegra::Engines::ShaderType stage_, GPUVAddr gpu_addr, VAddr cpu_addr_,
VideoCommon::Shader::ProgramCode program_code, u32 main_offset); VideoCommon::Shader::ProgramCode program_code, u32 main_offset_);
~Shader(); ~Shader();
GPUVAddr GetGpuAddr() const { GPUVAddr GetGpuAddr() const {
@ -119,13 +119,13 @@ private:
class VKPipelineCache final : public VideoCommon::ShaderCache<Shader> { class VKPipelineCache final : public VideoCommon::ShaderCache<Shader> {
public: public:
explicit VKPipelineCache(RasterizerVulkan& rasterizer, Tegra::GPU& gpu, explicit VKPipelineCache(RasterizerVulkan& rasterizer_, Tegra::GPU& gpu_,
Tegra::Engines::Maxwell3D& maxwell3d, Tegra::Engines::Maxwell3D& maxwell3d_,
Tegra::Engines::KeplerCompute& kepler_compute, Tegra::Engines::KeplerCompute& kepler_compute_,
Tegra::MemoryManager& gpu_memory, const VKDevice& device, Tegra::MemoryManager& gpu_memory_, const VKDevice& device_,
VKScheduler& scheduler, VKDescriptorPool& descriptor_pool, VKScheduler& scheduler_, VKDescriptorPool& descriptor_pool_,
VKUpdateDescriptorQueue& update_descriptor_queue, VKUpdateDescriptorQueue& update_descriptor_queue_,
VKRenderPassCache& renderpass_cache); VKRenderPassCache& renderpass_cache_);
~VKPipelineCache() override; ~VKPipelineCache() override;
std::array<Shader*, Maxwell::MaxShaderProgram> GetShaders(); std::array<Shader*, Maxwell::MaxShaderProgram> GetShaders();

View file

@ -69,12 +69,10 @@ void QueryPool::Reserve(std::pair<VkQueryPool, u32> query) {
VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer_, VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_, Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_,
const VKDevice& device_, VKScheduler& scheduler_) const VKDevice& device_, VKScheduler& scheduler_)
: QueryCacheBase<VKQueryCache, CachedQuery, CounterStream, HostCounter>{rasterizer_, maxwell3d_, : QueryCacheBase{rasterizer_, maxwell3d_, gpu_memory_}, device{device_}, scheduler{scheduler_},
gpu_memory_}, query_pools{
device{device_}, scheduler{scheduler_}, query_pools{ QueryPool{device_, scheduler_, QueryType::SamplesPassed},
QueryPool{device_, scheduler_, } {}
QueryType::SamplesPassed},
} {}
VKQueryCache::~VKQueryCache() { VKQueryCache::~VKQueryCache() {
// TODO(Rodrigo): This is a hack to destroy all HostCounter instances before the base class // TODO(Rodrigo): This is a hack to destroy all HostCounter instances before the base class
@ -97,8 +95,8 @@ void VKQueryCache::Reserve(QueryType type, std::pair<VkQueryPool, u32> query) {
HostCounter::HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_, HostCounter::HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_,
QueryType type_) QueryType type_)
: HostCounterBase<VKQueryCache, HostCounter>{std::move(dependency_)}, cache{cache_}, : HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_},
type{type_}, query{cache_.AllocateQuery(type_)}, tick{cache_.Scheduler().CurrentTick()} { query{cache_.AllocateQuery(type_)}, tick{cache_.Scheduler().CurrentTick()} {
const vk::Device* logical = &cache_.Device().GetLogical(); const vk::Device* logical = &cache_.Device().GetLogical();
cache_.Scheduler().Record([logical, query = query](vk::CommandBuffer cmdbuf) { cache_.Scheduler().Record([logical, query = query](vk::CommandBuffer cmdbuf) {
logical->ResetQueryPoolEXT(query.first, query.second, 1); logical->ResetQueryPoolEXT(query.first, query.second, 1);
@ -119,18 +117,20 @@ u64 HostCounter::BlockingQuery() const {
if (tick >= cache.Scheduler().CurrentTick()) { if (tick >= cache.Scheduler().CurrentTick()) {
cache.Scheduler().Flush(); cache.Scheduler().Flush();
} }
u64 data; u64 data;
const VkResult result = cache.Device().GetLogical().GetQueryResults( const VkResult query_result = cache.Device().GetLogical().GetQueryResults(
query.first, query.second, 1, sizeof(data), &data, sizeof(data), query.first, query.second, 1, sizeof(data), &data, sizeof(data),
VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT);
switch (result) {
switch (query_result) {
case VK_SUCCESS: case VK_SUCCESS:
return data; return data;
case VK_ERROR_DEVICE_LOST: case VK_ERROR_DEVICE_LOST:
cache.Device().ReportLoss(); cache.Device().ReportLoss();
[[fallthrough]]; [[fallthrough]];
default: default:
throw vk::Exception(result); throw vk::Exception(query_result);
} }
} }

View file

@ -95,8 +95,8 @@ private:
class CachedQuery : public VideoCommon::CachedQueryBase<HostCounter> { class CachedQuery : public VideoCommon::CachedQueryBase<HostCounter> {
public: public:
explicit CachedQuery(VKQueryCache&, VideoCore::QueryType, VAddr cpu_addr, u8* host_ptr) explicit CachedQuery(VKQueryCache&, VideoCore::QueryType, VAddr cpu_addr_, u8* host_ptr_)
: VideoCommon::CachedQueryBase<HostCounter>{cpu_addr, host_ptr} {} : CachedQueryBase{cpu_addr_, host_ptr_} {}
}; };
} // namespace Vulkan } // namespace Vulkan

View file

@ -128,12 +128,12 @@ Tegra::Texture::FullTextureInfo GetTextureInfo(const Engine& engine, const Entry
const u32 offset_2 = entry.secondary_offset; const u32 offset_2 = entry.secondary_offset;
const u32 handle_1 = engine.AccessConstBuffer32(stage_type, buffer_1, offset_1); const u32 handle_1 = engine.AccessConstBuffer32(stage_type, buffer_1, offset_1);
const u32 handle_2 = engine.AccessConstBuffer32(stage_type, buffer_2, offset_2); const u32 handle_2 = engine.AccessConstBuffer32(stage_type, buffer_2, offset_2);
return engine.GetTextureInfo(handle_1 | handle_2); return engine.GetTextureInfo(Tegra::Texture::TextureHandle{handle_1 | handle_2});
} }
} }
if (entry.is_bindless) { if (entry.is_bindless) {
const auto tex_handle = engine.AccessConstBuffer32(stage_type, entry.buffer, entry.offset); const auto tex_handle = engine.AccessConstBuffer32(stage_type, entry.buffer, entry.offset);
return engine.GetTextureInfo(tex_handle); return engine.GetTextureInfo(Tegra::Texture::TextureHandle{tex_handle});
} }
const auto& gpu_profile = engine.AccessGuestDriverProfile(); const auto& gpu_profile = engine.AccessGuestDriverProfile();
const u32 entry_offset = static_cast<u32>(index * gpu_profile.GetTextureHandlerSize()); const u32 entry_offset = static_cast<u32>(index * gpu_profile.GetTextureHandlerSize());
@ -380,12 +380,12 @@ void RasterizerVulkan::DrawParameters::Draw(vk::CommandBuffer cmdbuf) const {
} }
} }
RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window, Tegra::GPU& gpu_, RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
Tegra::MemoryManager& gpu_memory_, Tegra::MemoryManager& gpu_memory_,
Core::Memory::Memory& cpu_memory, VKScreenInfo& screen_info_, Core::Memory::Memory& cpu_memory_, VKScreenInfo& screen_info_,
const VKDevice& device_, VKMemoryManager& memory_manager_, const VKDevice& device_, VKMemoryManager& memory_manager_,
StateTracker& state_tracker_, VKScheduler& scheduler_) StateTracker& state_tracker_, VKScheduler& scheduler_)
: RasterizerAccelerated(cpu_memory), gpu(gpu_), gpu_memory(gpu_memory_), : RasterizerAccelerated(cpu_memory_), gpu(gpu_), gpu_memory(gpu_memory_),
maxwell3d(gpu.Maxwell3D()), kepler_compute(gpu.KeplerCompute()), screen_info(screen_info_), maxwell3d(gpu.Maxwell3D()), kepler_compute(gpu.KeplerCompute()), screen_info(screen_info_),
device(device_), memory_manager(memory_manager_), state_tracker(state_tracker_), device(device_), memory_manager(memory_manager_), state_tracker(state_tracker_),
scheduler(scheduler_), staging_pool(device, memory_manager, scheduler), scheduler(scheduler_), staging_pool(device, memory_manager, scheduler),
@ -397,11 +397,11 @@ RasterizerVulkan::RasterizerVulkan(Core::Frontend::EmuWindow& emu_window, Tegra:
texture_cache(*this, maxwell3d, gpu_memory, device, memory_manager, scheduler, staging_pool), texture_cache(*this, maxwell3d, gpu_memory, device, memory_manager, scheduler, staging_pool),
pipeline_cache(*this, gpu, maxwell3d, kepler_compute, gpu_memory, device, scheduler, pipeline_cache(*this, gpu, maxwell3d, kepler_compute, gpu_memory, device, scheduler,
descriptor_pool, update_descriptor_queue, renderpass_cache), descriptor_pool, update_descriptor_queue, renderpass_cache),
buffer_cache(*this, gpu_memory, cpu_memory, device, memory_manager, scheduler, staging_pool), buffer_cache(*this, gpu_memory, cpu_memory_, device, memory_manager, scheduler, staging_pool),
sampler_cache(device), query_cache(*this, maxwell3d, gpu_memory, device, scheduler), sampler_cache(device), query_cache(*this, maxwell3d, gpu_memory, device, scheduler),
fence_manager(*this, gpu, gpu_memory, texture_cache, buffer_cache, query_cache, device, fence_manager(*this, gpu, gpu_memory, texture_cache, buffer_cache, query_cache, device,
scheduler), scheduler),
wfi_event(device.GetLogical().CreateEvent()), async_shaders(emu_window) { wfi_event(device.GetLogical().CreateEvent()), async_shaders(emu_window_) {
scheduler.SetQueryCache(query_cache); scheduler.SetQueryCache(query_cache);
if (device.UseAsynchronousShaders()) { if (device.UseAsynchronousShaders()) {
async_shaders.AllocateWorkers(); async_shaders.AllocateWorkers();

View file

@ -105,11 +105,11 @@ struct ImageView {
class RasterizerVulkan final : public VideoCore::RasterizerAccelerated { class RasterizerVulkan final : public VideoCore::RasterizerAccelerated {
public: public:
explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window, Tegra::GPU& gpu, explicit RasterizerVulkan(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_,
Tegra::MemoryManager& gpu_memory, Core::Memory::Memory& cpu_memory, Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_,
VKScreenInfo& screen_info, const VKDevice& device, VKScreenInfo& screen_info_, const VKDevice& device_,
VKMemoryManager& memory_manager, StateTracker& state_tracker, VKMemoryManager& memory_manager_, StateTracker& state_tracker_,
VKScheduler& scheduler); VKScheduler& scheduler_);
~RasterizerVulkan() override; ~RasterizerVulkan() override;
void Draw(bool is_indexed, bool is_instanced) override; void Draw(bool is_indexed, bool is_instanced) override;

View file

@ -489,12 +489,12 @@ VkImageView CachedSurfaceView::GetAttachment() {
return *render_target; return *render_target;
} }
VKTextureCache::VKTextureCache(VideoCore::RasterizerInterface& rasterizer, VKTextureCache::VKTextureCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::Engines::Maxwell3D& maxwell3d, Tegra::Engines::Maxwell3D& maxwell3d_,
Tegra::MemoryManager& gpu_memory, const VKDevice& device_, Tegra::MemoryManager& gpu_memory_, const VKDevice& device_,
VKMemoryManager& memory_manager_, VKScheduler& scheduler_, VKMemoryManager& memory_manager_, VKScheduler& scheduler_,
VKStagingBufferPool& staging_pool_) VKStagingBufferPool& staging_pool_)
: TextureCache(rasterizer, maxwell3d, gpu_memory, device_.IsOptimalAstcSupported()), : TextureCache(rasterizer_, maxwell3d_, gpu_memory_, device_.IsOptimalAstcSupported()),
device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_}, staging_pool{ device{device_}, memory_manager{memory_manager_}, scheduler{scheduler_}, staging_pool{
staging_pool_} {} staging_pool_} {}

View file

@ -193,10 +193,11 @@ private:
class VKTextureCache final : public TextureCacheBase { class VKTextureCache final : public TextureCacheBase {
public: public:
explicit VKTextureCache(VideoCore::RasterizerInterface& rasterizer, explicit VKTextureCache(VideoCore::RasterizerInterface& rasterizer_,
Tegra::Engines::Maxwell3D& maxwell3d, Tegra::MemoryManager& gpu_memory, Tegra::Engines::Maxwell3D& maxwell3d_,
const VKDevice& device, VKMemoryManager& memory_manager, Tegra::MemoryManager& gpu_memory_, const VKDevice& device_,
VKScheduler& scheduler, VKStagingBufferPool& staging_pool); VKMemoryManager& memory_manager_, VKScheduler& scheduler_,
VKStagingBufferPool& staging_pool_);
~VKTextureCache(); ~VKTextureCache();
private: private:

View file

@ -374,8 +374,8 @@ std::string ASTManager::Print() const {
return printer.GetResult(); return printer.GetResult();
} }
ASTManager::ASTManager(bool full_decompile, bool disable_else_derivation) ASTManager::ASTManager(bool do_full_decompile, bool disable_else_derivation_)
: full_decompile{full_decompile}, disable_else_derivation{disable_else_derivation} {}; : full_decompile{do_full_decompile}, disable_else_derivation{disable_else_derivation_} {}
ASTManager::~ASTManager() { ASTManager::~ASTManager() {
Clear(); Clear();

View file

@ -76,7 +76,7 @@ public:
class ASTIfThen { class ASTIfThen {
public: public:
explicit ASTIfThen(Expr condition) : condition{std::move(condition)} {} explicit ASTIfThen(Expr condition_) : condition{std::move(condition_)} {}
Expr condition; Expr condition;
ASTZipper nodes{}; ASTZipper nodes{};
}; };
@ -88,63 +88,68 @@ public:
class ASTBlockEncoded { class ASTBlockEncoded {
public: public:
explicit ASTBlockEncoded(u32 start, u32 end) : start{start}, end{end} {} explicit ASTBlockEncoded(u32 start_, u32 _) : start{start_}, end{_} {}
u32 start; u32 start;
u32 end; u32 end;
}; };
class ASTBlockDecoded { class ASTBlockDecoded {
public: public:
explicit ASTBlockDecoded(NodeBlock&& new_nodes) : nodes(std::move(new_nodes)) {} explicit ASTBlockDecoded(NodeBlock&& new_nodes_) : nodes(std::move(new_nodes_)) {}
NodeBlock nodes; NodeBlock nodes;
}; };
class ASTVarSet { class ASTVarSet {
public: public:
explicit ASTVarSet(u32 index, Expr condition) : index{index}, condition{std::move(condition)} {} explicit ASTVarSet(u32 index_, Expr condition_)
: index{index_}, condition{std::move(condition_)} {}
u32 index; u32 index;
Expr condition; Expr condition;
}; };
class ASTLabel { class ASTLabel {
public: public:
explicit ASTLabel(u32 index) : index{index} {} explicit ASTLabel(u32 index_) : index{index_} {}
u32 index; u32 index;
bool unused{}; bool unused{};
}; };
class ASTGoto { class ASTGoto {
public: public:
explicit ASTGoto(Expr condition, u32 label) : condition{std::move(condition)}, label{label} {} explicit ASTGoto(Expr condition_, u32 label_)
: condition{std::move(condition_)}, label{label_} {}
Expr condition; Expr condition;
u32 label; u32 label;
}; };
class ASTDoWhile { class ASTDoWhile {
public: public:
explicit ASTDoWhile(Expr condition) : condition{std::move(condition)} {} explicit ASTDoWhile(Expr condition_) : condition{std::move(condition_)} {}
Expr condition; Expr condition;
ASTZipper nodes{}; ASTZipper nodes{};
}; };
class ASTReturn { class ASTReturn {
public: public:
explicit ASTReturn(Expr condition, bool kills) explicit ASTReturn(Expr condition_, bool kills_)
: condition{std::move(condition)}, kills{kills} {} : condition{std::move(condition_)}, kills{kills_} {}
Expr condition; Expr condition;
bool kills; bool kills;
}; };
class ASTBreak { class ASTBreak {
public: public:
explicit ASTBreak(Expr condition) : condition{std::move(condition)} {} explicit ASTBreak(Expr condition_) : condition{std::move(condition_)} {}
Expr condition; Expr condition;
}; };
class ASTBase { class ASTBase {
public: public:
explicit ASTBase(ASTNode parent, ASTData data) explicit ASTBase(ASTNode parent_, ASTData data_)
: data{std::move(data)}, parent{std::move(parent)} {} : data{std::move(data_)}, parent{std::move(parent_)} {}
template <class U, class... Args> template <class U, class... Args>
static ASTNode Make(ASTNode parent, Args&&... args) { static ASTNode Make(ASTNode parent, Args&&... args) {
@ -300,7 +305,7 @@ private:
class ASTManager final { class ASTManager final {
public: public:
ASTManager(bool full_decompile, bool disable_else_derivation); explicit ASTManager(bool do_full_decompile, bool disable_else_derivation_);
~ASTManager(); ~ASTManager();
ASTManager(const ASTManager& o) = delete; ASTManager(const ASTManager& o) = delete;

View file

@ -13,7 +13,7 @@
namespace VideoCommon::Shader { namespace VideoCommon::Shader {
AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window) : emu_window(emu_window) {} AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window_) : emu_window(emu_window_) {}
AsyncShaders::~AsyncShaders() { AsyncShaders::~AsyncShaders() {
KillWorkers(); KillWorkers();

View file

@ -66,7 +66,7 @@ public:
Tegra::Engines::ShaderType shader_type; Tegra::Engines::ShaderType shader_type;
}; };
explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window); explicit AsyncShaders(Core::Frontend::EmuWindow& emu_window_);
~AsyncShaders(); ~AsyncShaders();
/// Start up shader worker threads /// Start up shader worker threads

View file

@ -66,8 +66,8 @@ struct BlockInfo {
}; };
struct CFGRebuildState { struct CFGRebuildState {
explicit CFGRebuildState(const ProgramCode& program_code, u32 start, Registry& registry) explicit CFGRebuildState(const ProgramCode& program_code_, u32 start_, Registry& registry_)
: program_code{program_code}, registry{registry}, start{start} {} : program_code{program_code_}, registry{registry_}, start{start_} {}
const ProgramCode& program_code; const ProgramCode& program_code;
Registry& registry; Registry& registry;

View file

@ -42,10 +42,10 @@ struct Condition {
class SingleBranch { class SingleBranch {
public: public:
SingleBranch() = default; SingleBranch() = default;
SingleBranch(Condition condition, s32 address, bool kill, bool is_sync, bool is_brk, explicit SingleBranch(Condition condition_, s32 address_, bool kill_, bool is_sync_,
bool ignore) bool is_brk_, bool ignore_)
: condition{condition}, address{address}, kill{kill}, is_sync{is_sync}, is_brk{is_brk}, : condition{condition_}, address{address_}, kill{kill_}, is_sync{is_sync_}, is_brk{is_brk_},
ignore{ignore} {} ignore{ignore_} {}
bool operator==(const SingleBranch& b) const { bool operator==(const SingleBranch& b) const {
return std::tie(condition, address, kill, is_sync, is_brk, ignore) == return std::tie(condition, address, kill, is_sync, is_brk, ignore) ==
@ -65,15 +65,15 @@ public:
}; };
struct CaseBranch { struct CaseBranch {
CaseBranch(u32 cmp_value, u32 address) : cmp_value{cmp_value}, address{address} {} explicit CaseBranch(u32 cmp_value_, u32 address_) : cmp_value{cmp_value_}, address{address_} {}
u32 cmp_value; u32 cmp_value;
u32 address; u32 address;
}; };
class MultiBranch { class MultiBranch {
public: public:
MultiBranch(u32 gpr, std::vector<CaseBranch>&& branches) explicit MultiBranch(u32 gpr_, std::vector<CaseBranch>&& branches_)
: gpr{gpr}, branches{std::move(branches)} {} : gpr{gpr_}, branches{std::move(branches_)} {}
u32 gpr{}; u32 gpr{};
std::vector<CaseBranch> branches{}; std::vector<CaseBranch> branches{};

View file

@ -66,7 +66,7 @@ std::optional<u32> TryDeduceSamplerSize(const Sampler& sampler_to_deduce,
class ASTDecoder { class ASTDecoder {
public: public:
ASTDecoder(ShaderIR& ir) : ir(ir) {} explicit ASTDecoder(ShaderIR& ir_) : ir(ir_) {}
void operator()(ASTProgram& ast) { void operator()(ASTProgram& ast) {
ASTNode current = ast.nodes.GetFirst(); ASTNode current = ast.nodes.GetFirst();

View file

@ -258,7 +258,7 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) {
case OpCode::Id::LEA_IMM: case OpCode::Id::LEA_IMM:
case OpCode::Id::LEA_RZ: case OpCode::Id::LEA_RZ:
case OpCode::Id::LEA_HI: { case OpCode::Id::LEA_HI: {
auto [op_a, op_b, op_c] = [&]() -> std::tuple<Node, Node, Node> { auto [op_a_, op_b_, op_c_] = [&]() -> std::tuple<Node, Node, Node> {
switch (opcode->get().GetId()) { switch (opcode->get().GetId()) {
case OpCode::Id::LEA_R2: { case OpCode::Id::LEA_R2: {
return {GetRegister(instr.gpr20), GetRegister(instr.gpr39), return {GetRegister(instr.gpr20), GetRegister(instr.gpr39),
@ -294,8 +294,9 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) {
UNIMPLEMENTED_IF_MSG(instr.lea.pred48 != static_cast<u64>(Pred::UnusedIndex), UNIMPLEMENTED_IF_MSG(instr.lea.pred48 != static_cast<u64>(Pred::UnusedIndex),
"Unhandled LEA Predicate"); "Unhandled LEA Predicate");
Node value = Operation(OperationCode::ILogicalShiftLeft, std::move(op_a), std::move(op_c)); Node value =
value = Operation(OperationCode::IAdd, std::move(op_b), std::move(value)); Operation(OperationCode::ILogicalShiftLeft, std::move(op_a_), std::move(op_c_));
value = Operation(OperationCode::IAdd, std::move(op_b_), std::move(value));
SetRegister(bb, instr.gpr0, std::move(value)); SetRegister(bb, instr.gpr0, std::move(value));
break; break;

View file

@ -76,7 +76,7 @@ public:
class ExprPredicate final { class ExprPredicate final {
public: public:
explicit ExprPredicate(u32 predicate) : predicate{predicate} {} explicit ExprPredicate(u32 predicate_) : predicate{predicate_} {}
bool operator==(const ExprPredicate& b) const { bool operator==(const ExprPredicate& b) const {
return predicate == b.predicate; return predicate == b.predicate;
@ -91,7 +91,7 @@ public:
class ExprCondCode final { class ExprCondCode final {
public: public:
explicit ExprCondCode(ConditionCode cc) : cc{cc} {} explicit ExprCondCode(ConditionCode condition_code) : cc{condition_code} {}
bool operator==(const ExprCondCode& b) const { bool operator==(const ExprCondCode& b) const {
return cc == b.cc; return cc == b.cc;
@ -121,7 +121,7 @@ public:
class ExprGprEqual final { class ExprGprEqual final {
public: public:
ExprGprEqual(u32 gpr, u32 value) : gpr{gpr}, value{value} {} explicit ExprGprEqual(u32 gpr_, u32 value_) : gpr{gpr_}, value{value_} {}
bool operator==(const ExprGprEqual& b) const { bool operator==(const ExprGprEqual& b) const {
return gpr == b.gpr && value == b.value; return gpr == b.gpr && value == b.value;

View file

@ -290,18 +290,18 @@ struct Sampler {
is_buffer{is_buffer_}, is_indexed{is_indexed_} {} is_buffer{is_buffer_}, is_indexed{is_indexed_} {}
/// Separate sampler constructor /// Separate sampler constructor
constexpr explicit Sampler(u32 index_, std::pair<u32, u32> offsets, std::pair<u32, u32> buffers, constexpr explicit Sampler(u32 index_, std::pair<u32, u32> offsets_,
Tegra::Shader::TextureType type, bool is_array_, bool is_shadow_, std::pair<u32, u32> buffers_, Tegra::Shader::TextureType type_,
bool is_buffer_) bool is_array_, bool is_shadow_, bool is_buffer_)
: index{index_}, offset{offsets.first}, secondary_offset{offsets.second}, : index{index_}, offset{offsets_.first}, secondary_offset{offsets_.second},
buffer{buffers.first}, secondary_buffer{buffers.second}, type{type}, is_array{is_array_}, buffer{buffers_.first}, secondary_buffer{buffers_.second}, type{type_},
is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_separated{true} {} is_array{is_array_}, is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_separated{true} {}
/// Bindless samplers constructor /// Bindless samplers constructor
constexpr explicit Sampler(u32 index_, u32 offset_, u32 buffer_, constexpr explicit Sampler(u32 index_, u32 offset_, u32 buffer_,
Tegra::Shader::TextureType type, bool is_array_, bool is_shadow_, Tegra::Shader::TextureType type_, bool is_array_, bool is_shadow_,
bool is_buffer_, bool is_indexed_) bool is_buffer_, bool is_indexed_)
: index{index_}, offset{offset_}, buffer{buffer_}, type{type}, is_array{is_array_}, : index{index_}, offset{offset_}, buffer{buffer_}, type{type_}, is_array{is_array_},
is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_bindless{true}, is_indexed{is_indexed_} { is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_bindless{true}, is_indexed{is_indexed_} {
} }

View file

@ -25,9 +25,10 @@ using Tegra::Shader::PredCondition;
using Tegra::Shader::PredOperation; using Tegra::Shader::PredOperation;
using Tegra::Shader::Register; using Tegra::Shader::Register;
ShaderIR::ShaderIR(const ProgramCode& program_code, u32 main_offset, CompilerSettings settings, ShaderIR::ShaderIR(const ProgramCode& program_code_, u32 main_offset_, CompilerSettings settings_,
Registry& registry) Registry& registry_)
: program_code{program_code}, main_offset{main_offset}, settings{settings}, registry{registry} { : program_code{program_code_}, main_offset{main_offset_}, settings{settings_}, registry{
registry_} {
Decode(); Decode();
PostDecode(); PostDecode();
} }

View file

@ -29,8 +29,8 @@ struct ShaderBlock;
constexpr u32 MAX_PROGRAM_LENGTH = 0x1000; constexpr u32 MAX_PROGRAM_LENGTH = 0x1000;
struct ConstBuffer { struct ConstBuffer {
constexpr explicit ConstBuffer(u32 max_offset, bool is_indirect) constexpr explicit ConstBuffer(u32 max_offset_, bool is_indirect_)
: max_offset{max_offset}, is_indirect{is_indirect} {} : max_offset{max_offset_}, is_indirect{is_indirect_} {}
constexpr ConstBuffer() = default; constexpr ConstBuffer() = default;
@ -66,8 +66,8 @@ struct GlobalMemoryUsage {
class ShaderIR final { class ShaderIR final {
public: public:
explicit ShaderIR(const ProgramCode& program_code, u32 main_offset, CompilerSettings settings, explicit ShaderIR(const ProgramCode& program_code_, u32 main_offset_,
Registry& registry); CompilerSettings settings_, Registry& registry_);
~ShaderIR(); ~ShaderIR();
const std::map<u32, NodeBlock>& GetBasicBlocks() const { const std::map<u32, NodeBlock>& GetBasicBlocks() const {

View file

@ -9,16 +9,16 @@
namespace VideoCommon { namespace VideoCommon {
struct CopyParams { struct CopyParams {
constexpr CopyParams(u32 source_x, u32 source_y, u32 source_z, u32 dest_x, u32 dest_y, constexpr CopyParams(u32 source_x_, u32 source_y_, u32 source_z_, u32 dest_x_, u32 dest_y_,
u32 dest_z, u32 source_level, u32 dest_level, u32 width, u32 height, u32 dest_z_, u32 source_level_, u32 dest_level_, u32 width_, u32 height_,
u32 depth) u32 depth_)
: source_x{source_x}, source_y{source_y}, source_z{source_z}, dest_x{dest_x}, : source_x{source_x_}, source_y{source_y_}, source_z{source_z_}, dest_x{dest_x_},
dest_y{dest_y}, dest_z{dest_z}, source_level{source_level}, dest_y{dest_y_}, dest_z{dest_z_}, source_level{source_level_},
dest_level{dest_level}, width{width}, height{height}, depth{depth} {} dest_level{dest_level_}, width{width_}, height{height_}, depth{depth_} {}
constexpr CopyParams(u32 width, u32 height, u32 depth, u32 level) constexpr CopyParams(u32 width_, u32 height_, u32 depth_, u32 level_)
: source_x{}, source_y{}, source_z{}, dest_x{}, dest_y{}, dest_z{}, source_level{level}, : source_x{}, source_y{}, source_z{}, dest_x{}, dest_y{}, dest_z{}, source_level{level_},
dest_level{level}, width{width}, height{height}, depth{depth} {} dest_level{level_}, width{width_}, height{height_}, depth{depth_} {}
u32 source_x; u32 source_x;
u32 source_y; u32 source_y;

View file

@ -24,12 +24,12 @@ constexpr bool C = false; // Normal color
constexpr bool S = true; // Srgb constexpr bool S = true; // Srgb
struct Table { struct Table {
constexpr Table(TextureFormat texture_format, bool is_srgb, ComponentType red_component, constexpr Table(TextureFormat texture_format_, bool is_srgb_, ComponentType red_component_,
ComponentType green_component, ComponentType blue_component, ComponentType green_component_, ComponentType blue_component_,
ComponentType alpha_component, PixelFormat pixel_format) ComponentType alpha_component_, PixelFormat pixel_format_)
: texture_format{texture_format}, pixel_format{pixel_format}, red_component{red_component}, : texture_format{texture_format_}, pixel_format{pixel_format_},
green_component{green_component}, blue_component{blue_component}, red_component{red_component_}, green_component{green_component_},
alpha_component{alpha_component}, is_srgb{is_srgb} {} blue_component{blue_component_}, alpha_component{alpha_component_}, is_srgb{is_srgb_} {}
TextureFormat texture_format; TextureFormat texture_format;
PixelFormat pixel_format; PixelFormat pixel_format;

View file

@ -25,11 +25,11 @@ StagingCache::StagingCache() = default;
StagingCache::~StagingCache() = default; StagingCache::~StagingCache() = default;
SurfaceBaseImpl::SurfaceBaseImpl(GPUVAddr gpu_addr, const SurfaceParams& params, SurfaceBaseImpl::SurfaceBaseImpl(GPUVAddr gpu_addr_, const SurfaceParams& params_,
bool is_astc_supported) bool is_astc_supported_)
: params{params}, gpu_addr{gpu_addr}, mipmap_sizes(params.num_levels), : params{params_}, gpu_addr{gpu_addr_}, mipmap_sizes(params_.num_levels),
mipmap_offsets(params.num_levels) { mipmap_offsets(params.num_levels) {
is_converted = IsPixelFormatASTC(params.pixel_format) && !is_astc_supported; is_converted = IsPixelFormatASTC(params.pixel_format) && !is_astc_supported_;
host_memory_size = params.GetHostSizeInBytes(is_converted); host_memory_size = params.GetHostSizeInBytes(is_converted);
std::size_t offset = 0; std::size_t offset = 0;

View file

@ -148,8 +148,8 @@ public:
} }
protected: protected:
explicit SurfaceBaseImpl(GPUVAddr gpu_addr, const SurfaceParams& params, explicit SurfaceBaseImpl(GPUVAddr gpu_addr_, const SurfaceParams& params_,
bool is_astc_supported); bool is_astc_supported_);
~SurfaceBaseImpl() = default; ~SurfaceBaseImpl() = default;
virtual void DecorateSurfaceName() = 0; virtual void DecorateSurfaceName() = 0;
@ -297,9 +297,9 @@ public:
} }
protected: protected:
explicit SurfaceBase(const GPUVAddr gpu_addr, const SurfaceParams& params, explicit SurfaceBase(const GPUVAddr gpu_addr_, const SurfaceParams& params_,
bool is_astc_supported) bool is_astc_supported_)
: SurfaceBaseImpl(gpu_addr, params, is_astc_supported) {} : SurfaceBaseImpl{gpu_addr_, params_, is_astc_supported_} {}
~SurfaceBase() = default; ~SurfaceBase() = default;

View file

@ -13,10 +13,10 @@
namespace VideoCommon { namespace VideoCommon {
struct ViewParams { struct ViewParams {
constexpr explicit ViewParams(VideoCore::Surface::SurfaceTarget target, u32 base_layer, constexpr explicit ViewParams(VideoCore::Surface::SurfaceTarget target_, u32 base_layer_,
u32 num_layers, u32 base_level, u32 num_levels) u32 num_layers_, u32 base_level_, u32 num_levels_)
: target{target}, base_layer{base_layer}, num_layers{num_layers}, base_level{base_level}, : target{target_}, base_layer{base_layer_}, num_layers{num_layers_},
num_levels{num_levels} {} base_level{base_level_}, num_levels{num_levels_} {}
std::size_t Hash() const; std::size_t Hash() const;
@ -44,7 +44,7 @@ struct ViewParams {
class ViewBase { class ViewBase {
public: public:
constexpr explicit ViewBase(const ViewParams& params) : params{params} {} constexpr explicit ViewBase(const ViewParams& view_params) : params{view_params} {}
constexpr const ViewParams& GetViewParams() const { constexpr const ViewParams& GetViewParams() const {
return params; return params;

View file

@ -146,7 +146,7 @@ enum class MsaaMode : u32 {
}; };
union TextureHandle { union TextureHandle {
TextureHandle(u32 raw) : raw{raw} {} /* implicit */ TextureHandle(u32 raw_) : raw{raw_} {}
u32 raw; u32 raw;
BitField<0, 20, u32> tic_id; BitField<0, 20, u32> tic_id;