diff options
| author | 2018-09-15 15:21:06 +0200 | |
|---|---|---|
| committer | 2018-09-15 15:21:06 +0200 | |
| commit | 63c2e32e207d31ecadd9022e1d7cd705c9febac8 (patch) | |
| tree | 8a90e8ef2804f147dff7225a543a8740ecf7160c /src/video_core | |
| parent | Merge pull request #1310 from lioncash/kernel-ns (diff) | |
| download | yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.gz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.xz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.zip | |
Port #4182 from Citra: "Prefix all size_t with std::"
Diffstat (limited to 'src/video_core')
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 | ||
| 249 | void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) { | 249 | void 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 { | |||
| 316 | std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderStage stage) const { | 316 | std::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 | ||
| 363 | Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage, size_t offset) const { | 363 | Texture::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 | ||
| 930 | private: | 930 | private: |
| 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 58f2904ce..d85c5883d 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 | ||
| 21 | struct Register { | 21 | struct 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, |
| @@ -584,7 +584,7 @@ union Instruction { | |||
| 584 | BitField<31, 4, u64> component_mask; | 584 | BitField<31, 4, u64> component_mask; |
| 585 | BitField<55, 3, TextureProcessMode> process_mode; | 585 | BitField<55, 3, TextureProcessMode> process_mode; |
| 586 | 586 | ||
| 587 | bool IsComponentEnabled(size_t component) const { | 587 | bool IsComponentEnabled(std::size_t component) const { |
| 588 | return ((1ull << component) & component_mask) != 0; | 588 | return ((1ull << component) & component_mask) != 0; |
| 589 | } | 589 | } |
| 590 | } tex; | 590 | } tex; |
| @@ -599,7 +599,7 @@ union Instruction { | |||
| 599 | BitField<29, 2, TextureType> texture_type; | 599 | BitField<29, 2, TextureType> texture_type; |
| 600 | BitField<31, 4, u64> component_mask; | 600 | BitField<31, 4, u64> component_mask; |
| 601 | 601 | ||
| 602 | bool IsComponentEnabled(size_t component) const { | 602 | bool IsComponentEnabled(std::size_t component) const { |
| 603 | return ((1ull << component) & component_mask) != 0; | 603 | return ((1ull << component) & component_mask) != 0; |
| 604 | } | 604 | } |
| 605 | } tmml; | 605 | } tmml; |
| @@ -646,7 +646,7 @@ union Instruction { | |||
| 646 | return gpr28.Value() != Register::ZeroIndex; | 646 | return gpr28.Value() != Register::ZeroIndex; |
| 647 | } | 647 | } |
| 648 | 648 | ||
| 649 | bool IsComponentEnabled(size_t component) const { | 649 | bool IsComponentEnabled(std::size_t component) const { |
| 650 | static constexpr std::array<std::array<u32, 8>, 4> mask_lut{{ | 650 | static constexpr std::array<std::array<u32, 8>, 4> mask_lut{{ |
| 651 | {}, | 651 | {}, |
| 652 | {0x1, 0x2, 0x4, 0x8, 0x3, 0x9, 0xa, 0xc}, | 652 | {0x1, 0x2, 0x4, 0x8, 0x3, 0x9, 0xa, 0xc}, |
| @@ -654,7 +654,7 @@ union Instruction { | |||
| 654 | {0x7, 0xb, 0xd, 0xe, 0xf}, | 654 | {0x7, 0xb, 0xd, 0xe, 0xf}, |
| 655 | }}; | 655 | }}; |
| 656 | 656 | ||
| 657 | size_t index{gpr0.Value() != Register::ZeroIndex ? 1U : 0U}; | 657 | std::size_t index{gpr0.Value() != Register::ZeroIndex ? 1U : 0U}; |
| 658 | index |= gpr28.Value() != Register::ZeroIndex ? 2 : 0; | 658 | index |= gpr28.Value() != Register::ZeroIndex ? 2 : 0; |
| 659 | 659 | ||
| 660 | u32 mask = mask_lut[index][component_mask_selector]; | 660 | u32 mask = mask_lut[index][component_mask_selector]; |
| @@ -939,7 +939,7 @@ public: | |||
| 939 | private: | 939 | private: |
| 940 | struct Detail { | 940 | struct Detail { |
| 941 | private: | 941 | private: |
| 942 | static constexpr size_t opcode_bitsize = 16; | 942 | static constexpr std::size_t opcode_bitsize = 16; |
| 943 | 943 | ||
| 944 | /** | 944 | /** |
| 945 | * Generates the mask and the expected value after masking from a given bitstring. | 945 | * Generates the mask and the expected value after masking from a given bitstring. |
| @@ -948,8 +948,8 @@ private: | |||
| 948 | */ | 948 | */ |
| 949 | static auto GetMaskAndExpect(const char* const bitstring) { | 949 | static auto GetMaskAndExpect(const char* const bitstring) { |
| 950 | u16 mask = 0, expect = 0; | 950 | u16 mask = 0, expect = 0; |
| 951 | for (size_t i = 0; i < opcode_bitsize; i++) { | 951 | for (std::size_t i = 0; i < opcode_bitsize; i++) { |
| 952 | const size_t bit_position = opcode_bitsize - i - 1; | 952 | const std::size_t bit_position = opcode_bitsize - i - 1; |
| 953 | switch (bitstring[i]) { | 953 | switch (bitstring[i]) { |
| 954 | case '0': | 954 | case '0': |
| 955 | mask |= 1 << bit_position; | 955 | 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 | ||
| 13 | namespace OpenGL { | 13 | namespace OpenGL { |
| 14 | 14 | ||
| 15 | OGLBufferCache::OGLBufferCache(size_t size) : stream_buffer(GL_ARRAY_BUFFER, size) {} | 15 | OGLBufferCache::OGLBufferCache(std::size_t size) : stream_buffer(GL_ARRAY_BUFFER, size) {} |
| 16 | 16 | ||
| 17 | GLintptr OGLBufferCache::UploadMemory(Tegra::GPUVAddr gpu_addr, size_t size, size_t alignment, | 17 | GLintptr 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 | ||
| 56 | GLintptr OGLBufferCache::UploadHostMemory(const void* raw_pointer, size_t size, size_t alignment) { | 56 | GLintptr 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 | ||
| 66 | void OGLBufferCache::Map(size_t max_size) { | 67 | void 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 | ||
| 84 | void OGLBufferCache::AlignBuffer(size_t alignment) { | 85 | void 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 | ||
| 32 | class OGLBufferCache final : public RasterizerCache<std::shared_ptr<CachedBufferEntry>> { | 32 | class OGLBufferCache final : public RasterizerCache<std::shared_ptr<CachedBufferEntry>> { |
| 33 | public: | 33 | public: |
| 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 | ||
| 46 | protected: | 46 | protected: |
| 47 | void AlignBuffer(size_t alignment); | 47 | void AlignBuffer(std::size_t alignment); |
| 48 | 48 | ||
| 49 | private: | 49 | private: |
| 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, | |||
| 46 | RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window, ScreenInfo& info) | 46 | RasterizerOpenGL::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 | ||
| 241 | size_t RasterizerOpenGL::CalculateVertexArraysSize() const { | 241 | std::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 | ||
| 300 | void RasterizerOpenGL::ConfigureFramebuffers(bool using_color_fb, bool using_depth_fb, | 300 | void 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 32001e44b..3f385484f 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()); |
| @@ -203,7 +203,7 @@ static GLenum SurfaceTargetToGL(SurfaceParams::SurfaceTarget target) { | |||
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { | 205 | static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { |
| 206 | ASSERT(static_cast<size_t>(pixel_format) < tex_format_tuples.size()); | 206 | ASSERT(static_cast<std::size_t>(pixel_format) < tex_format_tuples.size()); |
| 207 | auto& format = tex_format_tuples[static_cast<unsigned int>(pixel_format)]; | 207 | auto& format = tex_format_tuples[static_cast<unsigned int>(pixel_format)]; |
| 208 | ASSERT(component_type == format.component_type); | 208 | ASSERT(component_type == format.component_type); |
| 209 | 209 | ||
| @@ -256,7 +256,7 @@ static bool IsFormatBCn(PixelFormat format) { | |||
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | template <bool morton_to_gl, PixelFormat format> | 258 | template <bool morton_to_gl, PixelFormat format> |
| 259 | void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, size_t gl_buffer_size, | 259 | void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, std::size_t gl_buffer_size, |
| 260 | VAddr addr) { | 260 | VAddr addr) { |
| 261 | constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / CHAR_BIT; | 261 | constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / CHAR_BIT; |
| 262 | constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format); | 262 | constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format); |
| @@ -267,7 +267,7 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, size_t | |||
| 267 | const u32 tile_size{IsFormatBCn(format) ? 4U : 1U}; | 267 | const u32 tile_size{IsFormatBCn(format) ? 4U : 1U}; |
| 268 | const std::vector<u8> data = Tegra::Texture::UnswizzleTexture( | 268 | const std::vector<u8> data = Tegra::Texture::UnswizzleTexture( |
| 269 | addr, tile_size, bytes_per_pixel, stride, height, block_height); | 269 | addr, tile_size, bytes_per_pixel, stride, height, block_height); |
| 270 | const size_t size_to_copy{std::min(gl_buffer_size, data.size())}; | 270 | const std::size_t size_to_copy{std::min(gl_buffer_size, data.size())}; |
| 271 | memcpy(gl_buffer, data.data(), size_to_copy); | 271 | memcpy(gl_buffer, data.data(), size_to_copy); |
| 272 | } else { | 272 | } else { |
| 273 | // TODO(bunnei): Assumes the default rendering GOB size of 16 (128 lines). We should | 273 | // TODO(bunnei): Assumes the default rendering GOB size of 16 (128 lines). We should |
| @@ -278,7 +278,7 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, u8* gl_buffer, size_t | |||
| 278 | } | 278 | } |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | static constexpr std::array<void (*)(u32, u32, u32, u8*, size_t, VAddr), | 281 | static constexpr std::array<void (*)(u32, u32, u32, u8*, std::size_t, VAddr), |
| 282 | SurfaceParams::MaxPixelFormat> | 282 | SurfaceParams::MaxPixelFormat> |
| 283 | morton_to_gl_fns = { | 283 | morton_to_gl_fns = { |
| 284 | // clang-format off | 284 | // clang-format off |
| @@ -335,7 +335,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, size_t, VAddr), | |||
| 335 | // clang-format on | 335 | // clang-format on |
| 336 | }; | 336 | }; |
| 337 | 337 | ||
| 338 | static constexpr std::array<void (*)(u32, u32, u32, u8*, size_t, VAddr), | 338 | static constexpr std::array<void (*)(u32, u32, u32, u8*, std::size_t, VAddr), |
| 339 | SurfaceParams::MaxPixelFormat> | 339 | SurfaceParams::MaxPixelFormat> |
| 340 | gl_to_morton_fns = { | 340 | gl_to_morton_fns = { |
| 341 | // clang-format off | 341 | // clang-format off |
| @@ -513,9 +513,9 @@ static void ConvertS8Z24ToZ24S8(std::vector<u8>& data, u32 width, u32 height) { | |||
| 513 | S8Z24 input_pixel{}; | 513 | S8Z24 input_pixel{}; |
| 514 | Z24S8 output_pixel{}; | 514 | Z24S8 output_pixel{}; |
| 515 | constexpr auto bpp{CachedSurface::GetGLBytesPerPixel(PixelFormat::S8Z24)}; | 515 | constexpr auto bpp{CachedSurface::GetGLBytesPerPixel(PixelFormat::S8Z24)}; |
| 516 | for (size_t y = 0; y < height; ++y) { | 516 | for (std::size_t y = 0; y < height; ++y) { |
| 517 | for (size_t x = 0; x < width; ++x) { | 517 | for (std::size_t x = 0; x < width; ++x) { |
| 518 | const size_t offset{bpp * (y * width + x)}; | 518 | const std::size_t offset{bpp * (y * width + x)}; |
| 519 | std::memcpy(&input_pixel, &data[offset], sizeof(S8Z24)); | 519 | std::memcpy(&input_pixel, &data[offset], sizeof(S8Z24)); |
| 520 | output_pixel.s8.Assign(input_pixel.s8); | 520 | output_pixel.s8.Assign(input_pixel.s8); |
| 521 | output_pixel.z24.Assign(input_pixel.z24); | 521 | output_pixel.z24.Assign(input_pixel.z24); |
| @@ -526,9 +526,9 @@ static void ConvertS8Z24ToZ24S8(std::vector<u8>& data, u32 width, u32 height) { | |||
| 526 | 526 | ||
| 527 | static void ConvertG8R8ToR8G8(std::vector<u8>& data, u32 width, u32 height) { | 527 | static void ConvertG8R8ToR8G8(std::vector<u8>& data, u32 width, u32 height) { |
| 528 | constexpr auto bpp{CachedSurface::GetGLBytesPerPixel(PixelFormat::G8R8U)}; | 528 | constexpr auto bpp{CachedSurface::GetGLBytesPerPixel(PixelFormat::G8R8U)}; |
| 529 | for (size_t y = 0; y < height; ++y) { | 529 | for (std::size_t y = 0; y < height; ++y) { |
| 530 | for (size_t x = 0; x < width; ++x) { | 530 | for (std::size_t x = 0; x < width; ++x) { |
| 531 | const size_t offset{bpp * (y * width + x)}; | 531 | const std::size_t offset{bpp * (y * width + x)}; |
| 532 | const u8 temp{data[offset]}; | 532 | const u8 temp{data[offset]}; |
| 533 | data[offset] = data[offset + 1]; | 533 | data[offset] = data[offset + 1]; |
| 534 | data[offset + 1] = temp; | 534 | data[offset + 1] = temp; |
| @@ -591,13 +591,13 @@ void CachedSurface::LoadGLBuffer() { | |||
| 591 | UNREACHABLE(); | 591 | UNREACHABLE(); |
| 592 | } | 592 | } |
| 593 | 593 | ||
| 594 | gl_buffer.resize(static_cast<size_t>(params.depth) * copy_size); | 594 | gl_buffer.resize(static_cast<std::size_t>(params.depth) * copy_size); |
| 595 | morton_to_gl_fns[static_cast<size_t>(params.pixel_format)]( | 595 | morton_to_gl_fns[static_cast<std::size_t>(params.pixel_format)]( |
| 596 | params.width, params.block_height, params.height, gl_buffer.data(), copy_size, | 596 | params.width, params.block_height, params.height, gl_buffer.data(), copy_size, |
| 597 | params.addr); | 597 | params.addr); |
| 598 | } else { | 598 | } else { |
| 599 | const u8* const texture_src_data_end{texture_src_data + | 599 | const u8* const texture_src_data_end{texture_src_data + |
| 600 | (static_cast<size_t>(params.depth) * copy_size)}; | 600 | (static_cast<std::size_t>(params.depth) * copy_size)}; |
| 601 | gl_buffer.assign(texture_src_data, texture_src_data_end); | 601 | gl_buffer.assign(texture_src_data, texture_src_data_end); |
| 602 | } | 602 | } |
| 603 | 603 | ||
| @@ -616,7 +616,7 @@ void CachedSurface::UploadGLTexture(GLuint read_fb_handle, GLuint draw_fb_handle | |||
| 616 | 616 | ||
| 617 | MICROPROFILE_SCOPE(OpenGL_TextureUL); | 617 | MICROPROFILE_SCOPE(OpenGL_TextureUL); |
| 618 | 618 | ||
| 619 | ASSERT(gl_buffer.size() == static_cast<size_t>(params.width) * params.height * | 619 | ASSERT(gl_buffer.size() == static_cast<std::size_t>(params.width) * params.height * |
| 620 | GetGLBytesPerPixel(params.pixel_format) * params.depth); | 620 | GetGLBytesPerPixel(params.pixel_format) * params.depth); |
| 621 | 621 | ||
| 622 | const auto& rect{params.GetRect()}; | 622 | const auto& rect{params.GetRect()}; |
| @@ -624,8 +624,9 @@ void CachedSurface::UploadGLTexture(GLuint read_fb_handle, GLuint draw_fb_handle | |||
| 624 | // Load data from memory to the surface | 624 | // Load data from memory to the surface |
| 625 | const GLint x0 = static_cast<GLint>(rect.left); | 625 | const GLint x0 = static_cast<GLint>(rect.left); |
| 626 | const GLint y0 = static_cast<GLint>(rect.bottom); | 626 | const GLint y0 = static_cast<GLint>(rect.bottom); |
| 627 | const size_t buffer_offset = | 627 | const std::size_t buffer_offset = |
| 628 | static_cast<size_t>(static_cast<size_t>(y0) * params.width + static_cast<size_t>(x0)) * | 628 | static_cast<std::size_t>(static_cast<std::size_t>(y0) * params.width + |
| 629 | static_cast<std::size_t>(x0)) * | ||
| 629 | GetGLBytesPerPixel(params.pixel_format); | 630 | GetGLBytesPerPixel(params.pixel_format); |
| 630 | 631 | ||
| 631 | const FormatTuple& tuple = GetFormatTuple(params.pixel_format, params.component_type); | 632 | const FormatTuple& tuple = GetFormatTuple(params.pixel_format, params.component_type); |
| @@ -727,7 +728,7 @@ Surface RasterizerCacheOpenGL::GetDepthBufferSurface(bool preserve_contents) { | |||
| 727 | return GetSurface(depth_params, preserve_contents); | 728 | return GetSurface(depth_params, preserve_contents); |
| 728 | } | 729 | } |
| 729 | 730 | ||
| 730 | Surface RasterizerCacheOpenGL::GetColorBufferSurface(size_t index, bool preserve_contents) { | 731 | Surface RasterizerCacheOpenGL::GetColorBufferSurface(std::size_t index, bool preserve_contents) { |
| 731 | const auto& regs{Core::System::GetInstance().GPU().Maxwell3D().regs}; | 732 | const auto& regs{Core::System::GetInstance().GPU().Maxwell3D().regs}; |
| 732 | 733 | ||
| 733 | ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets); | 734 | ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets); |
| @@ -825,7 +826,7 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& surface, | |||
| 825 | auto source_format = GetFormatTuple(params.pixel_format, params.component_type); | 826 | auto source_format = GetFormatTuple(params.pixel_format, params.component_type); |
| 826 | auto dest_format = GetFormatTuple(new_params.pixel_format, new_params.component_type); | 827 | auto dest_format = GetFormatTuple(new_params.pixel_format, new_params.component_type); |
| 827 | 828 | ||
| 828 | size_t buffer_size = std::max(params.SizeInBytes(), new_params.SizeInBytes()); | 829 | std::size_t buffer_size = std::max(params.SizeInBytes(), new_params.SizeInBytes()); |
| 829 | 830 | ||
| 830 | glBindBuffer(GL_PIXEL_PACK_BUFFER, copy_pbo.handle); | 831 | glBindBuffer(GL_PIXEL_PACK_BUFFER, copy_pbo.handle); |
| 831 | glBufferData(GL_PIXEL_PACK_BUFFER, buffer_size, nullptr, GL_STREAM_DRAW_ARB); | 832 | glBufferData(GL_PIXEL_PACK_BUFFER, buffer_size, nullptr, GL_STREAM_DRAW_ARB); |
| @@ -849,7 +850,7 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& surface, | |||
| 849 | LOG_DEBUG(HW_GPU, "Trying to upload extra texture data from the CPU during " | 850 | LOG_DEBUG(HW_GPU, "Trying to upload extra texture data from the CPU during " |
| 850 | "reinterpretation but the texture is tiled."); | 851 | "reinterpretation but the texture is tiled."); |
| 851 | } | 852 | } |
| 852 | size_t remaining_size = new_params.SizeInBytes() - params.SizeInBytes(); | 853 | std::size_t remaining_size = new_params.SizeInBytes() - params.SizeInBytes(); |
| 853 | std::vector<u8> data(remaining_size); | 854 | std::vector<u8> data(remaining_size); |
| 854 | Memory::ReadBlock(new_params.addr + params.SizeInBytes(), data.data(), data.size()); | 855 | Memory::ReadBlock(new_params.addr + params.SizeInBytes(), data.data(), data.size()); |
| 855 | glBufferSubData(GL_PIXEL_PACK_BUFFER, params.SizeInBytes(), remaining_size, | 856 | 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 57ea8593b..aafac9a20 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -90,7 +90,7 @@ struct SurfaceParams { | |||
| 90 | Invalid = 255, | 90 | Invalid = 255, |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | static constexpr size_t MaxPixelFormat = static_cast<size_t>(PixelFormat::Max); | 93 | static constexpr std::size_t MaxPixelFormat = static_cast<std::size_t>(PixelFormat::Max); |
| 94 | 94 | ||
| 95 | enum class ComponentType { | 95 | enum class ComponentType { |
| 96 | Invalid = 0, | 96 | Invalid = 0, |
| @@ -199,8 +199,8 @@ struct SurfaceParams { | |||
| 199 | 1, // Z32FS8 | 199 | 1, // Z32FS8 |
| 200 | }}; | 200 | }}; |
| 201 | 201 | ||
| 202 | ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); | 202 | ASSERT(static_cast<std::size_t>(format) < compression_factor_table.size()); |
| 203 | return compression_factor_table[static_cast<size_t>(format)]; | 203 | return compression_factor_table[static_cast<std::size_t>(format)]; |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | static constexpr u32 GetFormatBpp(PixelFormat format) { | 206 | static constexpr u32 GetFormatBpp(PixelFormat format) { |
| @@ -260,8 +260,8 @@ struct SurfaceParams { | |||
| 260 | 64, // Z32FS8 | 260 | 64, // Z32FS8 |
| 261 | }}; | 261 | }}; |
| 262 | 262 | ||
| 263 | ASSERT(static_cast<size_t>(format) < bpp_table.size()); | 263 | ASSERT(static_cast<std::size_t>(format) < bpp_table.size()); |
| 264 | return bpp_table[static_cast<size_t>(format)]; | 264 | return bpp_table[static_cast<std::size_t>(format)]; |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | u32 GetFormatBpp() const { | 267 | u32 GetFormatBpp() const { |
| @@ -636,16 +636,18 @@ struct SurfaceParams { | |||
| 636 | } | 636 | } |
| 637 | 637 | ||
| 638 | static SurfaceType GetFormatType(PixelFormat pixel_format) { | 638 | static SurfaceType GetFormatType(PixelFormat pixel_format) { |
| 639 | if (static_cast<size_t>(pixel_format) < static_cast<size_t>(PixelFormat::MaxColorFormat)) { | 639 | if (static_cast<std::size_t>(pixel_format) < |
| 640 | static_cast<std::size_t>(PixelFormat::MaxColorFormat)) { | ||
| 640 | return SurfaceType::ColorTexture; | 641 | return SurfaceType::ColorTexture; |
| 641 | } | 642 | } |
| 642 | 643 | ||
| 643 | if (static_cast<size_t>(pixel_format) < static_cast<size_t>(PixelFormat::MaxDepthFormat)) { | 644 | if (static_cast<std::size_t>(pixel_format) < |
| 645 | static_cast<std::size_t>(PixelFormat::MaxDepthFormat)) { | ||
| 644 | return SurfaceType::Depth; | 646 | return SurfaceType::Depth; |
| 645 | } | 647 | } |
| 646 | 648 | ||
| 647 | if (static_cast<size_t>(pixel_format) < | 649 | if (static_cast<std::size_t>(pixel_format) < |
| 648 | static_cast<size_t>(PixelFormat::MaxDepthStencilFormat)) { | 650 | static_cast<std::size_t>(PixelFormat::MaxDepthStencilFormat)) { |
| 649 | return SurfaceType::DepthStencil; | 651 | return SurfaceType::DepthStencil; |
| 650 | } | 652 | } |
| 651 | 653 | ||
| @@ -659,7 +661,7 @@ struct SurfaceParams { | |||
| 659 | MathUtil::Rectangle<u32> GetRect() const; | 661 | MathUtil::Rectangle<u32> GetRect() const; |
| 660 | 662 | ||
| 661 | /// Returns the size of this surface in bytes, adjusted for compression | 663 | /// Returns the size of this surface in bytes, adjusted for compression |
| 662 | size_t SizeInBytes() const { | 664 | std::size_t SizeInBytes() const { |
| 663 | const u32 compression_factor{GetCompressionFactor(pixel_format)}; | 665 | const u32 compression_factor{GetCompressionFactor(pixel_format)}; |
| 664 | ASSERT(width % compression_factor == 0); | 666 | ASSERT(width % compression_factor == 0); |
| 665 | ASSERT(height % compression_factor == 0); | 667 | ASSERT(height % compression_factor == 0); |
| @@ -671,7 +673,7 @@ struct SurfaceParams { | |||
| 671 | static SurfaceParams CreateForTexture(const Tegra::Texture::FullTextureInfo& config); | 673 | static SurfaceParams CreateForTexture(const Tegra::Texture::FullTextureInfo& config); |
| 672 | 674 | ||
| 673 | /// Creates SurfaceParams from a framebuffer configuration | 675 | /// Creates SurfaceParams from a framebuffer configuration |
| 674 | static SurfaceParams CreateForFramebuffer(size_t index); | 676 | static SurfaceParams CreateForFramebuffer(std::size_t index); |
| 675 | 677 | ||
| 676 | /// Creates SurfaceParams for a depth buffer configuration | 678 | /// Creates SurfaceParams for a depth buffer configuration |
| 677 | static SurfaceParams CreateForDepthBuffer(u32 zeta_width, u32 zeta_height, | 679 | static SurfaceParams CreateForDepthBuffer(u32 zeta_width, u32 zeta_height, |
| @@ -694,7 +696,7 @@ struct SurfaceParams { | |||
| 694 | u32 height; | 696 | u32 height; |
| 695 | u32 depth; | 697 | u32 depth; |
| 696 | u32 unaligned_height; | 698 | u32 unaligned_height; |
| 697 | size_t size_in_bytes; | 699 | std::size_t size_in_bytes; |
| 698 | SurfaceTarget target; | 700 | SurfaceTarget target; |
| 699 | }; | 701 | }; |
| 700 | 702 | ||
| @@ -711,7 +713,7 @@ struct SurfaceReserveKey : Common::HashableStruct<OpenGL::SurfaceParams> { | |||
| 711 | namespace std { | 713 | namespace std { |
| 712 | template <> | 714 | template <> |
| 713 | struct hash<SurfaceReserveKey> { | 715 | struct hash<SurfaceReserveKey> { |
| 714 | size_t operator()(const SurfaceReserveKey& k) const { | 716 | std::size_t operator()(const SurfaceReserveKey& k) const { |
| 715 | return k.Hash(); | 717 | return k.Hash(); |
| 716 | } | 718 | } |
| 717 | }; | 719 | }; |
| @@ -727,7 +729,7 @@ public: | |||
| 727 | return params.addr; | 729 | return params.addr; |
| 728 | } | 730 | } |
| 729 | 731 | ||
| 730 | size_t GetSizeInBytes() const { | 732 | std::size_t GetSizeInBytes() const { |
| 731 | return params.size_in_bytes; | 733 | return params.size_in_bytes; |
| 732 | } | 734 | } |
| 733 | 735 | ||
| @@ -775,7 +777,7 @@ public: | |||
| 775 | Surface GetDepthBufferSurface(bool preserve_contents); | 777 | Surface GetDepthBufferSurface(bool preserve_contents); |
| 776 | 778 | ||
| 777 | /// Get the color surface based on the framebuffer configuration and the specified render target | 779 | /// Get the color surface based on the framebuffer configuration and the specified render target |
| 778 | Surface GetColorBufferSurface(size_t index, bool preserve_contents); | 780 | Surface GetColorBufferSurface(std::size_t index, bool preserve_contents); |
| 779 | 781 | ||
| 780 | /// Flushes the surface to Switch memory | 782 | /// Flushes the surface to Switch memory |
| 781 | void FlushSurface(const Surface& surface); | 783 | 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 |
| 15 | static VAddr GetShaderAddress(Maxwell::ShaderProgram program) { | 15 | static 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 |
| 30 | static void SetShaderUniformBlockBinding(GLuint shader, const char* name, | 30 | static 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 2d56370c7..d58a65935 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 | ||
| 190 | private: | 190 | private: |
| 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 | ||
| 233 | private: | 233 | private: |
| 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; |
| @@ -1894,8 +1894,8 @@ private: | |||
| 1894 | UNREACHABLE(); | 1894 | UNREACHABLE(); |
| 1895 | } | 1895 | } |
| 1896 | } | 1896 | } |
| 1897 | size_t dest_elem{}; | 1897 | std::size_t dest_elem{}; |
| 1898 | for (size_t elem = 0; elem < 4; ++elem) { | 1898 | for (std::size_t elem = 0; elem < 4; ++elem) { |
| 1899 | if (!instr.tex.IsComponentEnabled(elem)) { | 1899 | if (!instr.tex.IsComponentEnabled(elem)) { |
| 1900 | // Skip disabled components | 1900 | // Skip disabled components |
| 1901 | continue; | 1901 | continue; |
| @@ -1999,8 +1999,8 @@ private: | |||
| 1999 | const std::string texture = "textureGather(" + sampler + ", coords, " + | 1999 | const std::string texture = "textureGather(" + sampler + ", coords, " + |
| 2000 | std::to_string(instr.tld4.component) + ')'; | 2000 | std::to_string(instr.tld4.component) + ')'; |
| 2001 | 2001 | ||
| 2002 | size_t dest_elem{}; | 2002 | std::size_t dest_elem{}; |
| 2003 | for (size_t elem = 0; elem < 4; ++elem) { | 2003 | for (std::size_t elem = 0; elem < 4; ++elem) { |
| 2004 | if (!instr.tex.IsComponentEnabled(elem)) { | 2004 | if (!instr.tex.IsComponentEnabled(elem)) { |
| 2005 | // Skip disabled components | 2005 | // Skip disabled components |
| 2006 | continue; | 2006 | 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 | ||
| 14 | namespace OpenGL::GLShader { | 14 | namespace OpenGL::GLShader { |
| 15 | 15 | ||
| 16 | constexpr size_t MAX_PROGRAM_CODE_LENGTH{0x1000}; | 16 | constexpr std::size_t MAX_PROGRAM_CODE_LENGTH{0x1000}; |
| 17 | using ProgramCode = std::vector<u64>; | 17 | using ProgramCode = std::vector<u64>; |
| 18 | 18 | ||
| 19 | class ConstBufferEntry { | 19 | class 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 | ||
| 76 | public: | 76 | public: |
| 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 | ||
| 139 | private: | 139 | private: |
| @@ -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 @@ | |||
| 12 | namespace OpenGL::GLShader { | 12 | namespace 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 |
| 15 | static constexpr size_t NumTextureSamplers = 32; | 15 | static constexpr std::size_t NumTextureSamplers = 32; |
| 16 | 16 | ||
| 17 | using Tegra::Engines::Maxwell3D; | 17 | using 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; |