vrend: add fb/texture bind interface that takes a separate resource id

This is needed to implement texture views

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Dave Airlie 7 years ago
parent 8d210b8b6a
commit eb1a230d7c
  1. 28
      src/vrend_renderer.c

@ -1471,7 +1471,8 @@ int vrend_create_sampler_view(struct vrend_context *ctx,
return 0;
}
void vrend_fb_bind_texture(struct vrend_resource *res,
static void vrend_fb_bind_texture_id(struct vrend_resource *res,
int id,
int idx,
uint32_t level, uint32_t layer)
{
@ -1495,38 +1496,38 @@ void vrend_fb_bind_texture(struct vrend_resource *res,
case GL_TEXTURE_CUBE_MAP_ARRAY:
if (layer == 0xffffffff)
glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment,
res->id, level);
id, level);
else
glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT, attachment,
res->id, level, layer);
id, level, layer);
break;
case GL_TEXTURE_3D:
if (layer == 0xffffffff)
glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment,
res->id, level);
id, level);
else if (vrend_state.use_gles)
glFramebufferTexture3DOES(GL_FRAMEBUFFER_EXT, attachment,
res->target, res->id, level, layer);
res->target, id, level, layer);
else
glFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, attachment,
res->target, res->id, level, layer);
res->target, id, level, layer);
break;
case GL_TEXTURE_CUBE_MAP:
if (layer == 0xffffffff)
glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment,
res->id, level);
id, level);
else
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment,
GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer, res->id, level);
GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer, id, level);
break;
case GL_TEXTURE_1D:
glFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, attachment,
res->target, res->id, level);
res->target, id, level);
break;
case GL_TEXTURE_2D:
default:
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment,
res->target, res->id, level);
res->target, id, level);
break;
}
@ -1545,6 +1546,13 @@ void vrend_fb_bind_texture(struct vrend_resource *res,
}
}
void vrend_fb_bind_texture(struct vrend_resource *res,
int idx,
uint32_t level, uint32_t layer)
{
vrend_fb_bind_texture_id(res, res->id, idx, level, layer);
}
static void vrend_hw_set_zsurf_texture(struct vrend_context *ctx)
{
struct vrend_resource *tex;

Loading…
Cancel
Save