struct iris_context *ice = (struct iris_context *) ctx;
struct iris_screen *screen = (struct iris_screen *)ctx->screen;
const struct gen_device_info *devinfo = &screen->devinfo;
- struct iris_surface *surf = calloc(1, sizeof(struct iris_surface));
- struct pipe_surface *psurf = &surf->base;
- struct iris_resource *res = (struct iris_resource *) tex;
-
- if (!surf)
- return NULL;
-
- pipe_reference_init(&psurf->reference, 1);
- pipe_resource_reference(&psurf->texture, tex);
- psurf->context = ctx;
- psurf->format = tmpl->format;
- psurf->width = tex->width0;
- psurf->height = tex->height0;
- psurf->texture = tex;
- psurf->u.tex.first_layer = tmpl->u.tex.first_layer;
- psurf->u.tex.last_layer = tmpl->u.tex.last_layer;
- psurf->u.tex.level = tmpl->u.tex.level;
isl_surf_usage_flags_t usage = 0;
if (tmpl->writable)
usage = ISL_SURF_USAGE_RENDER_TARGET_BIT;
const struct iris_format_info fmt =
- iris_format_for_usage(devinfo, psurf->format, usage);
+ iris_format_for_usage(devinfo, tmpl->format, usage);
if ((usage & ISL_SURF_USAGE_RENDER_TARGET_BIT) &&
!isl_format_supports_rendering(devinfo, fmt.fmt)) {
* hasn't had the opportunity yet. In the meantime, we need to
* avoid hitting ISL asserts about unsupported formats below.
*/
- free(surf);
return NULL;
}
+ struct iris_surface *surf = calloc(1, sizeof(struct iris_surface));
+ struct pipe_surface *psurf = &surf->base;
+ struct iris_resource *res = (struct iris_resource *) tex;
+
+ if (!surf)
+ return NULL;
+
+ pipe_reference_init(&psurf->reference, 1);
+ pipe_resource_reference(&psurf->texture, tex);
+ psurf->context = ctx;
+ psurf->format = tmpl->format;
+ psurf->width = tex->width0;
+ psurf->height = tex->height0;
+ psurf->texture = tex;
+ psurf->u.tex.first_layer = tmpl->u.tex.first_layer;
+ psurf->u.tex.last_layer = tmpl->u.tex.last_layer;
+ psurf->u.tex.level = tmpl->u.tex.level;
+
struct isl_view *view = &surf->view;
*view = (struct isl_view) {
.format = fmt.fmt,