Skip to content

Commit

Permalink
[Vulkan] Non-seamless cube map filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Triang3l committed May 5, 2024
1 parent e9f7a8b commit a90f83d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/xenia/gpu/gpu_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ DEFINE_bool(
"the real reason why they're invalid is found.",
"GPU");

DEFINE_bool(
non_seamless_cube_map, true,
"Disable filtering between cube map faces near edges where possible "
"(Vulkan with VK_EXT_non_seamless_cube_map) to reproduce the Direct3D 9 "
"behavior.",
"GPU");

// Extremely bright screen borders in 4D5307E6.
// Reading between texels with half-pixel offset in 58410954.
DEFINE_bool(
Expand Down
2 changes: 2 additions & 0 deletions src/xenia/gpu/gpu_flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ DECLARE_bool(vsync);

DECLARE_bool(gpu_allow_invalid_fetch_constants);

DECLARE_bool(non_seamless_cube_map);

DECLARE_bool(half_pixel_offset);

DECLARE_int32(query_occlusion_fake_sample_count);
Expand Down
9 changes: 6 additions & 3 deletions src/xenia/gpu/vulkan/vulkan_texture_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
#include "xenia/base/profiling.h"
#include "xenia/gpu/gpu_flags.h"
#include "xenia/gpu/texture_info.h"
#include "xenia/gpu/texture_util.h"
#include "xenia/gpu/vulkan/deferred_command_buffer.h"
Expand Down Expand Up @@ -760,9 +761,11 @@ VkSampler VulkanTextureCache::UseSampler(SamplerParameters parameters,
// GetSamplerParameters.
VkSamplerCreateInfo sampler_create_info = {};
sampler_create_info.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
// TODO(Triang3l): VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT if
// VK_EXT_non_seamless_cube_map and the nonSeamlessCubeMap feature are
// supported.
if (provider.device_info().nonSeamlessCubeMap &&
cvars::non_seamless_cube_map) {
sampler_create_info.flags |=
VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT;
}
sampler_create_info.magFilter =
parameters.mag_linear ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
sampler_create_info.minFilter =
Expand Down

0 comments on commit a90f83d

Please sign in to comment.