Skip to content

Commit e01524d

Browse files
authored
Replace R32F texture format with R16F (#6784)
1 parent f02756c commit e01524d

7 files changed

Lines changed: 10 additions & 10 deletions

File tree

osu.Framework/Graphics/Lines/Path.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ protected override bool OnInvalidate(Invalidation invalidation, InvalidationSour
315315
return result;
316316
}
317317

318-
private readonly BufferedDrawNodeSharedData sharedData = new BufferedDrawNodeSharedData(TexturePixelFormat.R32Float, clipToRootNode: true);
318+
private readonly BufferedDrawNodeSharedData sharedData = new BufferedDrawNodeSharedData(TexturePixelFormat.R16Float, clipToRootNode: true);
319319

320320
protected override DrawNode CreateDrawNode() => new PathBufferedDrawNode(this, new PathDrawNode(this), sharedData);
321321

osu.Framework/Graphics/OpenGL/GLRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ public override IFrameBuffer CreateFrameBuffer(TexturePixelFormat textureFormat
441441
glTextureFormat = TextureComponentCount.Rgba8;
442442
break;
443443

444-
case TexturePixelFormat.R32Float:
445-
glTextureFormat = TextureComponentCount.R32f;
444+
case TexturePixelFormat.R16Float:
445+
glTextureFormat = TextureComponentCount.R16f;
446446
break;
447447

448448
default:

osu.Framework/Graphics/OpenGL/Textures/GLTexture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ private void setFormat(TextureComponentCount internalFormat)
117117
PixelType = PixelType.UnsignedByte;
118118
break;
119119

120-
case TextureComponentCount.R32f:
120+
case TextureComponentCount.R16f:
121121
PixelFormat = PixelFormat.Red;
122-
PixelType = PixelType.Float;
122+
PixelType = PixelType.HalfFloat;
123123
break;
124124

125125
default:

osu.Framework/Graphics/Rendering/TexturePixelFormat.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ namespace osu.Framework.Graphics.Rendering
66
public enum TexturePixelFormat
77
{
88
R8G8B8A8Float,
9-
R32Float
9+
R16Float
1010
}
1111
}

osu.Framework/Graphics/Veldrid/VeldridExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ public static PixelFormat ToPixelFormat(this TexturePixelFormat texturePixelForm
121121
case TexturePixelFormat.R8G8B8A8Float:
122122
return PixelFormat.R8G8B8A8UNorm;
123123

124-
case TexturePixelFormat.R32Float:
125-
return PixelFormat.R32Float;
124+
case TexturePixelFormat.R16Float:
125+
return PixelFormat.R16Float;
126126

127127
default:
128128
throw new ArgumentException($"Unsupported render buffer format: {texturePixelFormat}", nameof(texturePixelFormat));

osu.Framework/Resources/Shaders/sh_Path.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ layout(location = 0) out vec4 o_Colour;
2424

2525
void main(void)
2626
{
27-
highp float dstFromEdge = texture(sampler2D(m_Texture, m_Sampler), v_TexCoord).r;
27+
mediump float dstFromEdge = texture(sampler2D(m_Texture, m_Sampler), v_TexCoord).r;
2828
lowp vec4 pathCol = texture(sampler2D(m_Texture1, m_Sampler1), TexRect1.xy + vec2(dstFromEdge, 0.0) * TexRect1.zw, -0.9);
2929
o_Colour = getRoundedColor(vec4(pathCol.rgb, pathCol.a * float(dstFromEdge > 0.0)), v_TexCoord);
3030
}

osu.Framework/Resources/Shaders/sh_PathPrepass.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ layout(location = 1) in highp vec2 v_StartPos;
99
layout(location = 2) in highp vec2 v_EndPos;
1010
layout(location = 3) in highp float v_Radius;
1111

12-
layout(location = 0) out highp float o_Colour;
12+
layout(location = 0) out mediump float o_Colour;
1313

1414
void main(void)
1515
{

0 commit comments

Comments
 (0)