summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2015-05-17 11:55:05 +0800
committerChia-I Wu <[email protected]>2015-06-14 15:43:20 +0800
commitf9d2bbe967fb1fbbe7102c0765f067b3155f5ca6 (patch)
tree7b94b767df491ece0ed852db4d09db9c83efe1c5 /src
parent9da9cf729ff74684902cbb4b53b5cccd442df28e (diff)
ilo: add pipe_texture_target to ilo_image
Save the target in ilo_image instead of passing it around.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/ilo/core/ilo_image.c2
-rw-r--r--src/gallium/drivers/ilo/core/ilo_image.h2
-rw-r--r--src/gallium/drivers/ilo/core/ilo_state_3d.h2
-rw-r--r--src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c8
-rw-r--r--src/gallium/drivers/ilo/core/ilo_state_3d_top.c17
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c10
6 files changed, 18 insertions, 23 deletions
diff --git a/src/gallium/drivers/ilo/core/ilo_image.c b/src/gallium/drivers/ilo/core/ilo_image.c
index 240595992bf..5365dd10bab 100644
--- a/src/gallium/drivers/ilo/core/ilo_image.c
+++ b/src/gallium/drivers/ilo/core/ilo_image.c
@@ -675,6 +675,7 @@ img_init_size_and_format(struct ilo_image *img,
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;
@@ -1343,6 +1344,7 @@ img_init_for_transfer(struct ilo_image *img,
img->aux.type = ILO_IMAGE_AUX_NONE;
+ img->target = templ->target;
img->width0 = templ->width0;
img->height0 = templ->height0;
img->depth0 = templ->depth0;
diff --git a/src/gallium/drivers/ilo/core/ilo_image.h b/src/gallium/drivers/ilo/core/ilo_image.h
index 1354dd4e986..bef08bc3ca2 100644
--- a/src/gallium/drivers/ilo/core/ilo_image.h
+++ b/src/gallium/drivers/ilo/core/ilo_image.h
@@ -88,6 +88,8 @@ struct ilo_image_lod {
* Texture layout.
*/
struct ilo_image {
+ enum pipe_texture_target target;
+
/* size, format, etc for programming hardware states */
unsigned width0;
unsigned height0;
diff --git a/src/gallium/drivers/ilo/core/ilo_state_3d.h b/src/gallium/drivers/ilo/core/ilo_state_3d.h
index 04d00756e09..819a17d2681 100644
--- a/src/gallium/drivers/ilo/core/ilo_state_3d.h
+++ b/src/gallium/drivers/ilo/core/ilo_state_3d.h
@@ -386,7 +386,6 @@ ilo_gpe_init_view_surface_for_buffer(const struct ilo_dev *dev,
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,
@@ -399,7 +398,6 @@ void
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);
diff --git a/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c b/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c
index 5a4c5dde7e7..22cd4eac82e 100644
--- a/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c
+++ b/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c
@@ -936,7 +936,6 @@ static void
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)
@@ -947,7 +946,7 @@ zs_init_info(const struct ilo_dev *dev,
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) {
/*
@@ -1086,7 +1085,7 @@ zs_init_info(const struct ilo_dev *dev,
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;
@@ -1097,7 +1096,6 @@ void
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)
@@ -1111,7 +1109,7 @@ ilo_gpe_init_zs_surface(const struct ilo_dev *dev,
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) {
diff --git a/src/gallium/drivers/ilo/core/ilo_state_3d_top.c b/src/gallium/drivers/ilo/core/ilo_state_3d_top.c
index c498a8462a9..4c06c91da90 100644
--- a/src/gallium/drivers/ilo/core/ilo_state_3d_top.c
+++ b/src/gallium/drivers/ilo/core/ilo_state_3d_top.c
@@ -554,7 +554,6 @@ view_init_for_buffer_gen6(const struct ilo_dev *dev,
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,
@@ -569,7 +568,7 @@ view_init_for_image_gen6(const struct ilo_dev *dev,
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)
@@ -583,7 +582,7 @@ view_init_for_image_gen6(const struct ilo_dev *dev,
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) {
@@ -910,7 +909,6 @@ view_init_for_buffer_gen7(const struct ilo_dev *dev,
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,
@@ -925,7 +923,7 @@ view_init_for_image_gen7(const struct ilo_dev *dev,
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)
@@ -939,7 +937,7 @@ view_init_for_image_gen7(const struct ilo_dev *dev,
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) {
@@ -1045,7 +1043,7 @@ view_init_for_image_gen7(const struct ilo_dev *dev,
* 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:
@@ -1220,7 +1218,6 @@ ilo_gpe_init_view_surface_for_buffer(const struct ilo_dev *dev,
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,
@@ -1230,11 +1227,11 @@ ilo_gpe_init_view_surface_for_image(const struct ilo_dev *dev,
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);
}
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index 7627fcf7c96..3865e15bfb1 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -1019,8 +1019,7 @@ ilo_create_sampler_view(struct pipe_context *pipe,
"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,
@@ -1066,8 +1065,7 @@ ilo_create_surface(struct pipe_context *pipe,
/* 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,
@@ -1077,7 +1075,7 @@ ilo_create_surface(struct pipe_context *pipe,
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);
@@ -1292,7 +1290,7 @@ ilo_state_vector_init(const struct ilo_dev *dev,
{
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);