The shader code is preprocessed with glslang that doesn't use the driver
capabilities to define macros indicating the availability of extensions,
instead it uses its own set of supported extensions, and in this case
it supports ARB_gpu_shader5. As a result the generated shader code would
make use of the (u)intBitsToFloat conversion functions based on the define
GL_ARB_gpu_shader5 also if the driver doesn't support this extension.
Hence an additional define is added to indicate whether bit casting
functions are available, and the extension is only enabled/required when
the driver actually supports it.
Closes: #1586
v2: - Fix ws
- reword commit message
v3: - check for ARB_shader_bit_encoding and ARB_gpu_shader5 in shader creation code
- don't enable GL_ARB_gpu_shader5 unconditionally in the OpenGL shader
- reword commit message
v4: Use an additional define HAS_BIT_CONVERSION to make sure gslang correctly
parses the shader code (Baldurk).
v6: - Add HAS_BIT_CONVERSION also with the GLES code path (Baldur)
- split patch
- reword commit message(s) (Baldur)
v7: fix ws
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
lala
These are not supported in GLES and causes shader compile errors when replaying a capture:
- OpenGL does not allow swizzles on scalar expressions
- implicit cast from "int" to "float"
- implicit cast from "int" to "uint"
Scalar swizzling can be replaced by vec4 and constant types can be explicitly specified.
* The histogram shouldn't be calculated as channel-wise averages, but instead by
'stacking' the channels (each channel contributes 1 to the appropriate
bucket).
* Degenerate channels (where min==max) are excluded and listed only as a single
spike, to avoid blowing out the automatic y-axis.
Detected two shader compile errors while replaying GLES apps:
1. „#extension directive must occur before any non-preprocessor token” - Fix the order of precisions and extensions in the shader code.
2. „extension 'GL_OES_texture_cube_map_array' is not supported” - Do not add extensions if they are actually not supported. TEXTURE_CUBE_MAP_ARRAY was added to GLES 3.2 so GL_OES_texture_cube_map_array and GL_EXT_texture_cube_map_array are no longer used.
* Split up old uber-cbuffers used for unrelated shaders into shader-specific
cbuffers (DebugPixelCBufferData -> TexDisplayPSCBuffer / CheckerboardCBuffer /
MeshPixelCBuffer).
* Split up HLSL files so not everything is lumped into 'debugdisplay.hlsl' but
has separate files as appropriate.
* Use #include in GLSL and HLSL to better organise shader code together rather
than relying on lumping files together on the C++ side.
* Renamed files like 'debugcbuffers.h' to 'hlsl_cbuffers.h'.
* Trimmed out some extensions/cruft that isn't needed in the GLSL side since we
no longer use separable shaders.
* Combine some shaders like Outline/Checkerboard that were similar into central
place.
* It gets a couple of things less than ideal, mostly glsl block names being on
the next line, but otherwise it's readable and stops mixed tabs/spaces which
had snuck in without checks.
* Supported textures are decoded into standard format of YUVA, displayed
visually with Y in green, U in blue, V in red.
* A new texture display mode 'YUVA decode' has been added which does a default
full-range conversion from YUV to RGB.
* Custom shaders can be used to implement a custom decode matrix.
* Instead of baking these into the overlay texture and trying to decode them
afterwards, we instead write a grayscale 16F value into the overlay texture,
and add a special decode display mode that will use the heatmap and bucketing
provided.
* This means that saving these overlay textures now saves grayscale. When saving
to an 8-bit format, we remap to 0-255 so that greater than 1.0 values are
mapped lower.
* This doesn't translate well to metalsl and is in general not very useful - we
were only doing it to avoid packing issues which in some cases are moot
anyway. E.g. the histogram buffer doesn't have to be std140 and packed like an
array of vectors, it can be std430 and packed like an array of uints.
* If the descriptor set only declares bindings 0 and 1, then a declared
UBO with binding 2 - even if unused by the shader - will crash the
driver.
* As a workaround for now we just #define out these UBOs unless
compiling a pipeline that requires them.
* On OpenGL we just define the macro always, since this isn't needed.
* GLES separable programs are completely broken, so we need to just go
back to ye-olde style of linking shaders together. On GLES this is
particularly painful as it means we have to version match whatever
shader the user was using.
* Instead we write transparent black when out of bounds. This only works
when we're blending, but the cases that we don't blend are when we do
a blit to a precisely sized output target with no offset, so it
shouldn't cause a problem.
* There were inconsistencies that could lead to off-by-one or
missampling in some cases when applying a slight offset to ensure we
sample the selected slice of the texture.