[Mesa-dev] [PATCH] i965: Let driconf clamp_max_samples affect context version

Eric Anholt eric at anholt.net
Mon Nov 4 17:52:56 PST 2013

Chad Versace <chad.versace at linux.intel.com> writes:

> Commit 2f89662 added the driconf option 'clamp_max_samples'.  In that
> commit, the option did not alter the context version.
> Specifically, Mesa constructed a GL 3.0 context for Baytrail even if
> clamp_max_samples=0, which clamps GL_MAX_SAMPLES to 0. This violates the
> GL 3.0 spec, which requires GL_MAX_SAMPLES >= 4.
> The spec violation causes WebGL fail on Chromium because it correctly
> assumes that a GL 3.0 context supports at least 4 samples.
> This patch fixes calculation of the context version to respect the
> post-clamped value of GL_MAX_SAMPLES. This in turn fixes WebGL on
> Chromium when clamp_max_samples=0.

The extra copy of something-a-lot-like-intel_quantize_num_samples()
still bothers me, for debug code that we don't expect to ever get turned
on.  Since it's only called at context init time, something like this
might work:

/* Clamp max_samples to the highest implementation-supported sample
 * count less than or equal to the driconf clamp_max_samples option.
unsigned clamp_max_samples = driQueryOptioni(&brw->optionCache, "clamp_max_samples");
unsigned max_samples = intel_quantize_num_samples(clamp_max_samples);
while (intel_quantize_num_samples(max_samples) > clamp_max_samples)
      max_samples /= 2;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131104/1413e282/attachment.pgp>

More information about the mesa-dev mailing list