vrend: add ARB_texture_buffer_range support.

This passes the piglit tests

Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
macos/master
Dave Airlie 7 years ago
parent 792b99d9db
commit cc6ecc610d
  1. 15
      src/vrend_renderer.c

@ -116,6 +116,7 @@ struct global_renderer_state {
bool have_tf2; bool have_tf2;
bool have_stencil_texturing; bool have_stencil_texturing;
bool have_sample_shading; bool have_sample_shading;
bool have_texture_buffer_range;
/* these appeared broken on at least one driver */ /* these appeared broken on at least one driver */
bool use_explicit_locations; bool use_explicit_locations;
@ -2091,6 +2092,15 @@ void vrend_set_single_sampler_view(struct vrend_context *ctx,
glBindTexture(GL_TEXTURE_BUFFER, view->texture->tbo_tex_id); glBindTexture(GL_TEXTURE_BUFFER, view->texture->tbo_tex_id);
internalformat = tex_conv_table[view->format].internalformat; internalformat = tex_conv_table[view->format].internalformat;
if (vrend_state.have_texture_buffer_range) {
unsigned offset = view->val0;
unsigned size = view->val1 - view->val0 + 1;
int blsize = util_format_get_blocksize(view->format);
offset *= blsize;
size *= blsize;
glTexBufferRange(GL_TEXTURE_BUFFER, internalformat, view->texture->id, offset, size);
} else
glTexBuffer(GL_TEXTURE_BUFFER, internalformat, view->texture->id); glTexBuffer(GL_TEXTURE_BUFFER, internalformat, view->texture->id);
} }
} }
@ -4240,6 +4250,9 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
if (gl_ver >= 40 || epoxy_has_gl_extension("GL_ARB_sample_shading")) if (gl_ver >= 40 || epoxy_has_gl_extension("GL_ARB_sample_shading"))
vrend_state.have_sample_shading = true; vrend_state.have_sample_shading = true;
if (gl_ver >= 43 || epoxy_has_gl_extension("GL_ARB_texture_buffer_range"))
vrend_state.have_texture_buffer_range = true;
/* callbacks for when we are cleaning up the object table */ /* callbacks for when we are cleaning up the object table */
vrend_resource_set_destroy_callback(vrend_destroy_resource_object); vrend_resource_set_destroy_callback(vrend_destroy_resource_object);
vrend_object_set_destroy_callback(VIRGL_OBJECT_QUERY, vrend_destroy_query_object); vrend_object_set_destroy_callback(VIRGL_OBJECT_QUERY, vrend_destroy_query_object);
@ -7030,7 +7043,7 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, (GLint*)&caps->v2.uniform_buffer_offset_alignment); glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, (GLint*)&caps->v2.uniform_buffer_offset_alignment);
if (gl_ver >= 43) { if (gl_ver >= 43) {
caps->v2.texture_buffer_offset_alignment = 0; glGetIntegerv(GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, (GLint*)&caps->v2.texture_buffer_offset_alignment);
glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT, (GLint*)&caps->v2.shader_buffer_offset_alignment); glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT, (GLint*)&caps->v2.shader_buffer_offset_alignment);
} }

Loading…
Cancel
Save