[virglrenderer-devel] [PATCH 1/2] vrend_shader: split out sampler declaration emission logic
Gurchetan Singh
gurchetansingh at chromium.org
Mon Jul 2 22:12:21 UTC 2018
On Sun, Jul 1, 2018 at 3:32 PM Elie Tournier <tournier.elie at gmail.com> wrote:
>
> On Fri, Jun 29, 2018 at 06:03:09PM -0700, Gurchetan Singh wrote:
> > On Fri, Jun 29, 2018 at 5:16 AM, Elie Tournier <tournier.elie at gmail.com>
> > wrote:
> >
> > > On Thu, Jun 28, 2018 at 08:31:26PM -0700, Gurchetan Singh wrote:
> > > > Sampler arrays don't work with shadow textures. Let's have a
> > > > separate emission function that we can use with sampler arrays and
> > > > normal samplers.
> > > >
> > > The v2 looks better but I still have the same issues.
> > > Patches don't apply on top of Dave gl-4.3 branch. And a "double free or
> > > corruption".
> > >
> > >
> > I tested on gl-4.3, but back-ported to master. Here's the branch I used to
> > test:
> >
> > https://gitlab.freedesktop.org/gurchetansingh/virglrenderer/commits/gl-4.3
>
> I will take that for a spin. It looks quite nice.
> >
> > I'm running on an Nvidia GL host. Are you running on a GLES host? Also,
> > do happen to know which test triggers the error? For me, dEQP gles31 runs
> > to completion without any host side crashes.
>
> I'm running on Intel GL host with the Dave's mesa gl-4.3 branch.
> The crash happened when I launched the VM.
I ran Ubuntu VMs using multiple configurations:
mesa master + virglrenderer master with this series applied ---> boots fine
mesa gl4.3 + virglrenderer gl4.3 with this series applied ---> boots fine
I got "vrend_report_buffer_error: context error reported 1
"systemd-logind" Illegal command buffer 131106" if I tried to mix
branches:
mesa gl4.3 + virglrenderer master with this series applied --> doesn't
get to login screen
mesa gl4.3 + virglrenderer master without this series applied -->
doesn't get to login screen
Are you getting a crash or this illegal command buffer error? If it's
a crash, do you have a symbolized trace?
> >
> >
> > > I maybe did something wrong.
> > > So what setup should I use to test this fix?
> > > > v2: Split out in separate function, initialize shadow variable to
> > > > zero
> > > > ---
> > > > src/vrend_shader.c | 34 ++++++++++++++++++++++++++++++++++
> > > > 1 file changed, 34 insertions(+)
> > > >
> > > > diff --git a/src/vrend_shader.c b/src/vrend_shader.c
> > > > index f7bf853c46..f0dc49cbbf 100644
> > > > --- a/src/vrend_shader.c
> > > > +++ b/src/vrend_shader.c
> > > > @@ -3409,6 +3409,40 @@ static char get_return_type_prefix(enum
> > > tgsi_return_type type)
> > > > return ' ';
> > > > }
> > > >
> > > > +/* i represents the i-th sampler array or i-th sampler. */
> > > > +static void emit_sampler_declaration(struct dump_ctx *ctx, char
> > > *glsl_hdr, uint32_t i,
> > > > + uint32_t range, uint32_t
> > > texture_type, uint32_t return_type)
> > > > +{
> > > > + int shadow;
> > > > + char buf[255], ret_type;
> > > > + const char *sname, *precision, *tex_type;
> > > > +
> > > > + shadow = 0;
> > > > + sname = tgsi_proc_to_prefix(ctx->prog_type);
> > > > + precision = (ctx->cfg->use_gles) ? "highp " : " ";
> > > > +
> > > > + tex_type = vrend_shader_samplertypeconv(texture_type, &shadow);
> > > > + ret_type = vrend_shader_samplerreturnconv(return_type);
> > > > +
> > > > + /* GLES does not support 1D textures -- we use a 2D texture and set
> > > the parameter set to 0.5 */
> > > > + if (ctx->cfg->use_gles && texture_type == TGSI_TEXTURE_1D)
> > > > + snprintf(buf, 255, "uniform %csampler2D %ssamp%d;\n", ret_type,
> > > sname, i);
> > > > + else if (range)
> > > > + snprintf(buf, 255, "uniform %s%csampler%s %ssamp%d[%d];\n",
> > > precision, ret_type, tex_type, sname, i, range);
> > > > + else
> > > > + snprintf(buf, 255, "uniform %s%csampler%s %ssamp%d;\n",
> > > precision, ret_type, tex_type, sname, i);
> > > > +
> > > > + strcat_realloc(glsl_hdr, buf);
> > > > +
> > > > + if (shadow) {
> > > > + snprintf(buf, 255, "uniform %svec4 %sshadmask%d;\n", precision,
> > > sname, i);
> > > > + strcat_realloc(glsl_hdr, buf);
> > > > + snprintf(buf, 255, "uniform %svec4 %sshadadd%d;\n", precision,
> > > sname, i);
> > > > + strcat_realloc(glsl_hdr, buf);
> > > > + ctx->shadow_samp_mask |= (1 << i);
> > > > + }
> > > > +}
> > > > +
> > > > static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
> > > > {
> > > > uint32_t i;
> > > > --
> > > > 2.18.0.rc2.346.g013aa6912e-goog
> > > >
> > > > _______________________________________________
> > > > virglrenderer-devel mailing list
> > > > virglrenderer-devel at lists.freedesktop.org
> > > > https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel
> > >
More information about the virglrenderer-devel
mailing list