GNOME Bugzilla – Bug 737505
gltestsrc: implement checkers pattern in GLSL
Last modified: 2014-10-07 12:44:20 UTC
Created attachment 287268 [details] [review] patch to implement checkers pattern in GLSL seems that gltestsrc comments out the checkers pattern which based on line by line drawing, this patch implements checkers pattern in GLSL. for common usage, I moved the position/mvp variable to static.
Review of attachment 287268 [details] [review]: This seems to have blocks that are twice the size of the videotestsrc ones. Also, this is black/white whereas videotestsrc works on red/green. gltestsrc pattern=checkers-8 ! glvideomixer ! glimagesink seems to produce weird artifacts when used together. Probably because you're not writing to the alpha channel in the shader. There is also the checker shader in glvideomixer if you want to use it.
Created attachment 287321 [details] [review] v2 fix inconsist bug (In reply to comment #1) > Review of attachment 287268 [details] [review]: > > This seems to have blocks that are twice the size of the videotestsrc ones. > > Also, this is black/white whereas videotestsrc works on red/green. sorry for the inconsist bug, I'm not sure if this is suitable implementation, so just did a quick hack ... > > gltestsrc pattern=checkers-8 ! glvideomixer ! glimagesink seems to produce > weird artifacts when used together. Probably because you're not writing to the > alpha channel in the shader. > fixed > There is also the checker shader in glvideomixer if you want to use it. I'm not sure whether to use it , since conditional statement in shader may hit some old hardware performance(I didn't test it ,maybe doesn't matter )
Review of attachment 287321 [details] [review]: One small issue :) ::: ext/gl/gstgltestsrc.c @@ +317,3 @@ + float result=mod(xy_mod.x+xy_mod.y,2.0); \ + gl_FragColor.r=step(result,0.5); \ + gl_FragColor.g=1-gl_FragColor.r; \ '1-gl_FragColor.r' is not glsl spec compliant and the mesa shader compiler fails with it. You need to do '1.0-gl_FragColor.r' instead.
Created attachment 287409 [details] [review] v3 fix glsl compliant (In reply to comment #3) > Review of attachment 287321 [details] [review]: > > One small issue :) > > ::: ext/gl/gstgltestsrc.c > @@ +317,3 @@ > + float result=mod(xy_mod.x+xy_mod.y,2.0); \ > + gl_FragColor.r=step(result,0.5); \ > + gl_FragColor.g=1-gl_FragColor.r; \ > > '1-gl_FragColor.r' is not glsl spec compliant and the mesa shader compiler > fails with it. > > You need to do '1.0-gl_FragColor.r' instead. fixed, also fix the 'Tab' indent
commit 2c293b4f61a1495cda2f8ddf2c6096739f7e5fad Author: Wang Xin-yu (王昕宇) <comicfans44@gmail.com> Date: Sun Sep 28 10:51:09 2014 +0800 gltestsrc: implement checkers pattern with GLSL https://bugzilla.gnome.org/show_bug.cgi?id=737505