Merge pull request #576 from Subv/warnings1

Build: Fixed some MSVC warnings in various parts of the code.
This commit is contained in:
bunnei 2018-06-20 16:46:14 -04:00 committed by GitHub
commit c3e95086b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 24 additions and 22 deletions

View file

@ -73,21 +73,21 @@ u32 PartitionFilesystem::GetNumEntries() const {
return pfs_header.num_entries; return pfs_header.num_entries;
} }
u64 PartitionFilesystem::GetEntryOffset(int index) const { u64 PartitionFilesystem::GetEntryOffset(u32 index) const {
if (index > GetNumEntries()) if (index > GetNumEntries())
return 0; return 0;
return content_offset + pfs_entries[index].fs_entry.offset; return content_offset + pfs_entries[index].fs_entry.offset;
} }
u64 PartitionFilesystem::GetEntrySize(int index) const { u64 PartitionFilesystem::GetEntrySize(u32 index) const {
if (index > GetNumEntries()) if (index > GetNumEntries())
return 0; return 0;
return pfs_entries[index].fs_entry.size; return pfs_entries[index].fs_entry.size;
} }
std::string PartitionFilesystem::GetEntryName(int index) const { std::string PartitionFilesystem::GetEntryName(u32 index) const {
if (index > GetNumEntries()) if (index > GetNumEntries())
return ""; return "";

View file

@ -27,9 +27,9 @@ public:
Loader::ResultStatus Load(const std::vector<u8>& file_data, size_t offset = 0); Loader::ResultStatus Load(const std::vector<u8>& file_data, size_t offset = 0);
u32 GetNumEntries() const; u32 GetNumEntries() const;
u64 GetEntryOffset(int index) const; u64 GetEntryOffset(u32 index) const;
u64 GetEntrySize(int index) const; u64 GetEntrySize(u32 index) const;
std::string GetEntryName(int index) const; std::string GetEntryName(u32 index) const;
u64 GetFileOffset(const std::string& name) const; u64 GetFileOffset(const std::string& name) const;
u64 GetFileSize(const std::string& name) const; u64 GetFileSize(const std::string& name) const;

View file

@ -749,7 +749,7 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
ASSERT(thread->owner_process->ideal_processor != THREADPROCESSORID_DEFAULT); ASSERT(thread->owner_process->ideal_processor != THREADPROCESSORID_DEFAULT);
// Set the target CPU to the one specified in the process' exheader. // Set the target CPU to the one specified in the process' exheader.
core = thread->owner_process->ideal_processor; core = thread->owner_process->ideal_processor;
mask = 1 << core; mask = 1ull << core;
} }
if (mask == 0) { if (mask == 0) {
@ -766,7 +766,7 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
} }
// Error out if the input core isn't enabled in the input mask. // Error out if the input core isn't enabled in the input mask.
if (core < Core::NUM_CPU_CORES && (mask & (1 << core)) == 0) { if (core < Core::NUM_CPU_CORES && (mask & (1ull << core)) == 0) {
return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidCombination); return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidCombination);
} }

View file

@ -328,7 +328,7 @@ bool AudRenU::IsFeatureSupported(AudioFeatures feature, u32_le revision) const {
u32_be version_num = (revision - Common::MakeMagic('R', 'E', 'V', '0')); // Byte swap u32_be version_num = (revision - Common::MakeMagic('R', 'E', 'V', '0')); // Byte swap
switch (feature) { switch (feature) {
case AudioFeatures::Splitter: case AudioFeatures::Splitter:
return version_num >= 2; return version_num >= 2u;
default: default:
return false; return false;
} }

View file

@ -121,8 +121,9 @@ u32 nvhost_gpu::AllocateObjectContext(const std::vector<u8>& input, std::vector<
} }
u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output) {
if (input.size() < sizeof(IoctlSubmitGpfifo)) if (input.size() < sizeof(IoctlSubmitGpfifo)) {
UNIMPLEMENTED(); UNIMPLEMENTED();
}
IoctlSubmitGpfifo params{}; IoctlSubmitGpfifo params{};
std::memcpy(&params, input.data(), sizeof(IoctlSubmitGpfifo)); std::memcpy(&params, input.data(), sizeof(IoctlSubmitGpfifo));
NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}", NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}",

View file

@ -328,8 +328,9 @@ std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderSt
Texture::FullTextureInfo tex_info{}; Texture::FullTextureInfo tex_info{};
// TODO(Subv): Use the shader to determine which textures are actually accessed. // TODO(Subv): Use the shader to determine which textures are actually accessed.
tex_info.index = (current_texture - tex_info_buffer.address - TextureInfoOffset) / tex_info.index =
sizeof(Texture::TextureHandle); static_cast<u32>(current_texture - tex_info_buffer.address - TextureInfoOffset) /
sizeof(Texture::TextureHandle);
// Load the TIC data. // Load the TIC data.
if (tex_handle.tic_id != 0) { if (tex_handle.tic_id != 0) {

View file

@ -372,7 +372,7 @@ union Instruction {
BitField<31, 4, u64> component_mask; BitField<31, 4, u64> component_mask;
bool IsComponentEnabled(size_t component) const { bool IsComponentEnabled(size_t component) const {
return ((1 << component) & component_mask) != 0; return ((1ull << component) & component_mask) != 0;
} }
} tex; } tex;
@ -391,7 +391,7 @@ union Instruction {
ASSERT(component_mask_selector < mask.size()); ASSERT(component_mask_selector < mask.size());
return ((1 << component) & mask[component_mask_selector]) != 0; return ((1ull << component) & mask[component_mask_selector]) != 0;
} }
} texs; } texs;

