Bug 62236 - the issue of not correct display from MALI Integer Logic sample
Summary: the issue of not correct display from MALI Integer Logic sample
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/softpipe (show other bugs)
Version: unspecified
Hardware: Other Windows (All)
: medium major
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-12 15:14 UTC by alanchang544
Modified: 2019-09-18 18:27 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description alanchang544 2013-03-12 15:14:25 UTC
Hi 
I use MALI Integer Logic sample and work with Mesa code to run together. 
No matter Mesa3d GIT Feb version or Mesa 9.0 (modify to let it support gles3), I found there is wrong display issue of this sample. 
If I modify something in \src\gallium\drivers\softpipe\sp_setup.c (yes, I use softpipe in gallium), and find it's ok. 
But I don't know the rasterization algorithm exactly and don't know the solution good enough or not. 
Please help me to give your professional comment. 

Note1:  the change of sp_setup.c  (the last two lines are changed only )
static void
tri_persp_coeff(struct setup_context *setup,
                struct tgsi_interp_coef *coef,
                uint i,
                const float v[3])
{
   /* premultiply by 1/w  (v[0][3] is always W):
    */
   float mina = v[0] * setup->vmin[0][3];
   float mida = v[1] * setup->vmid[0][3];
   float maxa = v[2] * setup->vmax[0][3];
   float botda = mida - mina;
   float majda = maxa - mina;
   float a = setup->ebot.dy * majda - botda * setup->emaj.dy;
   float b = setup->emaj.dx * botda - majda * setup->ebot.dx;
   float dadx = a * setup->oneoverarea;
   float dady = b * setup->oneoverarea;

   /*
   debug_printf("tri persp %d,%d: %f %f %f\n", vertSlot, i,
          	setup->vmin[vertSlot][i],
          	setup->vmid[vertSlot][i],
       		setup->vmax[vertSlot][i]
          );
   */
   assert(i <= 3);
   coef->dadx[i] = dadx;
   coef->dady[i] = dady;
   coef->a0[i] = (mina -
                  (dadx * (setup->vmin[0][0] - setup->pixel_offset/setup->vmin[0][3]) +
                   dady * (setup->vmin[0][1] - setup->pixel_offset/setup->vmin[0][3])));
}

Note2:  MALI sample is from the attach file Mali_OpenGL_ES_SDK_for_Linux_On_ARM_v2.0.0.9444_Win32.msi 
And there are some patches to let it run it with mesa 

The first place to let integer type texture to use GL_NEAREST as mag/min filter, not GL_LINEAR in original IntegerLogics.cpp
    /* Load ping texture data. */
    GL_CHECK(glActiveTexture(GL_TEXTURE0));
    GL_CHECK(glBindTexture  (GL_TEXTURE_2D, pingTextureID));
    GL_CHECK(glTexImage2D   (GL_TEXTURE_2D, 0,                     GL_R8UI, WINDOW_W, WINDOW_H, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, pingTextureData));
    GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,     GL_CLAMP_TO_EDGE));
    GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,     GL_CLAMP_TO_EDGE));
    GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
    GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));

    /* Load pong texture data. */
    GL_CHECK(glActiveTexture(GL_TEXTURE1));
    GL_CHECK(glBindTexture  (GL_TEXTURE_2D, pongTextureID));
    GL_CHECK(glTexImage2D   (GL_TEXTURE_2D, 0,                     GL_R8UI, WINDOW_W, WINDOW_H, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, NULL));
    GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,     GL_CLAMP_TO_EDGE));
    GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,     GL_CLAMP_TO_EDGE));
    GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
    GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));

The second place to add explicit type conversion in IntegerLogic_Merge_shader.frag
void main()
{
	/* Determine if the currently drawn line is odd or even. */
	if((uint(gl_FragCoord.y) & 1u) == 0u)
	{
		/* Use the ping texture. */
		fragColor = vec4(texture(pingTexture, fragmentTexCoord).rrrr);
	}
	else
	{
		/* Use the pong texture. */
		fragColor = vec4(texture(pongTexture, fragmentTexCoord).rrrr);
	}
}
Comment 1 GitLab Migration User 2019-09-18 18:27:39 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/209.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.