modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/compile/pr42705.c (about) 1 typedef int GLint; 2 typedef unsigned char GLubyte; 3 typedef unsigned int uint32_t; 4 struct radeon_bo { 5 void *ptr; 6 uint32_t flags; 7 }; 8 struct radeon_renderbuffer { 9 struct radeon_bo *bo; 10 unsigned int cpp; 11 int has_surface; 12 }; 13 static inline 14 GLint r600_1d_tile_helper(const struct radeon_renderbuffer * rrb, 15 GLint x, GLint y, GLint is_depth, GLint is_stencil) 16 { 17 GLint element_bytes = rrb->cpp; 18 GLint num_samples = 1; 19 GLint tile_width = 8; 20 GLint tile_height = 8; 21 GLint tile_thickness = 1; 22 GLint tile_bytes; 23 GLint tiles_per_row; 24 GLint slice_offset; 25 GLint tile_row_index; 26 GLint tile_column_index; 27 GLint tile_offset; 28 GLint pixel_number = 0; 29 GLint element_offset; 30 GLint offset = 0; 31 tile_bytes = tile_width * tile_height * tile_thickness 32 * element_bytes * num_samples; 33 tile_column_index = x / tile_width; 34 tile_offset = ((tile_row_index * tiles_per_row) 35 + tile_column_index) * tile_bytes; 36 if (is_depth) { 37 } 38 else { 39 GLint sample_offset; 40 switch (element_bytes) { 41 case 1: pixel_number |= ((x >> 0) & 1) << 0; 42 } 43 element_offset = sample_offset + (pixel_number * element_bytes); 44 } 45 offset = slice_offset + tile_offset + element_offset; 46 return offset; 47 } 48 GLubyte *r600_ptr_color(const struct radeon_renderbuffer * rrb, 49 GLint x, GLint y) 50 { 51 GLubyte *ptr = rrb->bo->ptr; 52 uint32_t mask = 1 | 2; 53 GLint offset; 54 if (rrb->has_surface || !(rrb->bo->flags & mask)) { 55 offset = r600_1d_tile_helper(rrb, x, y, 0, 0); 56 } 57 return &ptr[offset]; 58 }