Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade framework, upgrade shaders to new spir-v #321

Closed
wants to merge 5 commits into from

Conversation

WebFreak001
Copy link
Contributor

note: I tested these things on top of #320

I haven't tried if all shaders work though, I don't know how to run the visual tests.

@WebFreak001 WebFreak001 requested a review from andy840119 as a code owner March 19, 2023 04:44
WebFreak001 added a commit to WebFreak001/karaoke that referenced this pull request Mar 19, 2023
@andy840119
Copy link
Member

image

@WebFreak001 Thanks for your contribution! You saved my time 🎉
Some of the test case are broken, but it still able to opened in the visual tests 🤔
I have the same issue when trying to upgrade the shader in this morning 😢

@WebFreak001
Copy link
Contributor Author

I noticed some shader code in the tests which I didn't upgrade yet. Gonna sleep for now, maybe gonna look at it tomorrow

@andy840119
Copy link
Member

andy840119 commented Mar 19, 2023

And notice that i might open another PR(#322) because uniform in the shader might designed like this:

// see the demo: https://www.geeks3d.com/20101029/shader-library-pixelation-post-processing-effect-glsl/
#include "sh_Utils.h"

layout(location = 2) in mediump vec2 v_TexCoord;

// will pass the value in the CustomizedShaderBufferedDrawNode
layout(std140, set = 0, binding = 0) uniform m_SharedParameters
{
    mediump vec2 g_TexSize;
    float g_InflationPercentage;
};

// will pass the value in the customized shader. might have the same name for every shader? not very sure
layout(std140, set = 2, binding = 0) uniform m_PixelParameters
{
    mediump vec2 g_Size;
};

layout(set = 1, binding = 0) uniform lowp texture2D m_Texture;
layout(set = 1, binding = 1) uniform lowp sampler m_Sampler;

layout(location = 0) out vec4 o_Colour;

void main(void) 
{ 
    vec2 separaorParts = g_TexSize / (g_Size * g_InflationPercentage);
    vec2 uv = v_TexCoord;
    uv = uv * separaorParts;
    uv = floor(uv);
    uv = uv / separaorParts;
    o_Colour = toSRGB(texture(sampler2D(m_Texture, m_Sampler), uv));
}

@andy840119
Copy link
Member

@WebFreak001 close this issue because create another PR for the minimum required change only.
Feel free to push to the #322 or create another PR based on that branch.

@andy840119 andy840119 closed this Mar 19, 2023
public float Mix { get; set; } = 1f;

public override void ApplyValue()
{
if (Texture == null)
return;

// where this 1 is from? I have no clue.
Texture.Bind(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WebFreak001 WebFreak001 deleted the framework-upgrade branch March 19, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants