<p dir="ltr"></p>
<p dir="ltr">On Nov 20, 2016 22:42, "Jordan Justen" <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>> wrote:<br>
><br>
> On 2016-11-20 21:15:24, Jason Ekstrand wrote:<br>
> > On Sun, Nov 20, 2016 at 9:12 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> > wrote:<br>
> ><br>
> > On Sun, Nov 20, 2016 at 8:03 PM, Jordan Justen<br>
> > <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>> wrote:<br>
> ><br>
> > Fixes:<br>
> ><br>
> > ES31-CTS.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_pot<br>
> > ES31-CTS.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_npot<br>
> > ES31-CTS.functional.texture.border_clamp.formats.depth32f_stencil8_sample_stencil.nearest_size_pot<br>
> > ES31-CTS.functional.texture.border_clamp.formats.depth32f_stencil8_sample_stencil.nearest_size_npot<br>
> > ES31-CTS.functional.texture.border_clamp.unused_channels.depth24_stencil8_sample_stencil<br>
> > ES31-CTS.functional.texture.border_clamp.unused_channels.depth32f_stencil8_sample_stencil<br>
> ><br>
> > Signed-off-by: Jordan Justen <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>><br>
> > ---<br>
> > src/mesa/drivers/dri/i965/brw_sampler_state.c | 18 +++++++++---------<br>
> > src/mesa/drivers/dri/i965/brw_state.h | 9 ---------<br>
> > 2 files changed, 9 insertions(+), 18 deletions(-)<br>
> ><br>
> > diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c<br>
> > b/src/mesa/drivers/dri/i965/brw_sampler_state.c<br>
> > index 7df2c55..412efb9 100644<br>
> > --- a/src/mesa/drivers/dri/i965/brw_sampler_state.c<br>
> > +++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c<br>
> > @@ -213,7 +213,7 @@ static void<br>
> > upload_default_color(struct brw_context *brw,<br>
> > const struct gl_sampler_object *sampler,<br>
> > mesa_format format, GLenum base_format,<br>
> > - bool is_integer_format,<br>
> > + bool is_integer_format, bool<br>
> > is_stencil_sampling,<br>
> > uint32_t *sdc_offset)<br>
> > {<br>
> > union gl_color_union color;<br>
> > @@ -277,7 +277,7 @@ upload_default_color(struct brw_context *brw,<br>
> > uint32_t *sdc = brw_state_batch(brw,<br>
> > AUB_TRACE_SAMPLER_DEFAULT_COLOR,<br>
> > 4 * 4, 64, sdc_offset);<br>
> > memcpy(sdc, color.ui, 4 * 4);<br>
> > - } else if (brw->is_haswell && is_integer_format) {<br>
> > + } else if (brw->is_haswell && (is_integer_format ||<br>
> > is_stencil_sampling)) {<br>
> > /* Haswell's integer border color support is completely insane:<br>
> > * SAMPLER_BORDER_COLOR_STATE is 20 DWords. The first four are<br>
> > * for float colors. The next 12 DWords are MBZ and only exist<br>
> > to<br>
> > @@ -291,10 +291,9 @@ upload_default_color(struct brw_context *brw,<br>
> > memset(sdc, 0, 20 * 4);<br>
> > sdc = &sdc[16];<br>
> ><br>
> > + bool stencil = format == MESA_FORMAT_S_UINT8 ||<br>
> > is_stencil_sampling;<br>
> > const int bits_per_channel =<br>
> > - _mesa_get_format_bits(format,<br>
> > - format == MESA_FORMAT_S_UINT8 ?<br>
> > - GL_STENCIL_BITS : GL_RED_BITS);<br>
> > + _mesa_get_format_bits(format, stencil ? GL_STENCIL_BITS :<br>
> > GL_RED_BITS);<br>
> ><br>
> > I guess my suggestion could cause problems here. When we're stencil<br>
> > sampling, does the format come in as anything other than S_UINT8? Do we<br>
> > ever get combined dept-stencil formats in here?<br>
> ><br>
><br>
> Yeah, I think that was what was happening. Note that the affected<br>
> tests (see commit message), have depth+stencil. So, I think<br>
> is_integer_format is false due to the depth aspect of the format.<br>
><br>
> My first attempt at a fix was to alter is_integer_format to || in<br>
> texObj->StencilSampling when calling brw_update_sampler_state, but<br>
> that hit an assert. (I think it was trying to call<br>
> _mesa_get_format_bits with GL_RED_BITS on a depth/stencil format.)</p>
<p dir="ltr">Yeah, that's what I was afraid of on my second reading of the patch. In that case, this is probably the correct solution.</p>
<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>></p>
<p dir="ltr">> -Jordan<br>
><br>
> ><br>
> > /* From the Haswell PRM, "Command Reference: Structures", Page<br>
> > 36:<br>
> > * "If any color channel is missing from the surface format,<br>
> > @@ -389,12 +388,13 @@ upload_default_color(struct brw_context *brw,<br>
> > * Sets the sampler state for a single unit based off of the sampler<br>
> > key<br>
> > * entry.<br>
> > */<br>
> > -void<br>
> > +static void<br>
> > brw_update_sampler_state(struct brw_context *brw,<br>
> > GLenum target, bool tex_cube_map_seamless,<br>
> > GLfloat tex_unit_lod_bias,<br>
> > mesa_format format, GLenum base_format,<br>
> > bool is_integer_format,<br>
> > + bool is_stencil_sampling,<br>
> ><br>
> > Doesn't is_stencil_sampling imply is_integer_format? I mean, stencil is<br>
> > always R8_UINT, right?<br>
> ><br>
> ><br>
> > const struct gl_sampler_object *sampler,<br>
> > uint32_t *sampler_state,<br>
> > uint32_t batch_offset_for_sampler_state)<br>
> > @@ -516,8 +516,8 @@ brw_update_sampler_state(struct brw_context *brw,<br>
> > if (wrap_mode_needs_border_color(wrap_s) ||<br>
> > wrap_mode_needs_border_color(wrap_t) ||<br>
> > wrap_mode_needs_border_color(wrap_r)) {<br>
> > - upload_default_color(brw, sampler,<br>
> > - format, base_format, is_integer_format,<br>
> > + upload_default_color(brw, sampler, format, base_format,<br>
> > + is_integer_format, is_stencil_sampling,<br>
> > &border_color_offset);<br>
> > }<br>
> ><br>
> > @@ -555,7 +555,7 @@ update_sampler_state(struct brw_context *brw,<br>
> > brw_update_sampler_state(brw, texObj->Target,<br>
> > ctx->Texture.CubeMapSeamless,<br>
> > texUnit->LodBias,<br>
> > firstImage->TexFormat,<br>
> > firstImage->_BaseFormat,<br>
> > - texObj->_IsIntegerFormat,<br>
> > + texObj->_IsIntegerFormat,<br>
> > texObj->StencilSampling,<br>
> ><br>
> > In other words, you could just make that comma a pipe and call it a day.<br>
> ><br>
> ><br>
> > sampler,<br>
> > sampler_state,<br>
> > batch_offset_for_sampler_state);<br>
> > }<br>
> > diff --git a/src/mesa/drivers/dri/i965/brw_state.h<br>
> > b/src/mesa/drivers/dri/i965/brw_state.h<br>
> > index 07126e8..176557b 100644<br>
> > --- a/src/mesa/drivers/dri/i965/brw_state.h<br>
> > +++ b/src/mesa/drivers/dri/i965/brw_state.h<br>
> > @@ -335,15 +335,6 @@ void brw_emit_sampler_state(struct brw_context<br>
> > *brw,<br>
> > bool non_normalized_coordinates,<br>
> > uint32_t border_color_offset);<br>
> ><br>
> > -void brw_update_sampler_state(struct brw_context *brw,<br>
> > - GLenum target, bool<br>
> > tex_cube_map_seamless,<br>
> > - GLfloat tex_unit_lod_bias,<br>
> > - mesa_format format, GLenum base_format,<br>
> > - bool is_integer_format,<br>
> > - const struct gl_sampler_object<br>
> > *sampler,<br>
> > - uint32_t *sampler_state,<br>
> > - uint32_t<br>
> > batch_offset_for_sampler_state);<br>
> > -<br>
> > /* gen6_wm_state.c */<br>
> > void<br>
> > gen6_upload_wm_state(struct brw_context *brw,<br>
> > --<br>
> > 2.10.2<br>
> ><br>
> > _______________________________________________<br>
> > mesa-dev mailing list<br>
> > <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br></p>