mesa: add _mesa_program_state_value_size() helper
[mesa.git] / src / mesa / swrast / s_points.c
index 8180483ba4b528e97ffdad96cb46ec65f8604c42..1c6c239042aaef8aac20d1be8a3c2f417b3afd3d 100644 (file)
@@ -22,9 +22,8 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-
+#include "main/framebuffer.h"
 #include "main/glheader.h"
-#include "main/colormac.h"
 #include "main/macros.h"
 #include "s_context.h"
 #include "s_feedback.h"
@@ -39,7 +38,7 @@
    do {                                              \
       float tmp = (V)->attrib[VARYING_SLOT_POS][0]   \
                 + (V)->attrib[VARYING_SLOT_POS][1];  \
-      if (IS_INF_OR_NAN(tmp))                        \
+      if (util_is_inf_or_nan(tmp))                   \
         return;                                     \
    } while(0)
 
@@ -140,8 +139,8 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert)
          if (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) {
             /* a texcoord attribute */
             const GLuint u = attr - VARYING_SLOT_TEX0;
-            assert(u < ARRAY_SIZE(ctx->Point.CoordReplace));
-            if (ctx->Point.CoordReplace[u]) {
+            assert(u < MAX_TEXTURE_COORD_UNITS);
+            if (ctx->Point.CoordReplace & (1u << u)) {
                tCoords[numTcoords++] = attr;
 
                if (ctx->Point.SpriteRMode == GL_ZERO)
@@ -209,9 +208,9 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert)
       else {
          /* even size */
          /* 0.501 factor allows conformance to pass */
-         xmin = (GLint) (x + 0.501) - iRadius;
+         xmin = (GLint) (x + 0.501F) - iRadius;
          xmax = xmin + iSize - 1;
-         ymin = (GLint) (y + 0.501) - iRadius;
+         ymin = (GLint) (y + 0.501F) - iRadius;
          ymax = ymin + iSize - 1;
       }
 
@@ -258,7 +257,7 @@ smooth_point(struct gl_context *ctx, const SWvertex *vert)
    size = get_size(ctx, vert, GL_TRUE);
 
    /* alpha attenuation / fade factor */
-   if (ctx->Multisample._Enabled) {
+   if (_mesa_is_multisample_enabled(ctx)) {
       if (vert->pointSize >= ctx->Point.Threshold) {
          alphaAtten = 1.0F;
       }
@@ -424,9 +423,9 @@ large_point(struct gl_context *ctx, const SWvertex *vert)
       else {
          /* even size */
          /* 0.501 factor allows conformance to pass */
-         xmin = (GLint) (x + 0.501) - iRadius;
+         xmin = (GLint) (x + 0.501F) - iRadius;
          xmax = xmin + iSize - 1;
-         ymin = (GLint) (y + 0.501) - iRadius;
+         ymin = (GLint) (y + 0.501F) - iRadius;
          ymax = ymin + iSize - 1;
       }
 
@@ -553,7 +552,7 @@ _swrast_choose_point(struct gl_context *ctx)
       else if (ctx->Point.SmoothFlag) {
          swrast->Point = smooth_point;
       }
-      else if (size > 1.0 ||
+      else if (size > 1.0F ||
                ctx->Point._Attenuated ||
                ctx->VertexProgram.PointSizeEnabled) {
          swrast->Point = large_point;