mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-08-25 11:07:19 +02:00
renderer_opengl: Implement S8_UINT stencil format
This commit is contained in:
parent
2348eb41f3
commit
6dd6dc046c
@ -148,6 +148,8 @@ GLenum AttachmentType(PixelFormat format) {
|
|||||||
switch (const SurfaceType type = VideoCore::Surface::GetFormatType(format); type) {
|
switch (const SurfaceType type = VideoCore::Surface::GetFormatType(format); type) {
|
||||||
case SurfaceType::Depth:
|
case SurfaceType::Depth:
|
||||||
return GL_DEPTH_ATTACHMENT;
|
return GL_DEPTH_ATTACHMENT;
|
||||||
|
case SurfaceType::Stencil:
|
||||||
|
return GL_STENCIL_ATTACHMENT;
|
||||||
case SurfaceType::DepthStencil:
|
case SurfaceType::DepthStencil:
|
||||||
return GL_DEPTH_STENCIL_ATTACHMENT;
|
return GL_DEPTH_STENCIL_ATTACHMENT;
|
||||||
default:
|
default:
|
||||||
@ -897,6 +899,8 @@ void Image::Scale(bool up_scale) {
|
|||||||
return GL_COLOR_ATTACHMENT0;
|
return GL_COLOR_ATTACHMENT0;
|
||||||
case SurfaceType::Depth:
|
case SurfaceType::Depth:
|
||||||
return GL_DEPTH_ATTACHMENT;
|
return GL_DEPTH_ATTACHMENT;
|
||||||
|
case SurfaceType::Stencil:
|
||||||
|
return GL_STENCIL_ATTACHMENT;
|
||||||
case SurfaceType::DepthStencil:
|
case SurfaceType::DepthStencil:
|
||||||
return GL_DEPTH_STENCIL_ATTACHMENT;
|
return GL_DEPTH_STENCIL_ATTACHMENT;
|
||||||
default:
|
default:
|
||||||
@ -910,8 +914,10 @@ void Image::Scale(bool up_scale) {
|
|||||||
return GL_COLOR_BUFFER_BIT;
|
return GL_COLOR_BUFFER_BIT;
|
||||||
case SurfaceType::Depth:
|
case SurfaceType::Depth:
|
||||||
return GL_DEPTH_BUFFER_BIT;
|
return GL_DEPTH_BUFFER_BIT;
|
||||||
|
case SurfaceType::Stencil:
|
||||||
|
return GL_STENCIL_BUFFER_BIT;
|
||||||
case SurfaceType::DepthStencil:
|
case SurfaceType::DepthStencil:
|
||||||
return GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT;
|
return GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return GL_COLOR_BUFFER_BIT;
|
return GL_COLOR_BUFFER_BIT;
|
||||||
@ -923,8 +929,10 @@ void Image::Scale(bool up_scale) {
|
|||||||
return 0;
|
return 0;
|
||||||
case SurfaceType::Depth:
|
case SurfaceType::Depth:
|
||||||
return 1;
|
return 1;
|
||||||
case SurfaceType::DepthStencil:
|
case SurfaceType::Stencil:
|
||||||
return 2;
|
return 2;
|
||||||
|
case SurfaceType::DepthStencil:
|
||||||
|
return 3;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return 0;
|
return 0;
|
||||||
@ -1254,10 +1262,20 @@ Framebuffer::Framebuffer(TextureCacheRuntime& runtime, std::span<ImageView*, NUM
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (const ImageView* const image_view = depth_buffer; image_view) {
|
if (const ImageView* const image_view = depth_buffer; image_view) {
|
||||||
if (GetFormatType(image_view->format) == SurfaceType::DepthStencil) {
|
switch (GetFormatType(image_view->format)) {
|
||||||
buffer_bits |= GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
|
case SurfaceType::Depth:
|
||||||
} else {
|
|
||||||
buffer_bits |= GL_DEPTH_BUFFER_BIT;
|
buffer_bits |= GL_DEPTH_BUFFER_BIT;
|
||||||
|
break;
|
||||||
|
case SurfaceType::Stencil:
|
||||||
|
buffer_bits |= GL_STENCIL_BUFFER_BIT;
|
||||||
|
break;
|
||||||
|
case SurfaceType::DepthStencil:
|
||||||
|
buffer_bits |= GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
buffer_bits |= GL_DEPTH_BUFFER_BIT;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
const GLenum attachment = AttachmentType(image_view->format);
|
const GLenum attachment = AttachmentType(image_view->format);
|
||||||
AttachTexture(handle, attachment, image_view);
|
AttachTexture(handle, attachment, image_view);
|
||||||
|
@ -162,8 +162,8 @@ private:
|
|||||||
|
|
||||||
std::array<GLuint, Shader::NUM_TEXTURE_TYPES> null_image_views{};
|
std::array<GLuint, Shader::NUM_TEXTURE_TYPES> null_image_views{};
|
||||||
|
|
||||||
std::array<OGLFramebuffer, 3> rescale_draw_fbos;
|
std::array<OGLFramebuffer, 4> rescale_draw_fbos;
|
||||||
std::array<OGLFramebuffer, 3> rescale_read_fbos;
|
std::array<OGLFramebuffer, 4> rescale_read_fbos;
|
||||||
const Settings::ResolutionScalingInfo& resolution;
|
const Settings::ResolutionScalingInfo& resolution;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,6 +108,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB
|
|||||||
{GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT
|
{GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT
|
||||||
{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT
|
{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT
|
||||||
{GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM
|
{GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM
|
||||||
|
{GL_STENCIL_INDEX8, GL_STENCIL, GL_UNSIGNED_BYTE}, // S8_UINT
|
||||||
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT
|
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT
|
||||||
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM
|
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM
|
||||||
{GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL,
|
{GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL,
|
||||||
|
Loading…
Reference in New Issue
Block a user