Commit d1b7b00a authored by Keith Whitwell's avatar Keith Whitwell

gallium: begin converting drivers to pipe_resource

Work in progress...
parent 51c25117
......@@ -1419,7 +1419,7 @@ set_vertex_data(struct gen_mipmap_state *ctx,
offset = get_next_slot( ctx );
pipe_buffer_write_nooverlap(ctx->pipe->screen, ctx->vbuf,
pipe_buffer_write_nooverlap(ctx->pipe, ctx->vbuf,
offset, sizeof(ctx->vertices), ctx->vertices);
return offset;
......
......@@ -132,7 +132,7 @@ pipe_buffer_create( struct pipe_screen *screen,
{
struct pipe_resource buffer;
memset(&buffer, 0, sizeof buffer);
buffer.target = PIPE_RESOURCE_BUFFER;
buffer.target = PIPE_BUFFER;
buffer.format = PIPE_FORMAT_R8_UNORM; /* want TYPELESS or similar */
buffer.usage = usage;
buffer.width0 = size;
......
......@@ -6,7 +6,6 @@ LIBNAME = softpipe
C_SOURCES = \
sp_fs_exec.c \
sp_fs_sse.c \
sp_buffer.c \
sp_clear.c \
sp_fence.c \
sp_flush.c \
......@@ -33,7 +32,6 @@ C_SOURCES = \
sp_tex_sample.c \
sp_tex_tile_cache.c \
sp_tile_cache.c \
sp_surface.c \
sp_video_context.c
sp_surface.c
include ../../Makefile.template
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_math.h"
#include "sp_screen.h"
#include "sp_buffer.h"
struct pipe_resource *
softpipe_buffer_create(struct pipe_screen *screen,
unsigned alignment,
unsigned usage,
unsigned size)
{
struct softpipe_buffer *buffer = CALLOC_STRUCT(softpipe_buffer);
pipe_reference_init(&buffer->base.reference, 1);
buffer->base.screen = screen;
buffer->base.usage = usage;
buffer->base.width0 = size;
buffer->base.height0 = 1;
buffer->base.depth0 = 1;
buffer->data = align_malloc(size, alignment);
return &buffer->base;
}
/**
* Create buffer which wraps user-space data.
*/
static struct pipe_buffer *
softpipe_user_buffer_create(struct pipe_screen *screen,
void *ptr,
unsigned bytes)
{
struct softpipe_buffer *buffer;
buffer = CALLOC_STRUCT(softpipe_buffer);
if(!buffer)
return NULL;
pipe_reference_init(&buffer->base.reference, 1);
buffer->base.screen = screen;
buffer->base.usage = PIPE_BUFFER_USAGE_CPU_READ;
buffer->base.width0 = bytes;
buffer->base.height0 = 1;
buffer->base.depth0 = 1;
buffer->userBuffer = TRUE;
buffer->data = ptr;
return &buffer->base;
}
void
softpipe_init_screen_buffer_funcs(struct pipe_screen *screen)
{
screen->user_buffer_create = softpipe_user_buffer_create;
}
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef SP_BUFFER_H
#define SP_BUFFER_H
#include "pipe/p_compiler.h"
#include "pipe/p_state.h"
struct softpipe_buffer
{
struct pipe_resource base;
boolean userBuffer; /** Is this a user-space buffer? */
void *data;
};
struct pipe_resource *
softpipe_buffer_create(struct pipe_screen *screen,
unsigned alignment,
unsigned usage,
unsigned size);
/** Cast wrapper */
static INLINE struct softpipe_buffer *
softpipe_buffer( struct pipe_buffer *buf )
{
return (struct softpipe_buffer *)buf;
}
void
softpipe_init_screen_buffer_funcs(struct pipe_screen *screen);
#endif /* SP_BUFFER_H */
......@@ -117,7 +117,7 @@ softpipe_destroy( struct pipe_context *pipe )
for (j = 0; j < PIPE_MAX_CONSTANT_BUFFERS; j++) {
if (softpipe->constants[i][j]) {
pipe_buffer_reference(&softpipe->constants[i][j], NULL);
pipe_resource_reference(&softpipe->constants[i][j], NULL);
}
}
}
......
......@@ -66,7 +66,7 @@ struct softpipe_context {
struct pipe_blend_color blend_color;
struct pipe_stencil_ref stencil_ref;
struct pipe_clip_state clip;
struct pipe_buffer *constants[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS];
struct pipe_resource *constants[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS];
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
......
......@@ -39,7 +39,7 @@
#include "sp_context.h"
#include "sp_query.h"
#include "sp_state.h"
#include "sp_buffer.h"
#include "sp_texture.h"
#include "draw/draw_context.h"
......@@ -55,7 +55,7 @@
*/
static void
softpipe_draw_range_elements_instanced(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned minIndex,
unsigned maxIndex,
......@@ -85,7 +85,7 @@ softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
void
softpipe_draw_range_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned min_index,
unsigned max_index,
......@@ -106,7 +106,7 @@ softpipe_draw_range_elements(struct pipe_context *pipe,
void
softpipe_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
......@@ -144,7 +144,7 @@ softpipe_draw_arrays_instanced(struct pipe_context *pipe,
void
softpipe_draw_elements_instanced(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned mode,
unsigned start,
......@@ -166,7 +166,7 @@ softpipe_draw_elements_instanced(struct pipe_context *pipe,
static void
softpipe_draw_range_elements_instanced(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned minIndex,
unsigned maxIndex,
......@@ -193,13 +193,13 @@ softpipe_draw_range_elements_instanced(struct pipe_context *pipe,
/* Map vertex buffers */
for (i = 0; i < sp->num_vertex_buffers; i++) {
void *buf = softpipe_buffer(sp->vertex_buffer[i].buffer)->data;
void *buf = softpipe_resource(sp->vertex_buffer[i].buffer)->data;
draw_set_mapped_vertex_buffer(draw, i, buf);
}
/* Map index buffer, if present */
if (indexBuffer) {
void *mapped_indexes = softpipe_buffer(indexBuffer)->data;
void *mapped_indexes = softpipe_resource(indexBuffer)->data;
draw_set_mapped_element_buffer_range(draw,
indexSize,
minIndex,
......
......@@ -35,7 +35,6 @@
#include "sp_texture.h"
#include "sp_screen.h"
#include "sp_context.h"
#include "sp_buffer.h"
#include "sp_fence.h"
#include "sp_public.h"
......@@ -239,7 +238,6 @@ softpipe_create_screen(struct sw_winsys *winsys)
screen->base.flush_frontbuffer = softpipe_flush_frontbuffer;
softpipe_init_screen_texture_funcs(&screen->base);
softpipe_init_screen_buffer_funcs(&screen->base);
softpipe_init_screen_fence_funcs(&screen->base);
return &screen->base;
......
......@@ -150,7 +150,7 @@ void softpipe_set_clip_state( struct pipe_context *,
void softpipe_set_constant_buffer(struct pipe_context *,
uint shader, uint index,
struct pipe_buffer *buf);
struct pipe_resource *buf);
void *softpipe_create_fs_state(struct pipe_context *,
const struct pipe_shader_state *);
......@@ -188,7 +188,7 @@ softpipe_set_vertex_sampler_views(struct pipe_context *,
struct pipe_sampler_view *
softpipe_create_sampler_view(struct pipe_context *pipe,
struct pipe_texture *texture,
struct pipe_resource *texture,
const struct pipe_sampler_view *templ);
void
......@@ -210,12 +210,12 @@ void softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
unsigned start, unsigned count);
void softpipe_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count);
void
softpipe_draw_range_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned min_index,
unsigned max_index,
......@@ -231,7 +231,7 @@ softpipe_draw_arrays_instanced(struct pipe_context *pipe,
void
softpipe_draw_elements_instanced(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer,
struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned mode,
unsigned start,
......
......@@ -28,7 +28,7 @@
#include "sp_context.h"
#include "sp_state.h"
#include "sp_fs.h"
#include "sp_buffer.h"
#include "sp_texture.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
......@@ -167,11 +167,11 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
void
softpipe_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
struct pipe_buffer *constants)
struct pipe_resource *constants)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
unsigned size = constants ? constants->width0 : 0;
const void *data = constants ? softpipe_buffer(constants)->data : NULL;
const void *data = constants ? softpipe_resource(constants)->data : NULL;
assert(shader < PIPE_SHADER_TYPES);
assert(index == 0);
......
......@@ -132,7 +132,7 @@ softpipe_create_sampler_view(struct pipe_context *pipe,
*view = *templ;
view->reference.count = 1;
view->texture = NULL;
pipe_resource_reference(&view->resource, resource);
pipe_resource_reference(&view->texture, resource);
view->context = pipe;
}
......@@ -144,7 +144,7 @@ void
softpipe_sampler_view_destroy(struct pipe_context *pipe,
struct pipe_sampler_view *view)
{
pipe_texture_reference(&view->texture, NULL);
pipe_resource_reference(&view->texture, NULL);
FREE(view);
}
......@@ -226,7 +226,7 @@ get_sampler_varient( unsigned unit,
struct pipe_resource *resource,
unsigned processor )
{
struct softpipe_texture *sp_texture = softpipe_resource(resource);
struct softpipe_resource *sp_texture = softpipe_resource(resource);
struct sp_sampler_varient *v = NULL;
union sp_sampler_key key;
......@@ -294,7 +294,7 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe)
for (i = 0; i <= softpipe->fs->info.file_max[TGSI_FILE_SAMPLER]; i++) {
if (softpipe->sampler[i]) {
struct pipe_texture *texture = NULL;
struct pipe_resource *texture = NULL;
if (softpipe->sampler_views[i]) {
texture = softpipe->sampler_views[i]->texture;
......
......@@ -547,7 +547,7 @@ compute_lambda_1d(const struct sp_sampler_varient *samp,
const float t[QUAD_SIZE],
const float p[QUAD_SIZE])
{
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
float rho = MAX2(dsdx, dsdy) * texture->width0;
......@@ -562,7 +562,7 @@ compute_lambda_2d(const struct sp_sampler_varient *samp,
const float t[QUAD_SIZE],
const float p[QUAD_SIZE])
{
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]);
......@@ -581,7 +581,7 @@ compute_lambda_3d(const struct sp_sampler_varient *samp,
const float t[QUAD_SIZE],
const float p[QUAD_SIZE])
{
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]);
......@@ -651,7 +651,7 @@ static INLINE const float *
get_texel_2d(const struct sp_sampler_varient *samp,
union tex_tile_address addr, int x, int y)
{
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
unsigned level = addr.bits.level;
if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
......@@ -744,7 +744,7 @@ static INLINE const float *
get_texel_3d(const struct sp_sampler_varient *samp,
union tex_tile_address addr, int x, int y, int z)
{
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
unsigned level = addr.bits.level;
if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
......@@ -932,7 +932,7 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
unsigned level0, j;
int width;
int x[4];
......@@ -968,7 +968,7 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
unsigned level0, j;
int width, height;
int x[4], y[4];
......@@ -1016,7 +1016,7 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
const unsigned *faces = samp->faces; /* zero when not cube-mapping */
unsigned level0, j;
int width, height;
......@@ -1056,7 +1056,7 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
unsigned level0, j;
int width, height, depth;
int x[4], y[4], z[4];
......@@ -1098,7 +1098,7 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
unsigned level0, j;
int width;
int x0[4], x1[4];
......@@ -1138,7 +1138,7 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
unsigned level0, j;
int width, height;
int x0[4], y0[4], x1[4], y1[4];
......@@ -1185,7 +1185,7 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
const unsigned *faces = samp->faces; /* zero when not cube-mapping */
unsigned level0, j;
int width, height;
......@@ -1234,7 +1234,7 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
unsigned level0, j;
int width, height, depth;
int x0[4], x1[4], y0[4], y1[4], z0[4], z1[4];
......@@ -1310,7 +1310,7 @@ mip_filter_linear(struct tgsi_sampler *tgsi_sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
int level0;
float lambda;
float lod[QUAD_SIZE];
......@@ -1373,7 +1373,7 @@ mip_filter_nearest(struct tgsi_sampler *tgsi_sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
float lambda;
float lod[QUAD_SIZE];
......@@ -1461,7 +1461,7 @@ mip_filter_linear_2d_linear_repeat_POT(
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
const struct pipe_resource *texture = samp->texture;
int level0;
float lambda;
float lod[QUAD_SIZE];
......@@ -1867,7 +1867,7 @@ get_img_filter(const union sp_sampler_key key,
void
sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp,
struct softpipe_tex_tile_cache *tex_cache,
const struct pipe_texture *texture )
const struct pipe_resource *texture )
{
const struct pipe_sampler_state *sampler = samp->sampler;
......
......@@ -85,7 +85,7 @@ struct sp_sampler_varient
/* Currently bound texture:
*/
const struct pipe_texture *texture;
const struct pipe_resource *texture;
struct softpipe_tex_tile_cache *cache;
unsigned processor;
......@@ -129,7 +129,7 @@ sp_create_sampler_varient( const struct pipe_sampler_state *sampler,
void sp_sampler_varient_bind_texture( struct sp_sampler_varient *varient,
struct softpipe_tex_tile_cache *tex_cache,
const struct pipe_texture *tex );
const struct pipe_resource *tex );
void sp_sampler_varient_destroy( struct sp_sampler_varient * );
......
......@@ -122,13 +122,13 @@ void
sp_tex_tile_cache_set_sampler_view(struct softpipe_tex_tile_cache *tc,
struct pipe_sampler_view *view)
{
struct pipe_texture *texture = view ? view->texture : NULL;
struct pipe_resource *texture = view ? view->texture : NULL;
uint i;
assert(!tc->transfer);
if (tc->texture != texture) {
pipe_texture_reference(&tc->texture, texture);
pipe_resource_reference(&tc->texture, texture);
if (tc->tex_trans) {
if (tc->tex_trans_map) {
......
......@@ -74,7 +74,7 @@ struct softpipe_tex_tile_cache
struct pipe_transfer *transfer;
void *transfer_map;
struct pipe_texture *texture; /**< if caching a texture */
struct pipe_resource *texture; /**< if caching a texture */
unsigned timestamp;
struct softpipe_tex_cached_tile entries[NUM_ENTRIES];
......
......@@ -36,7 +36,6 @@
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_simple_screen.h"
#include "sp_context.h"
#include "sp_texture.h"
......@@ -50,10 +49,10 @@
* Use a simple, maximally packed layout.
*/
static boolean
softpipe_texture_layout(struct pipe_screen *screen,
struct softpipe_texture * spt)
softpipe_resource_layout(struct pipe_screen *screen,
struct softpipe_resource * spt)
{
struct pipe_texture *pt = &spt->base;
struct pipe_resource *pt = &spt->base;
unsigned level;
unsigned width = pt->width0;
unsigned height = pt->height0;
......@@ -85,7 +84,7 @@ softpipe_texture_layout(struct pipe_screen *screen,
*/
static boolean
softpipe_displaytarget_layout(struct pipe_screen *screen,
struct softpipe_texture * spt)
struct softpipe_resource * spt)
{
struct sw_winsys *winsys = softpipe_screen(screen)->winsys;
......@@ -103,13 +102,13 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
/**
* Create new pipe_texture given the template information.
* Create new pipe_resource given the template information.
*/
static struct pipe_texture *
softpipe_texture_create(struct pipe_screen *screen,
const struct pipe_texture *template)
static struct pipe_resource *
softpipe_resource_create(struct pipe_screen *screen,
const struct pipe_resource *template)
{
struct softpipe_texture *spt = CALLOC_STRUCT(softpipe_texture);
struct softpipe_resource *spt = CALLOC_STRUCT(softpipe_resource);
if (!spt)
return NULL;
......@@ -128,7 +127,7 @@ softpipe_texture_create(struct pipe_screen *screen,
goto fail;
}
else {
if (!softpipe_texture_layout(screen, spt))
if (!softpipe_resource_layout(screen, spt))
goto fail;
}
......@@ -143,17 +142,18 @@ softpipe_texture_create(struct pipe_screen *screen,
static void
softpipe_texture_destroy(struct pipe_texture *pt)
softpipe_resource_destroy(struct pipe_screen *pscreen,
struct pipe_resource *pt)
{
struct softpipe_screen *screen = softpipe_screen(pt->screen);
struct softpipe_texture *spt = softpipe_texture(pt);
struct softpipe_screen *screen = softpipe_screen(pscreen);
struct softpipe_resource *spt = softpipe_resource(pt);
if (spt->dt) {
/* display target */
struct sw_winsys *winsys = screen->winsys;
winsys->displaytarget_destroy(winsys, spt->dt);
}
else {
else if (!spt->userBuffer) {
/* regular texture */
align_free(spt->data);
}
......@@ -167,11 +167,11 @@ softpipe_texture_destroy(struct pipe_texture *pt)
*/
static struct pipe_surface *
softpipe_get_tex_surface(struct pipe_screen *screen,
struct pipe_texture *pt,
struct pipe_resource *pt,
unsigned face, unsigned level, unsigned zslice,
unsigned usage)
{
struct softpipe_texture *spt = softpipe_texture(pt);
struct softpipe_resource *spt = softpipe_resource(pt);
struct pipe_surface *ps;
assert(level <= pt->last_level);
......@@ -179,7 +179,7 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
ps = CALLOC_STRUCT(pipe_surface);
if (ps) {
pipe_reference_init(&ps->reference, 1);
pipe_texture_reference(&ps->texture, pt);
pipe_resource_reference(&ps->texture, pt);
ps->format = pt->format;
ps->width = u_minify(pt->width0, level);
ps->height = u_minify(pt->height0, level);
......@@ -238,7 +238,7 @@ softpipe_tex_surface_destroy(struct pipe_surface *surf)
* where it would happen. For softpipe, nothing to do.
*/
assert(surf->texture);
pipe_texture_reference(&surf->texture, NULL);
pipe_resource_reference(&surf->texture, NULL);
FREE(surf);
}
......@@ -262,7 +262,7 @@ softpipe_get_transfer(struct pipe_context *pipe,
enum pipe_transfer_usage usage,
const struct pipe_box *box)
{
struct softpipe_texture *sptex = softpipe_texture(resource);
struct softpipe_resource *sptex = softpipe_resource(resource);
struct softpipe_transfer *spt;
assert(resource);
......@@ -317,11 +317,6 @@ static void
softpipe_transfer_destroy(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
/* Effectively do the texture_update work here - if texture images
* needed post-processing to put them into hardware layout, this is
* where it would happen. For softpipe, nothing to do.
*/
assert (transfer->resource);
pipe_resource_reference(&transfer->resource, NULL);