Mesa (master): i965: Terminate brw_supported_msaa_modes() list with -1, not 0

Chad Versace chadversary at kemper.freedesktop.org
Fri Nov 22 23:27:13 UTC 2013


Module: Mesa
Branch: master
Commit: 8d1a8d65b55bac28fe2c63847b1ef216b7f2c9aa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d1a8d65b55bac28fe2c63847b1ef216b7f2c9aa

Author: Chad Versace <chad.versace at linux.intel.com>
Date:   Fri Nov 15 08:21:30 2013 -0800

i965: Terminate brw_supported_msaa_modes() list with -1, not 0

This simplifies the loop logic in a subsqequent patch that refactors
intel_quantize_num_samples() to use brw_supported_msaa_modes().

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>

---

 src/mesa/drivers/dri/i965/brw_context.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 4e09038..52b1084 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -279,14 +279,15 @@ brw_init_driver_functions(struct brw_context *brw,
 
 /**
  * Return array of MSAA modes supported by the hardware. The array is
- * zero-terminated and sorted in decreasing order.
+ * 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};
-   static const int gen6_samples[] = {4, 0};
-   static const int gen4_samples[] = {0};
+   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) {
@@ -314,7 +315,7 @@ brw_override_max_samples(struct brw_context *brw)
    /* Select the largest supported MSAA mode that does not exceed
     * clamp_max_samples.
     */
-   for (int i = 0; supported_msaa_modes[i] != 0; ++i) {
+   for (int i = 0; supported_msaa_modes[i] != -1; ++i) {
       if (supported_msaa_modes[i] <= clamp_max_samples) {
          max_samples = supported_msaa_modes[i];
          break;




More information about the mesa-commit mailing list