diff options
| author | 2021-11-19 01:16:49 -0800 | |
|---|---|---|
| committer | 2021-11-19 01:16:49 -0800 | |
| commit | c45af76ea0f19a76a7fa99e37d296aa2fabf0395 (patch) | |
| tree | ffb440bd7ee2f624164cc7f1f912db7a81ca06c5 /src/video_core/renderer_opengl | |
| parent | Merge pull request #7349 from ameerj/ogl-convert-image (diff) | |
| parent | renderer_vulkan: Implement S8_UINT stencil format (diff) | |
| download | yuzu-c45af76ea0f19a76a7fa99e37d296aa2fabf0395.tar.gz yuzu-c45af76ea0f19a76a7fa99e37d296aa2fabf0395.tar.xz yuzu-c45af76ea0f19a76a7fa99e37d296aa2fabf0395.zip | |
Merge pull request #7357 from Morph1984/s8_uint
video_core: Implement S8_UINT format
Diffstat (limited to 'src/video_core/renderer_opengl')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 26 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.h | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/maxwell_to_gl.h | 1 |
3 files changed, 25 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 6956535e5..9e7850428 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -148,6 +148,8 @@ GLenum AttachmentType(PixelFormat format) { | |||
| 148 | switch (const SurfaceType type = VideoCore::Surface::GetFormatType(format); type) { | 148 | switch (const SurfaceType type = VideoCore::Surface::GetFormatType(format); type) { |
| 149 | case SurfaceType::Depth: | 149 | case SurfaceType::Depth: |
| 150 | return GL_DEPTH_ATTACHMENT; | 150 | return GL_DEPTH_ATTACHMENT; |
| 151 | case SurfaceType::Stencil: | ||
| 152 | return GL_STENCIL_ATTACHMENT; | ||
| 151 | case SurfaceType::DepthStencil: | 153 | case SurfaceType::DepthStencil: |
| 152 | return GL_DEPTH_STENCIL_ATTACHMENT; | 154 | return GL_DEPTH_STENCIL_ATTACHMENT; |
| 153 | default: | 155 | default: |
| @@ -907,6 +909,8 @@ void Image::Scale(bool up_scale) { | |||
| 907 | return GL_COLOR_ATTACHMENT0; | 909 | return GL_COLOR_ATTACHMENT0; |
| 908 | case SurfaceType::Depth: | 910 | case SurfaceType::Depth: |
| 909 | return GL_DEPTH_ATTACHMENT; | 911 | return GL_DEPTH_ATTACHMENT; |
| 912 | case SurfaceType::Stencil: | ||
| 913 | return GL_STENCIL_ATTACHMENT; | ||
| 910 | case SurfaceType::DepthStencil: | 914 | case SurfaceType::DepthStencil: |
| 911 | return GL_DEPTH_STENCIL_ATTACHMENT; | 915 | return GL_DEPTH_STENCIL_ATTACHMENT; |
| 912 | default: | 916 | default: |
| @@ -920,8 +924,10 @@ void Image::Scale(bool up_scale) { | |||
| 920 | return GL_COLOR_BUFFER_BIT; | 924 | return GL_COLOR_BUFFER_BIT; |
| 921 | case SurfaceType::Depth: | 925 | case SurfaceType::Depth: |
| 922 | return GL_DEPTH_BUFFER_BIT; | 926 | return GL_DEPTH_BUFFER_BIT; |
| 927 | case SurfaceType::Stencil: | ||
| 928 | return GL_STENCIL_BUFFER_BIT; | ||
| 923 | case SurfaceType::DepthStencil: | 929 | case SurfaceType::DepthStencil: |
| 924 | return GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT; | 930 | return GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; |
| 925 | default: | 931 | default: |
| 926 | UNREACHABLE(); | 932 | UNREACHABLE(); |
| 927 | return GL_COLOR_BUFFER_BIT; | 933 | return GL_COLOR_BUFFER_BIT; |
| @@ -933,8 +939,10 @@ void Image::Scale(bool up_scale) { | |||
| 933 | return 0; | 939 | return 0; |
| 934 | case SurfaceType::Depth: | 940 | case SurfaceType::Depth: |
| 935 | return 1; | 941 | return 1; |
| 936 | case SurfaceType::DepthStencil: | 942 | case SurfaceType::Stencil: |
| 937 | return 2; | 943 | return 2; |
| 944 | case SurfaceType::DepthStencil: | ||
| 945 | return 3; | ||
| 938 | default: | 946 | default: |
| 939 | UNREACHABLE(); | 947 | UNREACHABLE(); |
| 940 | return 0; | 948 | return 0; |
| @@ -1264,10 +1272,20 @@ Framebuffer::Framebuffer(TextureCacheRuntime& runtime, std::span<ImageView*, NUM | |||
| 1264 | } | 1272 | } |
| 1265 | 1273 | ||
| 1266 | if (const ImageView* const image_view = depth_buffer; image_view) { | 1274 | if (const ImageView* const image_view = depth_buffer; image_view) { |
| 1267 | if (GetFormatType(image_view->format) == SurfaceType::DepthStencil) { | 1275 | switch (GetFormatType(image_view->format)) { |
| 1276 | case SurfaceType::Depth: | ||
| 1277 | buffer_bits |= GL_DEPTH_BUFFER_BIT; | ||
| 1278 | break; | ||
| 1279 | case SurfaceType::Stencil: | ||
| 1280 | buffer_bits |= GL_STENCIL_BUFFER_BIT; | ||
| 1281 | break; | ||
| 1282 | case SurfaceType::DepthStencil: | ||
| 1268 | buffer_bits |= GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; | 1283 | buffer_bits |= GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; |
| 1269 | } else { | 1284 | break; |
| 1285 | default: | ||
| 1286 | UNREACHABLE(); | ||
| 1270 | buffer_bits |= GL_DEPTH_BUFFER_BIT; | 1287 | buffer_bits |= GL_DEPTH_BUFFER_BIT; |
| 1288 | break; | ||
| 1271 | } | 1289 | } |
| 1272 | const GLenum attachment = AttachmentType(image_view->format); | 1290 | const GLenum attachment = AttachmentType(image_view->format); |
| 1273 | AttachTexture(handle, attachment, image_view); | 1291 | AttachTexture(handle, attachment, image_view); |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 578f8d523..40acc8fad 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h | |||
| @@ -164,8 +164,8 @@ private: | |||
| 164 | 164 | ||
| 165 | std::array<GLuint, Shader::NUM_TEXTURE_TYPES> null_image_views{}; | 165 | std::array<GLuint, Shader::NUM_TEXTURE_TYPES> null_image_views{}; |
| 166 | 166 | ||
| 167 | std::array<OGLFramebuffer, 3> rescale_draw_fbos; | 167 | std::array<OGLFramebuffer, 4> rescale_draw_fbos; |
| 168 | std::array<OGLFramebuffer, 3> rescale_read_fbos; | 168 | std::array<OGLFramebuffer, 4> rescale_read_fbos; |
| 169 | const Settings::ResolutionScalingInfo& resolution; | 169 | const Settings::ResolutionScalingInfo& resolution; |
| 170 | }; | 170 | }; |
| 171 | 171 | ||
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 39158aa3e..daba42ed9 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h | |||
| @@ -108,6 +108,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB | |||
| 108 | {GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT | 108 | {GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT |
| 109 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT | 109 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT |
| 110 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM | 110 | {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM |
| 111 | {GL_STENCIL_INDEX8, GL_STENCIL, GL_UNSIGNED_BYTE}, // S8_UINT | ||
| 111 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT | 112 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT |
| 112 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM | 113 | {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM |
| 113 | {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, | 114 | {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, |