gallium: add PIPE_CAP_NULL_TEXTURES
this allows drivers to indicate that they support sampling from null textures instead of using fallback textures for now, this is only used for depth-based fallback textures Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21072>
This commit is contained in:

committed by
Marge Bot

parent
7f98fcae52
commit
2127287d4d
@@ -640,6 +640,7 @@ The integer capabilities:
|
|||||||
* ``PIPE_CAP_DEVICE_PROTECTED_CONTEXT``: Whether the device supports protected / encrypted context which can manipulate protected / encrypted content (some devices might need protected contexts to access protected content, whereas ``PIPE_CAP_DEVICE_PROTECTED_SURFACE`` does not require any particular context to do so).
|
* ``PIPE_CAP_DEVICE_PROTECTED_CONTEXT``: Whether the device supports protected / encrypted context which can manipulate protected / encrypted content (some devices might need protected contexts to access protected content, whereas ``PIPE_CAP_DEVICE_PROTECTED_SURFACE`` does not require any particular context to do so).
|
||||||
* ``PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT``: Whether to allow glthread to convert glBufferSubData to glCopyBufferSubData. This may improve or worsen performance depending on your driver.
|
* ``PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT``: Whether to allow glthread to convert glBufferSubData to glCopyBufferSubData. This may improve or worsen performance depending on your driver.
|
||||||
* ``PIPE_CAP_VALIDATE_ALL_DIRTY_STATES`` : Whether state validation must also validate the state changes for resources types used in the previous shader but not in the current shader.
|
* ``PIPE_CAP_VALIDATE_ALL_DIRTY_STATES`` : Whether state validation must also validate the state changes for resources types used in the previous shader but not in the current shader.
|
||||||
|
* ``PIPE_CAP_NULL_TEXTURES`` : Whether the driver supports sampling from NULL textures.
|
||||||
|
|
||||||
.. _pipe_capf:
|
.. _pipe_capf:
|
||||||
|
|
||||||
|
@@ -524,6 +524,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
|
|||||||
return 64;
|
return 64;
|
||||||
|
|
||||||
case PIPE_CAP_VALIDATE_ALL_DIRTY_STATES:
|
case PIPE_CAP_VALIDATE_ALL_DIRTY_STATES:
|
||||||
|
case PIPE_CAP_NULL_TEXTURES:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@@ -1015,6 +1015,7 @@ enum pipe_cap
|
|||||||
/** For EGL_EXT_protected_content */
|
/** For EGL_EXT_protected_content */
|
||||||
PIPE_CAP_DEVICE_PROTECTED_CONTEXT,
|
PIPE_CAP_DEVICE_PROTECTED_CONTEXT,
|
||||||
PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT,
|
PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT,
|
||||||
|
PIPE_CAP_NULL_TEXTURES,
|
||||||
|
|
||||||
PIPE_CAP_VALIDATE_ALL_DIRTY_STATES,
|
PIPE_CAP_VALIDATE_ALL_DIRTY_STATES,
|
||||||
PIPE_CAP_LAST,
|
PIPE_CAP_LAST,
|
||||||
|
@@ -946,6 +946,8 @@ struct gl_texture_object
|
|||||||
GLboolean External;
|
GLboolean External;
|
||||||
GLubyte RequiredTextureImageUnits;
|
GLubyte RequiredTextureImageUnits;
|
||||||
|
|
||||||
|
GLboolean NullTexture; /**< this texture is incomplete and should be passed to the driver as NULL */
|
||||||
|
|
||||||
/** GL_EXT_memory_object */
|
/** GL_EXT_memory_object */
|
||||||
GLenum16 TextureTiling;
|
GLenum16 TextureTiling;
|
||||||
|
|
||||||
|
@@ -1091,14 +1091,18 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex, bool is
|
|||||||
0, /* border */
|
0, /* border */
|
||||||
is_depth ? GL_DEPTH_COMPONENT : GL_RGBA, texFormat);
|
is_depth ? GL_DEPTH_COMPONENT : GL_RGBA, texFormat);
|
||||||
_mesa_update_texture_object_swizzle(ctx, texObj);
|
_mesa_update_texture_object_swizzle(ctx, texObj);
|
||||||
if (is_depth)
|
if (ctx->st->can_null_texture && is_depth) {
|
||||||
st_TexImage(ctx, dims, texImage,
|
texObj->NullTexture = GL_TRUE;
|
||||||
GL_DEPTH_COMPONENT, GL_FLOAT, texel,
|
} else {
|
||||||
&ctx->DefaultPacking);
|
if (is_depth)
|
||||||
else
|
st_TexImage(ctx, dims, texImage,
|
||||||
st_TexImage(ctx, dims, texImage,
|
GL_DEPTH_COMPONENT, GL_FLOAT, texel,
|
||||||
GL_RGBA, GL_UNSIGNED_BYTE, texel,
|
&ctx->DefaultPacking);
|
||||||
&ctx->DefaultPacking);
|
else
|
||||||
|
st_TexImage(ctx, dims, texImage,
|
||||||
|
GL_RGBA, GL_UNSIGNED_BYTE, texel,
|
||||||
|
&ctx->DefaultPacking);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_mesa_test_texobj_completeness(ctx, texObj);
|
_mesa_test_texobj_completeness(ctx, texObj);
|
||||||
@@ -1109,7 +1113,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex, bool is
|
|||||||
|
|
||||||
/* Complete the driver's operation in case another context will also
|
/* Complete the driver's operation in case another context will also
|
||||||
* use the same fallback texture. */
|
* use the same fallback texture. */
|
||||||
st_glFinish(ctx);
|
if (!ctx->st->can_null_texture || !is_depth)
|
||||||
|
st_glFinish(ctx);
|
||||||
}
|
}
|
||||||
return ctx->Shared->FallbackTex[tex][is_depth];
|
return ctx->Shared->FallbackTex[tex][is_depth];
|
||||||
}
|
}
|
||||||
|
@@ -3085,7 +3085,7 @@ st_finalize_texture(struct gl_context *ctx,
|
|||||||
|
|
||||||
/* May need to create a new gallium texture:
|
/* May need to create a new gallium texture:
|
||||||
*/
|
*/
|
||||||
if (!tObj->pt) {
|
if (!tObj->pt && !tObj->NullTexture) {
|
||||||
GLuint bindings = default_bindings(st, firstImageFormat);
|
GLuint bindings = default_bindings(st, firstImageFormat);
|
||||||
|
|
||||||
tObj->pt = st_texture_create(st,
|
tObj->pt = st_texture_create(st,
|
||||||
@@ -3115,7 +3115,7 @@ st_finalize_texture(struct gl_context *ctx,
|
|||||||
|
|
||||||
/* Need to import images in main memory or held in other textures.
|
/* Need to import images in main memory or held in other textures.
|
||||||
*/
|
*/
|
||||||
if (stImage && tObj->pt != stImage->pt) {
|
if (stImage && !tObj->NullTexture && tObj->pt != stImage->pt) {
|
||||||
GLuint height;
|
GLuint height;
|
||||||
GLuint depth;
|
GLuint depth;
|
||||||
|
|
||||||
|
@@ -642,6 +642,9 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
|
|||||||
st->validate_all_dirty_states =
|
st->validate_all_dirty_states =
|
||||||
screen->get_param(screen, PIPE_CAP_VALIDATE_ALL_DIRTY_STATES)
|
screen->get_param(screen, PIPE_CAP_VALIDATE_ALL_DIRTY_STATES)
|
||||||
? true : false;
|
? true : false;
|
||||||
|
st->can_null_texture =
|
||||||
|
screen->get_param(screen, PIPE_CAP_NULL_TEXTURES)
|
||||||
|
? true : false;
|
||||||
|
|
||||||
util_throttle_init(&st->throttle,
|
util_throttle_init(&st->throttle,
|
||||||
screen->get_param(screen,
|
screen->get_param(screen,
|
||||||
|
@@ -207,6 +207,7 @@ struct st_context
|
|||||||
boolean has_hw_atomics;
|
boolean has_hw_atomics;
|
||||||
|
|
||||||
boolean validate_all_dirty_states;
|
boolean validate_all_dirty_states;
|
||||||
|
boolean can_null_texture;
|
||||||
|
|
||||||
/* driver supports scissored clears */
|
/* driver supports scissored clears */
|
||||||
boolean can_scissor_clear;
|
boolean can_scissor_clear;
|
||||||
|
Reference in New Issue
Block a user