struct virgl_resource *res = virgl_resource(resource);
uint32_t handle;
+ /* no support for buffer surfaces */
+ if (resource->target == PIPE_BUFFER)
+ return NULL;
+
surf = CALLOC_STRUCT(virgl_surface);
if (!surf)
return NULL;
pipe_resource_reference(&surf->base.texture, resource);
surf->base.context = ctx;
surf->base.format = templ->format;
- if (resource->target != PIPE_BUFFER) {
- surf->base.width = u_minify(resource->width0, templ->u.tex.level);
- surf->base.height = u_minify(resource->height0, templ->u.tex.level);
- surf->base.u.tex.level = templ->u.tex.level;
- surf->base.u.tex.first_layer = templ->u.tex.first_layer;
- surf->base.u.tex.last_layer = templ->u.tex.last_layer;
- } else {
- surf->base.width = templ->u.buf.last_element - templ->u.buf.first_element + 1;
- surf->base.height = resource->height0;
- surf->base.u.buf.first_element = templ->u.buf.first_element;
- surf->base.u.buf.last_element = templ->u.buf.last_element;
- }
+
+ surf->base.width = u_minify(resource->width0, templ->u.tex.level);
+ surf->base.height = u_minify(resource->height0, templ->u.tex.level);
+ surf->base.u.tex.level = templ->u.tex.level;
+ surf->base.u.tex.first_layer = templ->u.tex.first_layer;
+ surf->base.u.tex.last_layer = templ->u.tex.last_layer;
+
virgl_encoder_create_surface(vctx, handle, res, &surf->base);
surf->handle = handle;
return &surf->base;
virgl_encoder_write_dword(ctx->cbuf, handle);
virgl_encoder_write_res(ctx, res);
virgl_encoder_write_dword(ctx->cbuf, templat->format);
- if (templat->texture->target == PIPE_BUFFER) {
- virgl_encoder_write_dword(ctx->cbuf, templat->u.buf.first_element);
- virgl_encoder_write_dword(ctx->cbuf, templat->u.buf.last_element);
- } else {
- virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.level);
- virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.first_layer | (templat->u.tex.last_layer << 16));
- }
+ assert(templat->texture->target != PIPE_BUFFER);
+ virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.level);
+ virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.first_layer | (templat->u.tex.last_layer << 16));
+
return 0;
}