key->surf[idx].texture = psurf->texture;
key->surf[idx].u = psurf->u;
key->surf[idx].pos = pos;
- key->surf[idx].samples = psurf->nr_samples;
+ key->surf[idx].samples = MAX2(1, psurf->nr_samples);
key->surf[idx].format = psurf->format;
}
rsc->internal_format = format;
rsc->cpp = util_format_get_blocksize(format);
- prsc->nr_samples = MAX2(1, prsc->nr_samples);
- rsc->cpp *= prsc->nr_samples;
+ rsc->cpp *= fd_resource_nr_samples(prsc);
assert(rsc->cpp);
if (!rsc->bo)
goto fail;
- prsc->nr_samples = MAX2(1, prsc->nr_samples);
rsc->internal_format = tmpl->format;
- rsc->cpp = prsc->nr_samples * util_format_get_blocksize(tmpl->format);
+ rsc->cpp = util_format_get_blocksize(tmpl->format);
+ rsc->cpp *= fd_resource_nr_samples(prsc);
slice->pitch = handle->stride / rsc->cpp;
slice->offset = handle->offset;
slice->size0 = handle->stride * prsc->height0;
return false;
}
+/* access # of samples, with 0 normalized to 1 (which is what we care about
+ * most of the time)
+ */
+static inline unsigned
+fd_resource_nr_samples(struct pipe_resource *prsc)
+{
+ return MAX2(1, prsc->nr_samples);
+}
+
void fd_blitter_pipe_begin(struct fd_context *ctx, bool render_cond, bool discard,
enum fd_render_stage stage);
void fd_blitter_pipe_end(struct fd_context *ctx);
#include "freedreno_texture.h"
#include "freedreno_context.h"
+#include "freedreno_resource.h"
#include "freedreno_util.h"
static void
tex->num_textures = util_last_bit(tex->valid_textures);
for (i = 0; i < tex->num_textures; i++) {
- uint nr_samples = tex->textures[i]->texture->nr_samples;
+ uint nr_samples = fd_resource_nr_samples(tex->textures[i]->texture);
samplers |= (nr_samples >> 1) << (i * 2);
}