From ad48259d7eac63f3967459d18980e9dcc38fd0f6 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 24 Jan 2021 04:03:36 -0300 Subject: maxwell_to_vk: Silence -Wextra warnings about using different enum types --- src/video_core/renderer_vulkan/maxwell_to_vk.cpp | 2 +- src/video_core/renderer_vulkan/maxwell_to_vk.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index ca7c2c579..1062bf5a9 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp @@ -671,7 +671,7 @@ VkFrontFace FrontFace(Maxwell::FrontFace front_face) { return {}; } -VkCullModeFlags CullFace(Maxwell::CullFace cull_face) { +VkCullModeFlagBits CullFace(Maxwell::CullFace cull_face) { switch (cull_face) { case Maxwell::CullFace::Front: return VK_CULL_MODE_FRONT_BIT; diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.h b/src/video_core/renderer_vulkan/maxwell_to_vk.h index 537969840..c1494f554 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.h +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.h @@ -55,7 +55,7 @@ VkBlendFactor BlendFactor(Maxwell::Blend::Factor factor); VkFrontFace FrontFace(Maxwell::FrontFace front_face); -VkCullModeFlags CullFace(Maxwell::CullFace cull_face); +VkCullModeFlagBits CullFace(Maxwell::CullFace cull_face); VkComponentSwizzle SwizzleSource(Tegra::Texture::SwizzleSource swizzle); -- cgit v1.2.3 From 80a673a27f059737a334692ba71cb566ba017cfc Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 24 Jan 2021 04:31:41 -0300 Subject: maxwell_3d: Silence array bounds warnings --- src/video_core/engines/maxwell_3d.cpp | 68 +++++++++++++++++------------------ src/video_core/engines/maxwell_3d.h | 2 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 9be651e24..116ad1722 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -179,22 +179,22 @@ void Maxwell3D::ProcessMethodCall(u32 method, u32 argument, u32 nonshadow_argume return ProcessMacroBind(argument); case MAXWELL3D_REG_INDEX(firmware[4]): return ProcessFirmwareCall4(); - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[1]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[2]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[3]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[4]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[5]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[6]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[7]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[8]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[9]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[10]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[11]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[12]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[13]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[14]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[15]): + case MAXWELL3D_REG_INDEX(const_buffer.cb_data): + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 1: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 2: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 3: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 4: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 5: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 6: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 7: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 8: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 9: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 10: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 11: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 12: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 13: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 14: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 15: return StartCBData(method); case MAXWELL3D_REG_INDEX(cb_bind[0]): return ProcessCBBind(0); @@ -287,22 +287,22 @@ void Maxwell3D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, return; } switch (method) { - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[1]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[2]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[3]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[4]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[5]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[6]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[7]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[8]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[9]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[10]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[11]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[12]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[13]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[14]): - case MAXWELL3D_REG_INDEX(const_buffer.cb_data[15]): + case MAXWELL3D_REG_INDEX(const_buffer.cb_data): + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 1: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 2: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 3: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 4: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 5: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 6: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 7: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 8: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 9: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 10: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 11: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 12: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 13: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 14: + case MAXWELL3D_REG_INDEX(const_buffer.cb_data) + 15: ProcessCBMultiData(method, base_start, amount); break; default: @@ -592,7 +592,7 @@ void Maxwell3D::ProcessCBData(u32 value) { } void Maxwell3D::StartCBData(u32 method) { - constexpr u32 first_cb_data = MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]); + constexpr u32 first_cb_data = MAXWELL3D_REG_INDEX(const_buffer.cb_data); cb_data_state.start_pos = regs.const_buffer.cb_pos; cb_data_state.id = method - first_cb_data; cb_data_state.current = method; @@ -605,7 +605,7 @@ void Maxwell3D::ProcessCBMultiData(u32 method, const u32* start_base, u32 amount if (cb_data_state.current != null_cb_data) { FinishCBData(); } - constexpr u32 first_cb_data = MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]); + constexpr u32 first_cb_data = MAXWELL3D_REG_INDEX(const_buffer.cb_data); cb_data_state.start_pos = regs.const_buffer.cb_pos; cb_data_state.id = method - first_cb_data; cb_data_state.current = method; diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 326b32228..002d1b3f9 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -1337,7 +1337,7 @@ public: u32 cb_address_high; u32 cb_address_low; u32 cb_pos; - u32 cb_data[NumCBData]; + std::array cb_data; GPUVAddr BufferAddress() const { return static_cast( -- cgit v1.2.3 From 1b76e7e890b92dcb549e2cfc3d7ee895fcd33598 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 24 Jan 2021 04:32:19 -0300 Subject: video_core: Silence -Wmissing-field-initializers warnings --- .../renderer_vulkan/vk_graphics_pipeline.cpp | 1 + src/video_core/renderer_vulkan/vk_texture_cache.h | 2 +- src/video_core/shader/async_shaders.cpp | 18 +++++++ src/video_core/texture_cache/util.cpp | 59 +++++++++++++--------- .../vulkan_common/vulkan_debug_callback.cpp | 1 + 5 files changed, 56 insertions(+), 25 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index a5214d0bc..485cb43f2 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -181,6 +181,7 @@ std::vector VKGraphicsPipeline::CreateShaderModules( .pNext = nullptr, .flags = 0, .codeSize = 0, + .pCode = nullptr, }; std::vector shader_modules; diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index a55d405d1..8d29361a1 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h @@ -72,7 +72,7 @@ struct TextureCacheRuntime { MemoryAllocator& memory_allocator; StagingBufferPool& staging_buffer_pool; BlitImageHelper& blit_image_helper; - std::unordered_map renderpass_cache; + std::unordered_map renderpass_cache{}; void Finish(); diff --git a/src/video_core/shader/async_shaders.cpp b/src/video_core/shader/async_shaders.cpp index 9707136e9..3b40db9bc 100644 --- a/src/video_core/shader/async_shaders.cpp +++ b/src/video_core/shader/async_shaders.cpp @@ -129,6 +129,15 @@ void AsyncShaders::QueueOpenGLShader(const OpenGL::Device& device, .compiler_settings = compiler_settings, .registry = registry, .cpu_address = cpu_addr, + .pp_cache = nullptr, + .vk_device = nullptr, + .scheduler = nullptr, + .descriptor_pool = nullptr, + .update_descriptor_queue = nullptr, + .bindings{}, + .program{}, + .key{}, + .num_color_buffers = 0, }); cv.notify_one(); } @@ -143,6 +152,15 @@ void AsyncShaders::QueueVulkanShader(Vulkan::VKPipelineCache* pp_cache, std::unique_lock lock(queue_mutex); pending_queue.push({ .backend = Backend::Vulkan, + .device = nullptr, + .shader_type{}, + .uid = 0, + .code{}, + .code_b{}, + .main_offset = 0, + .compiler_settings{}, + .registry{}, + .cpu_address = 0, .pp_cache = pp_cache, .vk_device = &device, .scheduler = &scheduler, diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp index b23424523..bb2cdef81 100644 --- a/src/video_core/texture_cache/util.cpp +++ b/src/video_core/texture_cache/util.cpp @@ -1193,25 +1193,35 @@ u32 MapSizeBytes(const ImageBase& image) { } } -using P = PixelFormat; - -static_assert(CalculateLevelSize(LevelInfo{{1920, 1080}, {0, 2, 0}, {1, 1}, 2, 0}, 0) == 0x7f8000); -static_assert(CalculateLevelSize(LevelInfo{{32, 32}, {0, 0, 4}, {1, 1}, 4, 0}, 0) == 0x4000); - -static_assert(CalculateLevelOffset(P::R8_SINT, {1920, 1080}, {0, 2}, 1, 0, 7) == 0x2afc00); -static_assert(CalculateLevelOffset(P::ASTC_2D_12X12_UNORM, {8192, 4096}, {0, 2}, 1, 0, 12) == - 0x50d200); - -static_assert(CalculateLevelOffset(P::A8B8G8R8_UNORM, {1024, 1024}, {0, 4}, 1, 0, 0) == 0); -static_assert(CalculateLevelOffset(P::A8B8G8R8_UNORM, {1024, 1024}, {0, 4}, 1, 0, 1) == 0x400000); -static_assert(CalculateLevelOffset(P::A8B8G8R8_UNORM, {1024, 1024}, {0, 4}, 1, 0, 2) == 0x500000); -static_assert(CalculateLevelOffset(P::A8B8G8R8_UNORM, {1024, 1024}, {0, 4}, 1, 0, 3) == 0x540000); -static_assert(CalculateLevelOffset(P::A8B8G8R8_UNORM, {1024, 1024}, {0, 4}, 1, 0, 4) == 0x550000); -static_assert(CalculateLevelOffset(P::A8B8G8R8_UNORM, {1024, 1024}, {0, 4}, 1, 0, 5) == 0x554000); -static_assert(CalculateLevelOffset(P::A8B8G8R8_UNORM, {1024, 1024}, {0, 4}, 1, 0, 6) == 0x555000); -static_assert(CalculateLevelOffset(P::A8B8G8R8_UNORM, {1024, 1024}, {0, 4}, 1, 0, 7) == 0x555400); -static_assert(CalculateLevelOffset(P::A8B8G8R8_UNORM, {1024, 1024}, {0, 4}, 1, 0, 8) == 0x555600); -static_assert(CalculateLevelOffset(P::A8B8G8R8_UNORM, {1024, 1024}, {0, 4}, 1, 0, 9) == 0x555800); +static_assert(CalculateLevelSize(LevelInfo{{1920, 1080, 1}, {0, 2, 0}, {1, 1}, 2, 0}, 0) == + 0x7f8000); +static_assert(CalculateLevelSize(LevelInfo{{32, 32, 1}, {0, 0, 4}, {1, 1}, 4, 0}, 0) == 0x4000); + +static_assert(CalculateLevelOffset(PixelFormat::R8_SINT, {1920, 1080, 1}, {0, 2, 0}, 1, 0, 7) == + 0x2afc00); +static_assert(CalculateLevelOffset(PixelFormat::ASTC_2D_12X12_UNORM, {8192, 4096, 1}, {0, 2, 0}, 1, + 0, 12) == 0x50d200); + +static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0, + 0) == 0); +static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0, + 1) == 0x400000); +static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0, + 2) == 0x500000); +static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0, + 3) == 0x540000); +static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0, + 4) == 0x550000); +static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0, + 5) == 0x554000); +static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0, + 6) == 0x555000); +static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0, + 7) == 0x555400); +static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0, + 8) == 0x555600); +static_assert(CalculateLevelOffset(PixelFormat::A8B8G8R8_UNORM, {1024, 1024, 1}, {0, 4, 0}, 1, 0, + 9) == 0x555800); constexpr u32 ValidateLayerSize(PixelFormat format, u32 width, u32 height, u32 block_height, u32 tile_width_spacing, u32 level) { @@ -1221,13 +1231,14 @@ constexpr u32 ValidateLayerSize(PixelFormat format, u32 width, u32 height, u32 b return AlignLayerSize(offset, size, block, DefaultBlockHeight(format), tile_width_spacing); } -static_assert(ValidateLayerSize(P::ASTC_2D_12X12_UNORM, 8192, 4096, 2, 0, 12) == 0x50d800); -static_assert(ValidateLayerSize(P::A8B8G8R8_UNORM, 1024, 1024, 2, 0, 10) == 0x556000); -static_assert(ValidateLayerSize(P::BC3_UNORM, 128, 128, 2, 0, 8) == 0x6000); +static_assert(ValidateLayerSize(PixelFormat::ASTC_2D_12X12_UNORM, 8192, 4096, 2, 0, 12) == + 0x50d800); +static_assert(ValidateLayerSize(PixelFormat::A8B8G8R8_UNORM, 1024, 1024, 2, 0, 10) == 0x556000); +static_assert(ValidateLayerSize(PixelFormat::BC3_UNORM, 128, 128, 2, 0, 8) == 0x6000); -static_assert(ValidateLayerSize(P::A8B8G8R8_UNORM, 518, 572, 4, 3, 1) == 0x190000, +static_assert(ValidateLayerSize(PixelFormat::A8B8G8R8_UNORM, 518, 572, 4, 3, 1) == 0x190000, "Tile width spacing is not working"); -static_assert(ValidateLayerSize(P::BC5_UNORM, 1024, 1024, 3, 4, 11) == 0x160000, +static_assert(ValidateLayerSize(PixelFormat::BC5_UNORM, 1024, 1024, 3, 4, 11) == 0x160000, "Compressed tile width spacing is not working"); } // namespace VideoCommon diff --git a/src/video_core/vulkan_common/vulkan_debug_callback.cpp b/src/video_core/vulkan_common/vulkan_debug_callback.cpp index ea7af8ad4..5c64c9bf7 100644 --- a/src/video_core/vulkan_common/vulkan_debug_callback.cpp +++ b/src/video_core/vulkan_common/vulkan_debug_callback.cpp @@ -39,6 +39,7 @@ vk::DebugUtilsMessenger CreateDebugCallback(const vk::Instance& instance) { VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT, .pfnUserCallback = Callback, + .pUserData = nullptr, }); } -- cgit v1.2.3 From cc4335a9c61466096e351542f584919a86ba5ea7 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 24 Jan 2021 04:42:41 -0300 Subject: video_core/cmake: Enforce -Warray-bounds and -Wmissing-field-initializers --- src/video_core/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index bb1f8491f..8bf6eba0e 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -308,8 +308,10 @@ if (MSVC) ) else() target_compile_options(video_core PRIVATE + -Werror=array-bounds -Werror=conversion -Wno-error=sign-conversion + -Werror=missing-field-initializers -Werror=pessimizing-move -Werror=redundant-move -Werror=shadow -- cgit v1.2.3 From 748551dafba54ae0c9a43946dbe50c878a1be17d Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 24 Jan 2021 17:31:29 -0300 Subject: cmake: Enforce -Warray-bounds and -Wmissing-field-initializers globally --- src/CMakeLists.txt | 2 ++ src/video_core/CMakeLists.txt | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 478246b6f..1cfd3bbc9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,8 +64,10 @@ if (MSVC) else() add_compile_options( -Wall + -Werror=array-bounds -Werror=implicit-fallthrough -Werror=missing-declarations + -Werror=missing-field-initializers -Werror=reorder -Werror=switch -Werror=uninitialized diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 8bf6eba0e..bb1f8491f 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -308,10 +308,8 @@ if (MSVC) ) else() target_compile_options(video_core PRIVATE - -Werror=array-bounds -Werror=conversion -Wno-error=sign-conversion - -Werror=missing-field-initializers -Werror=pessimizing-move -Werror=redundant-move -Werror=shadow -- cgit v1.2.3