Save the target in ilo_image instead of passing it around.
enum pipe_format format = templ->format;
bool require_separate_stencil = false;
+ img->target = templ->target;
img->width0 = templ->width0;
img->height0 = templ->height0;
img->depth0 = templ->depth0;
img->aux.type = ILO_IMAGE_AUX_NONE;
+ img->target = templ->target;
img->width0 = templ->width0;
img->height0 = templ->height0;
img->depth0 = templ->depth0;
* Texture layout.
*/
struct ilo_image {
+ enum pipe_texture_target target;
+
/* size, format, etc for programming hardware states */
unsigned width0;
unsigned height0;
void
ilo_gpe_init_view_surface_for_image(const struct ilo_dev *dev,
const struct ilo_image *img,
- enum pipe_texture_target target,
enum pipe_format format,
unsigned first_level,
unsigned num_levels,
ilo_gpe_init_zs_surface(const struct ilo_dev *dev,
const struct ilo_image *img,
const struct ilo_image *s8_img,
- enum pipe_texture_target target,
enum pipe_format format, unsigned level,
unsigned first_layer, unsigned num_layers,
struct ilo_zs_surface *zs);
zs_init_info(const struct ilo_dev *dev,
const struct ilo_image *img,
const struct ilo_image *s8_img,
- enum pipe_texture_target target,
enum pipe_format format, unsigned level,
unsigned first_layer, unsigned num_layers,
struct ilo_zs_surface_info *info)
memset(info, 0, sizeof(*info));
- info->surface_type = ilo_gpe_gen6_translate_texture(target);
+ info->surface_type = ilo_gpe_gen6_translate_texture(img->target);
if (info->surface_type == GEN6_SURFTYPE_CUBE) {
/*
info->width = img->width0;
info->height = img->height0;
- info->depth = (target == PIPE_TEXTURE_3D) ? img->depth0 : num_layers;
+ info->depth = (img->target == PIPE_TEXTURE_3D) ? img->depth0 : num_layers;
info->lod = level;
info->first_layer = first_layer;
ilo_gpe_init_zs_surface(const struct ilo_dev *dev,
const struct ilo_image *img,
const struct ilo_image *s8_img,
- enum pipe_texture_target target,
enum pipe_format format, unsigned level,
unsigned first_layer, unsigned num_layers,
struct ilo_zs_surface *zs)
ILO_DEV_ASSERT(dev, 6, 8);
if (img) {
- zs_init_info(dev, img, s8_img, target, format,
+ zs_init_info(dev, img, s8_img, format,
level, first_layer, num_layers, &info);
switch (img->sample_count) {
static void
view_init_for_image_gen6(const struct ilo_dev *dev,
const struct ilo_image *img,
- enum pipe_texture_target target,
enum pipe_format format,
unsigned first_level,
unsigned num_levels,
ILO_DEV_ASSERT(dev, 6, 6);
- surface_type = ilo_gpe_gen6_translate_texture(target);
+ surface_type = ilo_gpe_gen6_translate_texture(img->target);
assert(surface_type != GEN6_SURFTYPE_BUFFER);
if (format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT && img->separate_stencil)
width = img->width0;
height = img->height0;
- depth = (target == PIPE_TEXTURE_3D) ? img->depth0 : num_layers;
+ depth = (img->target == PIPE_TEXTURE_3D) ? img->depth0 : num_layers;
pitch = img->bo_stride;
if (surface_type == GEN6_SURFTYPE_CUBE) {
static void
view_init_for_image_gen7(const struct ilo_dev *dev,
const struct ilo_image *img,
- enum pipe_texture_target target,
enum pipe_format format,
unsigned first_level,
unsigned num_levels,
ILO_DEV_ASSERT(dev, 7, 8);
- surface_type = ilo_gpe_gen6_translate_texture(target);
+ surface_type = ilo_gpe_gen6_translate_texture(img->target);
assert(surface_type != GEN6_SURFTYPE_BUFFER);
if (format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT && img->separate_stencil)
width = img->width0;
height = img->height0;
- depth = (target == PIPE_TEXTURE_3D) ? img->depth0 : num_layers;
+ depth = (img->target == PIPE_TEXTURE_3D) ? img->depth0 : num_layers;
pitch = img->bo_stride;
if (surface_type == GEN6_SURFTYPE_CUBE) {
* returns zero for the number of layers when this field is not set.
*/
if (surface_type != GEN6_SURFTYPE_3D) {
- switch (target) {
+ switch (img->target) {
case PIPE_TEXTURE_1D_ARRAY:
case PIPE_TEXTURE_2D_ARRAY:
case PIPE_TEXTURE_CUBE_ARRAY:
void
ilo_gpe_init_view_surface_for_image(const struct ilo_dev *dev,
const struct ilo_image *img,
- enum pipe_texture_target target,
enum pipe_format format,
unsigned first_level,
unsigned num_levels,
struct ilo_view_surface *surf)
{
if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
- view_init_for_image_gen7(dev, img, target, format,
+ view_init_for_image_gen7(dev, img, format,
first_level, num_levels, first_layer, num_layers,
is_rt, surf);
} else {
- view_init_for_image_gen6(dev, img, target, format,
+ view_init_for_image_gen6(dev, img, format,
first_level, num_levels, first_layer, num_layers,
is_rt, surf);
}
"not created for sampling\n");
}
- ilo_gpe_init_view_surface_for_image(dev, &tex->image,
- tex->base.target, templ->format,
+ ilo_gpe_init_view_surface_for_image(dev, &tex->image, templ->format,
templ->u.tex.first_level,
templ->u.tex.last_level - templ->u.tex.first_level + 1,
templ->u.tex.first_layer,
/* relax this? */
assert(tex->base.target != PIPE_BUFFER);
- ilo_gpe_init_view_surface_for_image(dev,
- &tex->image, tex->base.target,
+ ilo_gpe_init_view_surface_for_image(dev, &tex->image,
templ->format, templ->u.tex.level, 1,
templ->u.tex.first_layer,
templ->u.tex.last_layer - templ->u.tex.first_layer + 1,
ilo_gpe_init_zs_surface(dev, &tex->image,
(tex->separate_s8) ? &tex->separate_s8->image : NULL,
- tex->base.target, templ->format,
+ templ->format,
templ->u.tex.level, templ->u.tex.first_layer,
templ->u.tex.last_layer - templ->u.tex.first_layer + 1,
&surf->u.zs);
{
ilo_gpe_set_scissor_null(dev, &vec->scissor);
- ilo_gpe_init_zs_surface(dev, NULL, NULL, PIPE_TEXTURE_2D,
+ ilo_gpe_init_zs_surface(dev, NULL, NULL,
PIPE_FORMAT_NONE, 0, 0, 1, &vec->fb.null_zs);
util_dynarray_init(&vec->global_binding.bindings);