llvmpipe: enable texcoord semantics
authorDave Airlie <airlied@redhat.com>
Tue, 3 Dec 2019 23:26:46 +0000 (09:26 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 4 Dec 2019 02:08:14 +0000 (12:08 +1000)
To make NIR transitioning easier, move the driver to using
texcoord semantics.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_setup_point.c

index 0814145512c1b34fbca7b398f9502df79b2c7364..ce41baa529bbadb93437b3955caefe0d4b1e6cf2 100644 (file)
@@ -227,8 +227,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
-   case PIPE_CAP_TGSI_TEXCOORD:
       return 0;
+   case PIPE_CAP_TGSI_TEXCOORD:
    case PIPE_CAP_DRAW_INDIRECT:
       return 1;
 
index 0c4b1b758f921568dcdf0e8c7c37376849d7e14c..073ca5b1c88825e50fc5128077ccd5dc3714639f 100644 (file)
@@ -241,27 +241,35 @@ setup_point_coefficients( struct lp_setup_context *setup,
       case LP_INTERP_LINEAR:
          /* Sprite tex coords may use linear interpolation someday */
          /* fall-through */
-      case LP_INTERP_PERSPECTIVE:
+      case LP_INTERP_PERSPECTIVE: {
          /* check if the sprite coord flag is set for this attribute.
           * If so, set it up so it up so x and y vary from 0 to 1.
           */
-         if (shader->info.base.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) {
+         bool do_texcoord_coef = false;
+         if (shader->info.base.input_semantic_name[slot] == TGSI_SEMANTIC_PCOORD) {
+            do_texcoord_coef = true;
+         }
+         else if (shader->info.base.input_semantic_name[slot] == TGSI_SEMANTIC_TEXCOORD) {
             unsigned semantic_index = shader->info.base.input_semantic_index[slot];
             /* Note that sprite_coord enable is a bitfield of
              * PIPE_MAX_SHADER_OUTPUTS bits.
              */
             if (semantic_index < PIPE_MAX_SHADER_OUTPUTS &&
                 (setup->sprite_coord_enable & (1u << semantic_index))) {
-               for (i = 0; i < NUM_CHANNELS; i++) {
-                  if (usage_mask & (1 << i)) {
-                     texcoord_coef(setup, info, slot + 1, i,
-                                   setup->sprite_coord_origin,
-                                   perspective);
-                  }
+               do_texcoord_coef = true;
+            }
+         }
+         if (do_texcoord_coef) {
+            for (i = 0; i < NUM_CHANNELS; i++) {
+               if (usage_mask & (1 << i)) {
+                  texcoord_coef(setup, info, slot + 1, i,
+                                setup->sprite_coord_origin,
+                                perspective);
                }
-               break;
             }
+            break;
          }
+      }
          /* fall-through */
       case LP_INTERP_CONSTANT:
          for (i = 0; i < NUM_CHANNELS; i++) {