video_core: Fix SNORM texture buffer emulating error (#9001)

This commit is contained in:
Feng Chen 2022-11-04 14:39:42 +08:00 committed by GitHub
parent ece22fcbc7
commit 75596c07e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 224 additions and 52 deletions

View file

@ -29,17 +29,17 @@ constexpr std::array PROGRAM_LUT{
[[nodiscard]] GLenum GetTextureBufferFormat(GLenum gl_format) {
switch (gl_format) {
case GL_RGBA8_SNORM:
return GL_RGBA8;
return GL_RGBA8I;
case GL_R8_SNORM:
return GL_R8;
return GL_R8I;
case GL_RGBA16_SNORM:
return GL_RGBA16;
return GL_RGBA16I;
case GL_R16_SNORM:
return GL_R16;
return GL_R16I;
case GL_RG16_SNORM:
return GL_RG16;
return GL_RG16I;
case GL_RG8_SNORM:
return GL_RG8;
return GL_RG8I;
default:
return gl_format;
}
@ -96,9 +96,6 @@ GLuint Buffer::View(u32 offset, u32 size, PixelFormat format) {
texture.Create(GL_TEXTURE_BUFFER);
const GLenum gl_format{MaxwellToGL::GetFormatTuple(format).internal_format};
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,

View file

@ -504,8 +504,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
}
}
if (info.uses_render_area) {
const auto render_area_width(static_cast<GLfloat>(regs.render_area.width));
const auto render_area_height(static_cast<GLfloat>(regs.render_area.height));
const auto render_area_width(static_cast<GLfloat>(regs.surface_clip.width));
const auto render_area_height(static_cast<GLfloat>(regs.surface_clip.height));
if (use_assembly) {
glProgramLocalParameter4fARB(AssemblyStage(stage), 1, render_area_width,
render_area_height, 0.0f, 0.0f);

View file

@ -618,11 +618,11 @@ void RasterizerOpenGL::SyncViewport() {
}
flags[Dirty::Viewport0 + index] = false;
if (!regs.viewport_transform_enabled) {
const auto x = static_cast<GLfloat>(regs.render_area.x);
const auto y = static_cast<GLfloat>(regs.render_area.y);
const auto width = static_cast<GLfloat>(regs.render_area.width);
const auto height = static_cast<GLfloat>(regs.render_area.height);
if (!regs.viewport_scale_offset_enbled) {
const auto x = static_cast<GLfloat>(regs.surface_clip.x);
const auto y = static_cast<GLfloat>(regs.surface_clip.y);
const auto width = static_cast<GLfloat>(regs.surface_clip.width);
const auto height = static_cast<GLfloat>(regs.surface_clip.height);
glViewportIndexedf(static_cast<GLuint>(index), x, y, width != 0.0f ? width : 1.0f,
height != 0.0f ? height : 1.0f);
continue;