Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upClipping issues on Android: textureSize(sCache, 0) is 0 #907
Comments
|
Thanks @MortimerGoro ! I see that we are setting it in let u_cache = gl::get_uniform_location(program.id, "sCache");
if u_cache != -1 {
gl::uniform_1i(u_cache, TextureSampler::Cache as i32);
} |
|
And indeed we are not always actually binding it. We only bind it for the passes following the first one. I suggest we bind a dummy texture for the first pass each time. |
|
@kvark the testcase I've using is the test_webgl_triangle.html file on Servo tests/html folder. It also happens with a plain
Yes that uniform is correctly set on Android. I think that the texture bind wasn't done on Desktop OpenGL too. I put some log calls and only saw that 0 texture_id was bound. But it seems that textureSize(texure_id = 0) leads to undefined behavior on the shader, gives (1,1) on desktop and (0,0) on Android. |
|
Hold tight, fix is coming ;) |
Dummy sCache texture input Fixes #907 r? @glennw <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/913) <!-- Reviewable:end -->
Dummy sCache texture input Fixes #907 r? @glennw <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/913) <!-- Reviewable:end -->
Hello,
I'm working on WebVR Servo for Android and couldn't get some basic WebGL canvas to show on a simple html. It also happens with other non WebGL simple elements as images. After some debugging found that the textures from images and WebGL canvases are ok but the problem is related to the clipping implementation.
In the ps_image.fs.gl shader, the
textureLod(sColor0, st, 0.0)gives the correct color but it's multiplied by a 0 alpha. The alpha 0 is set by the call to do_clip() function.write_clip()function is correctly called in the vertex shader. The problem seems to be thattextureSize(sCache, 0).xyreturns avec(0, 0)value, which leads to an invalid alpha value. In the same demo run on my desktop machine,textureSize(sCache, 0).xyreturns avec(1, 1)value, which leads to a correct alpha value.