mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-17 12:27:03 +02:00
[vk] Added support for Stencil component type in texture handling
This commit is contained in:
parent
5b1252f3a2
commit
3cf1a41555
3 changed files with 21 additions and 4 deletions
|
|
@ -202,8 +202,9 @@ Id TextureColorResultType(EmitContext& ctx, const TextureDefinition& def) {
|
||||||
case SamplerComponentType::Depth:
|
case SamplerComponentType::Depth:
|
||||||
return ctx.F32[4];
|
return ctx.F32[4];
|
||||||
case SamplerComponentType::Sint:
|
case SamplerComponentType::Sint:
|
||||||
case SamplerComponentType::Stencil:
|
|
||||||
return ctx.S32[4];
|
return ctx.S32[4];
|
||||||
|
case SamplerComponentType::Stencil:
|
||||||
|
return ctx.U32[4];
|
||||||
case SamplerComponentType::Uint:
|
case SamplerComponentType::Uint:
|
||||||
return ctx.U32[4];
|
return ctx.U32[4];
|
||||||
}
|
}
|
||||||
|
|
@ -216,8 +217,9 @@ Id TextureSampleResultToFloat(EmitContext& ctx, const TextureDefinition& def, Id
|
||||||
case SamplerComponentType::Depth:
|
case SamplerComponentType::Depth:
|
||||||
return color;
|
return color;
|
||||||
case SamplerComponentType::Sint:
|
case SamplerComponentType::Sint:
|
||||||
case SamplerComponentType::Stencil:
|
|
||||||
return ctx.OpConvertSToF(ctx.F32[4], color);
|
return ctx.OpConvertSToF(ctx.F32[4], color);
|
||||||
|
case SamplerComponentType::Stencil:
|
||||||
|
return ctx.OpConvertUToF(ctx.F32[4], color);
|
||||||
case SamplerComponentType::Uint:
|
case SamplerComponentType::Uint:
|
||||||
return ctx.OpConvertUToF(ctx.F32[4], color);
|
return ctx.OpConvertUToF(ctx.F32[4], color);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,9 @@ Id ComponentScalarType(EmitContext& ctx, SamplerComponentType component_type) {
|
||||||
case SamplerComponentType::Depth:
|
case SamplerComponentType::Depth:
|
||||||
return ctx.F32[1];
|
return ctx.F32[1];
|
||||||
case SamplerComponentType::Sint:
|
case SamplerComponentType::Sint:
|
||||||
case SamplerComponentType::Stencil:
|
|
||||||
return ctx.S32[1];
|
return ctx.S32[1];
|
||||||
|
case SamplerComponentType::Stencil:
|
||||||
|
return ctx.U32[1];
|
||||||
case SamplerComponentType::Uint:
|
case SamplerComponentType::Uint:
|
||||||
return ctx.U32[1];
|
return ctx.U32[1];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -911,6 +911,15 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched
|
||||||
view_formats[index_a].push_back(view_info.format);
|
view_formats[index_a].push_back(view_info.format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (VideoCore::Surface::GetFormatType(image_format) ==
|
||||||
|
VideoCore::Surface::SurfaceType::DepthStencil) {
|
||||||
|
const auto stencil_info = MaxwellToVK::SurfaceFormat(
|
||||||
|
device, FormatType::Optimal, true, PixelFormat::S8_UINT);
|
||||||
|
auto& formats = view_formats[index_a];
|
||||||
|
if (std::ranges::find(formats, stencil_info.format) == formats.end()) {
|
||||||
|
formats.push_back(stencil_info.format);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings::values.gpu_unswizzle_enabled.GetValue()) {
|
if (Settings::values.gpu_unswizzle_enabled.GetValue()) {
|
||||||
|
|
@ -2288,7 +2297,12 @@ VkImageView ImageView::StencilView() {
|
||||||
if (stencil_view) {
|
if (stencil_view) {
|
||||||
return *stencil_view;
|
return *stencil_view;
|
||||||
}
|
}
|
||||||
const auto& info = MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, true, format);
|
PixelFormat view_format = format;
|
||||||
|
if (VideoCore::Surface::GetFormatType(format) ==
|
||||||
|
VideoCore::Surface::SurfaceType::DepthStencil) {
|
||||||
|
view_format = PixelFormat::S8_UINT;
|
||||||
|
}
|
||||||
|
const auto& info = MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, true, view_format);
|
||||||
stencil_view = MakeView(info.format, VK_IMAGE_ASPECT_STENCIL_BIT);
|
stencil_view = MakeView(info.format, VK_IMAGE_ASPECT_STENCIL_BIT);
|
||||||
return *stencil_view;
|
return *stencil_view;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue