gallium: add a new cap PIPE_CAP_GLSL_ZERO_INIT
Allows driver to select a zero init mode between the 3 possible values. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4607>
This commit is contained in:
@@ -345,6 +345,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
|
||||
case PIPE_CAP_SHADER_SAMPLES_IDENTICAL:
|
||||
case PIPE_CAP_TGSI_ATOMINC_WRAP:
|
||||
case PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE:
|
||||
case PIPE_CAP_GLSL_ZERO_INIT:
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_MAX_GS_INVOCATIONS:
|
||||
|
||||
@@ -579,6 +579,7 @@ The integer capabilities:
|
||||
* ``PIPE_CAP_SYSTEM_SVM``: True if all application memory can be shared with the GPU without explicit mapping.
|
||||
* ``PIPE_CAP_VIEWPORT_MASK``: Whether ``TGSI_SEMANTIC_VIEWPORT_MASK`` and ``TGSI_PROPERTY_LAYER_VIEWPORT_RELATIVE`` are supported (see GL_NV_viewport_array2).
|
||||
* ``PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE``: Whether mapping a buffer as unsynchronized from any thread is safe.
|
||||
* ``PIPE_CAP_GLSL_ZERO_INIT``: Choose a default zero initialization some glsl variables. If `1`, then all glsl shader variables and gl_FragColor are initialized to zero. If `2`, then shader out variables are not initialized but function out variables are.
|
||||
|
||||
.. _pipe_capf:
|
||||
|
||||
|
||||
@@ -164,6 +164,9 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE:
|
||||
return 1;
|
||||
|
||||
case PIPE_CAP_GLSL_ZERO_INIT:
|
||||
return 2;
|
||||
|
||||
case PIPE_CAP_QUERY_SO_OVERFLOW:
|
||||
return !sscreen->use_ngg_streamout;
|
||||
|
||||
|
||||
@@ -947,6 +947,7 @@ enum pipe_cap
|
||||
PIPE_CAP_VIEWPORT_MASK,
|
||||
PIPE_CAP_ALPHA_TO_COVERAGE_DITHER_CONTROL,
|
||||
PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE,
|
||||
PIPE_CAP_GLSL_ZERO_INIT,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -3868,9 +3868,13 @@ struct gl_constants
|
||||
GLboolean ForceGLSLAbsSqrt;
|
||||
|
||||
/**
|
||||
* Types of variable to default initialized to zero.
|
||||
* Types of variable to default initialized to zero. Supported values are:
|
||||
* - 0: no zero initialization
|
||||
* - 1: all shader variables and gl_FragColor are initialiazed to 0
|
||||
* - 2: same as 1, but shader out variables are *not* initialized, while
|
||||
* function out variables are now initialized.
|
||||
*/
|
||||
GLuint GLSLZeroInit;
|
||||
GLchar GLSLZeroInit;
|
||||
|
||||
/**
|
||||
* Treat integer textures using GL_LINEAR filters as GL_NEAREST.
|
||||
|
||||
@@ -1205,6 +1205,8 @@ void st_init_extensions(struct pipe_screen *screen,
|
||||
|
||||
if (options->glsl_zero_init) {
|
||||
consts->GLSLZeroInit = 1;
|
||||
} else {
|
||||
consts->GLSLZeroInit = screen->get_param(screen, PIPE_CAP_GLSL_ZERO_INIT);
|
||||
}
|
||||
|
||||
consts->ForceIntegerTexNearest = options->force_integer_tex_nearest;
|
||||
|
||||
Reference in New Issue
Block a user