[Mesa-dev] [PATCH 09/11] swr: [rasterizer core] rename *_MAX enum values to *_COUNT

Tim Rowley timothy.o.rowley at intel.com
Mon Jul 18 17:10:18 UTC 2016


Makes these names semantically correct.
---
 src/gallium/drivers/swr/rasterizer/core/api.cpp        |  6 +++---
 src/gallium/drivers/swr/rasterizer/core/backend.cpp    | 18 +++++++++---------
 src/gallium/drivers/swr/rasterizer/core/multisample.h  |  4 ++--
 src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp |  4 ++--
 src/gallium/drivers/swr/rasterizer/core/state.h        | 11 +++++------
 5 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp
index c3a1539..8a2787b 100644
--- a/src/gallium/drivers/swr/rasterizer/core/api.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp
@@ -735,10 +735,10 @@ void SetupMacroTileScissors(DRAW_CONTEXT *pDC)
 }
 
 // templated backend function tables
-extern PFN_BACKEND_FUNC gBackendNullPs[SWR_MULTISAMPLE_TYPE_MAX];
+extern PFN_BACKEND_FUNC gBackendNullPs[SWR_MULTISAMPLE_TYPE_COUNT];
 extern PFN_BACKEND_FUNC gBackendSingleSample[2][2][2];
-extern PFN_BACKEND_FUNC gBackendPixelRateTable[SWR_MULTISAMPLE_TYPE_MAX][SWR_MSAA_SAMPLE_PATTERN_MAX][2][2][2][2];
-extern PFN_BACKEND_FUNC gBackendSampleRateTable[SWR_MULTISAMPLE_TYPE_MAX][2][2][2];
+extern PFN_BACKEND_FUNC gBackendPixelRateTable[SWR_MULTISAMPLE_TYPE_COUNT][SWR_MSAA_SAMPLE_PATTERN_COUNT][2][2][2][2];
+extern PFN_BACKEND_FUNC gBackendSampleRateTable[SWR_MULTISAMPLE_TYPE_COUNT][2][2][2];
 void SetupPipeline(DRAW_CONTEXT *pDC)
 {
     DRAW_STATE* pState = pDC->pState;
diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.cpp b/src/gallium/drivers/swr/rasterizer/core/backend.cpp
index 5d83baf..81abb29 100644
--- a/src/gallium/drivers/swr/rasterizer/core/backend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/backend.cpp
@@ -1155,19 +1155,19 @@ void InitClearTilesTable()
     sClearTilesTable[R8_UINT] = ClearMacroTile<R8_UINT>;
 }
 
-PFN_BACKEND_FUNC gBackendNullPs[SWR_MULTISAMPLE_TYPE_MAX];
+PFN_BACKEND_FUNC gBackendNullPs[SWR_MULTISAMPLE_TYPE_COUNT];
 PFN_BACKEND_FUNC gBackendSingleSample[2] // input coverage
                                      [2] // centroid
                                      [2] // canEarlyZ
                                      = {};
-PFN_BACKEND_FUNC gBackendPixelRateTable[SWR_MULTISAMPLE_TYPE_MAX]
-                                       [SWR_MSAA_SAMPLE_PATTERN_MAX]
+PFN_BACKEND_FUNC gBackendPixelRateTable[SWR_MULTISAMPLE_TYPE_COUNT]
+                                       [SWR_MSAA_SAMPLE_PATTERN_COUNT]
                                        [2] // input coverage
                                        [2] // centroid
                                        [2] // forcedSampleCount
                                        [2] // canEarlyZ
                                        = {};
-PFN_BACKEND_FUNC gBackendSampleRateTable[SWR_MULTISAMPLE_TYPE_MAX]
+PFN_BACKEND_FUNC gBackendSampleRateTable[SWR_MULTISAMPLE_TYPE_COUNT]
                                         [2] // input coverage
                                         [2] // centroid
                                         [2] // canEarlyZ
@@ -1255,11 +1255,11 @@ void InitBackendSingleFuncTable(PFN_BACKEND_FUNC (&table)[2][2][2])
     }
 }
 
