diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-06-10 07:55:27 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:35 +0200 |
commit | cd8427367ed372e355fa76a78d41b3bc64f997ca (patch) | |
tree | d8e5db860e68cef834f8c14a6e1f3c33d252dadd | |
parent | shader_environment: Fix local memory size calculations (diff) | |
download | yuzu-cd8427367ed372e355fa76a78d41b3bc64f997ca.tar yuzu-cd8427367ed372e355fa76a78d41b3bc64f997ca.tar.gz yuzu-cd8427367ed372e355fa76a78d41b3bc64f997ca.tar.bz2 yuzu-cd8427367ed372e355fa76a78d41b3bc64f997ca.tar.lz yuzu-cd8427367ed372e355fa76a78d41b3bc64f997ca.tar.xz yuzu-cd8427367ed372e355fa76a78d41b3bc64f997ca.tar.zst yuzu-cd8427367ed372e355fa76a78d41b3bc64f997ca.zip |
-rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index 334ed470f..0703614de 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp @@ -25,6 +25,25 @@ constexpr std::array PROGRAM_LUT{ GL_VERTEX_PROGRAM_NV, GL_TESS_CONTROL_PROGRAM_NV, GL_TESS_EVALUATION_PROGRAM_NV, GL_GEOMETRY_PROGRAM_NV, GL_FRAGMENT_PROGRAM_NV, }; + +[[nodiscard]] GLenum GetTextureBufferFormat(GLenum gl_format) { + switch (gl_format) { + case GL_RGBA8_SNORM: + return GL_RGBA8; + case GL_R8_SNORM: + return GL_R8; + case GL_RGBA16_SNORM: + return GL_RGBA16; + case GL_R16_SNORM: + return GL_R16; + case GL_RG16_SNORM: + return GL_RG16; + case GL_RG8_SNORM: + return GL_RG8; + default: + return gl_format; + } +} } // Anonymous namespace Buffer::Buffer(BufferCacheRuntime&, VideoCommon::NullBufferParams null_params) @@ -76,7 +95,11 @@ GLuint Buffer::View(u32 offset, u32 size, PixelFormat format) { OGLTexture texture; texture.Create(GL_TEXTURE_BUFFER); const GLenum gl_format{MaxwellToGL::GetFormatTuple(format).internal_format}; - glTextureBufferRange(texture.handle, gl_format, buffer.handle, offset, size); + const GLenum texture_format{GetTextureBufferFormat(gl_format)}; + if (texture_format != gl_format) { + LOG_WARNING(Render_OpenGL, "Emulating SNORM texture buffer with UNORM."); + } + glTextureBufferRange(texture.handle, texture_format, buffer.handle, offset, size); views.push_back({ .offset = offset, .size = size, |