mirror of
https://github.com/mikage-emu/mikage-dev.git
synced 2025-02-21 19:49:00 +01:00
Vulkan: Fix validation errors
This commit is contained in:
parent
4ec7cb4a2d
commit
4d538257b1
3 changed files with 12 additions and 6 deletions
|
@ -174,7 +174,7 @@ EmuDisplay::EmuDisplay(spdlog::logger& logger, vk::PhysicalDevice physical_devic
|
|||
1,
|
||||
vk::SampleCountFlagBits::e1,
|
||||
vk::ImageTiling::eOptimal,
|
||||
vk::ImageUsageFlagBits::eTransferSrc | vk::ImageUsageFlagBits::eColorAttachment,
|
||||
vk::ImageUsageFlagBits::eTransferSrc | vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eSampled,
|
||||
vk::SharingMode::eExclusive, // TODO: Probably should be sharing this?
|
||||
0, nullptr, // queue families
|
||||
vk::ImageLayout::eUndefined
|
||||
|
|
|
@ -103,7 +103,7 @@ std::string GenerateFragmentShader(Context& context) {
|
|||
code += "layout(binding = 3) uniform sampler2D sampler2;\n";
|
||||
|
||||
code += "layout(location = 4) in vec4 in_quat;\n";
|
||||
code += "layout(location = 5) in vec3 in_view;\n";
|
||||
code += "layout(location = 5) in vec4 in_view;\n";
|
||||
|
||||
// Lighting lookup tables
|
||||
// NOTE: No Vulkan drivers advertise maxImageDimension1D < 4096... TODO: But actually these are texel buffers now
|
||||
|
@ -157,7 +157,7 @@ std::string GenerateFragmentShader(Context& context) {
|
|||
code += fmt::format("vec4 lit_color_primary = vec4(uniforms.light_global_ambient.rgb, 1.0);\n"); // TODO: Should be a uvec4. TODO: Should this be enabled even if lighting is globally off?
|
||||
code += fmt::format("uvec4 lit_color_secondary = uvec4(0, 0, 0, 255);\n");
|
||||
|
||||
code += fmt::format("vec3 view = normalize(in_view);\n");
|
||||
code += fmt::format("vec3 view = normalize(in_view.xyz);\n");
|
||||
|
||||
// (TODO: Handle opposite quaternion case)
|
||||
// TODO: To support bump mapping, a generic quaternion transform must be implemented here
|
||||
|
@ -232,7 +232,7 @@ std::string GenerateFragmentShader(Context& context) {
|
|||
// TODO: Should the normalized view be added here? Test this!
|
||||
// NOTE: Nano Assault uses a really silly light vector (-10000, 0, 2500) on the title screen, so it seems safe to assume this is unconditionally normalized
|
||||
code += fmt::format("vec3 light_vector = normalize(uniforms.lights[{}].diffuse_dir.rgb{});\n",
|
||||
light_index, light_config.config.is_directional() ? "" : " + in_view");
|
||||
light_index, light_config.config.is_directional() ? "" : " + in_view.xyz");
|
||||
|
||||
code += fmt::format("vec3 half_vector = view + light_vector;\n");
|
||||
code += fmt::format("float half_vector_length_sq = dot(half_vector, half_vector);\n");
|
||||
|
|
|
@ -59,11 +59,10 @@ bool IsRenderDocActive() {
|
|||
return is_active;
|
||||
}
|
||||
|
||||
VulkanDeviceManager::VulkanDeviceManager(VulkanInstanceManager& instance, spdlog::logger&, vk::SurfaceKHR surface, bool is_wayland) {
|
||||
VulkanDeviceManager::VulkanDeviceManager(VulkanInstanceManager& instance, spdlog::logger& logger, vk::SurfaceKHR surface, bool is_wayland) {
|
||||
physical_device = std::invoke([&]() {
|
||||
auto physical_devices = instance.instance->enumeratePhysicalDevices();
|
||||
for (auto& phys_device : physical_devices) {
|
||||
// auto features = phys_device.getFeatures();
|
||||
auto properties = phys_device.getProperties();
|
||||
std::cerr << "Found device: \"" << properties.deviceName << "\"" << std::endl;
|
||||
}
|
||||
|
@ -168,7 +167,14 @@ VulkanDeviceManager::VulkanDeviceManager(VulkanInstanceManager& instance, spdlog
|
|||
VULKAN_HPP_DEFAULT_DISPATCHER.vkCmdDebugMarkerEndEXT = nullptr;
|
||||
}
|
||||
|
||||
auto supported_features = physical_device.getFeatures();
|
||||
auto features = vk::PhysicalDeviceFeatures { };
|
||||
if (supported_features.logicOp) {
|
||||
features.logicOp = true;
|
||||
} else {
|
||||
// TODO: Implement fallback
|
||||
logger.warn("Warning: GPU driver does not support logic operations.");
|
||||
}
|
||||
|
||||
vk::DeviceCreateInfo info { vk::DeviceCreateFlagBits { },
|
||||
static_cast<uint32_t>(queue_info.size()), queue_info.data(),
|
||||
|
|
Loading…
Add table
Reference in a new issue