-void InitBackendPixelFuncTable(PFN_BACKEND_FUNC (&table)[SWR_MULTISAMPLE_TYPE_MAX][SWR_MSAA_SAMPLE_PATTERN_MAX][2][2][2][2])
+void InitBackendPixelFuncTable(PFN_BACKEND_FUNC (&table)[SWR_MULTISAMPLE_TYPE_COUNT][SWR_MSAA_SAMPLE_PATTERN_COUNT][2][2][2][2])
 {
-    for(uint32_t sampleCount = SWR_MULTISAMPLE_1X; sampleCount < SWR_MULTISAMPLE_TYPE_MAX; sampleCount++)
+    for(uint32_t sampleCount = SWR_MULTISAMPLE_1X; sampleCount < SWR_MULTISAMPLE_TYPE_COUNT; sampleCount++)
     {
-        for(uint32_t samplePattern = SWR_MSAA_CENTER_PATTERN; samplePattern < SWR_MSAA_SAMPLE_PATTERN_MAX; samplePattern++)
+        for(uint32_t samplePattern = SWR_MSAA_CENTER_PATTERN; samplePattern < SWR_MSAA_SAMPLE_PATTERN_COUNT; samplePattern++)
         {
             for(uint32_t inputCoverage = 0; inputCoverage < 2; inputCoverage++)
             {
@@ -1280,9 +1280,9 @@ void InitBackendPixelFuncTable(PFN_BACKEND_FUNC (&table)[SWR_MULTISAMPLE_TYPE_MA
     }
 }
 
-void InitBackendSampleFuncTable(PFN_BACKEND_FUNC (&table)[SWR_MULTISAMPLE_TYPE_MAX][2][2][2])
+void InitBackendSampleFuncTable(PFN_BACKEND_FUNC (&table)[SWR_MULTISAMPLE_TYPE_COUNT][2][2][2])
 {
-    for(uint32_t sampleCount = SWR_MULTISAMPLE_1X; sampleCount < SWR_MULTISAMPLE_TYPE_MAX; sampleCount++)
+    for(uint32_t sampleCount = SWR_MULTISAMPLE_1X; sampleCount < SWR_MULTISAMPLE_TYPE_COUNT; sampleCount++)
     {
         for(uint32_t inputCoverage = 0; inputCoverage < 2; inputCoverage++)
         {
diff --git a/src/gallium/drivers/swr/rasterizer/core/multisample.h b/src/gallium/drivers/swr/rasterizer/core/multisample.h
index bba0d9a..55387a2 100644
--- a/src/gallium/drivers/swr/rasterizer/core/multisample.h
+++ b/src/gallium/drivers/swr/rasterizer/core/multisample.h
@@ -36,8 +36,8 @@ typedef std::integral_constant<int, 1> SingleSampleT;
 INLINE
 uint32_t GetNumSamples(SWR_MULTISAMPLE_COUNT sampleCount)
 {
-    static const uint32_t sampleCountLUT[SWR_MULTISAMPLE_TYPE_MAX] {1, 2, 4, 8, 16};
-    assert(sampleCount < SWR_MULTISAMPLE_TYPE_MAX);
+    static const uint32_t sampleCountLUT[SWR_MULTISAMPLE_TYPE_COUNT] {1, 2, 4, 8, 16};
+    assert(sampleCount < SWR_MULTISAMPLE_TYPE_COUNT);
     return sampleCountLUT[sampleCount];
 }
 
diff --git a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp
index 408d1d5..897556a 100644
--- a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp
@@ -1545,8 +1545,8 @@ PFN_WORK_FUNC GetRasterizerFunc(
 )
 {
     return TemplateArgUnroller<RasterizerChooser>::GetFunc(
-        IntArg<0,4>{numSamples},
+        IntArg<SWR_MULTISAMPLE_1X,SWR_MULTISAMPLE_TYPE_COUNT-1>{numSamples},
         IsConservative,
-        IntArg<SWR_INPUT_COVERAGE_NONE, SWR_INPUT_COVERAGE_MAX>{InputCoverage},
+        IntArg<SWR_INPUT_COVERAGE_NONE, SWR_INPUT_COVERAGE_COUNT-1>{InputCoverage},
         RasterizeScissorEdges);
 }
diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h
index 0931c82..3514a8f 100644
--- a/src/gallium/drivers/swr/rasterizer/core/state.h
+++ b/src/gallium/drivers/swr/rasterizer/core/state.h
@@ -761,7 +761,7 @@ enum SWR_MULTISAMPLE_COUNT
     SWR_MULTISAMPLE_4X,
     SWR_MULTISAMPLE_8X,
     SWR_MULTISAMPLE_16X,
-    SWR_MULTISAMPLE_TYPE_MAX
+    SWR_MULTISAMPLE_TYPE_COUNT
 };
 
 struct SWR_BLEND_STATE
@@ -872,7 +872,7 @@ enum SWR_MSAA_SAMPLE_PATTERN
 {
     SWR_MSAA_CENTER_PATTERN,
     SWR_MSAA_STANDARD_PATTERN,
-    SWR_MSAA_SAMPLE_PATTERN_MAX
+    SWR_MSAA_SAMPLE_PATTERN_COUNT
 };
 
 enum SWR_PIXEL_LOCATION
@@ -1008,7 +1008,7 @@ enum SWR_SHADING_RATE
 {
     SWR_SHADING_RATE_PIXEL,
     SWR_SHADING_RATE_SAMPLE,
-    SWR_SHADING_RATE_MAX,
+    SWR_SHADING_RATE_COUNT,
 };
 
 enum SWR_INPUT_COVERAGE
@@ -1016,7 +1016,7 @@ enum SWR_INPUT_COVERAGE
     SWR_INPUT_COVERAGE_NONE,
     SWR_INPUT_COVERAGE_NORMAL,
     SWR_INPUT_COVERAGE_INNER_CONSERVATIVE,
-    SWR_INPUT_COVERAGE_MAX,
+    SWR_INPUT_COVERAGE_COUNT,
 };
 
 enum SWR_PS_POSITION_OFFSET
@@ -1024,7 +1024,7 @@ enum SWR_PS_POSITION_OFFSET
     SWR_PS_POSITION_SAMPLE_NONE, 
     SWR_PS_POSITION_SAMPLE_OFFSET, 
     SWR_PS_POSITION_CENTROID_OFFSET,
-    SWR_PS_POSITION_OFFSET_MAX,
+    SWR_PS_POSITION_OFFSET_COUNT,
 };
 
 enum SWR_BARYCENTRICS_MASK
@@ -1032,7 +1032,6 @@ enum SWR_BARYCENTRICS_MASK
     SWR_BARYCENTRIC_PER_PIXEL_MASK = 0x1,
     SWR_BARYCENTRIC_CENTROID_MASK = 0x2,
     SWR_BARYCENTRIC_PER_SAMPLE_MASK = 0x4,
-    SWR_BARYCENTRICS_MASK_MAX = 0x8
 };
 
 // pixel shader state
-- 
1.9.1



More information about the mesa-dev mailing list