v3d: Use the symbolic names for wrap modes from the XML.
authorEric Anholt <eric@anholt.net>
Wed, 23 Jan 2019 19:54:48 +0000 (11:54 -0800)
committerEric Anholt <eric@anholt.net>
Sun, 27 Jan 2019 16:30:03 +0000 (08:30 -0800)
src/broadcom/cle/v3d_packet_v33.xml
src/gallium/drivers/v3d/v3dx_state.c

index 31395450153233de19626a20bf80d6cce39b31ad..4f605e7a4d068b70aea0e1a239c0e0c49c330714 100644 (file)
   </enum>
 
   <enum name="Wrap Mode" prefix="V3D_WRAP_MODE">
-      <value name="Wrap mode REPEAT" value="0"/>
-      <value name="Wrap mode CLAMP" value="1"/>
-      <value name="Wrap mode MIRROR" value="2"/>
-      <value name="Wrap mode BORDER" value="3"/>
-      <value name="Wrap mode MIRROR_ONCE" value="4"/>
+      <value name="REPEAT" value="0"/>
+      <value name="CLAMP" value="1"/>
+      <value name="MIRROR" value="2"/>
+      <value name="BORDER" value="3"/>
+      <value name="MIRROR_ONCE" value="4"/>
   </enum>
 
   <enum name="TMU Op" prefix="V3D_TMU_OP" min_ver="41">
index 9560d3f293b241bb941d75c00bad5a986171cb2b..eafa8853cb9541eed9af9e547104914f76bc2cd5 100644 (file)
@@ -503,19 +503,22 @@ v3d_set_framebuffer_state(struct pipe_context *pctx,
         v3d->dirty |= VC5_DIRTY_FRAMEBUFFER;
 }
 
-static uint32_t translate_wrap(uint32_t pipe_wrap, bool using_nearest)
+static enum V3DX(Wrap_Mode)
+translate_wrap(uint32_t pipe_wrap, bool using_nearest)
 {
         switch (pipe_wrap) {
         case PIPE_TEX_WRAP_REPEAT:
-                return 0;
+                return V3D_WRAP_MODE_REPEAT;
         case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
-                return 1;
+                return V3D_WRAP_MODE_CLAMP;
         case PIPE_TEX_WRAP_MIRROR_REPEAT:
-                return 2;
+                return V3D_WRAP_MODE_MIRROR;
         case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
-                return 3;
+                return V3D_WRAP_MODE_BORDER;
         case PIPE_TEX_WRAP_CLAMP:
-                return (using_nearest ? 1 : 3);
+                return (using_nearest ?
+                        V3D_WRAP_MODE_CLAMP :
+                        V3D_WRAP_MODE_BORDER);
         default:
                 unreachable("Unknown wrap mode");
         }