summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar bunnei2018-09-17 09:51:47 -0400
committerGravatar GitHub2018-09-17 09:51:47 -0400
commit076add4ccddff3940e20fc320615e3d330f77119 (patch)
treebacabcfed8665974c276489509a1caa330ad36a2 /src/video_core
parentMerge pull request #1329 from raven02/bgr5a1u (diff)
parentPort #4182 from Citra: "Prefix all size_t with std::" (diff)
downloadyuzu-076add4ccddff3940e20fc320615e3d330f77119.tar.gz
yuzu-076add4ccddff3940e20fc320615e3d330f77119.tar.xz
yuzu-076add4ccddff3940e20fc320615e3d330f77119.zip
Merge pull request #1326 from FearlessTobi/port-4182
Port #4182 from Citra: "Prefix all size_t with std::"
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/engines/fermi_2d.h2
-rw-r--r--src/video_core/engines/maxwell_3d.cpp13
-rw-r--r--src/video_core/engines/maxwell_3d.h28
-rw-r--r--src/video_core/engines/maxwell_dma.cpp2
-rw-r--r--src/video_core/engines/maxwell_dma.h2
-rw-r--r--src/video_core/engines/shader_bytecode.h18
-rw-r--r--src/video_core/macro_interpreter.h2
-rw-r--r--src/video_core/renderer_opengl/gl_buffer_cache.cpp15
-rw-r--r--src/video_core/renderer_opengl/gl_buffer_cache.h16
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp30
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp43
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h32
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp6
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.h2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp28
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.h18
-rw-r--r--src/video_core/renderer_opengl/gl_shader_manager.h2
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_stream_buffer.cpp2
20 files changed, 138 insertions, 133 deletions
diff --git a/src/video_core/engines/fermi_2d.h b/src/video_core/engines/fermi_2d.h
index dcf9ef8b9..021b83eaa 100644
--- a/src/video_core/engines/fermi_2d.h
+++ b/src/video_core/engines/fermi_2d.h
@@ -26,7 +26,7 @@ public:
26 void WriteReg(u32 method, u32 value); 26 void WriteReg(u32 method, u32 value);
27 27
28 struct Regs { 28 struct Regs {
29 static constexpr size_t NUM_REGS = 0x258; 29 static constexpr std::size_t NUM_REGS = 0x258;
30 30
31 struct Surface { 31 struct Surface {
32 RenderTargetFormat format; 32 RenderTargetFormat format;
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 329079ddd..8afd26fe9 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -248,8 +248,8 @@ void Maxwell3D::DrawArrays() {
248 248
249void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) { 249void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) {
250 // Bind the buffer currently in CB_ADDRESS to the specified index in the desired shader stage. 250 // Bind the buffer currently in CB_ADDRESS to the specified index in the desired shader stage.
251 auto& shader = state.shader_stages[static_cast<size_t>(stage)]; 251 auto& shader = state.shader_stages[static_cast<std::size_t>(stage)];
252 auto& bind_data = regs.cb_bind[static_cast<size_t>(stage)]; 252 auto& bind_data = regs.cb_bind[static_cast<std::size_t>(stage)];
253 253
254 auto& buffer = shader.const_buffers[bind_data.index]; 254 auto& buffer = shader.const_buffers[bind_data.index];
255 255
@@ -316,14 +316,14 @@ Texture::TSCEntry Maxwell3D::GetTSCEntry(u32 tsc_index) const {
316std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderStage stage) const { 316std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderStage stage) const {
317 std::vector<Texture::FullTextureInfo> textures; 317 std::vector<Texture::FullTextureInfo> textures;
318 318
319 auto& fragment_shader = state.shader_stages[static_cast<size_t>(stage)]; 319 auto& fragment_shader = state.shader_stages[static_cast<std::size_t>(stage)];
320 auto& tex_info_buffer = fragment_shader.const_buffers[regs.tex_cb_index]; 320 auto& tex_info_buffer = fragment_shader.const_buffers[regs.tex_cb_index];
321 ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0); 321 ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0);
322 322
323 GPUVAddr tex_info_buffer_end = tex_info_buffer.address + tex_info_buffer.size; 323 GPUVAddr tex_info_buffer_end = tex_info_buffer.address + tex_info_buffer.size;
324 324
325 // Offset into the texture constbuffer where the texture info begins. 325 // Offset into the texture constbuffer where the texture info begins.
326 static constexpr size_t TextureInfoOffset = 0x20; 326 static constexpr std::size_t TextureInfoOffset = 0x20;
327 327
328 for (GPUVAddr current_texture = tex_info_buffer.address + TextureInfoOffset; 328 for (GPUVAddr current_texture = tex_info_buffer.address + TextureInfoOffset;
329 current_texture < tex_info_buffer_end; current_texture += sizeof(Texture::TextureHandle)) { 329 current_texture < tex_info_buffer_end; current_texture += sizeof(Texture::TextureHandle)) {
@@ -360,8 +360,9 @@ std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderSt
360 return textures; 360 return textures;
361} 361}
362 362
363Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage, size_t offset) const { 363Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage,
364 auto& shader = state.shader_stages[static_cast<size_t>(stage)]; 364 std::size_t offset) const {
365 auto& shader = state.shader_stages[static_cast<std::size_t>(stage)];
365 auto& tex_info_buffer = shader.const_buffers[regs.tex_cb_index]; 366 auto& tex_info_buffer = shader.const_buffers[regs.tex_cb_index];
366 ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0); 367 ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0);
367 368
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index d3be900a4..b81b0723d 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -34,17 +34,17 @@ public:
34 /// Register structure of the Maxwell3D engine. 34 /// Register structure of the Maxwell3D engine.
35 /// TODO(Subv): This structure will need to be made bigger as more registers are discovered. 35 /// TODO(Subv): This structure will need to be made bigger as more registers are discovered.
36 struct Regs { 36 struct Regs {
37 static constexpr size_t NUM_REGS = 0xE00; 37 static constexpr std::size_t NUM_REGS = 0xE00;
38 38
39 static constexpr size_t NumRenderTargets = 8; 39 static constexpr std::size_t NumRenderTargets = 8;
40 static constexpr size_t NumViewports = 16; 40 static constexpr std::size_t NumViewports = 16;
41 static constexpr size_t NumCBData = 16; 41 static constexpr std::size_t NumCBData = 16;
42 static constexpr size_t NumVertexArrays = 32; 42 static constexpr std::size_t NumVertexArrays = 32;
43 static constexpr size_t NumVertexAttributes = 32; 43 static constexpr std::size_t NumVertexAttributes = 32;
44 static constexpr size_t MaxShaderProgram = 6; 44 static constexpr std::size_t MaxShaderProgram = 6;
45 static constexpr size_t MaxShaderStage = 5; 45 static constexpr std::size_t MaxShaderStage = 5;
46 // Maximum number of const buffers per shader stage. 46 // Maximum number of const buffers per shader stage.
47 static constexpr size_t MaxConstBuffers = 18; 47 static constexpr std::size_t MaxConstBuffers = 18;
48 48
49 enum class QueryMode : u32 { 49 enum class QueryMode : u32 {
50 Write = 0, 50 Write = 0,
@@ -443,9 +443,9 @@ public:
443 } 443 }
444 }; 444 };
445 445
446 bool IsShaderConfigEnabled(size_t index) const { 446 bool IsShaderConfigEnabled(std::size_t index) const {
447 // The VertexB is always enabled. 447 // The VertexB is always enabled.
448 if (index == static_cast<size_t>(Regs::ShaderProgram::VertexB)) { 448 if (index == static_cast<std::size_t>(Regs::ShaderProgram::VertexB)) {
449 return true; 449 return true;
450 } 450 }
451 return shader_config[index].enable != 0; 451 return shader_config[index].enable != 0;
@@ -571,7 +571,7 @@ public:
571 BitField<25, 3, u32> map_7; 571 BitField<25, 3, u32> map_7;
572 }; 572 };
573 573
574 u32 GetMap(size_t index) const { 574 u32 GetMap(std::size_t index) const {
575 const std::array<u32, NumRenderTargets> maps{map_0, map_1, map_2, map_3, 575 const std::array<u32, NumRenderTargets> maps{map_0, map_1, map_2, map_3,
576 map_4, map_5, map_6, map_7}; 576 map_4, map_5, map_6, map_7};
577 ASSERT(index < maps.size()); 577 ASSERT(index < maps.size());
@@ -925,7 +925,7 @@ public:
925 std::vector<Texture::FullTextureInfo> GetStageTextures(Regs::ShaderStage stage) const; 925 std::vector<Texture::FullTextureInfo> GetStageTextures(Regs::ShaderStage stage) const;
926 926
927 /// Returns the texture information for a specific texture in a specific shader stage. 927 /// Returns the texture information for a specific texture in a specific shader stage.
928 Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, size_t offset) const; 928 Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, std::size_t offset) const;
929 929
930private: 930private:
931 VideoCore::RasterizerInterface& rasterizer; 931 VideoCore::RasterizerInterface& rasterizer;
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp
index c24d33d5c..aa7481b8c 100644
--- a/src/video_core/engines/maxwell_dma.cpp
+++ b/src/video_core/engines/maxwell_dma.cpp
@@ -50,7 +50,7 @@ void MaxwellDMA::HandleCopy() {
50 ASSERT(regs.dst_params.pos_y == 0); 50 ASSERT(regs.dst_params.pos_y == 0);
51 51
52 if (regs.exec.is_dst_linear == regs.exec.is_src_linear) { 52 if (regs.exec.is_dst_linear == regs.exec.is_src_linear) {
53 size_t copy_size = regs.x_count; 53 std::size_t copy_size = regs.x_count;
54 54
55 // When the enable_2d bit is disabled, the copy is performed as if we were copying a 1D 55 // When the enable_2d bit is disabled, the copy is performed as if we were copying a 1D
56 // buffer of length `x_count`, otherwise we copy a 2D buffer of size (x_count, y_count). 56 // buffer of length `x_count`, otherwise we copy a 2D buffer of size (x_count, y_count).
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h
index 7882f16e0..311ccb616 100644
--- a/src/video_core/engines/maxwell_dma.h
+++ b/src/video_core/engines/maxwell_dma.h
@@ -23,7 +23,7 @@ public:
23 void WriteReg(u32 method, u32 value); 23 void WriteReg(u32 method, u32 value);
24 24
25 struct Regs { 25 struct Regs {
26 static constexpr size_t NUM_REGS = 0x1D6; 26 static constexpr std::size_t NUM_REGS = 0x1D6;
27 27
28 struct Parameters { 28 struct Parameters {
29 union { 29 union {
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index d6e2397f2..6e555ea03 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -20,10 +20,10 @@ namespace Tegra::Shader {
20 20
21struct Register { 21struct Register {
22 /// Number of registers 22 /// Number of registers
23 static constexpr size_t NumRegisters = 256; 23 static constexpr std::size_t NumRegisters = 256;
24 24
25 /// Register 255 is special cased to always be 0 25 /// Register 255 is special cased to always be 0
26 static constexpr size_t ZeroIndex = 255; 26 static constexpr std::size_t ZeroIndex = 255;
27 27
28 enum class Size : u64 { 28 enum class Size : u64 {
29 Byte = 0, 29 Byte = 0,
@@ -592,7 +592,7 @@ union Instruction {
592 BitField<31, 4, u64> component_mask; 592 BitField<31, 4, u64> component_mask;
593 BitField<55, 3, TextureProcessMode> process_mode; 593 BitField<55, 3, TextureProcessMode> process_mode;
594 594
595 bool IsComponentEnabled(size_t component) const { 595 bool IsComponentEnabled(std::size_t component) const {
596 return ((1ull << component) & component_mask) != 0; 596 return ((1ull << component) & component_mask) != 0;
597 } 597 }
598 } tex; 598 } tex;
@@ -607,7 +607,7 @@ union Instruction {
607 BitField<29, 2, TextureType> texture_type; 607 BitField<29, 2, TextureType> texture_type;
608 BitField<31, 4, u64> component_mask; 608 BitField<31, 4, u64> component_mask;
609 609
610 bool IsComponentEnabled(size_t component) const { 610 bool IsComponentEnabled(std::size_t component) const {
611 return ((1ull << component) & component_mask) != 0; 611 return ((1ull << component) & component_mask) != 0;
612 } 612 }
613 } tmml; 613 } tmml;
@@ -654,7 +654,7 @@ union Instruction {
654 return gpr28.Value() != Register::ZeroIndex; 654 return gpr28.Value() != Register::ZeroIndex;
655 } 655 }
656 656
657 bool IsComponentEnabled(size_t component) const { 657 bool IsComponentEnabled(std::size_t component) const {
658 static constexpr std::array<std::array<u32, 8>, 4> mask_lut{{ 658 static constexpr std::array<std::array<u32, 8>, 4> mask_lut{{
659 {}, 659 {},
660 {0x1, 0x2, 0x4, 0x8, 0x3, 0x9, 0xa, 0xc}, 660 {0x1, 0x2, 0x4, 0x8, 0x3, 0x9, 0xa, 0xc},
@@ -662,7 +662,7 @@ union Instruction {
662 {0x7, 0xb, 0xd, 0xe, 0xf}, 662 {0x7, 0xb, 0xd, 0xe, 0xf},
663 }}; 663 }};
664 664
665 size_t index{gpr0.Value() != Register::ZeroIndex ? 1U : 0U}; 665 std::size_t index{gpr0.Value() != Register::ZeroIndex ? 1U : 0U};
666 index |= gpr28.Value() != Register::ZeroIndex ? 2 : 0; 666 index |= gpr28.Value() != Register::ZeroIndex ? 2 : 0;
667 667
668 u32 mask = mask_lut[index][component_mask_selector]; 668 u32 mask = mask_lut[index][component_mask_selector];
@@ -947,7 +947,7 @@ public:
947private: 947private:
948 struct Detail { 948 struct Detail {
949 private: 949 private:
950 static constexpr size_t opcode_bitsize = 16; 950 static constexpr std::size_t opcode_bitsize = 16;
951 951
952 /** 952 /**
953 * Generates the mask and the expected value after masking from a given bitstring. 953 * Generates the mask and the expected value after masking from a given bitstring.
@@ -956,8 +956,8 @@ private:
956 */ 956 */
957 static auto GetMaskAndExpect(const char* const bitstring) { 957 static auto GetMaskAndExpect(const char* const bitstring) {
958 u16 mask = 0, expect = 0; 958 u16 mask = 0, expect = 0;
959 for (size_t i = 0; i < opcode_bitsize; i++) { 959 for (std::size_t i = 0; i < opcode_bitsize; i++) {
960 const size_t bit_position = opcode_bitsize - i - 1; 960 const std::size_t bit_position = opcode_bitsize - i - 1;
961 switch (bitstring[i]) { 961 switch (bitstring[i]) {
962 case '0': 962 case '0':
963 mask |= 1 << bit_position; 963 mask |= 1 << bit_position;
diff --git a/src/video_core/macro_interpreter.h b/src/video_core/macro_interpreter.h
index 7d836b816..cee0baaf3 100644
--- a/src/video_core/macro_interpreter.h
+++ b/src/video_core/macro_interpreter.h
@@ -152,7 +152,7 @@ private:
152 boost::optional<u32> 152 boost::optional<u32>
153 delayed_pc; ///< Program counter to execute at after the delay slot is executed. 153 delayed_pc; ///< Program counter to execute at after the delay slot is executed.
154 154
155 static constexpr size_t NumMacroRegisters = 8; 155 static constexpr std::size_t NumMacroRegisters = 8;
156 156
157 /// General purpose macro registers. 157 /// General purpose macro registers.
158 std::array<u32, NumMacroRegisters> registers = {}; 158 std::array<u32, NumMacroRegisters> registers = {};
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp
index 0b5d18bcb..578aca789 100644
--- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp
@@ -12,10 +12,10 @@
12 12
13namespace OpenGL { 13namespace OpenGL {
14 14
15OGLBufferCache::OGLBufferCache(size_t size) : stream_buffer(GL_ARRAY_BUFFER, size) {} 15OGLBufferCache::OGLBufferCache(std::size_t size) : stream_buffer(GL_ARRAY_BUFFER, size) {}
16 16
17GLintptr OGLBufferCache::UploadMemory(Tegra::GPUVAddr gpu_addr, size_t size, size_t alignment, 17GLintptr OGLBufferCache::UploadMemory(Tegra::GPUVAddr gpu_addr, std::size_t size,
18 bool cache) { 18 std::size_t alignment, bool cache) {
19 auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager(); 19 auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager();
20 const boost::optional<VAddr> cpu_addr{memory_manager.GpuToCpuAddress(gpu_addr)}; 20 const boost::optional<VAddr> cpu_addr{memory_manager.GpuToCpuAddress(gpu_addr)};
21 21
@@ -53,7 +53,8 @@ GLintptr OGLBufferCache::UploadMemory(Tegra::GPUVAddr gpu_addr, size_t size, siz
53 return uploaded_offset; 53 return uploaded_offset;
54} 54}
55 55
56GLintptr OGLBufferCache::UploadHostMemory(const void* raw_pointer, size_t size, size_t alignment) { 56GLintptr OGLBufferCache::UploadHostMemory(const void* raw_pointer, std::size_t size,
57 std::size_t alignment) {
57 AlignBuffer(alignment); 58 AlignBuffer(alignment);
58 std::memcpy(buffer_ptr, raw_pointer, size); 59 std::memcpy(buffer_ptr, raw_pointer, size);
59 GLintptr uploaded_offset = buffer_offset; 60 GLintptr uploaded_offset = buffer_offset;
@@ -63,7 +64,7 @@ GLintptr OGLBufferCache::UploadHostMemory(const void* raw_pointer, size_t size,
63 return uploaded_offset; 64 return uploaded_offset;
64} 65}
65 66
66void OGLBufferCache::Map(size_t max_size) { 67void OGLBufferCache::Map(std::size_t max_size) {
67 bool invalidate; 68 bool invalidate;
68 std::tie(buffer_ptr, buffer_offset_base, invalidate) = 69 std::tie(buffer_ptr, buffer_offset_base, invalidate) =
69 stream_buffer.Map(static_cast<GLsizeiptr>(max_size), 4); 70 stream_buffer.Map(static_cast<GLsizeiptr>(max_size), 4);
@@ -81,10 +82,10 @@ GLuint OGLBufferCache::GetHandle() const {
81 return stream_buffer.GetHandle(); 82 return stream_buffer.GetHandle();
82} 83}
83 84
84void OGLBufferCache::AlignBuffer(size_t alignment) { 85void OGLBufferCache::AlignBuffer(std::size_t alignment) {
85 // Align the offset, not the mapped pointer 86 // Align the offset, not the mapped pointer
86 GLintptr offset_aligned = 87 GLintptr offset_aligned =
87 static_cast<GLintptr>(Common::AlignUp(static_cast<size_t>(buffer_offset), alignment)); 88 static_cast<GLintptr>(Common::AlignUp(static_cast<std::size_t>(buffer_offset), alignment));
88 buffer_ptr += offset_aligned - buffer_offset; 89 buffer_ptr += offset_aligned - buffer_offset;
89 buffer_offset = offset_aligned; 90 buffer_offset = offset_aligned;
90} 91}
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h
index 6da862902..6c18461f4 100644
--- a/src/video_core/renderer_opengl/gl_buffer_cache.h
+++ b/src/video_core/renderer_opengl/gl_buffer_cache.h
@@ -19,32 +19,32 @@ struct CachedBufferEntry final {
19 return addr; 19 return addr;
20 } 20 }
21 21
22 size_t GetSizeInBytes() const { 22 std::size_t GetSizeInBytes() const {
23 return size; 23 return size;
24 } 24 }
25 25
26 VAddr addr; 26 VAddr addr;
27 size_t size; 27 std::size_t size;
28 GLintptr offset; 28 GLintptr offset;
29 size_t alignment; 29 std::size_t alignment;
30}; 30};
31 31
32class OGLBufferCache final : public RasterizerCache<std::shared_ptr<CachedBufferEntry>> { 32class OGLBufferCache final : public RasterizerCache<std::shared_ptr<CachedBufferEntry>> {
33public: 33public:
34 explicit OGLBufferCache(size_t size); 34 explicit OGLBufferCache(std::size_t size);
35 35
36 GLintptr UploadMemory(Tegra::GPUVAddr gpu_addr, size_t size, size_t alignment = 4, 36 GLintptr UploadMemory(Tegra::GPUVAddr gpu_addr, std::size_t size, std::size_t alignment = 4,
37 bool cache = true); 37 bool cache = true);
38 38
39 GLintptr UploadHostMemory(const void* raw_pointer, size_t size, size_t alignment = 4); 39 GLintptr UploadHostMemory(const void* raw_pointer, std::size_t size, std::size_t alignment = 4);
40 40
41 void Map(size_t max_size); 41 void Map(std::size_t max_size);
42 void Unmap(); 42 void Unmap();
43 43
44 GLuint GetHandle() const; 44 GLuint GetHandle() const;
45 45
46protected: 46protected:
47 void AlignBuffer(size_t alignment); 47 void AlignBuffer(std::size_t alignment);
48 48
49private: 49private:
50 OGLStreamBuffer stream_buffer; 50 OGLStreamBuffer stream_buffer;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 7e1bba67d..274c2dbcf 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -46,7 +46,7 @@ MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100,
46RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window, ScreenInfo& info) 46RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window, ScreenInfo& info)
47 : emu_window{window}, screen_info{info}, buffer_cache(STREAM_BUFFER_SIZE) { 47 : emu_window{window}, screen_info{info}, buffer_cache(STREAM_BUFFER_SIZE) {
48 // Create sampler objects 48 // Create sampler objects
49 for (size_t i = 0; i < texture_samplers.size(); ++i) { 49 for (std::size_t i = 0; i < texture_samplers.size(); ++i) {
50 texture_samplers[i].Create(); 50 texture_samplers[i].Create();
51 state.texture_units[i].sampler = texture_samplers[i].sampler.handle; 51 state.texture_units[i].sampler = texture_samplers[i].sampler.handle;
52 } 52 }
@@ -181,7 +181,7 @@ void RasterizerOpenGL::SetupShaders() {
181 u32 current_constbuffer_bindpoint = Tegra::Engines::Maxwell3D::Regs::MaxShaderStage; 181 u32 current_constbuffer_bindpoint = Tegra::Engines::Maxwell3D::Regs::MaxShaderStage;
182 u32 current_texture_bindpoint = 0; 182 u32 current_texture_bindpoint = 0;
183 183
184 for (size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) { 184 for (std::size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) {
185 const auto& shader_config = gpu.regs.shader_config[index]; 185 const auto& shader_config = gpu.regs.shader_config[index];
186 const Maxwell::ShaderProgram program{static_cast<Maxwell::ShaderProgram>(index)}; 186 const Maxwell::ShaderProgram program{static_cast<Maxwell::ShaderProgram>(index)};
187 187
@@ -190,12 +190,12 @@ void RasterizerOpenGL::SetupShaders() {
190 continue; 190 continue;
191 } 191 }
192 192
193 const size_t stage{index == 0 ? 0 : index - 1}; // Stage indices are 0 - 5 193 const std::size_t stage{index == 0 ? 0 : index - 1}; // Stage indices are 0 - 5
194 194
195 GLShader::MaxwellUniformData ubo{}; 195 GLShader::MaxwellUniformData ubo{};
196 ubo.SetFromRegs(gpu.state.shader_stages[stage]); 196 ubo.SetFromRegs(gpu.state.shader_stages[stage]);
197 const GLintptr offset = buffer_cache.UploadHostMemory( 197 const GLintptr offset = buffer_cache.UploadHostMemory(
198 &ubo, sizeof(ubo), static_cast<size_t>(uniform_buffer_alignment)); 198 &ubo, sizeof(ubo), static_cast<std::size_t>(uniform_buffer_alignment));
199 199
200 // Bind the buffer 200 // Bind the buffer
201 glBindBufferRange(GL_UNIFORM_BUFFER, stage, buffer_cache.GetHandle(), offset, sizeof(ubo)); 201 glBindBufferRange(GL_UNIFORM_BUFFER, stage, buffer_cache.GetHandle(), offset, sizeof(ubo));
@@ -238,10 +238,10 @@ void RasterizerOpenGL::SetupShaders() {
238 shader_program_manager->UseTrivialGeometryShader(); 238 shader_program_manager->UseTrivialGeometryShader();
239} 239}
240 240
241size_t RasterizerOpenGL::CalculateVertexArraysSize() const { 241std::size_t RasterizerOpenGL::CalculateVertexArraysSize() const {
242 const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; 242 const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
243 243
244 size_t size = 0; 244 std::size_t size = 0;
245 for (u32 index = 0; index < Maxwell::NumVertexArrays; ++index) { 245 for (u32 index = 0; index < Maxwell::NumVertexArrays; ++index) {
246 if (!regs.vertex_array[index].IsEnabled()) 246 if (!regs.vertex_array[index].IsEnabled())
247 continue; 247 continue;
@@ -299,7 +299,7 @@ void RasterizerOpenGL::UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {
299 299
300void RasterizerOpenGL::ConfigureFramebuffers(bool using_color_fb, bool using_depth_fb, 300void RasterizerOpenGL::ConfigureFramebuffers(bool using_color_fb, bool using_depth_fb,
301 bool preserve_contents, 301 bool preserve_contents,
302 boost::optional<size_t> single_color_target) { 302 boost::optional<std::size_t> single_color_target) {
303 MICROPROFILE_SCOPE(OpenGL_Framebuffer); 303 MICROPROFILE_SCOPE(OpenGL_Framebuffer);
304 const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; 304 const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
305 305
@@ -330,7 +330,7 @@ void RasterizerOpenGL::ConfigureFramebuffers(bool using_color_fb, bool using_dep
330 } else { 330 } else {
331 // Multiple color attachments are enabled 331 // Multiple color attachments are enabled
332 std::array<GLenum, Maxwell::NumRenderTargets> buffers; 332 std::array<GLenum, Maxwell::NumRenderTargets> buffers;
333 for (size_t index = 0; index < Maxwell::NumRenderTargets; ++index) { 333 for (std::size_t index = 0; index < Maxwell::NumRenderTargets; ++index) {
334 Surface color_surface = res_cache.GetColorBufferSurface(index, preserve_contents); 334 Surface color_surface = res_cache.GetColorBufferSurface(index, preserve_contents);
335 buffers[index] = GL_COLOR_ATTACHMENT0 + regs.rt_control.GetMap(index); 335 buffers[index] = GL_COLOR_ATTACHMENT0 + regs.rt_control.GetMap(index);
336 glFramebufferTexture2D( 336 glFramebufferTexture2D(
@@ -342,7 +342,7 @@ void RasterizerOpenGL::ConfigureFramebuffers(bool using_color_fb, bool using_dep
342 } 342 }
343 } else { 343 } else {
344 // No color attachments are enabled - zero out all of them 344 // No color attachments are enabled - zero out all of them
345 for (size_t index = 0; index < Maxwell::NumRenderTargets; ++index) { 345 for (std::size_t index = 0; index < Maxwell::NumRenderTargets; ++index) {
346 glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, 346 glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,
347 GL_COLOR_ATTACHMENT0 + static_cast<GLenum>(index), GL_TEXTURE_2D, 347 GL_COLOR_ATTACHMENT0 + static_cast<GLenum>(index), GL_TEXTURE_2D,
348 0, 0); 348 0, 0);
@@ -462,15 +462,15 @@ void RasterizerOpenGL::DrawArrays() {
462 state.draw.vertex_buffer = buffer_cache.GetHandle(); 462 state.draw.vertex_buffer = buffer_cache.GetHandle();
463 state.Apply(); 463 state.Apply();
464 464
465 size_t buffer_size = CalculateVertexArraysSize(); 465 std::size_t buffer_size = CalculateVertexArraysSize();
466 466
467 if (is_indexed) { 467 if (is_indexed) {
468 buffer_size = Common::AlignUp<size_t>(buffer_size, 4) + index_buffer_size; 468 buffer_size = Common::AlignUp<std::size_t>(buffer_size, 4) + index_buffer_size;
469 } 469 }
470 470
471 // Uniform space for the 5 shader stages 471 // Uniform space for the 5 shader stages
472 buffer_size = 472 buffer_size =
473 Common::AlignUp<size_t>(buffer_size, 4) + 473 Common::AlignUp<std::size_t>(buffer_size, 4) +
474 (sizeof(GLShader::MaxwellUniformData) + uniform_buffer_alignment) * Maxwell::MaxShaderStage; 474 (sizeof(GLShader::MaxwellUniformData) + uniform_buffer_alignment) * Maxwell::MaxShaderStage;
475 475
476 // Add space for at least 18 constant buffers 476 // Add space for at least 18 constant buffers
@@ -644,7 +644,7 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, Shader& shad
644 MICROPROFILE_SCOPE(OpenGL_UBO); 644 MICROPROFILE_SCOPE(OpenGL_UBO);
645 const auto& gpu = Core::System::GetInstance().GPU(); 645 const auto& gpu = Core::System::GetInstance().GPU();
646 const auto& maxwell3d = gpu.Maxwell3D(); 646 const auto& maxwell3d = gpu.Maxwell3D();
647 const auto& shader_stage = maxwell3d.state.shader_stages[static_cast<size_t>(stage)]; 647 const auto& shader_stage = maxwell3d.state.shader_stages[static_cast<std::size_t>(stage)];
648 const auto& entries = shader->GetShaderEntries().const_buffer_entries; 648 const auto& entries = shader->GetShaderEntries().const_buffer_entries;
649 649
650 constexpr u64 max_binds = Tegra::Engines::Maxwell3D::Regs::MaxConstBuffers; 650 constexpr u64 max_binds = Tegra::Engines::Maxwell3D::Regs::MaxConstBuffers;
@@ -667,7 +667,7 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, Shader& shad
667 continue; 667 continue;
668 } 668 }
669 669
670 size_t size = 0; 670 std::size_t size = 0;
671 671
672 if (used_buffer.IsIndirect()) { 672 if (used_buffer.IsIndirect()) {
673 // Buffer is accessed indirectly, so upload the entire thing 673 // Buffer is accessed indirectly, so upload the entire thing
@@ -689,7 +689,7 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, Shader& shad
689 ASSERT_MSG(size <= MaxConstbufferSize, "Constbuffer too big"); 689 ASSERT_MSG(size <= MaxConstbufferSize, "Constbuffer too big");
690 690
691 GLintptr const_buffer_offset = buffer_cache.UploadMemory( 691 GLintptr const_buffer_offset = buffer_cache.UploadMemory(
692 buffer.address, size, static_cast<size_t>(uniform_buffer_alignment)); 692 buffer.address, size, static_cast<std::size_t>(uniform_buffer_alignment));
693 693
694 // Now configure the bindpoint of the buffer inside the shader 694 // Now configure the bindpoint of the buffer inside the shader
695 glUniformBlockBinding(shader->GetProgramHandle(), 695 glUniformBlockBinding(shader->GetProgramHandle(),
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 163412882..bf9560bdc 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -73,7 +73,7 @@ public:
73 }; 73 };
74 74
75 /// Maximum supported size that a constbuffer can have in bytes. 75 /// Maximum supported size that a constbuffer can have in bytes.
76 static constexpr size_t MaxConstbufferSize = 0x10000; 76 static constexpr std::size_t MaxConstbufferSize = 0x10000;
77 static_assert(MaxConstbufferSize % sizeof(GLvec4) == 0, 77 static_assert(MaxConstbufferSize % sizeof(GLvec4) == 0,
78 "The maximum size of a constbuffer must be a multiple of the size of GLvec4"); 78 "The maximum size of a constbuffer must be a multiple of the size of GLvec4");
79 79
@@ -106,7 +106,7 @@ private:
106 */ 106 */
107 void ConfigureFramebuffers(bool use_color_fb = true, bool using_depth_fb = true, 107 void ConfigureFramebuffers(bool use_color_fb = true, bool using_depth_fb = true,
108 bool preserve_contents = true, 108 bool preserve_contents = true,
109 boost::optional<size_t> single_color_target = {}); 109 boost::optional<std::size_t> single_color_target = {});
110 110
111 /* 111 /*
112 * Configures the current constbuffers to use for the draw command. 112 * Configures the current constbuffers to use for the draw command.
@@ -180,12 +180,12 @@ private:
180 180
181 std::array<SamplerInfo, GLShader::NumTextureSamplers> texture_samplers; 181 std::array<SamplerInfo, GLShader::NumTextureSamplers> texture_samplers;
182 182
183 static constexpr size_t STREAM_BUFFER_SIZE = 128 * 1024 * 1024; 183 static constexpr std::size_t STREAM_BUFFER_SIZE = 128 * 1024 * 1024;
184 OGLBufferCache buffer_cache; 184 OGLBufferCache buffer_cache;
185 OGLFramebuffer framebuffer; 185 OGLFramebuffer framebuffer;
186 GLint uniform_buffer_alignment; 186 GLint uniform_buffer_alignment;
187 187
188 size_t CalculateVertexArraysSize() const; 188 std::size_t CalculateVertexArraysSize() const;
189 189
190 void SetupVertexArrays(); 190 void SetupVertexArrays();
191 191
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 63bbcb666..86682d7cb 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -75,7 +75,7 @@ static VAddr TryGetCpuAddr(Tegra::GPUVAddr gpu_addr) {
75 return params; 75 return params;
76} 76}
77 77
78/*static*/ SurfaceParams SurfaceParams::CreateForFramebuffer(size_t index) { 78/*static*/ SurfaceParams SurfaceParams::CreateForFramebuffer(std::size_t index) {
79 const auto& config{Core::System::GetInstance().GPU().Maxwell3D().regs.rt[index]}; 79 const auto& config{Core::System::GetInstance().GPU().Maxwell3D().regs.rt[index]};
80 SurfaceParams params{}; 80 SurfaceParams params{};
81 params.addr = TryGetCpuAddr(config.Address()); 81 params.addr = TryGetCpuAddr(config.Address());
@@ -204,7 +204,7 @@ static GLenum SurfaceTargetToGL(SurfaceParams::SurfaceTarget target) {
204} 204}
205 205
206static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { 206static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) {
207 ASSERT(static_cast<size_t>(pixel_format) < tex_format_tuples.size()); 207 ASSERT(static_cast<std::size_t>(pixel_format) < tex_format_tuples.size());
208 auto& format = tex_format_tuples[static_cast<unsigned int>(pixel_format)]; 208 auto& format = tex_format_tuples[static_cast<unsigned int>(pixel_format)];
209 ASSERT(component_type == format.component_type); 209 ASSERT(component_type == format.component_type);
210 210
@@ -260,7 +260,7 @@ static bool IsFormatBCn(PixelFormat format) {
260} 260}
261 261
262template <bool morton_to_gl, PixelFormat format> 262template <bool morton_to_gl, PixelFormat format>
263void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, size_t gl_buffer_size, 263void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, std::size_t gl_buffer_size,
264 VAddr addr) { 264 VAddr addr) {
265 constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / CHAR_BIT; 265 constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / CHAR_BIT;
266 constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format); 266 constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format);
@@ -271,7 +271,7 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, size_t
271 const u32 tile_size{IsFormatBCn(format) ? 4U : 1U}; 271 const u32 tile_size{IsFormatBCn(format) ? 4U : 1U};
272 const std::vector<u8> data = Tegra::Texture::UnswizzleTexture( 272 const std::vector<u8> data = Tegra::Texture::UnswizzleTexture(
273 addr, tile_size, bytes_per_pixel, stride, height, block_height); 273 addr, tile_size, bytes_per_pixel, stride, height, block_height);
274 const size_t size_to_copy{std::min(gl_buffer_size, data.size())}; 274 const std::size_t size_to_copy{std::min(gl_buffer_size, data.size())};
275 memcpy(gl_buffer, data.data(), size_to_copy); 275 memcpy(gl_buffer, data.data(), size_to_copy);
276 } else { 276 } else {
277 // TODO(bunnei): Assumes the default rendering GOB size of 16 (128 lines). We should 277 // TODO(bunnei): Assumes the default rendering GOB size of 16 (128 lines). We should
@@ -282,7 +282,7 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, size_t
282 } 282 }
283} 283}
284 284
285static constexpr std::array<void (*)(u32, u32, u32, u8*, size_t, VAddr), 285static constexpr std::array<void (*)(u32, u32, u32, u8*, std::size_t, VAddr),
286 SurfaceParams::MaxPixelFormat> 286 SurfaceParams::MaxPixelFormat>
287 morton_to_gl_fns = { 287 morton_to_gl_fns = {
288 // clang-format off 288 // clang-format off
@@ -340,7 +340,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, size_t, VAddr),
340 // clang-format on 340 // clang-format on
341}; 341};
342 342
343static constexpr std::array<void (*)(u32, u32, u32, u8*, size_t, VAddr), 343static constexpr std::array<void (*)(u32, u32, u32, u8*, std::size_t, VAddr),
344 SurfaceParams::MaxPixelFormat> 344 SurfaceParams::MaxPixelFormat>
345 gl_to_morton_fns = { 345 gl_to_morton_fns = {
346 // clang-format off 346 // clang-format off
@@ -519,9 +519,9 @@ static void ConvertS8Z24ToZ24S8(std::vector<u8>& data, u32 width, u32 height) {
519 S8Z24 input_pixel{}; 519 S8Z24 input_pixel{};
520 Z24S8 output_pixel{}; 520 Z24S8 output_pixel{};
521 constexpr auto bpp{CachedSurface::GetGLBytesPerPixel(PixelFormat::S8Z24)}; 521 constexpr auto bpp{CachedSurface::GetGLBytesPerPixel(PixelFormat::S8Z24)};
522 for (size_t y = 0; y < height; ++y) { 522 for (std::size_t y = 0; y < height; ++y) {
523 for (size_t x = 0; x < width; ++x) { 523 for (std::size_t x = 0; x < width; ++x) {
524 const size_t offset{bpp * (y * width + x)}; 524 const std::size_t offset{bpp * (y * width + x)};
525 std::memcpy(&input_pixel, &data[offset], sizeof(S8Z24)); 525 std::memcpy(&input_pixel, &data[offset], sizeof(S8Z24));
526 output_pixel.s8.Assign(input_pixel.s8); 526 output_pixel.s8.Assign(input_pixel.s8);
527 output_pixel.z24.Assign(input_pixel.z24); 527 output_pixel.z24.Assign(input_pixel.z24);
@@ -532,9 +532,9 @@ static void ConvertS8Z24ToZ24S8(std::vector<u8>& data, u32 width, u32 height) {
532 532
533static void ConvertG8R8ToR8G8(std::vector<u8>& data, u32 width, u32 height) { 533static void ConvertG8R8ToR8G8(std::vector<u8>& data, u32 width, u32 height) {
534 constexpr auto bpp{CachedSurface::GetGLBytesPerPixel(PixelFormat::G8R8U)}; 534 constexpr auto bpp{CachedSurface::GetGLBytesPerPixel(PixelFormat::G8R8U)};
535 for (size_t y = 0; y < height; ++y) { 535 for (std::size_t y = 0; y < height; ++y) {
536 for (size_t x = 0; x < width; ++x) { 536 for (std::size_t x = 0; x < width; ++x) {
537 const size_t offset{bpp * (y * width + x)}; 537 const std::size_t offset{bpp * (y * width + x)};
538 const u8 temp{data[offset]}; 538 const u8 temp{data[offset]};
539 data[offset] = data[offset + 1]; 539 data[offset] = data[offset + 1];
540 data[offset + 1] = temp; 540 data[offset + 1] = temp;
@@ -598,13 +598,13 @@ void CachedSurface::LoadGLBuffer() {
598 UNREACHABLE(); 598 UNREACHABLE();
599 } 599 }
600 600
601 gl_buffer.resize(static_cast<size_t>(params.depth) * copy_size); 601 gl_buffer.resize(static_cast<std::size_t>(params.depth) * copy_size);
602 morton_to_gl_fns[static_cast<size_t>(params.pixel_format)]( 602 morton_to_gl_fns[static_cast<std::size_t>(params.pixel_format)](
603 params.width, params.block_height, params.height, gl_buffer.data(), copy_size, 603 params.width, params.block_height, params.height, gl_buffer.data(), copy_size,
604 params.addr); 604 params.addr);
605 } else { 605 } else {
606 const u8* const texture_src_data_end{texture_src_data + 606 const u8* const texture_src_data_end{texture_src_data +
607 (static_cast<size_t>(params.depth) * copy_size)}; 607 (static_cast<std::size_t>(params.depth) * copy_size)};
608 gl_buffer.assign(texture_src_data, texture_src_data_end); 608 gl_buffer.assign(texture_src_data, texture_src_data_end);
609 } 609 }
610 610
@@ -623,7 +623,7 @@ void CachedSurface::UploadGLTexture(GLuint read_fb_handle, GLuint draw_fb_handle
623 623
624 MICROPROFILE_SCOPE(OpenGL_TextureUL); 624 MICROPROFILE_SCOPE(OpenGL_TextureUL);
625 625
626 ASSERT(gl_buffer.size() == static_cast<size_t>(params.width) * params.height * 626 ASSERT(gl_buffer.size() == static_cast<std::size_t>(params.width) * params.height *
627 GetGLBytesPerPixel(params.pixel_format) * params.depth); 627 GetGLBytesPerPixel(params.pixel_format) * params.depth);
628 628
629 const auto& rect{params.GetRect()}; 629 const auto& rect{params.GetRect()};
@@ -631,8 +631,9 @@ void CachedSurface::UploadGLTexture(GLuint read_fb_handle, GLuint draw_fb_handle
631 // Load data from memory to the surface 631 // Load data from memory to the surface
632 const GLint x0 = static_cast<GLint>(rect.left); 632 const GLint x0 = static_cast<GLint>(rect.left);
633 const GLint y0 = static_cast<GLint>(rect.bottom); 633 const GLint y0 = static_cast<GLint>(rect.bottom);
634 const size_t buffer_offset = 634 const std::size_t buffer_offset =
635 static_cast<size_t>(static_cast<size_t>(y0) * params.width + static_cast<size_t>(x0)) * 635 static_cast<std::size_t>(static_cast<std::size_t>(y0) * params.width +
636 static_cast<std::size_t>(x0)) *
636 GetGLBytesPerPixel(params.pixel_format); 637 GetGLBytesPerPixel(params.pixel_format);
637 638
638 const FormatTuple& tuple = GetFormatTuple(params.pixel_format, params.component_type); 639 const FormatTuple& tuple = GetFormatTuple(params.pixel_format, params.component_type);
@@ -734,7 +735,7 @@ Surface RasterizerCacheOpenGL::GetDepthBufferSurface(bool preserve_contents) {
734 return GetSurface(depth_params, preserve_contents); 735 return GetSurface(depth_params, preserve_contents);
735} 736}
736 737
737Surface RasterizerCacheOpenGL::GetColorBufferSurface(size_t index, bool preserve_contents) { 738Surface RasterizerCacheOpenGL::GetColorBufferSurface(std::size_t index, bool preserve_contents) {
738 const auto& regs{Core::System::GetInstance().GPU().Maxwell3D().regs}; 739 const auto& regs{Core::System::GetInstance().GPU().Maxwell3D().regs};
739 740
740 ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets); 741 ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets);
@@ -832,7 +833,7 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& surface,
832 auto source_format = GetFormatTuple(params.pixel_format, params.component_type); 833 auto source_format = GetFormatTuple(params.pixel_format, params.component_type);
833 auto dest_format = GetFormatTuple(new_params.pixel_format, new_params.component_type); 834 auto dest_format = GetFormatTuple(new_params.pixel_format, new_params.component_type);
834 835
835 size_t buffer_size = std::max(params.SizeInBytes(), new_params.SizeInBytes()); 836 std::size_t buffer_size = std::max(params.SizeInBytes(), new_params.SizeInBytes());
836 837
837 glBindBuffer(GL_PIXEL_PACK_BUFFER, copy_pbo.handle); 838 glBindBuffer(GL_PIXEL_PACK_BUFFER, copy_pbo.handle);
838 glBufferData(GL_PIXEL_PACK_BUFFER, buffer_size, nullptr, GL_STREAM_DRAW_ARB); 839 glBufferData(GL_PIXEL_PACK_BUFFER, buffer_size, nullptr, GL_STREAM_DRAW_ARB);
@@ -856,7 +857,7 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& surface,
856 LOG_DEBUG(HW_GPU, "Trying to upload extra texture data from the CPU during " 857 LOG_DEBUG(HW_GPU, "Trying to upload extra texture data from the CPU during "
857 "reinterpretation but the texture is tiled."); 858 "reinterpretation but the texture is tiled.");
858 } 859 }
859 size_t remaining_size = new_params.SizeInBytes() - params.SizeInBytes(); 860 std::size_t remaining_size = new_params.SizeInBytes() - params.SizeInBytes();
860 std::vector<u8> data(remaining_size); 861 std::vector<u8> data(remaining_size);
861 Memory::ReadBlock(new_params.addr + params.SizeInBytes(), data.data(), data.size()); 862 Memory::ReadBlock(new_params.addr + params.SizeInBytes(), data.data(), data.size());
862 glBufferSubData(GL_PIXEL_PACK_BUFFER, params.SizeInBytes(), remaining_size, 863 glBufferSubData(GL_PIXEL_PACK_BUFFER, params.SizeInBytes(), remaining_size,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 9e90b7380..d7a4bc37f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -91,7 +91,7 @@ struct SurfaceParams {
91 Invalid = 255, 91 Invalid = 255,
92 }; 92 };
93 93
94 static constexpr size_t MaxPixelFormat = static_cast<size_t>(PixelFormat::Max); 94 static constexpr std::size_t MaxPixelFormat = static_cast<std::size_t>(PixelFormat::Max);
95 95
96 enum class ComponentType { 96 enum class ComponentType {
97 Invalid = 0, 97 Invalid = 0,
@@ -201,8 +201,8 @@ struct SurfaceParams {
201 1, // Z32FS8 201 1, // Z32FS8
202 }}; 202 }};
203 203
204 ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); 204 ASSERT(static_cast<std::size_t>(format) < compression_factor_table.size());
205 return compression_factor_table[static_cast<size_t>(format)]; 205 return compression_factor_table[static_cast<std::size_t>(format)];
206 } 206 }
207 207
208 static constexpr u32 GetFormatBpp(PixelFormat format) { 208 static constexpr u32 GetFormatBpp(PixelFormat format) {
@@ -263,8 +263,8 @@ struct SurfaceParams {
263 64, // Z32FS8 263 64, // Z32FS8
264 }}; 264 }};
265 265
266 ASSERT(static_cast<size_t>(format) < bpp_table.size()); 266 ASSERT(static_cast<std::size_t>(format) < bpp_table.size());
267 return bpp_table[static_cast<size_t>(format)]; 267 return bpp_table[static_cast<std::size_t>(format)];
268 } 268 }
269 269
270 u32 GetFormatBpp() const { 270 u32 GetFormatBpp() const {
@@ -644,16 +644,18 @@ struct SurfaceParams {
644 } 644 }
645 645
646 static SurfaceType GetFormatType(PixelFormat pixel_format) { 646 static SurfaceType GetFormatType(PixelFormat pixel_format) {
647 if (static_cast<size_t>(pixel_format) < static_cast<size_t>(PixelFormat::MaxColorFormat)) { 647 if (static_cast<std::size_t>(pixel_format) <
648 static_cast<std::size_t>(PixelFormat::MaxColorFormat)) {
648 return SurfaceType::ColorTexture; 649 return SurfaceType::ColorTexture;
649 } 650 }
650 651
651 if (static_cast<size_t>(pixel_format) < static_cast<size_t>(PixelFormat::MaxDepthFormat)) { 652 if (static_cast<std::size_t>(pixel_format) <
653 static_cast<std::size_t>(PixelFormat::MaxDepthFormat)) {
652 return SurfaceType::Depth; 654 return SurfaceType::Depth;
653 } 655 }
654 656
655 if (static_cast<size_t>(pixel_format) < 657 if (static_cast<std::size_t>(pixel_format) <
656 static_cast<size_t>(PixelFormat::MaxDepthStencilFormat)) { 658 static_cast<std::size_t>(PixelFormat::MaxDepthStencilFormat)) {
657 return SurfaceType::DepthStencil; 659 return SurfaceType::DepthStencil;
658 } 660 }
659 661
@@ -667,7 +669,7 @@ struct SurfaceParams {
667 MathUtil::Rectangle<u32> GetRect() const; 669 MathUtil::Rectangle<u32> GetRect() const;
668 670
669 /// Returns the size of this surface in bytes, adjusted for compression 671 /// Returns the size of this surface in bytes, adjusted for compression
670 size_t SizeInBytes() const { 672 std::size_t SizeInBytes() const {
671 const u32 compression_factor{GetCompressionFactor(pixel_format)}; 673 const u32 compression_factor{GetCompressionFactor(pixel_format)};
672 ASSERT(width % compression_factor == 0); 674 ASSERT(width % compression_factor == 0);
673 ASSERT(height % compression_factor == 0); 675 ASSERT(height % compression_factor == 0);
@@ -679,7 +681,7 @@ struct SurfaceParams {
679 static SurfaceParams CreateForTexture(const Tegra::Texture::FullTextureInfo& config); 681 static SurfaceParams CreateForTexture(const Tegra::Texture::FullTextureInfo& config);
680 682
681 /// Creates SurfaceParams from a framebuffer configuration 683 /// Creates SurfaceParams from a framebuffer configuration
682 static SurfaceParams CreateForFramebuffer(size_t index); 684 static SurfaceParams CreateForFramebuffer(std::size_t index);
683 685
684 /// Creates SurfaceParams for a depth buffer configuration 686 /// Creates SurfaceParams for a depth buffer configuration
685 static SurfaceParams CreateForDepthBuffer(u32 zeta_width, u32 zeta_height, 687 static SurfaceParams CreateForDepthBuffer(u32 zeta_width, u32 zeta_height,
@@ -702,7 +704,7 @@ struct SurfaceParams {
702 u32 height; 704 u32 height;
703 u32 depth; 705 u32 depth;
704 u32 unaligned_height; 706 u32 unaligned_height;
705 size_t size_in_bytes; 707 std::size_t size_in_bytes;
706 SurfaceTarget target; 708 SurfaceTarget target;
707}; 709};
708 710
@@ -719,7 +721,7 @@ struct SurfaceReserveKey : Common::HashableStruct<OpenGL::SurfaceParams> {
719namespace std { 721namespace std {
720template <> 722template <>
721struct hash<SurfaceReserveKey> { 723struct hash<SurfaceReserveKey> {
722 size_t operator()(const SurfaceReserveKey& k) const { 724 std::size_t operator()(const SurfaceReserveKey& k) const {
723 return k.Hash(); 725 return k.Hash();
724 } 726 }
725}; 727};
@@ -735,7 +737,7 @@ public:
735 return params.addr; 737 return params.addr;
736 } 738 }
737 739
738 size_t GetSizeInBytes() const { 740 std::size_t GetSizeInBytes() const {
739 return params.size_in_bytes; 741 return params.size_in_bytes;
740 } 742 }
741 743
@@ -783,7 +785,7 @@ public:
783 Surface GetDepthBufferSurface(bool preserve_contents); 785 Surface GetDepthBufferSurface(bool preserve_contents);
784 786
785 /// Get the color surface based on the framebuffer configuration and the specified render target 787 /// Get the color surface based on the framebuffer configuration and the specified render target
786 Surface GetColorBufferSurface(size_t index, bool preserve_contents); 788 Surface GetColorBufferSurface(std::size_t index, bool preserve_contents);
787 789
788 /// Flushes the surface to Switch memory 790 /// Flushes the surface to Switch memory
789 void FlushSurface(const Surface& surface); 791 void FlushSurface(const Surface& surface);
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 61080f5cc..894fe6eae 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -14,7 +14,7 @@ namespace OpenGL {
14/// Gets the address for the specified shader stage program 14/// Gets the address for the specified shader stage program
15static VAddr GetShaderAddress(Maxwell::ShaderProgram program) { 15static VAddr GetShaderAddress(Maxwell::ShaderProgram program) {
16 const auto& gpu = Core::System::GetInstance().GPU().Maxwell3D(); 16 const auto& gpu = Core::System::GetInstance().GPU().Maxwell3D();
17 const auto& shader_config = gpu.regs.shader_config[static_cast<size_t>(program)]; 17 const auto& shader_config = gpu.regs.shader_config[static_cast<std::size_t>(program)];
18 return *gpu.memory_manager.GpuToCpuAddress(gpu.regs.code_address.CodeAddress() + 18 return *gpu.memory_manager.GpuToCpuAddress(gpu.regs.code_address.CodeAddress() +
19 shader_config.offset); 19 shader_config.offset);
20} 20}
@@ -28,7 +28,7 @@ static GLShader::ProgramCode GetShaderCode(VAddr addr) {
28 28
29/// Helper function to set shader uniform block bindings for a single shader stage 29/// Helper function to set shader uniform block bindings for a single shader stage
30static void SetShaderUniformBlockBinding(GLuint shader, const char* name, 30static void SetShaderUniformBlockBinding(GLuint shader, const char* name,
31 Maxwell::ShaderStage binding, size_t expected_size) { 31 Maxwell::ShaderStage binding, std::size_t expected_size) {
32 const GLuint ub_index = glGetUniformBlockIndex(shader, name); 32 const GLuint ub_index = glGetUniformBlockIndex(shader, name);
33 if (ub_index == GL_INVALID_INDEX) { 33 if (ub_index == GL_INVALID_INDEX) {
34 return; 34 return;
@@ -36,7 +36,7 @@ static void SetShaderUniformBlockBinding(GLuint shader, const char* name,
36 36
37 GLint ub_size = 0; 37 GLint ub_size = 0;
38 glGetActiveUniformBlockiv(shader, ub_index, GL_UNIFORM_BLOCK_DATA_SIZE, &ub_size); 38 glGetActiveUniformBlockiv(shader, ub_index, GL_UNIFORM_BLOCK_DATA_SIZE, &ub_size);
39 ASSERT_MSG(static_cast<size_t>(ub_size) == expected_size, 39 ASSERT_MSG(static_cast<std::size_t>(ub_size) == expected_size,
40 "Uniform block size did not match! Got {}, expected {}", ub_size, expected_size); 40 "Uniform block size did not match! Got {}, expected {}", ub_size, expected_size);
41 glUniformBlockBinding(shader, ub_index, static_cast<GLuint>(binding)); 41 glUniformBlockBinding(shader, ub_index, static_cast<GLuint>(binding));
42} 42}
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h
index 6e6febcbc..9bafe43a9 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.h
+++ b/src/video_core/renderer_opengl/gl_shader_cache.h
@@ -28,7 +28,7 @@ public:
28 } 28 }
29 29
30 /// Gets the size of the shader in guest memory, required for cache management 30 /// Gets the size of the shader in guest memory, required for cache management
31 size_t GetSizeInBytes() const { 31 std::size_t GetSizeInBytes() const {
32 return GLShader::MAX_PROGRAM_CODE_LENGTH * sizeof(u64); 32 return GLShader::MAX_PROGRAM_CODE_LENGTH * sizeof(u64);
33 } 33 }
34 34
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 81c0662d0..15f628acd 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -189,7 +189,7 @@ public:
189 189
190private: 190private:
191 void AppendIndentation() { 191 void AppendIndentation() {
192 shader_source.append(static_cast<size_t>(scope) * 4, ' '); 192 shader_source.append(static_cast<std::size_t>(scope) * 4, ' ');
193 } 193 }
194 194
195 std::string shader_source; 195 std::string shader_source;
@@ -208,7 +208,7 @@ public:
208 UnsignedInteger, 208 UnsignedInteger,
209 }; 209 };
210 210
211 GLSLRegister(size_t index, const std::string& suffix) : index{index}, suffix{suffix} {} 211 GLSLRegister(std::size_t index, const std::string& suffix) : index{index}, suffix{suffix} {}
212 212
213 /// Gets the GLSL type string for a register 213 /// Gets the GLSL type string for a register
214 static std::string GetTypeString() { 214 static std::string GetTypeString() {
@@ -226,12 +226,12 @@ public:
226 } 226 }
227 227
228 /// Returns the index of the register 228 /// Returns the index of the register
229 size_t GetIndex() const { 229 std::size_t GetIndex() const {
230 return index; 230 return index;
231 } 231 }
232 232
233private: 233private:
234 const size_t index; 234 const std::size_t index;
235 const std::string& suffix; 235 const std::string& suffix;
236}; 236};
237 237
@@ -468,7 +468,7 @@ public:
468 /// necessary. 468 /// necessary.
469 std::string AccessSampler(const Sampler& sampler, Tegra::Shader::TextureType type, 469 std::string AccessSampler(const Sampler& sampler, Tegra::Shader::TextureType type,
470 bool is_array) { 470 bool is_array) {
471 const size_t offset = static_cast<size_t>(sampler.index.Value()); 471 const std::size_t offset = static_cast<std::size_t>(sampler.index.Value());
472 472
473 // If this sampler has already been used, return the existing mapping. 473 // If this sampler has already been used, return the existing mapping.
474 const auto itr = 474 const auto itr =
@@ -481,7 +481,7 @@ public:
481 } 481 }
482 482
483 // Otherwise create a new mapping for this sampler 483 // Otherwise create a new mapping for this sampler
484 const size_t next_index = used_samplers.size(); 484 const std::size_t next_index = used_samplers.size();
485 const SamplerEntry entry{stage, offset, next_index, type, is_array}; 485 const SamplerEntry entry{stage, offset, next_index, type, is_array};
486 used_samplers.emplace_back(entry); 486 used_samplers.emplace_back(entry);
487 return entry.GetName(); 487 return entry.GetName();
@@ -531,7 +531,7 @@ private:
531 void BuildRegisterList() { 531 void BuildRegisterList() {
532 regs.reserve(Register::NumRegisters); 532 regs.reserve(Register::NumRegisters);
533 533
534 for (size_t index = 0; index < Register::NumRegisters; ++index) { 534 for (std::size_t index = 0; index < Register::NumRegisters; ++index) {
535 regs.emplace_back(index, suffix); 535 regs.emplace_back(index, suffix);
536 } 536 }
537 } 537 }
@@ -862,7 +862,7 @@ private:
862 */ 862 */
863 bool IsSchedInstruction(u32 offset) const { 863 bool IsSchedInstruction(u32 offset) const {
864 // sched instructions appear once every 4 instructions. 864 // sched instructions appear once every 4 instructions.
865 static constexpr size_t SchedPeriod = 4; 865 static constexpr std::size_t SchedPeriod = 4;
866 u32 absolute_offset = offset - main_offset; 866 u32 absolute_offset = offset - main_offset;
867 867
868 return (absolute_offset % SchedPeriod) == 0; 868 return (absolute_offset % SchedPeriod) == 0;
@@ -930,7 +930,7 @@ private:
930 std::string result; 930 std::string result;
931 result += '('; 931 result += '(';
932 932
933 for (size_t i = 0; i < shift_amounts.size(); ++i) { 933 for (std::size_t i = 0; i < shift_amounts.size(); ++i) {
934 if (i) 934 if (i)
935 result += '|'; 935 result += '|';
936 result += "(((" + imm_lut + " >> (((" + op_c + " >> " + shift_amounts[i] + 936 result += "(((" + imm_lut + " >> (((" + op_c + " >> " + shift_amounts[i] +
@@ -956,7 +956,7 @@ private:
956 956
957 ASSERT_MSG(instr.texs.nodep == 0, "TEXS nodep not implemented"); 957 ASSERT_MSG(instr.texs.nodep == 0, "TEXS nodep not implemented");
958 958
959 size_t written_components = 0; 959 std::size_t written_components = 0;
960 for (u32 component = 0; component < 4; ++component) { 960 for (u32 component = 0; component < 4; ++component) {
961 if (!instr.texs.IsComponentEnabled(component)) { 961 if (!instr.texs.IsComponentEnabled(component)) {
962 continue; 962 continue;
@@ -1937,8 +1937,8 @@ private:
1937 UNREACHABLE(); 1937 UNREACHABLE();
1938 } 1938 }
1939 } 1939 }
1940 size_t dest_elem{}; 1940 std::size_t dest_elem{};
1941 for (size_t elem = 0; elem < 4; ++elem) { 1941 for (std::size_t elem = 0; elem < 4; ++elem) {
1942 if (!instr.tex.IsComponentEnabled(elem)) { 1942 if (!instr.tex.IsComponentEnabled(elem)) {
1943 // Skip disabled components 1943 // Skip disabled components
1944 continue; 1944 continue;
@@ -2042,8 +2042,8 @@ private:
2042 const std::string texture = "textureGather(" + sampler + ", coords, " + 2042 const std::string texture = "textureGather(" + sampler + ", coords, " +
2043 std::to_string(instr.tld4.component) + ')'; 2043 std::to_string(instr.tld4.component) + ')';
2044 2044
2045 size_t dest_elem{}; 2045 std::size_t dest_elem{};
2046 for (size_t elem = 0; elem < 4; ++elem) { 2046 for (std::size_t elem = 0; elem < 4; ++elem) {
2047 if (!instr.tex.IsComponentEnabled(elem)) { 2047 if (!instr.tex.IsComponentEnabled(elem)) {
2048 // Skip disabled components 2048 // Skip disabled components
2049 continue; 2049 continue;
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.h b/src/video_core/renderer_opengl/gl_shader_gen.h
index a43e2997b..d53b93ad5 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.h
+++ b/src/video_core/renderer_opengl/gl_shader_gen.h
@@ -13,7 +13,7 @@
13 13
14namespace OpenGL::GLShader { 14namespace OpenGL::GLShader {
15 15
16constexpr size_t MAX_PROGRAM_CODE_LENGTH{0x1000}; 16constexpr std::size_t MAX_PROGRAM_CODE_LENGTH{0x1000};
17using ProgramCode = std::vector<u64>; 17using ProgramCode = std::vector<u64>;
18 18
19class ConstBufferEntry { 19class ConstBufferEntry {
@@ -51,7 +51,7 @@ public:
51 } 51 }
52 52
53 std::string GetName() const { 53 std::string GetName() const {
54 return BufferBaseNames[static_cast<size_t>(stage)] + std::to_string(index); 54 return BufferBaseNames[static_cast<std::size_t>(stage)] + std::to_string(index);
55 } 55 }
56 56
57 u32 GetHash() const { 57 u32 GetHash() const {
@@ -74,15 +74,15 @@ class SamplerEntry {
74 using Maxwell = Tegra::Engines::Maxwell3D::Regs; 74 using Maxwell = Tegra::Engines::Maxwell3D::Regs;
75 75
76public: 76public:
77 SamplerEntry(Maxwell::ShaderStage stage, size_t offset, size_t index, 77 SamplerEntry(Maxwell::ShaderStage stage, std::size_t offset, std::size_t index,
78 Tegra::Shader::TextureType type, bool is_array) 78 Tegra::Shader::TextureType type, bool is_array)
79 : offset(offset), stage(stage), sampler_index(index), type(type), is_array(is_array) {} 79 : offset(offset), stage(stage), sampler_index(index), type(type), is_array(is_array) {}
80 80
81 size_t GetOffset() const { 81 std::size_t GetOffset() const {
82 return offset; 82 return offset;
83 } 83 }
84 84
85 size_t GetIndex() const { 85 std::size_t GetIndex() const {
86 return sampler_index; 86 return sampler_index;
87 } 87 }
88 88
@@ -91,7 +91,7 @@ public:
91 } 91 }
92 92
93 std::string GetName() const { 93 std::string GetName() const {
94 return std::string(TextureSamplerNames[static_cast<size_t>(stage)]) + '_' + 94 return std::string(TextureSamplerNames[static_cast<std::size_t>(stage)]) + '_' +
95 std::to_string(sampler_index); 95 std::to_string(sampler_index);
96 } 96 }
97 97
@@ -133,7 +133,7 @@ public:
133 } 133 }
134 134
135 static std::string GetArrayName(Maxwell::ShaderStage stage) { 135 static std::string GetArrayName(Maxwell::ShaderStage stage) {
136 return TextureSamplerNames[static_cast<size_t>(stage)]; 136 return TextureSamplerNames[static_cast<std::size_t>(stage)];
137 } 137 }
138 138
139private: 139private:
@@ -143,9 +143,9 @@ private:
143 143
144 /// Offset in TSC memory from which to read the sampler object, as specified by the sampling 144 /// Offset in TSC memory from which to read the sampler object, as specified by the sampling
145 /// instruction. 145 /// instruction.
146 size_t offset; 146 std::size_t offset;
147 Maxwell::ShaderStage stage; ///< Shader stage where this sampler was used. 147 Maxwell::ShaderStage stage; ///< Shader stage where this sampler was used.
148 size_t sampler_index; ///< Value used to index into the generated GLSL sampler array. 148 std::size_t sampler_index; ///< Value used to index into the generated GLSL sampler array.
149 Tegra::Shader::TextureType type; ///< The type used to sample this texture (Texture2D, etc) 149 Tegra::Shader::TextureType type; ///< The type used to sample this texture (Texture2D, etc)
150 bool is_array; ///< Whether the texture is being sampled as an array texture or not. 150 bool is_array; ///< Whether the texture is being sampled as an array texture or not.
151}; 151};
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.h b/src/video_core/renderer_opengl/gl_shader_manager.h
index 533e42caa..b86cd96e8 100644
--- a/src/video_core/renderer_opengl/gl_shader_manager.h
+++ b/src/video_core/renderer_opengl/gl_shader_manager.h
@@ -12,7 +12,7 @@
12namespace OpenGL::GLShader { 12namespace OpenGL::GLShader {
13 13
14/// Number of OpenGL texture samplers that can be used in the fragment shader 14/// Number of OpenGL texture samplers that can be used in the fragment shader
15static constexpr size_t NumTextureSamplers = 32; 15static constexpr std::size_t NumTextureSamplers = 32;
16 16
17using Tegra::Engines::Maxwell3D; 17using Tegra::Engines::Maxwell3D;
18 18
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index 6f70deb96..af99132ba 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -272,7 +272,7 @@ void OpenGLState::Apply() const {
272 } 272 }
273 273
274 // Clip distance 274 // Clip distance
275 for (size_t i = 0; i < clip_distance.size(); ++i) { 275 for (std::size_t i = 0; i < clip_distance.size(); ++i) {
276 if (clip_distance[i] != cur_state.clip_distance[i]) { 276 if (clip_distance[i] != cur_state.clip_distance[i]) {
277 if (clip_distance[i]) { 277 if (clip_distance[i]) {
278 glEnable(GL_CLIP_DISTANCE0 + static_cast<GLenum>(i)); 278 glEnable(GL_CLIP_DISTANCE0 + static_cast<GLenum>(i));
diff --git a/src/video_core/renderer_opengl/gl_stream_buffer.cpp b/src/video_core/renderer_opengl/gl_stream_buffer.cpp
index aadf68f16..664f3ca20 100644
--- a/src/video_core/renderer_opengl/gl_stream_buffer.cpp
+++ b/src/video_core/renderer_opengl/gl_stream_buffer.cpp
@@ -61,7 +61,7 @@ std::tuple<u8*, GLintptr, bool> OGLStreamBuffer::Map(GLsizeiptr size, GLintptr a
61 mapped_size = size; 61 mapped_size = size;
62 62
63 if (alignment > 0) { 63 if (alignment > 0) {
64 buffer_pos = Common::AlignUp<size_t>(buffer_pos, alignment); 64 buffer_pos = Common::AlignUp<std::size_t>(buffer_pos, alignment);
65 } 65 }
66 66
67 bool invalidate = false; 67 bool invalidate = false;