diff options
4 files changed, 12 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index a32a7e984..c39626850 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp @@ -249,20 +249,24 @@ CachedProgram SpecializeShader(const std::string& code, const GLShader::ShaderEn if (!texture_buffer_usage.test(i)) { continue; } - source += fmt::format("#define SAMPLER_{}_IS_BUFFER", i); + source += fmt::format("#define SAMPLER_{}_IS_BUFFER\n", i); + } + if (texture_buffer_usage.any()) { + source += '\n'; } if (program_type == ProgramType::Geometry) { const auto [glsl_topology, debug_name, max_vertices] = GetPrimitiveDescription(primitive_mode); - source += "layout (" + std::string(glsl_topology) + ") in;\n"; + source += "layout (" + std::string(glsl_topology) + ") in;\n\n"; source += "#define MAX_VERTEX_INPUT " + std::to_string(max_vertices) + '\n'; } if (program_type == ProgramType::Compute) { source += "layout (local_size_variable) in;\n"; } + source += '\n'; source += code; OGLShader shader; diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 1bfdbcd61..359d58cbe 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -565,7 +565,7 @@ private: case Tegra::Shader::ImageType::Texture1D: return "image1D"; case Tegra::Shader::ImageType::TextureBuffer: - return "bufferImage"; + return "imageBuffer"; case Tegra::Shader::ImageType::Texture1DArray: return "image1DArray"; case Tegra::Shader::ImageType::Texture2D: diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 408332f90..4f135fe03 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -184,6 +184,9 @@ GLint GetSwizzleSource(SwizzleSource source) { } void ApplyTextureDefaults(const SurfaceParams& params, GLuint texture) { + if (params.IsBuffer()) { + return; + } glTextureParameteri(texture, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTextureParameteri(texture, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTextureParameteri(texture, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -208,6 +211,7 @@ OGLTexture CreateTexture(const SurfaceParams& params, GLenum target, GLenum inte glNamedBufferStorage(texture_buffer.handle, params.width * params.GetBytesPerPixel(), nullptr, GL_DYNAMIC_STORAGE_BIT); glTextureBuffer(texture.handle, internal_format, texture_buffer.handle); + break; case SurfaceTarget::Texture2D: case SurfaceTarget::TextureCubemap: glTextureStorage2D(texture.handle, params.emulated_levels, internal_format, params.width, diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index e3be018b9..e36bc2c04 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h @@ -213,7 +213,7 @@ struct TICEntry { if (header_version != TICHeaderVersion::OneDBuffer) { return width_minus_1 + 1; } - return (buffer_high_width_minus_one << 16) | buffer_low_width_minus_one; + return ((buffer_high_width_minus_one << 16) | buffer_low_width_minus_one) + 1; } u32 Height() const { |