fix(vulkan): address compiler warnings for Linux

- Fix variable shadowing in ShaderManager constructor by renaming parameter
- Remove unused variables in vk_texture_manager.cpp to avoid warnings
- Fix int conversion warning in syscall return value

These changes fix build errors when using certain optimized compile flags for Linux.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron 2025-04-18 14:24:47 +10:00
parent f1e169e060
commit 3205c9b691
3 changed files with 21 additions and 20 deletions

View File

@ -242,7 +242,7 @@ void AsyncCompileShader(const Device& device, const std::string& shader_path,
}).detach(); }).detach();
} }
ShaderManager::ShaderManager(const Device& device) : device(device) { ShaderManager::ShaderManager(const Device& device_) : device(device_) {
// Initialize command queue system // Initialize command queue system
InitializeCommandQueue(); InitializeCommandQueue();
} }

View File

@ -116,26 +116,27 @@ vk::Image TextureManager::LoadTexture(const std::string& texture_path) {
vk::Image TextureManager::CreateDefaultTexture() { vk::Image TextureManager::CreateDefaultTexture() {
// Create a small default texture (1x1 pixel) to use as a fallback // Create a small default texture (1x1 pixel) to use as a fallback
const VkExtent2D extent{1, 1}; // const VkExtent2D extent{1, 1};
// Create image // Create image
const VkImageCreateInfo image_ci{ // Avoid unused variable warning by commenting out the unused struct
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkImageCreateInfo image_ci{
.pNext = nullptr, // .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.flags = 0, // .pNext = nullptr,
.imageType = VK_IMAGE_TYPE_2D, // .flags = 0,
.format = texture_format, // .imageType = VK_IMAGE_TYPE_2D,
.extent = {extent.width, extent.height, 1}, // .format = texture_format,
.mipLevels = 1, // .extent = {extent.width, extent.height, 1},
.arrayLayers = 1, // .mipLevels = 1,
.samples = VK_SAMPLE_COUNT_1_BIT, // .arrayLayers = 1,
.tiling = VK_IMAGE_TILING_OPTIMAL, // .samples = VK_SAMPLE_COUNT_1_BIT,
.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, // .tiling = VK_IMAGE_TILING_OPTIMAL,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE, // .usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
.queueFamilyIndexCount = 0, // .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
.pQueueFamilyIndices = nullptr, // .queueFamilyIndexCount = 0,
.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED, // .pQueueFamilyIndices = nullptr,
}; // .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
// };
// TODO: create an actual VkImage [ZEP] // TODO: create an actual VkImage [ZEP]
LOG_INFO(Render_Vulkan, "Created default fallback texture"); LOG_INFO(Render_Vulkan, "Created default fallback texture");

View File

@ -205,7 +205,7 @@ void FaultManagedAllocator::ExceptionHandlerThread() {
void FaultManagedAllocator::Initialize(void* base, size_t size) { void FaultManagedAllocator::Initialize(void* base, size_t size) {
#if defined(__linux__) || defined(__ANDROID__) #if defined(__linux__) || defined(__ANDROID__)
uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK); uffd = static_cast<int>(syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK));
if (uffd < 0) { if (uffd < 0) {
LOG_ERROR(Render_Vulkan, "Failed to create userfaultfd, fault handling disabled"); LOG_ERROR(Render_Vulkan, "Failed to create userfaultfd, fault handling disabled");
return; return;