~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/drivers/softpipe/sp_texture.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
 * Conventional allocation path for non-display textures:
52
52
 * Use a simple, maximally packed layout.
53
53
 */
54
 
static boolean
 
54
static bool
55
55
softpipe_resource_layout(struct pipe_screen *screen,
56
56
                         struct softpipe_resource *spr,
57
 
                         boolean allocate)
 
57
                         bool allocate)
58
58
{
59
59
   struct pipe_resource *pt = &spr->base;
60
60
   unsigned level;
83
83
      /* if row_stride * height > SP_MAX_TEXTURE_SIZE */
84
84
      if ((uint64_t)spr->stride[level] * nblocksy > SP_MAX_TEXTURE_SIZE) {
85
85
         /* image too large */
86
 
         return FALSE;
 
86
         return false;
87
87
      }
88
88
 
89
89
      spr->img_stride[level] = spr->stride[level] * nblocksy;
96
96
   }
97
97
 
98
98
   if (buffer_size > SP_MAX_TEXTURE_SIZE)
99
 
      return FALSE;
 
99
      return false;
100
100
 
101
101
   if (allocate) {
102
102
      spr->data = align_malloc(buffer_size, 64);
103
103
      return spr->data != NULL;
104
104
   }
105
105
   else {
106
 
      return TRUE;
 
106
      return true;
107
107
   }
108
108
}
109
109
 
119
119
   struct softpipe_resource spr;
120
120
   memset(&spr, 0, sizeof(spr));
121
121
   spr.base = *res;
122
 
   return softpipe_resource_layout(screen, &spr, FALSE);
 
122
   return softpipe_resource_layout(screen, &spr, false);
123
123
}
124
124
 
125
125
 
126
126
/**
127
127
 * Texture layout for simple color buffers.
128
128
 */
129
 
static boolean
 
129
static bool
130
130
softpipe_displaytarget_layout(struct pipe_screen *screen,
131
131
                              struct softpipe_resource *spr,
132
132
                              const void *map_front_private)
177
177
         goto fail;
178
178
   }
179
179
   else {
180
 
      if (!softpipe_resource_layout(screen, spr, TRUE))
 
180
      if (!softpipe_resource_layout(screen, spr, true))
181
181
         goto fail;
182
182
   }
183
183
    
395
395
    * context if necessary.
396
396
    */
397
397
   if (!(usage & PIPE_MAP_UNSYNCHRONIZED)) {
398
 
      boolean read_only = !(usage & PIPE_MAP_WRITE);
399
 
      boolean do_not_block = !!(usage & PIPE_MAP_DONTBLOCK);
 
398
      bool read_only = !(usage & PIPE_MAP_WRITE);
 
399
      bool do_not_block = !!(usage & PIPE_MAP_DONTBLOCK);
400
400
      if (!softpipe_flush_resource(pipe, resource,
401
401
                                   level, box->depth > 1 ? -1 : box->z,
402
402
                                   0, /* flush_flags */
403
403
                                   read_only,
404
 
                                   TRUE, /* cpu_access */
 
404
                                   true, /* cpu_access */
405
405
                                   do_not_block)) {
406
406
         /*
407
407
          * It would have blocked, but state tracker requested no to.
502
502
   spr->base.height0 = 1;
503
503
   spr->base.depth0 = 1;
504
504
   spr->base.array_size = 1;
505
 
   spr->userBuffer = TRUE;
 
505
   spr->userBuffer = true;
506
506
   spr->data = ptr;
507
507
 
508
508
   return &spr->base;
523
523
 
524
524
   pipe->create_surface = softpipe_create_surface;
525
525
   pipe->surface_destroy = softpipe_surface_destroy;
526
 
   pipe->clear_texture = util_clear_texture;
 
526
   pipe->clear_texture = util_clear_texture_sw;
527
527
}
528
528
 
529
529