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. 32
      src/vrend_renderer.c

@ -1471,9 +1471,10 @@ int vrend_create_sampler_view(struct vrend_context *ctx,
return 0; return 0;
} }
void vrend_fb_bind_texture(struct vrend_resource *res, static void vrend_fb_bind_texture_id(struct vrend_resource *res,
int idx, int id,
uint32_t level, uint32_t layer) int idx,
uint32_t level, uint32_t layer)
{ {
const struct util_format_description *desc = util_format_description(res->base.format); const struct util_format_description *desc = util_format_description(res->base.format);
GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + idx; GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + idx;
@ -1495,38 +1496,38 @@ void vrend_fb_bind_texture(struct vrend_resource *res,
case GL_TEXTURE_CUBE_MAP_ARRAY: case GL_TEXTURE_CUBE_MAP_ARRAY:
if (layer == 0xffffffff) if (layer == 0xffffffff)
glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment, glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment,
res->id, level); id, level);
else else
glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT, attachment, glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT, attachment,
res->id, level, layer); id, level, layer);
break; break;
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
if (layer == 0xffffffff) if (layer == 0xffffffff)
glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment, glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment,
res->id, level); id, level);
else if (vrend_state.use_gles) else if (vrend_state.use_gles)
glFramebufferTexture3DOES(GL_FRAMEBUFFER_EXT, attachment, glFramebufferTexture3DOES(GL_FRAMEBUFFER_EXT, attachment,
res->target, res->id, level, layer); res->target, id, level, layer);
else else
glFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, attachment, glFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, attachment,
res->target, res->id, level, layer); res->target, id, level, layer);
break; break;
case GL_TEXTURE_CUBE_MAP: case GL_TEXTURE_CUBE_MAP:
if (layer == 0xffffffff) if (layer == 0xffffffff)
glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment, glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment,
res->id, level); id, level);
else else
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment, 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; break;
case GL_TEXTURE_1D: case GL_TEXTURE_1D:
glFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, attachment, glFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, attachment,
res->target, res->id, level); res->target, id, level);
break; break;
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
default: default:
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment, glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment,
res->target, res->id, level); res->target, id, level);
break; 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) static void vrend_hw_set_zsurf_texture(struct vrend_context *ctx)
{ {
struct vrend_resource *tex; struct vrend_resource *tex;

Loading…
Cancel
Save