1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 09:02:55 +08:00

Merge pull request #23374 from EVAST9919/ruleset-shaders-test

Add missing ruleset shader tests
This commit is contained in:
Dean Herbert 2023-05-02 19:52:09 +09:00 committed by GitHub
commit 2aaa52e904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 30 deletions

View File

@ -1,11 +1,14 @@
#include "sh_Utils.h" #define HIGH_PRECISION_VERTEX
varying mediump vec2 v_TexCoord; #include "sh_Utils.h"
varying mediump vec4 v_TexRect; #include "sh_Masking.h"
layout(location = 2) in highp vec2 v_TexCoord;
layout(location = 0) out vec4 o_Colour;
void main(void) void main(void)
{ {
float hueValue = v_TexCoord.x / (v_TexRect[2] - v_TexRect[0]); highp float hueValue = v_TexCoord.x / (v_TexRect[2] - v_TexRect[0]);
gl_FragColor = hsv2rgb(vec4(hueValue, 1, 1, 1)); o_Colour = getRoundedColor(hsv2rgb(vec4(hueValue, 1, 1, 1)), v_TexCoord);
} }

View File

@ -1,31 +1,25 @@
#include "sh_Utils.h" layout(location = 0) in highp vec2 m_Position;
layout(location = 1) in lowp vec4 m_Colour;
layout(location = 2) in highp vec2 m_TexCoord;
layout(location = 3) in highp vec4 m_TexRect;
layout(location = 4) in mediump vec2 m_BlendRange;
attribute highp vec2 m_Position; layout(location = 0) out highp vec2 v_MaskingPosition;
attribute lowp vec4 m_Colour; layout(location = 1) out lowp vec4 v_Colour;
attribute mediump vec2 m_TexCoord; layout(location = 2) out highp vec2 v_TexCoord;
attribute mediump vec4 m_TexRect; layout(location = 3) out highp vec4 v_TexRect;
attribute mediump vec2 m_BlendRange; layout(location = 4) out mediump vec2 v_BlendRange;
varying highp vec2 v_MaskingPosition;
varying lowp vec4 v_Colour;
varying mediump vec2 v_TexCoord;
varying mediump vec4 v_TexRect;
varying mediump vec2 v_BlendRange;
uniform highp mat4 g_ProjMatrix;
uniform highp mat3 g_ToMaskingSpace;
void main(void) void main(void)
{ {
// Transform from screen space to masking space. // Transform from screen space to masking space.
highp vec3 maskingPos = g_ToMaskingSpace * vec3(m_Position, 1.0); highp vec3 maskingPos = g_ToMaskingSpace * vec3(m_Position, 1.0);
v_MaskingPosition = maskingPos.xy / maskingPos.z; v_MaskingPosition = maskingPos.xy / maskingPos.z;
v_Colour = m_Colour; v_Colour = m_Colour;
v_TexCoord = m_TexCoord; v_TexCoord = m_TexCoord;
v_TexRect = m_TexRect; v_TexRect = m_TexRect;
v_BlendRange = m_BlendRange; v_BlendRange = m_BlendRange;
gl_Position = gProjMatrix * vec4(m_Position, 1.0, 1.0); gl_Position = g_ProjMatrix * vec4(m_Position, 1.0, 1.0);
} }

View File

@ -53,6 +53,8 @@ namespace osu.Game.Tests.Testing
{ {
Dependencies.Get<ShaderManager>().GetRawData(@"sh_TestVertex.vs"); Dependencies.Get<ShaderManager>().GetRawData(@"sh_TestVertex.vs");
Dependencies.Get<ShaderManager>().GetRawData(@"sh_TestFragment.fs"); Dependencies.Get<ShaderManager>().GetRawData(@"sh_TestFragment.fs");
Dependencies.Get<ShaderManager>().Load(@"TestVertex", @"TestFragment");
Dependencies.Get<ShaderManager>().Load(VertexShaderDescriptor.TEXTURE_2, @"TestFragment");
}); });
} }