summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-11-10 06:41:33 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2018-11-10 07:10:50 +0100
commit8d4bb10d443060dc56d6c6ddd9b84bbea00874d3 (patch)
treee171445255a669bf311468f0c005fe2045802627 /src/video_core/renderer_opengl/gl_shader_decompiler.cpp
parentgl_resource_manager: Amend clang-format discrepancies (diff)
downloadyuzu-8d4bb10d443060dc56d6c6ddd9b84bbea00874d3.tar
yuzu-8d4bb10d443060dc56d6c6ddd9b84bbea00874d3.tar.gz
yuzu-8d4bb10d443060dc56d6c6ddd9b84bbea00874d3.tar.bz2
yuzu-8d4bb10d443060dc56d6c6ddd9b84bbea00874d3.tar.lz
yuzu-8d4bb10d443060dc56d6c6ddd9b84bbea00874d3.tar.xz
yuzu-8d4bb10d443060dc56d6c6ddd9b84bbea00874d3.tar.zst
yuzu-8d4bb10d443060dc56d6c6ddd9b84bbea00874d3.zip
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_decompiler.cpp')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 09b003c59..bce7465b5 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -494,10 +494,10 @@ public:
// instruction for now.
if (stage == Maxwell3D::Regs::ShaderStage::Geometry) {
// TODO(Rodrigo): nouveau sets some attributes after setting emitting a geometry
- // shader. These instructions use a dirty register as buffer index. To avoid some
- // drivers from complaining for the out of boundary writes, guard them.
- const std::string buf_index{"min(" + GetRegisterAsInteger(buf_reg) + ", " +
- std::to_string(MAX_GEOMETRY_BUFFERS - 1) + ')'};
+ // shader. These instructions use a dirty register as buffer index, to avoid some
+ // drivers from complaining about out of boundary writes, guard them.
+ const std::string buf_index{"((" + GetRegisterAsInteger(buf_reg) + ") % " +
+ std::to_string(MAX_GEOMETRY_BUFFERS) + ')'};
shader.AddLine("amem[" + buf_index + "][" +
std::to_string(static_cast<u32>(attribute)) + ']' +
GetSwizzle(elem) + " = " + src + ';');
@@ -811,7 +811,11 @@ private:
std::optional<Register> vertex = {}) {
auto GeometryPass = [&](const std::string& name) {
if (stage == Maxwell3D::Regs::ShaderStage::Geometry && vertex) {
- return "gs_" + name + '[' + GetRegisterAsInteger(*vertex, 0, false) + ']';
+ // TODO(Rodrigo): Guard geometry inputs against out of bound reads. Some games set
+ // an 0x80000000 index for those and the shader fails to build. Find out why this
+ // happens and what's its intent.
+ return "gs_" + name + '[' + GetRegisterAsInteger(*vertex, 0, false) +
+ " % MAX_VERTEX_INPUT]";
}
return name;
};