/* struct lp_jit_texture */
{
- LLVMTypeRef elem_types[6];
+ LLVMTypeRef elem_types[LP_JIT_TEXTURE_NUM_FIELDS];
elem_types[LP_JIT_TEXTURE_WIDTH] = LLVMInt32Type();
elem_types[LP_JIT_TEXTURE_HEIGHT] = LLVMInt32Type();
elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32Type();
elem_types[LP_JIT_TEXTURE_ROW_STRIDE] =
LLVMArrayType(LLVMInt32Type(), LP_MAX_TEXTURE_LEVELS);
+ elem_types[LP_JIT_TEXTURE_IMG_STRIDE] =
+ LLVMArrayType(LLVMInt32Type(), LP_MAX_TEXTURE_LEVELS);
elem_types[LP_JIT_TEXTURE_DATA] =
LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0),
LP_MAX_TEXTURE_LEVELS);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, row_stride,
screen->target, texture_type,
LP_JIT_TEXTURE_ROW_STRIDE);
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, img_stride,
+ screen->target, texture_type,
+ LP_JIT_TEXTURE_IMG_STRIDE);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, data,
screen->target, texture_type,
LP_JIT_TEXTURE_DATA);
uint32_t depth;
uint32_t last_level;
uint32_t row_stride[LP_MAX_TEXTURE_LEVELS];
+ uint32_t img_stride[LP_MAX_TEXTURE_LEVELS];
const void *data[LP_MAX_TEXTURE_LEVELS];
};
LP_JIT_TEXTURE_DEPTH,
LP_JIT_TEXTURE_LAST_LEVEL,
LP_JIT_TEXTURE_ROW_STRIDE,
- LP_JIT_TEXTURE_DATA
+ LP_JIT_TEXTURE_IMG_STRIDE,
+ LP_JIT_TEXTURE_DATA,
+ LP_JIT_TEXTURE_NUM_FIELDS /* number of fields above */
};
llvmpipe_get_texture_image_all(lp_tex, j, LP_TEX_USAGE_READ,
LP_TEX_LAYOUT_LINEAR);
#endif
- jit_tex->row_stride[j] = lp_tex->stride[j];
+ jit_tex->row_stride[j] = lp_tex->row_stride[j];
+ jit_tex->img_stride[j] = lp_tex->img_stride[j];
}
}
else {
struct sw_winsys *winsys = screen->winsys;
jit_tex->data[0] = winsys->displaytarget_map(winsys, lp_tex->dt,
PIPE_TRANSFER_READ);
- jit_tex->row_stride[0] = lp_tex->stride[0];
+ jit_tex->row_stride[0] = lp_tex->row_stride[0];
+ jit_tex->img_stride[0] = lp_tex->img_stride[0];
assert(jit_tex->data[0]);
}
}
LP_TEX_LAYOUT_LINEAR);
util_copy_rect(dst_linear_ptr, format,
- dst_tex->stride[dst->level],
+ dst_tex->row_stride[dst->level],
dstx, dsty,
width, height,
- src_linear_ptr, src_tex->stride[src->level],
+ src_linear_ptr, src_tex->row_stride[src->level],
srcx, srcy);
}
}
LP_LLVM_TEXTURE_MEMBER(depth, LP_JIT_TEXTURE_DEPTH, TRUE)
LP_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL, TRUE)
LP_LLVM_TEXTURE_MEMBER(row_stride, LP_JIT_TEXTURE_ROW_STRIDE, FALSE)
+LP_LLVM_TEXTURE_MEMBER(img_stride, LP_JIT_TEXTURE_IMG_STRIDE, FALSE)
LP_LLVM_TEXTURE_MEMBER(data_ptr, LP_JIT_TEXTURE_DATA, FALSE)
sampler->dynamic_state.base.depth = lp_llvm_texture_depth;
sampler->dynamic_state.base.last_level = lp_llvm_texture_last_level;
sampler->dynamic_state.base.row_stride = lp_llvm_texture_row_stride;
+ sampler->dynamic_state.base.img_stride = lp_llvm_texture_img_stride;
sampler->dynamic_state.base.data_ptr = lp_llvm_texture_data_ptr;
sampler->dynamic_state.static_state = static_state;
sampler->dynamic_state.context_ptr = context_ptr;
*/
nblocksx = util_format_get_nblocksx(pt->format, align(width, TILE_SIZE));
- lpr->stride[level] =
+ lpr->row_stride[level] =
align(nblocksx * util_format_get_blocksize(pt->format), 16);
+ lpr->img_stride[level] = lpr->row_stride[level] * align(height, TILE_SIZE);
+
lpr->tiles_per_row[level] = width_t;
lpr->tiles_per_image[level] = width_t * height_t;
lpr->num_slices_faces[level] = num_slices;
lpr->tiles_per_row[0] = width_t;
lpr->tiles_per_image[0] = width_t * height_t;
lpr->num_slices_faces[0] = 1;
+ lpr->img_stride[0] = 0;
lpr->layout[0] = alloc_layout_array(1, width, height);
lpr->base.format,
width, height,
16,
- &lpr->stride[0] );
+ &lpr->row_stride[0] );
return lpr->dt != NULL;
}
lpr->dt = winsys->displaytarget_from_handle(winsys,
template,
whandle,
- &lpr->stride[0]);
+ &lpr->row_stride[0]);
if (!lpr->dt)
goto fail;
pipe_resource_reference(&pt->resource, resource);
pt->box = *box;
pt->sr = sr;
- pt->stride = lprex->stride[sr.level];
+ pt->stride = lprex->row_stride[sr.level];
pt->usage = usage;
return pt;
const enum pipe_format format = lpr->base.format;
const unsigned nblocksy =
util_format_get_nblocksy(format, align(height, TILE_SIZE));
- const unsigned buffer_size = nblocksy * lpr->stride[level];
+ const unsigned buffer_size = nblocksy * lpr->row_stride[level];
return buffer_size;
}
}
x * TILE_SIZE, y * TILE_SIZE,
TILE_SIZE, TILE_SIZE,
lpr->base.format,
- lpr->stride[level]);
+ lpr->row_stride[level]);
}
else {
lp_tiled_to_linear(other_data, target_data,
x * TILE_SIZE, y * TILE_SIZE,
TILE_SIZE, TILE_SIZE,
lpr->base.format,
- lpr->stride[level]);
+ lpr->row_stride[level]);
}
}
if (convert) {
lp_tiled_to_linear(tiled_img->data, linear_img->data,
x, y, TILE_SIZE, TILE_SIZE, lpr->base.format,
- lpr->stride[level]);
+ lpr->row_stride[level]);
}
if (new_layout != cur_layout)
if (convert) {
lp_linear_to_tiled(linear_img->data, tiled_img->data,
x, y, TILE_SIZE, TILE_SIZE, lpr->base.format,
- lpr->stride[level]);
+ lpr->row_stride[level]);
}
if (new_layout != cur_layout)
struct pipe_resource base;
/** Row stride in bytes */
- unsigned stride[LP_MAX_TEXTURE_LEVELS];
+ unsigned row_stride[LP_MAX_TEXTURE_LEVELS];
+ /** Image stride (for cube maps or 3D textures) in bytes */
+ unsigned img_stride[LP_MAX_TEXTURE_LEVELS];
unsigned tiles_per_row[LP_MAX_TEXTURE_LEVELS];
unsigned tiles_per_image[LP_MAX_TEXTURE_LEVELS];
/** Number of 3D slices or cube faces per level */
{
struct llvmpipe_resource *lpr = llvmpipe_resource(resource);
assert(level < LP_MAX_TEXTURE_2D_LEVELS);
- return lpr->stride[level];
+ return lpr->row_stride[level];
}