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();
}
ShaderManager::ShaderManager(const Device& device) : device(device) {
ShaderManager::ShaderManager(const Device& device_) : device(device_) {
// Initialize command queue system
InitializeCommandQueue();
}

View File

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