mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-26 00:49:00 +02:00
[vk] Another try with Depth/Stencil handling
This commit is contained in:
parent
55d799da82
commit
cd9f23aed1
1 changed files with 16 additions and 4 deletions
|
|
@ -876,12 +876,14 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched
|
||||||
}
|
}
|
||||||
for (size_t index_a = 0; index_a < VideoCore::Surface::MaxPixelFormat; index_a++) {
|
for (size_t index_a = 0; index_a < VideoCore::Surface::MaxPixelFormat; index_a++) {
|
||||||
const auto image_format = static_cast<PixelFormat>(index_a);
|
const auto image_format = static_cast<PixelFormat>(index_a);
|
||||||
|
const auto image_surface_type = VideoCore::Surface::GetFormatType(image_format);
|
||||||
|
auto& image_view_formats = view_formats[index_a];
|
||||||
const auto image_block_width = DefaultBlockWidth(image_format);
|
const auto image_block_width = DefaultBlockWidth(image_format);
|
||||||
const auto image_block_height = DefaultBlockHeight(image_format);
|
const auto image_block_height = DefaultBlockHeight(image_format);
|
||||||
const auto image_bytes_per_block = BytesPerBlock(image_format);
|
const auto image_bytes_per_block = BytesPerBlock(image_format);
|
||||||
bool needs_block_view = false;
|
bool needs_block_view = false;
|
||||||
if (IsPixelFormatASTC(image_format) && !device.IsOptimalAstcSupported()) {
|
if (IsPixelFormatASTC(image_format) && !device.IsOptimalAstcSupported()) {
|
||||||
view_formats[index_a].push_back(VK_FORMAT_A8B8G8R8_UNORM_PACK32);
|
image_view_formats.push_back(VK_FORMAT_A8B8G8R8_UNORM_PACK32);
|
||||||
needs_block_view = true;
|
needs_block_view = true;
|
||||||
}
|
}
|
||||||
for (size_t index_b = 0; index_b < VideoCore::Surface::MaxPixelFormat; index_b++) {
|
for (size_t index_b = 0; index_b < VideoCore::Surface::MaxPixelFormat; index_b++) {
|
||||||
|
|
@ -889,9 +891,17 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched
|
||||||
if (!VideoCore::Surface::IsViewCompatible(image_format, view_format, false, true)) {
|
if (!VideoCore::Surface::IsViewCompatible(image_format, view_format, false, true)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (image_surface_type == SurfaceType::DepthStencil &&
|
||||||
|
VideoCore::Surface::GetFormatType(view_format) == SurfaceType::Stencil &&
|
||||||
|
view_format != image_format) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const auto view_info =
|
const auto view_info =
|
||||||
MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, true, view_format);
|
MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, true, view_format);
|
||||||
view_formats[index_a].push_back(view_info.format);
|
if (std::find(image_view_formats.begin(), image_view_formats.end(), view_info.format) ==
|
||||||
|
image_view_formats.end()) {
|
||||||
|
image_view_formats.push_back(view_info.format);
|
||||||
|
}
|
||||||
if (!needs_block_view) {
|
if (!needs_block_view) {
|
||||||
const bool different_block = image_bytes_per_block != BytesPerBlock(view_format) ||
|
const bool different_block = image_bytes_per_block != BytesPerBlock(view_format) ||
|
||||||
image_block_width != DefaultBlockWidth(view_format) ||
|
image_block_width != DefaultBlockWidth(view_format) ||
|
||||||
|
|
@ -2393,8 +2403,10 @@ VkImageView ImageView::StencilView(Shader::TextureType texture_type) {
|
||||||
return *view;
|
return *view;
|
||||||
}
|
}
|
||||||
const auto surface_type = VideoCore::Surface::GetFormatType(format);
|
const auto surface_type = VideoCore::Surface::GetFormatType(format);
|
||||||
const PixelFormat view_format =
|
PixelFormat view_format = format;
|
||||||
surface_type == SurfaceType::DepthStencil ? PixelFormat::S8_UINT : format;
|
if (surface_type == SurfaceType::Stencil) {
|
||||||
|
view_format = PixelFormat::S8_UINT;
|
||||||
|
}
|
||||||
const auto& info = MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, true, view_format);
|
const auto& info = MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, true, view_format);
|
||||||
view = MakeView(info.format, VK_IMAGE_ASPECT_STENCIL_BIT, texture_type);
|
view = MakeView(info.format, VK_IMAGE_ASPECT_STENCIL_BIT, texture_type);
|
||||||
return *view;
|
return *view;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue