glsl: Add compute shaders to encode DXT5/BC3

These compute shaders are from the MIT-licensed GPU compressor, Betsy.
I have included copyright headers, inlined the __sharedOnlyBarrier macro
definition from the "UavCrossPlatform_piece_all.glsl" header when
applicable, and made the following changes to support GLES:

   * Conditionally disable the const keyword in the BC3 shaders
   * Make the params uniform in the BC4 shader uint2
   * Avoid implicit data type conversions in the BC3 shaders
   * Use constructors for array initialization in the BC1 shader
   * Add precision qualifiers to the BC3 shaders
   * Output to an rgba16ui image for the BC1 and BC4 shaders
   * Set the version of the BC3 shaders to 310 es

Ref: https://github.com/darksylinc/betsy/tree/cc723dcae9
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19827>
This commit is contained in:
Nanley Chery
2022-07-27 17:01:05 -07:00
committed by Marge Bot
parent 0a5a54b81a
commit 96cb3ba424
5 changed files with 911 additions and 1 deletions

View File

@@ -72,6 +72,34 @@ float64_glsl_h = custom_target(
float64_glsl_file = [files('float64.glsl')]
cross_platform_settings_piece_all_h = custom_target(
'cross_platform_settings_piece_all.h',
input : [files_xxd, 'CrossPlatformSettings_piece_all.glsl'],
output : 'cross_platform_settings_piece_all.h',
command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'cross_platform_settings_piece_all_header'],
)
bc1_glsl_h = custom_target(
'bc1_glsl.h',
input : [files_xxd, 'bc1.glsl'],
output : 'bc1_glsl.h',
command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'bc1_source'],
)
bc4_glsl_h = custom_target(
'bc4_glsl.h',
input : [files_xxd, 'bc4.glsl'],
output : 'bc4_glsl.h',
command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'bc4_source'],
)
etc2_rgba_stitch_glsl_h = custom_target(
'etc2_rgba_stitch_glsl.h',
input : [files_xxd, 'etc2_rgba_stitch.glsl'],
output : 'etc2_rgba_stitch_glsl.h',
command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'etc2_rgba_stitch_source'],
)
files_libglsl = files(
'ast.h',
'ast_array_index.cpp',
@@ -214,7 +242,8 @@ libglsl = static_library(
'glsl',
[files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h,
ir_expression_operation_strings_h, ir_expression_operation_constant_h,
float64_glsl_h],
float64_glsl_h, cross_platform_settings_piece_all_h, bc1_glsl_h, bc4_glsl_h,
etc2_rgba_stitch_glsl_h],
c_args : [c_msvc_compat_args, no_override_init_args],
cpp_args : [cpp_msvc_compat_args],
gnu_symbol_visibility : 'hidden',