<div dir="ltr">Looking into it.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 13, 2018 at 12:21 PM, Lepton Wu <span dir="ltr"><<a href="mailto:lepton@chromium.org" target="_blank">lepton@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This breaks  webgl fish test,  with this CL,<br>
<br>
<a href="https://webglsamples.org/aquarium/aquarium.html" rel="noreferrer" target="_blank">https://webglsamples.org/<wbr>aquarium/aquarium.html</a>  show black screen<br>
with Chrome OS inside qemu+virgl, even it show fps.<br>
<br>
I guess dEQP is running with offline rendering  so it doesn't find<br>
this regression.<br>
<div><div class="h5"><br>
On Thu, Mar 29, 2018 at 3:27 PM, Robert Tarasov<br>
<<a href="mailto:tutankhamen@chromium.org">tutankhamen@chromium.org</a>> wrote:<br>
> Ignores alpha channel while blitting R8G8B8X8_UNIFORM colorspace.<br>
> framebuffer It would be nice to perform some code refactoring in<br>
> vrend_blitter to minimize dup code. Fixes following test:<br>
> dEQP-GLES3.functional.fbo.<wbr>blit.conversion.rgb8_to_rgba8'<wbr>]<br>
> dEQP-GLES3.functional.fbo.<wbr>blit.conversion.rgb8_to_rgb10_<wbr>a2<br>
> dEQP-GLES3.functional.fbo.<wbr>blit.conversion.rgb8_to_rgba4'<wbr>]<br>
> ---<br>
>  src/vrend_blitter.c  | 76 ++++++++++++++++++++++++++++++<wbr>++++++++++++++<br>
>  src/vrend_blitter.h  | 11 +++++++<br>
>  src/vrend_renderer.c |  3 ++<br>
>  3 files changed, 90 insertions(+)<br>
><br>
> diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c<br>
> index edbc9ea..2acad14 100644<br>
> --- a/src/vrend_blitter.c<br>
> +++ b/src/vrend_blitter.c<br>
> @@ -59,6 +59,7 @@ struct vrend_blitter_ctx {<br>
>     GLuint vs;<br>
>     GLuint vs_pos_only;<br>
>     GLuint fs_texfetch_col[PIPE_MAX_<wbr>TEXTURE_TYPES];<br>
> +   GLuint fs_texfetch_col_ignore_alpha[<wbr>PIPE_MAX_TEXTURE_TYPES];<br>
>     GLuint fs_texfetch_col_emu_alpha[<wbr>PIPE_MAX_TEXTURE_TYPES];<br>
>     GLuint fs_texfetch_depth[PIPE_MAX_<wbr>TEXTURE_TYPES];<br>
>     GLuint fs_texfetch_depth_msaa[PIPE_<wbr>MAX_TEXTURE_TYPES];<br>
> @@ -155,6 +156,61 @@ static GLuint blit_build_frag_tex_col(struct vrend_blitter_ctx *blit_ctx, int tg<br>
>        return 0;<br>
>     }<br>
><br>
> +<br>
> +   return fs_id;<br>
> +}<br>
> +<br>
> +static GLuint blit_build_frag_tex_col_<wbr>ignore_alpha(struct vrend_blitter_ctx *blit_ctx, int tgsi_tex_target)<br>
> +{<br>
> +   GLuint fs_id;<br>
> +   char shader_buf[4096];<br>
> +   int is_shad;<br>
> +   const char *twm;<br>
> +   const char *ext_str = "";<br>
> +   switch (tgsi_tex_target) {<br>
> +   case TGSI_TEXTURE_1D:<br>
> +   case TGSI_TEXTURE_BUFFER:<br>
> +      twm = ".x";<br>
> +      break;<br>
> +   case TGSI_TEXTURE_1D_ARRAY:<br>
> +   case TGSI_TEXTURE_2D:<br>
> +   case TGSI_TEXTURE_RECT:<br>
> +   case TGSI_TEXTURE_2D_MSAA:<br>
> +   default:<br>
> +      twm = ".xy";<br>
> +      break;<br>
> +   case TGSI_TEXTURE_SHADOW1D:<br>
> +   case TGSI_TEXTURE_SHADOW2D:<br>
> +   case TGSI_TEXTURE_SHADOW1D_ARRAY:<br>
> +   case TGSI_TEXTURE_SHADOWRECT:<br>
> +   case TGSI_TEXTURE_3D:<br>
> +   case TGSI_TEXTURE_CUBE:<br>
> +   case TGSI_TEXTURE_2D_ARRAY:<br>
> +   case TGSI_TEXTURE_2D_ARRAY_MSAA:<br>
> +      twm = ".xyz";<br>
> +      break;<br>
> +   case TGSI_TEXTURE_SHADOWCUBE:<br>
> +   case TGSI_TEXTURE_SHADOW2D_ARRAY:<br>
> +   case TGSI_TEXTURE_SHADOWCUBE_ARRAY:<br>
> +   case TGSI_TEXTURE_CUBE_ARRAY:<br>
> +      twm = "";<br>
> +      break;<br>
> +   }<br>
> +<br>
> +   if (tgsi_tex_target == TGSI_TEXTURE_CUBE_ARRAY ||<br>
> +       tgsi_tex_target == TGSI_TEXTURE_SHADOWCUBE_ARRAY)<br>
> +      ext_str = "#extension GL_ARB_texture_cube_map_array : require\n";<br>
> +<br>
> +   snprintf(shader_buf, 4096, blit_ctx->use_gles ? FS_TEXFETCH_COL_IGNORE_ALPHA_<wbr>GLES : FS_TEXFETCH_COL_IGNORE_ALPHA_<wbr>GL,<br>
> +      ext_str, vrend_shader_samplertypeconv(<wbr>tgsi_tex_target, &is_shad), twm, "");<br>
> +<br>
> +   fs_id = glCreateShader(GL_FRAGMENT_<wbr>SHADER);<br>
> +<br>
> +   if (!build_and_check(fs_id, shader_buf)) {<br>
> +      glDeleteShader(fs_id);<br>
> +      return 0;<br>
> +   }<br>
> +<br>
>     return fs_id;<br>
>  }<br>
><br>
> @@ -340,6 +396,24 @@ static GLuint blit_get_frag_tex_col(struct vrend_blitter_ctx *blit_ctx, int pipe<br>
>     }<br>
>  }<br>
><br>
> +static GLuint blit_get_frag_tex_col_ignore_<wbr>alpha(struct vrend_blitter_ctx *blit_ctx, int pipe_tex_target, unsigned nr_samples)<br>
> +{<br>
> +   assert(pipe_tex_target < PIPE_MAX_TEXTURE_TYPES);<br>
> +<br>
> +   if (nr_samples > 1) {<br>
> +      return 0;<br>
> +   } else {<br>
> +      GLuint *shader = &blit_ctx->fs_texfetch_col_<wbr>ignore_alpha[pipe_tex_target];<br>
> +<br>
> +      if (!*shader) {<br>
> +         unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(<wbr>pipe_tex_target, 0);<br>
> +<br>
> +         *shader = blit_build_frag_tex_col_<wbr>ignore_alpha(blit_ctx, tgsi_tex);<br>
> +      }<br>
> +      return *shader;<br>
> +   }<br>
> +}<br>
> +<br>
>  static GLuint blit_get_frag_tex_col_emu_<wbr>alpha(struct vrend_blitter_ctx *blit_ctx, int pipe_tex_target, unsigned nr_samples)<br>
>  {<br>
>     assert(pipe_tex_target < PIPE_MAX_TEXTURE_TYPES);<br>
> @@ -589,6 +663,8 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,<br>
>        fs_id = blit_get_frag_tex_writedepth(<wbr>blit_ctx, src_res->base.target, src_res->base.nr_samples);<br>
>     else if (vrend_format_is_emulated_<wbr>alpha(info->dst.format))<br>
>        fs_id = blit_get_frag_tex_col_emu_<wbr>alpha(blit_ctx, src_res->base.target, src_res->base.nr_samples);<br>
> +   else if (src_res->base.format == VIRGL_FORMAT_R8G8B8X8_UNORM)<br>
> +      fs_id = blit_get_frag_tex_col_ignore_<wbr>alpha(blit_ctx, src_res->base.target, src_res->base.nr_samples);<br>
>     else<br>
>        fs_id = blit_get_frag_tex_col(blit_<wbr>ctx, src_res->base.target, src_res->base.nr_samples);<br>
>     glAttachShader(prog_id, fs_id);<br>
> diff --git a/src/vrend_blitter.h b/src/vrend_blitter.h<br>
> index 07573a7..8c0aac6 100644<br>
> --- a/src/vrend_blitter.h<br>
> +++ b/src/vrend_blitter.h<br>
> @@ -64,6 +64,17 @@<br>
>  #define FS_TEXFETCH_COL_GL HEADER_GL FS_TEXFETCH_COL_BODY<br>
>  #define FS_TEXFETCH_COL_GLES HEADER_GLES OUTFRAG_GLES FS_TEXFETCH_COL_BODY<br>
><br>
> +#define FS_TEXFETCH_COL_IGNORE_ALPHA_<wbr>BODY       \<br>
> +   "%s"                                         \<br>
> +   "uniform sampler%s samp;\n"                  \<br>
> +   "in vec4 tc;\n"                              \<br>
> +   "void main() {\n"                            \<br>
> +   "   vec4 temp = texture(samp, tc%s)%s;\n"    \<br>
> +   "   gl_FragColor = vec4(temp.rgb, 1.0f);\n"  \<br>
> +   "}\n"<br>
> +<br>
> +#define FS_TEXFETCH_COL_IGNORE_ALPHA_<wbr>GL HEADER_GL FS_TEXFETCH_COL_IGNORE_ALPHA_<wbr>BODY<br>
> +#define FS_TEXFETCH_COL_IGNORE_ALPHA_<wbr>GLES HEADER_GLES OUTFRAG_GLES FS_TEXFETCH_COL_IGNORE_ALPHA_<wbr>BODY<br>
><br>
>  #define FS_TEXFETCH_COL_ALPHA_DEST_<wbr>BODY         \<br>
>     "%s"                                         \<br>
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c<br>
> index 0eb8a7e..30db1b9 100644<br>
> --- a/src/vrend_renderer.c<br>
> +++ b/src/vrend_renderer.c<br>
> @@ -5952,6 +5952,9 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx,<br>
>         vrend_format_is_emulated_<wbr>alpha(info->src.format))<br>
>        use_gl = true;<br>
><br>
> +   if (info->src.format == VIRGL_FORMAT_R8G8B8X8_UNORM)<br>
> +      use_gl = true;<br>
> +<br>
>     if (use_gl) {<br>
>        vrend_renderer_blit_gl(ctx, src_res, dst_res, info);<br>
>        vrend_clicbs->make_current(0, ctx->sub->gl_context);<br>
> --<br>
> 2.17.0.rc1.321.gba9d0f2565-<wbr>goog<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> virglrenderer-devel mailing list<br>
> <a href="mailto:virglrenderer-devel@lists.freedesktop.org">virglrenderer-devel@lists.<wbr>freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/<wbr>virglrenderer-devel</a><br>
</blockquote></div><br></div>