-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
Fix gray alpha png #2234
base: dev
Are you sure you want to change the base?
Fix gray alpha png #2234
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#version 310 es | ||
precision highp float; | ||
precision highp int; | ||
|
||
layout(location = COLOR0) in vec4 v_color; | ||
layout(location = TEXCOORD0) in vec2 v_texCoord; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use highp precision for texture coordinates. |
||
|
||
layout(binding = 0) uniform sampler2D u_tex0; | ||
|
||
layout(location = SV_Target0) out vec4 FragColor; | ||
|
||
void main() | ||
{ | ||
vec4 c = texture(u_tex0, v_texCoord); | ||
FragColor = v_color * vec4(c.r, c.r, c.r, c.g); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will fail on GLES2, because for two channel textures it uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would (c.r, c.r, c.r, c.a) work for both cases? For RG8, it's being loaded as RGRG into the RGBA channels, so instead of using R and G, why not just use R and A, since A has the same value as G? |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use lowp precision as default for both float and int. That's enough for simple color processing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shader was copied from
positionTextureColor.frag
, with the only section changed being what is in themain()
function. The existing shaders use the same settings for precision etc..