From 95f5d162ef258c9ab8bab2147fa7e227fe21fbc9 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Apr 2021 22:36:30 +0100 Subject: [PATCH] Increase SheetCount back to 8. This was previously decreased to support legacy GPUs that only supported 8 texture image units and we need to reserve one of these for the palette texture. OpenGL 3.X mandates a minimum of 16 (and most most GL2 cards also supported it) so we can now safely increase this limit. --- OpenRA.Game/Graphics/SpriteRenderer.cs | 2 +- glsl/combined.frag | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/OpenRA.Game/Graphics/SpriteRenderer.cs b/OpenRA.Game/Graphics/SpriteRenderer.cs index 60abb23ef9..9707057b36 100644 --- a/OpenRA.Game/Graphics/SpriteRenderer.cs +++ b/OpenRA.Game/Graphics/SpriteRenderer.cs @@ -18,7 +18,7 @@ namespace OpenRA.Graphics { public class SpriteRenderer : Renderer.IBatchRenderer { - public const int SheetCount = 7; + public const int SheetCount = 8; static readonly string[] SheetIndexToTextureName = Exts.MakeArray(SheetCount, i => $"Texture{i}"); readonly Renderer renderer; diff --git a/glsl/combined.frag b/glsl/combined.frag index 01eb15cf4a..4f6f314695 100644 --- a/glsl/combined.frag +++ b/glsl/combined.frag @@ -10,6 +10,7 @@ uniform sampler2D Texture3; uniform sampler2D Texture4; uniform sampler2D Texture5; uniform sampler2D Texture6; +uniform sampler2D Texture7; uniform sampler2D Palette; uniform bool EnableDepthPreview; @@ -35,6 +36,7 @@ uniform vec2 Texture3Size; uniform vec2 Texture4Size; uniform vec2 Texture5Size; uniform vec2 Texture6Size; +uniform vec2 Texture7Size; #else in vec4 vColor; @@ -82,8 +84,10 @@ vec2 Size(float samplerIndex) return Texture4Size; else if (samplerIndex < 5.5) return Texture5Size; + else if (samplerIndex < 6.5) + return Texture6Size; - return Texture6Size; + return Texture7Size; } vec4 Sample(float samplerIndex, vec2 pos) @@ -100,8 +104,10 @@ vec4 Sample(float samplerIndex, vec2 pos) return texture2D(Texture4, pos); else if (samplerIndex < 5.5) return texture2D(Texture5, pos); + else if (samplerIndex < 6.5) + return texture2D(Texture6, pos); - return texture2D(Texture6, pos); + return texture2D(Texture7, pos); } #else ivec2 Size(float samplerIndex) @@ -118,8 +124,10 @@ ivec2 Size(float samplerIndex) return textureSize(Texture4, 0); else if (samplerIndex < 5.5) return textureSize(Texture5, 0); + else if (samplerIndex < 6.5) + return textureSize(Texture6, 0); - return textureSize(Texture6, 0); + return textureSize(Texture7, 0); } vec4 Sample(float samplerIndex, vec2 pos) @@ -136,8 +144,10 @@ vec4 Sample(float samplerIndex, vec2 pos) return texture(Texture4, pos); else if (samplerIndex < 5.5) return texture(Texture5, pos); + else if (samplerIndex < 6.5) + return texture(Texture6, pos); - return texture(Texture6, pos); + return texture(Texture7, pos); } #endif