functions->GetSamplePosition = gen6_get_sample_position;
}
-/**
- * Return array of MSAA modes supported by the hardware. The array is
- * terminated by -1 and sorted in decreasing order.
- */
-static const int*
-brw_supported_msaa_modes(const struct brw_context *brw)
-{
- static const int gen7_samples[] = {8, 4, 0, -1};
- static const int gen6_samples[] = {4, 0, -1};
- static const int gen4_samples[] = {0, -1};
-
- if (brw->gen >= 7) {
- return gen7_samples;
- } else if (brw->gen == 6) {
- return gen6_samples;
- } else {
- return gen4_samples;
- }
-}
-
/**
* Override GL_MAX_SAMPLES and related constants according to value of driconf
* option 'clamp_max_samples'.
if (clamp_max_samples < 0)
return;
- const int *supported_msaa_modes = brw_supported_msaa_modes(brw);
+ const int *supported_msaa_modes =
+ intel_supported_msaa_modes(brw->intelScreen);
int max_samples = 0;
/* Select the largest supported MSAA mode that does not exceed
ctx->Const.AlwaysUseGetTransformFeedbackVertexCount = true;
- const int max_samples = brw_supported_msaa_modes(brw)[0];
+ const int max_samples =
+ intel_supported_msaa_modes(brw->intelScreen)[0];
ctx->Const.MaxSamples = max_samples;
ctx->Const.MaxColorTextureSamples = max_samples;
ctx->Const.MaxDepthTextureSamples = max_samples;
#include "intel_fbo.h"
#include "intel_mipmap_tree.h"
#include "intel_regions.h"
+#include "intel_screen.h"
#include "intel_tex.h"
#include "brw_context.h"
unsigned
intel_quantize_num_samples(struct intel_screen *intel, unsigned num_samples)
{
- switch (intel->devinfo->gen) {
- case 6:
- /* Gen6 supports only 4x multisampling. */
- if (num_samples > 0)
- return 4;
- else
- return 0;
- case 7:
- /* Gen7 supports 4x and 8x multisampling. */
- if (num_samples > 4)
- return 8;
- else if (num_samples > 0)
- return 4;
+ const int *msaa_modes = intel_supported_msaa_modes(intel);
+ int quantized_samples = 0;
+
+ for (int i = 0; msaa_modes[i] != -1; ++i) {
+ if (msaa_modes[i] >= num_samples)
+ quantized_samples = msaa_modes[i];
else
- return 0;
- return 0;
- default:
- /* MSAA unsupported. */
- return 0;
+ break;
}
+
+ return quantized_samples;
}
return true;
}
+/**
+ * Return array of MSAA modes supported by the hardware. The array is
+ * zero-terminated and sorted in decreasing order.
+ */
+const int*
+intel_supported_msaa_modes(const struct intel_screen *screen)
+{
+ static const int gen7_modes[] = {8, 4, 0, -1};
+ static const int gen6_modes[] = {4, 0, -1};
+ static const int gen4_modes[] = {0, -1};
+
+ if (screen->devinfo->gen >= 7) {
+ return gen7_modes;
+ } else if (screen->devinfo->gen == 6) {
+ return gen6_modes;
+ } else {
+ return gen4_modes;
+ }
+}
+
static __DRIconfig**
intel_screen_make_configs(__DRIscreen *dri_screen)
{
double get_time(void);
void aub_dump_bmp(struct gl_context *ctx);
+const int*
+intel_supported_msaa_modes(const struct intel_screen *screen);
+
#endif