View file

@ -633,7 +633,7 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr
state.Apply(); state.Apply();
return current_bindpoint + entries.size(); return current_bindpoint + static_cast<u32>(entries.size());
} }
u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, GLuint program, u32 current_unit, u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, GLuint program, u32 current_unit,
@ -679,7 +679,7 @@ u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, GLuint program,
state.Apply(); state.Apply();
return current_unit + entries.size(); return current_unit + static_cast<u32>(entries.size());
} }
void RasterizerOpenGL::BindFramebufferSurfaces(const Surface& color_surface, void RasterizerOpenGL::BindFramebufferSurfaces(const Surface& color_surface,

View file

@ -575,7 +575,7 @@ void CachedSurface::UploadGLTexture(const MathUtil::Rectangle<u32>& rect, GLuint
glCompressedTexImage2D(GL_TEXTURE_2D, 0, tuple.internal_format, glCompressedTexImage2D(GL_TEXTURE_2D, 0, tuple.internal_format,
static_cast<GLsizei>(rect.GetWidth() * GetCompresssionFactor()), static_cast<GLsizei>(rect.GetWidth() * GetCompresssionFactor()),
static_cast<GLsizei>(rect.GetHeight() * GetCompresssionFactor()), 0, static_cast<GLsizei>(rect.GetHeight() * GetCompresssionFactor()), 0,
size, &gl_buffer[buffer_offset]); static_cast<GLsizei>(size), &gl_buffer[buffer_offset]);
} else { } else {
glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, static_cast<GLsizei>(rect.GetWidth()), glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, static_cast<GLsizei>(rect.GetWidth()),
static_cast<GLsizei>(rect.GetHeight()), tuple.format, tuple.type, static_cast<GLsizei>(rect.GetHeight()), tuple.format, tuple.type,

View file

@ -535,7 +535,7 @@ private:
*/ */
void SetRegister(const Register& reg, u64 elem, const std::string& value, void SetRegister(const Register& reg, u64 elem, const std::string& value,
u64 dest_num_components, u64 value_num_components, u64 dest_elem) { u64 dest_num_components, u64 value_num_components, u64 dest_elem) {
std::string dest = GetRegister(reg, dest_elem); std::string dest = GetRegister(reg, static_cast<u32>(dest_elem));
if (dest_num_components > 1) { if (dest_num_components > 1) {
dest += GetSwizzle(elem); dest += GetSwizzle(elem);
} }

View file

@ -38,8 +38,8 @@ void MaxwellUniformData::SetFromRegs(const Maxwell3D::State::ShaderStageInfo& sh
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
// TODO(bunnei): Support more than one viewport // TODO(bunnei): Support more than one viewport
viewport_flip[0] = regs.viewport_transform[0].scale_x < 0.0 ? -1.0 : 1.0; viewport_flip[0] = regs.viewport_transform[0].scale_x < 0.0 ? -1.0f : 1.0f;
viewport_flip[1] = regs.viewport_transform[0].scale_y < 0.0 ? -1.0 : 1.0; viewport_flip[1] = regs.viewport_transform[0].scale_y < 0.0 ? -1.0f : 1.0f;
} }
} // namespace GLShader } // namespace GLShader

View file

@ -196,13 +196,13 @@ void OpenGLState::Apply() const {
} }
// Textures // Textures
for (size_t i = 0; i < std::size(texture_units); ++i) { for (int i = 0; i < std::size(texture_units); ++i) {
if (texture_units[i].texture_2d != cur_state.texture_units[i].texture_2d) { if (texture_units[i].texture_2d != cur_state.texture_units[i].texture_2d) {
glActiveTexture(TextureUnits::MaxwellTexture(i).Enum()); glActiveTexture(TextureUnits::MaxwellTexture(i).Enum());
glBindTexture(GL_TEXTURE_2D, texture_units[i].texture_2d); glBindTexture(GL_TEXTURE_2D, texture_units[i].texture_2d);
} }
if (texture_units[i].sampler != cur_state.texture_units[i].sampler) { if (texture_units[i].sampler != cur_state.texture_units[i].sampler) {
glBindSampler(i, texture_units[i].sampler); glBindSampler(static_cast<GLuint>(i), texture_units[i].sampler);
} }
// Update the texture swizzle // Update the texture swizzle
if (texture_units[i].swizzle.r != cur_state.texture_units[i].swizzle.r || if (texture_units[i].swizzle.r != cur_state.texture_units[i].swizzle.r ||