get rid of yet another bind-flag set

These VREND_BIND_*-flags here are basically a subset of the
VIRGL_BIND_*-flags, with one custom flag added. So let's just use
those, and use an unused big from the others for the swizzle-flag.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
macos/master
Erik Faye-Lund 6 years ago committed by Dave Airlie
parent 2e84388a46
commit 58e521c57e
  1. 4
      src/vrend_blitter.c
  2. 6
      src/vrend_formats.c
  3. 12
      src/vrend_renderer.c
  4. 7
      src/vrend_renderer.h

@ -393,7 +393,7 @@ static GLuint blit_get_frag_tex_col(struct vrend_blitter_ctx *blit_ctx,
{
assert(pipe_tex_target < PIPE_MAX_TEXTURE_TYPES);
bool needs_swizzle = dst_entry->flags & VREND_BIND_NEED_SWIZZLE;
bool needs_swizzle = dst_entry->flags & VIRGL_BIND_NEED_SWIZZLE;
if (needs_swizzle || nr_samples > 1) {
const uint8_t *swizzle = needs_swizzle ? dst_entry->swizzle : NULL;
@ -776,7 +776,7 @@ void vrend_renderer_blit_gl(UNUSED struct vrend_context *ctx,
glBindTexture(src_res->target, src_res->id);
if (src_entry->flags & VREND_BIND_NEED_SWIZZLE) {
if (src_entry->flags & VIRGL_BIND_NEED_SWIZZLE) {
glTexParameteri(src_res->target, GL_TEXTURE_SWIZZLE_R,
to_gl_swizzle(src_entry->swizzle[0]));
glTexParameteri(src_res->target, GL_TEXTURE_SWIZZLE_G,

@ -313,7 +313,7 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries)
if (status == GL_INVALID_VALUE || status == GL_INVALID_ENUM) {
struct vrend_format_table *entry = NULL;
uint8_t swizzle[4];
binding = VREND_BIND_SAMPLER | VREND_BIND_RENDER | VREND_BIND_NEED_SWIZZLE;
binding = VIRGL_BIND_SAMPLER_VIEW | VIRGL_BIND_RENDER_TARGET | VIRGL_BIND_NEED_SWIZZLE;
switch (table[i].format) {
case PIPE_FORMAT_A8_UNORM:
@ -359,9 +359,9 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries)
}
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
binding = VREND_BIND_SAMPLER;
binding = VIRGL_BIND_SAMPLER_VIEW;
if (status == GL_FRAMEBUFFER_COMPLETE)
binding |= (is_depth ? VREND_BIND_DEPTHSTENCIL : VREND_BIND_RENDER);
binding |= (is_depth ? VIRGL_BIND_DEPTH_STENCIL : VIRGL_BIND_RENDER_TARGET);
glDeleteTextures(1, &tex_id);
glDeleteFramebuffers(1, &fb_id);

@ -532,16 +532,16 @@ static struct vrend_format_table tex_conv_table[VIRGL_FORMAT_MAX];
static inline bool vrend_format_can_sample(enum virgl_formats format)
{
return tex_conv_table[format].bindings & VREND_BIND_SAMPLER;
return tex_conv_table[format].bindings & VIRGL_BIND_SAMPLER_VIEW;
}
static inline bool vrend_format_can_render(enum virgl_formats format)
{
return tex_conv_table[format].bindings & VREND_BIND_RENDER;
return tex_conv_table[format].bindings & VIRGL_BIND_RENDER_TARGET;
}
static inline bool vrend_format_is_ds(enum virgl_formats format)
{
return tex_conv_table[format].bindings & VREND_BIND_DEPTHSTENCIL;
return tex_conv_table[format].bindings & VIRGL_BIND_DEPTH_STENCIL;
}
bool vrend_is_ds_format(enum virgl_formats format)
@ -559,7 +559,7 @@ bool vrend_format_is_emulated_alpha(enum virgl_formats format)
static bool vrend_format_needs_swizzle(enum virgl_formats format)
{
return tex_conv_table[format].flags & VREND_BIND_NEED_SWIZZLE;
return tex_conv_table[format].flags & VIRGL_BIND_NEED_SWIZZLE;
}
static inline const char *pipe_shader_to_prefix(int shader_type)
@ -793,7 +793,7 @@ vrend_insert_format_swizzle(int override_format, struct vrend_format_table *entr
int i;
tex_conv_table[override_format] = *entry;
tex_conv_table[override_format].bindings = bindings;
tex_conv_table[override_format].flags = VREND_BIND_NEED_SWIZZLE;
tex_conv_table[override_format].flags = VIRGL_BIND_NEED_SWIZZLE;
for (i = 0; i < 4; i++)
tex_conv_table[override_format].swizzle[i] = swizzle[i];
}
@ -1668,7 +1668,7 @@ int vrend_create_sampler_view(struct vrend_context *ctx,
swizzle[3] = PIPE_SWIZZLE_ONE;
}
if (tex_conv_table[view->format].flags & VREND_BIND_NEED_SWIZZLE) {
if (tex_conv_table[view->format].flags & VIRGL_BIND_NEED_SWIZZLE) {
if (swizzle[0] <= PIPE_SWIZZLE_ALPHA)
swizzle[0] = tex_conv_table[view->format].swizzle[swizzle[0]];
if (swizzle[1] <= PIPE_SWIZZLE_ALPHA)

@ -70,12 +70,7 @@ struct vrend_resource {
uint64_t mipmap_offsets[VR_MAX_TEXTURE_2D_LEVELS];
};
/* assume every format is sampler friendly */
#define VREND_BIND_SAMPLER (1 << 0)
#define VREND_BIND_RENDER (1 << 1)
#define VREND_BIND_DEPTHSTENCIL (1 << 2)
#define VREND_BIND_NEED_SWIZZLE (1 << 28)
#define VIRGL_BIND_NEED_SWIZZLE (1 << 28)
struct vrend_format_table {
enum virgl_formats format;

Loading…
Cancel
Save