<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 02. aug. 2018 10:48, Gert Wollny wrote:<br>
<blockquote type="cite"
cite="mid:20180802084827.22289-2-gert.wollny@collabora.com">
<pre wrap="">glTexStorage*D is more restrictive in supporting texture formats, especially
on GLES. Specifically, it doesn't support BGRA textures that are needed to get
any useful display, but it is needed to get immutable textures that are required
for glTextureView.
Check which formats are supported and use glTexStorage*D for these, otherwise
fall back to use glTexImage*D.
Signed-off-by: Gert Wollny <a class="moz-txt-link-rfc2396E" href="mailto:gert.wollny@collabora.com"><gert.wollny@collabora.com></a>
---
src/vrend_formats.c | 20 ++++++++++++++++++++
src/vrend_renderer.c | 17 +++++++++++------
src/vrend_renderer.h | 3 +++
3 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/src/vrend_formats.c b/src/vrend_formats.c
index 4647c43..b9f85a0 100644
--- a/src/vrend_formats.c
+++ b/src/vrend_formats.c
@@ -444,6 +444,26 @@ void vrend_build_format_list_gles(void)
add_formats(gles_z32_format);
}
+/* glTexStorage may not support all that is supported by glTexImage,
+ * so add a flag to indicate when it can be used.
+ */
+void vrend_check_texture_storage(struct vrend_format_table *table)
+{
+ int i;
+ GLuint tex_id;
+ for (i = 0; i < VIRGL_FORMAT_MAX; i++) {
+
+ if (table[i].internalformat != 0) {
+ glGenTextures(1, &tex_id);
+ glBindTexture(GL_TEXTURE_2D, tex_id);
+ glTexStorage2D(GL_TEXTURE_2D, 1, table[i].internalformat, 32, 32);
+ if (glGetError() == GL_NO_ERROR)
+ table[i].bindings |= VIRGL_BIND_CAN_TEXTURE_STORAGE;
+ glDeleteTextures(1, &tex_id);
+ }
+ }
+}
+
unsigned vrend_renderer_query_multisample_caps(unsigned max_samples, struct virgl_caps_v2 *caps)
{
GLuint tex;
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 392c909..02d413b 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -189,7 +189,7 @@ static const struct {
[feat_texture_array] = { 30, 30, { "GL_EXT_texture_array" } },
[feat_texture_buffer_range] = { 43, UNAVAIL, { "GL_ARB_texture_buffer_range" } },
[feat_texture_multisample] = { 32, 30, { "GL_ARB_texture_multisample" } },
- [feat_texture_storage] = { 42, UNAVAIL, { "GL_ARB_texture_storage" } },
+ [feat_texture_storage] = { 42, 30, { "GL_ARB_texture_storage" } },</pre>
</blockquote>
<br>
This needs a rebase now that 403875b ("vrend, feat: Add
feat_texture_srgb_decode and protect calls") has landed.<br>
<br>
(not really a review, just something I noticed while applying
locally)<br>
</body>
</html>