From de1374c1b9ff66f06eb43f3bb00ff8d7ccabb422 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 12 May 2022 00:23:46 -0400 Subject: [PATCH] video_core: Resolve C4267 warning on MSVC --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 +- .../renderer_opengl/texture_downloader_es.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 2f04412a4..1d5dcbb14 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -798,7 +798,7 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBindTexture(GL_TEXTURE_2D, state.texture_units[0].texture_2d); - for (std::size_t level{0}; level <= color_surface->max_level; ++level) { + for (u32 level{0}; level <= color_surface->max_level; ++level) { glCopyImageSubData(color_surface->texture.handle, GL_TEXTURE_2D, level, 0, 0, 0, temp_tex.handle, GL_TEXTURE_2D, level, 0, 0, 0, color_surface->GetScaledWidth() >> level, diff --git a/src/video_core/renderer_opengl/texture_downloader_es.cpp b/src/video_core/renderer_opengl/texture_downloader_es.cpp index 11663512e..1119ad65e 100644 --- a/src/video_core/renderer_opengl/texture_downloader_es.cpp +++ b/src/video_core/renderer_opengl/texture_downloader_es.cpp @@ -50,16 +50,18 @@ void TextureDownloaderES::Test() { state.Apply(); original_data.resize(tex_size * tex_size); - for (std::size_t idx = 0; idx < original_data.size(); ++idx) + for (std::size_t idx = 0; idx < original_data.size(); ++idx) { original_data[idx] = data_generator(idx); - glTexStorage2D(GL_TEXTURE_2D, 1, tuple.internal_format, tex_size, tex_size); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex_size, tex_size, tuple.format, tuple.type, + } + GLsizei tex_sizei = static_cast(tex_size); + glTexStorage2D(GL_TEXTURE_2D, 1, tuple.internal_format, tex_sizei, tex_sizei); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex_sizei, tex_sizei, tuple.format, tuple.type, original_data.data()); decltype(original_data) new_data(original_data.size()); glFinish(); auto start = std::chrono::high_resolution_clock::now(); - GetTexImage(GL_TEXTURE_2D, 0, tuple.format, tuple.type, tex_size, tex_size, + GetTexImage(GL_TEXTURE_2D, 0, tuple.format, tuple.type, tex_sizei, tex_sizei, new_data.data()); glFinish(); auto time = std::chrono::high_resolution_clock::now() - start;