aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_fbo.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2013-11-06 19:40:25 -0800
committerChad Versace <[email protected]>2013-11-22 14:56:15 -0800
commit95ebabbc5fceec6a9c37dbb4d8f3282a86fe02ce (patch)
tree7ddb66d3d69a62847d722f5441998a1df85d2b5d /src/mesa/drivers/dri/i965/intel_fbo.c
parent8d1a8d65b55bac28fe2c63847b1ef216b7f2c9aa (diff)
i965: Share code between intel_quantize_num_samples and clamp_max_samples
clamp_max_samples() and intel_quantize_num_samples() each maintained their own list of which MSAA modes the hardware supports. This patch removes the duplication by making intel_quantize_num_samples() use the same list as clamp_max_samples(), the list maintained in brw_supported_msaa_modes(). By removing the duplication, we prevent the scenario where someone updates one list but forgets to update the other. Move function `brw_context.c:static brw_supported_msaa_modes()` to `intel_screen.c:(non-static) intel_supported_msaa_modes()` and patch intel_quantize_num_samples() to use the list returned by that function. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_fbo.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_fbo.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index ddecb2b9800..472d2ca6f86 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -46,6 +46,7 @@
#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"
@@ -159,26 +160,17 @@ intel_unmap_renderbuffer(struct gl_context *ctx,
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;
}