/* Check for no-op */
if (num == softpipe->num_sampler_views &&
- !memcmp(softpipe->sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
+ !memcmp(softpipe->fragment_sampler_views, views,
+ num * sizeof(struct pipe_sampler_view *)))
return;
draw_flush(softpipe->draw);
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
struct pipe_sampler_view *view = i < num ? views[i] : NULL;
- pipe_sampler_view_reference(&softpipe->sampler_views[i], view);
+ pipe_sampler_view_reference(&softpipe->fragment_sampler_views[i], view);
sp_tex_tile_cache_set_sampler_view(softpipe->fragment_tex_cache[i], view);
}
*/
for (i = 0; i <= softpipe->vs->max_sampler; i++) {
if (softpipe->vertex_samplers[i]) {
- struct pipe_resource *texture = NULL;
-
- if (softpipe->vertex_sampler_views[i]) {
- texture = softpipe->vertex_sampler_views[i]->texture;
- }
-
softpipe->tgsi.vert_samplers_list[i] =
get_sampler_variant( i,
sp_sampler(softpipe->vertex_samplers[i]),
softpipe->vertex_sampler_views[i],
TGSI_PROCESSOR_VERTEX );
- sp_sampler_variant_bind_texture( softpipe->tgsi.vert_samplers_list[i],
- softpipe->vertex_tex_cache[i],
- texture );
+ sp_sampler_variant_bind_view( softpipe->tgsi.vert_samplers_list[i],
+ softpipe->vertex_tex_cache[i],
+ softpipe->vertex_sampler_views[i] );
}
}
if (softpipe->gs) {
for (i = 0; i <= softpipe->gs->max_sampler; i++) {
if (softpipe->geometry_samplers[i]) {
- struct pipe_resource *texture = NULL;
-
- if (softpipe->geometry_sampler_views[i]) {
- texture = softpipe->geometry_sampler_views[i]->texture;
- }
-
softpipe->tgsi.geom_samplers_list[i] =
get_sampler_variant(
i,
softpipe->geometry_sampler_views[i],
TGSI_PROCESSOR_GEOMETRY );
- sp_sampler_variant_bind_texture(
+ sp_sampler_variant_bind_view(
softpipe->tgsi.geom_samplers_list[i],
softpipe->geometry_tex_cache[i],
- texture );
+ softpipe->geometry_sampler_views[i] );
}
}
}
for (i = 0; i <= softpipe->fs->info.file_max[TGSI_FILE_SAMPLER]; i++) {
if (softpipe->sampler[i]) {
- struct pipe_resource *texture = NULL;
-
- if (softpipe->sampler_views[i]) {
- texture = softpipe->sampler_views[i]->texture;
- }
-
softpipe->tgsi.frag_samplers_list[i] =
get_sampler_variant( i,
sp_sampler(softpipe->sampler[i]),
- softpipe->sampler_views[i],
+ softpipe->fragment_sampler_views[i],
TGSI_PROCESSOR_FRAGMENT );
- sp_sampler_variant_bind_texture( softpipe->tgsi.frag_samplers_list[i],
- softpipe->fragment_tex_cache[i],
- texture );
+ sp_sampler_variant_bind_view( softpipe->tgsi.frag_samplers_list[i],
+ softpipe->fragment_tex_cache[i],
+ softpipe->fragment_sampler_views[i] );
}
}
}
const float t[QUAD_SIZE],
const float p[QUAD_SIZE])
{
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->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;
const float t[QUAD_SIZE],
const float p[QUAD_SIZE])
{
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->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]);
const float t[QUAD_SIZE],
const float p[QUAD_SIZE])
{
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->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]);
get_texel_2d(const struct sp_sampler_variant *samp,
union tex_tile_address addr, int x, int y)
{
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
unsigned level = addr.bits.level;
if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
get_texel_3d(const struct sp_sampler_variant *samp,
union tex_tile_address addr, int x, int y, int z)
{
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
unsigned level = addr.bits.level;
if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
unsigned level0, j;
int width;
int x[4];
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
unsigned level0, j;
int width, height;
int x[4], y[4];
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
const unsigned *faces = samp->faces; /* zero when not cube-mapping */
unsigned level0, j;
int width, height;
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
unsigned level0, j;
int width, height, depth;
int x[4], y[4], z[4];
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
unsigned level0, j;
int width;
int x0[4], x1[4];
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
unsigned level0, j;
int width, height;
int x0[4], y0[4], x1[4], y1[4];
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
const unsigned *faces = samp->faces; /* zero when not cube-mapping */
unsigned level0, j;
int width, height;
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
unsigned level0, j;
int width, height, depth;
int x0[4], x1[4], y0[4], y1[4], z0[4], z1[4];
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
int level0;
float lambda;
float lod[QUAD_SIZE];
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
float lambda;
float lod[QUAD_SIZE];
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
- const struct pipe_resource *texture = samp->texture;
+ const struct pipe_resource *texture = samp->view->texture;
int level0;
float lambda;
float lod[QUAD_SIZE];
* Bind the given texture object and texture cache to the sampler variant.
*/
void
-sp_sampler_variant_bind_texture( struct sp_sampler_variant *samp,
- struct softpipe_tex_tile_cache *tex_cache,
- const struct pipe_resource *texture )
+sp_sampler_variant_bind_view( struct sp_sampler_variant *samp,
+ struct softpipe_tex_tile_cache *tex_cache,
+ const struct pipe_sampler_view *view )
{
const struct pipe_sampler_state *sampler = samp->sampler;
+ const struct pipe_resource *texture = view->texture;
- samp->texture = texture;
+ samp->view = view;
samp->cache = tex_cache;
samp->xpot = util_unsigned_logbase2( texture->width0 );
samp->ypot = util_unsigned_logbase2( texture->height0 );