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

Does not give proper GLSL code #3

Open
SuicSoft opened this issue Aug 26, 2016 · 3 comments
Open

Does not give proper GLSL code #3

SuicSoft opened this issue Aug 26, 2016 · 3 comments

Comments

@SuicSoft
Copy link

I am trying to optimize this vertex shader

uniform mat4 ModelViewMatrix;
uniform vec3 Position;
uniform vec2 Size;

#if __VERSION__ >= 330
layout(location = 0) in vec2 Corner;
layout(location = 3) in vec2 Texcoord;
#else
in vec2 Corner;
in vec2 Texcoord;
#endif

out vec2 uv;

void main(void)
{
    uv = Texcoord;
    vec4 Center = ModelViewMatrix * vec4(Position, 1.);
    gl_Position = ProjectionMatrix * (Center + vec4(Size * Corner, 0., 0.));
}

But when I click optimize I get

򀨑R

@tschw
Copy link

tschw commented Aug 29, 2016

Seeing similar behavior sometimes.

I had to call it with glVersion = 2 to keep this from happening on a shader using gl_PointCoord - else I got this weird output instead of an error message, for instance.

@zz85
It might be a good idea to pull up the code.

To have an easy life and be on the safe side, just revert my patch and compile with -fno-strict-aliasing option for now. I got some notifications on the Mesa issue which I filed back then, so an upstream fix will float around eventually.

I recently revived the node script from glslunit to bake GLSL to source files and added optimization based on this tool (work in progress in the glslprep.js repository). This way, it's a single & easy to invoke build step without native code to be packaged. It takes a template for the wrapper source code, so should adapt to pretty much anything.

@SuicSoft
Copy link
Author

@tschw How can I do that ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants