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>
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:
* ``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:
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;
PIPE_CAP_VIEWPORT_MASK,
PIPE_CAP_ALPHA_TO_COVERAGE_DITHER_CONTROL,
PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE,
+ PIPE_CAP_GLSL_ZERO_INIT,
};
/**
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.
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;