<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - the issue of not correct display from MALI Integer Logic sample"
href="https://bugs.freedesktop.org/show_bug.cgi?id=62236">62236</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Summary</th>
<td>the issue of not correct display from MALI Integer Logic sample
</td>
</tr>
<tr>
<th>Severity</th>
<td>major
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows (All)
</td>
</tr>
<tr>
<th>Reporter</th>
<td>alanjang@hotmail.com
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Component</th>
<td>Other
</td>
</tr>
<tr>
<th>Product</th>
<td>Mesa
</td>
</tr></table>
<p>
<div>
<pre>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);
}
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>