GPU: Shader Create Info GLSL-C++ stubs #3

Closed
Clément Foucault wants to merge 90 commits from create-info-cpp-macros into glsl-include

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

Rel #127983

TODO

  • Base Macro work
  • Include every shader shared file inside glsl_cpp_stubs (to avoid issue with special types in create info)
  • Change shader stage interface instance name to not use quotes and use different "named" macro
  • Unroll variadic additional infos
  • Apply Macros
    • Builtin
    • Compositor
    • Draw
    • Overlay
    • Workbench
    • EEVEE

Follow up

  • Rename values in gpu::shader::Type to match C++
Rel #127983 TODO - [x] Base Macro work - [x] Include every shader shared file inside glsl_cpp_stubs (to avoid issue with special types in create info) - [x] Change shader stage interface instance name to not use quotes and use different "named" macro - [x] Unroll variadic additional infos - [x] Apply Macros - [x] Builtin - [x] Compositor - [x] Draw - [x] Overlay - [x] Workbench - [x] EEVEE Follow up - [ ] Rename values in gpu::shader::Type to match C++
Author
Owner

Python script used to do mass renaming (still have issues with the variation macros and some unconventional style):

import os
import re

# Function to perform regex replacements
def apply_replacements(content, replacements):
    for pattern, replacement in replacements:
        content = re.sub(pattern, replacement, content)
    return content

# Function to process all files in a folder
def process_folder(folder_path, file_extensions, replacements):
    for root, dirs, files in os.walk(folder_path):
        for file_name in files:
            # if file_name.endswith("_info.hh") and "infos" in root:
            if file_name.endswith("_info.hh") and "shaders" in root:
                file_path = os.path.join(root, file_name)
                # Read the file
                with open(file_path, 'r', encoding='utf-8') as file:
                    content = file.read()

                # # Apply replacements
                new_content = apply_replacements(content, replacements)

                # # Write the updated content back to the file
                with open(file_path, 'w', encoding='utf-8') as file:
                    file.write(new_content)

                print(f"Updated: {file_path}")


# Define the folder to search and the file types to process
folder_path = "/Users/clement/Blender/blender/source/blender"
file_extensions = [".hh"]  # Add more extensions if needed

# Define your regex patterns and replacements
replacements = [
    (r'\.additional_info\([\s\n]*"(\w+)"\)', r'.additional_info("\g<1>")'),
    (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)"\)', r'.additional_info("\g<1>")\n.additional_info("\g<2>")'),
    (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)',
     r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")'),
    (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)',
     r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")'),
    (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)',
     r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")'),
    (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)',
     r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")\n.additional_info("\g<6>")'),
    (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)',
     r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")\n.additional_info("\g<6>")\n.additional_info("\g<7>")'),
    (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)',
     r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")\n.additional_info("\g<6>")\n.additional_info("\g<7>")\n.additional_info("\g<8>")'),
    (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)',
     r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")\n.additional_info("\g<6>")\n.additional_info("\g<7>")\n.additional_info("\g<8>")\n.additional_info("\g<9>")'),
    (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)',
     r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")\n.additional_info("\g<6>")\n.additional_info("\g<7>")\n.additional_info("\g<8>")\n.additional_info("\g<9>")\n.additional_info("\g<1>0")'),
    (r'\)\.(\w+)\(', r')\n.\g<1>('),
    (r'\.push_constant\([\s\n]*Type::(\w+),[\s\n]*"(\w+)"\)', r'PUSH_CONSTANT(\g<1>, \g<2>)'),
    (r'\.push_constant\([\s\n]*Type::(\w+),[\s\n]*"(\w+)",[\s\n]*(.+)\)', r'PUSH_CONSTANT_ARRAY(\g<1>, \g<2>, \g<3>)'),
    (r'\.sampler\([\s\n]*(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"(\w+)"\)', r'SAMPLER(\g<1>, \g<2>, \g<3>)'),
    (r'\.sampler\([\s\n]*(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"(\w+)",[\s\n]*Frequency::(\w+)\)',
     r'SAMPLER_FREQ(\g<1>, \g<2>, \g<3>, \g<4>)'),
    (r'\.vertex_out\([\s\n]*(\w+)\)', r'VERTEX_OUT(\g<1>)'),
    (r'\.flat\([\s\n]*Type::(\w+),[\s\n]*"([\w\[\]]+)"\)', r'FLAT(\g<1>, \g<2>)'),
    (r'\.smooth\([\s\n]*Type::(\w+),[\s\n]*"([\w\[\]]+)"\)', r'SMOOTH(\g<1>, \g<2>)'),
    (r'\.no_perspective\([\s\n]*Type::(\w+),[\s\n]*"([\w\[\]]+)"\)', r'NO_PERSPECTIVE(\g<1>, \g<2>)'),
    (r'\.fragment_out\([\s\n]*(\w+),[\s\n]*Type::(\w+),[\s\n]*"(\w+)"\)', r'FRAGMENT_OUT(\g<1>, \g<2>, \g<3>)'),
    (r'\.fragment_out\([\s\n]*(\w+),[\s\n]*Type::(\w+),[\s\n]*"(\w+)",[\s\n]*DualBlend::(\w+)\)',
     r'FRAGMENT_OUT_DUAL(\g<1>, \g<2>, \g<3>, \g<4>)'),
    (r'\.fragment_out\([\s\n]*(\w+),[\s\n]*Type::(\w+),[\s\n]*"(\w+)",[\s\n]*DualBlend::NONE,[\s\n]*(\w+)\)',
     r'FRAGMENT_OUT_ROG(\g<1>, \g<2>, \g<3>, \g<4>)'),
    (r'\.uniform_buf\([\s\n]*(\w+),[\s\n]*"(\w+)",[\s\n]*"([\w\[\]]+)"\)', r'UNIFORM_BUF(\g<1>, \g<2>, \g<3>)'),
    (r'\.uniform_buf\([\s\n]*(\w+),[\s\n]*"(\w+)",[\s\n]*"([\w\[\]]+)",[\s\n]*Frequency::(\w+)\)',
     r'UNIFORM_BUF_FREQ(\g<1>, \g<2>, \g<3>, \g<4>)'),
    (r'\.storage_buf\([\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*"(\w+)",[\s\n]*"([\w\[\]]+)"\)',
     r'STORAGE_BUF(\g<1>, \g<2>, \g<3>, \g<4>)'),
    (r'\.storage_buf\([\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*(\w+),[\s\n]*"([\w\[\]]+)"\)',
     r'STORAGE_BUF(\g<1>, \g<2>, \g<3>, \g<4>)'),
    (r'\.storage_buf\([\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*"(\w+)",[\s\n]*"([\w\[\]]+)",[\s\n]*Frequency::(\w+)\)',
     r'STORAGE_BUF_FREQ(\g<1>, \g<2>, \g<3>, \g<4>, \g<5>)'),
    (r'\.image_out\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"([\w]+)"\)',
     r'IMAGE_FREQ(\g<1>, \g<2>, WRITE, \g<3>, \g<4>, PASS)'),
    (r'\.image_out\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*"([\w]+)"\)',
     r'IMAGE_FREQ(\g<1>, \g<2>, WRITE, FLOAT_2D, \g<3>, PASS)'),
    (r'\.image_out\([\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*(\w+),[\s\n]*"([\w]+)"\)',
     r'IMAGE_FREQ(\g<1>, \g<3>, \g<2>, FLOAT_2D, \g<4>, PASS)'),
    (r'\.uimage_out\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*"([\w]+)"\)',
     r'IMAGE_FREQ(\g<1>, \g<2>, WRITE, UINT_2D, \g<3>, PASS)'),
    (r'\.image_in\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*"([\w]+)"\)',
     r'IMAGE_FREQ(\g<1>, \g<2>, READ, FLOAT_2D, \g<3>, PASS)'),
    (r'\.image_in\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"([\w]+)"\)',
     r'IMAGE_FREQ(\g<1>, \g<2>, READ, \g<3>, \g<4>, PASS)'),
    (r'\.image_array_out\([\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*(\w+),[\s\n]*"([\w]+)"\)',
     r'IMAGE_FREQ(\g<1>, \g<3>, \g<2>, FLOAT_2D, \g<4>, PASS)'),
    (r'\.image\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"([\w]+)"\)',
     r'IMAGE(\g<1>, \g<2>, \g<3>, \g<4>, \g<5>)'),
    (r'\.image\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"([\w]+)",[\s\n]*Frequency::(\w+)\)',
     r'IMAGE_FREQ(\g<1>, \g<2>, \g<3>, \g<4>, \g<5>, \g<6>)'),
    (r'\.vertex_in\([\s\n]*(\w+),[\s\n]*Type::(\w+),[\s\n]*"(\w+)"\)', r'VERTEX_IN(\g<1>, \g<2>, \g<3>)'),
    (r'\.vertex_source\([\s\n]*"([\w\.]+)"\)', r'VERTEX_SOURCE("\g<1>")'),
    (r'\.geometry_source\([\s\n]*"([\w\.]+)"\)', r'GEOMETRY_SOURCE("\g<1>")'),
    (r'\.fragment_source\([\s\n]*"([\w\.]+)"\)', r'FRAGMENT_SOURCE("\g<1>")'),
    (r'\.compute_source\([\s\n]*"([\w\.]+)"\)', r'COMPUTE_SOURCE("\g<1>")'),
    (r'\.typedef_source\([\s\n]*"([\w\.]+)"\)', r'TYPEDEF_SOURCE("\g<1>")'),
    (r'\.do_static_compilation\([\s\n]*true\)', r'DO_STATIC_COMPILATION()'),
    (r'\.local_group_size\([\s\n]*([\w\s,]+)\)', r'LOCAL_GROUP_SIZE(\g<1>)'),
    (r'\.geometry_layout\([\s\n]*(.*)\)', r'GEOMETRY_LAYOUT(\g<1>)'),
    (r'\.geometry_out\([\s\n]*(.*)\)', r'GEOMETRY_OUT(\g<1>)'),
    (r'\.subpass_in\([\s\n]*(\w+),[\s\n]*Type::(\w+),[\s\n]*"(\w+)",[\s\n]*(\w+)\)',
     r'SUBPASS_IN(\g<1>, \g<2>, \g<3>, \g<4>)'),
    (r'\.early_fragment_test\([\s\n]*(.*)\)', r'EARLY_FRAGMENT_TEST(\g<1>)'),
    (r'\.depth_write\([\s\n]*(.*)\)', r'DEPTH_WRITE(\g<1>)'),
    (r'\.builtins\([\s\n]*(.*)\)', r'BUILTINS(\g<1>)'),
    (r'\.specialization_constant\([\s\n]*Type::(\w+),[\s\n]*"(\w+)",[\s\n]*([-\w]+)\)',
     r'SPECIALIZATION_CONSTANT(\g<1>, \g<2>, \g<3>)'),
    (r'\.auto_resource_location\([\s\n]*true\)', r'AUTO_RESOURCE_LOCATION()'),
    (r'\.metal_backend_only\([\s\n]*true\)', r'METAL_BACKEND_ONLY()'),
    (r'\.additional_info\([\s\n]*"(\w+)"\)', r'ADDITIONAL_INFO(\g<1>)'),
    (r'\.typedef_source\([\s\n]*"([\w\.]+)"\)', r'TYPEDEF_SOURCE("\g<1>")'),
    (r'\.mtl_max_total_threads_per_threadgroup\([\s\n]*(\d*)\)', r'MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(\g<1>)'),
    (r'\.define\("([\w\[\]\-\(\)\ ,]+)",[\s\n]*"([^"\n]+)"\)', r'DEFINE_VALUE("\g<1>", "\g<2>")'),
    (r'\.define\("([\w\[\]\-\(\)\ ,]+)",[\s\n]*([\w\[\]\-\+\*\/\(\)\\.,\ "]+)\)', r'DEFINE_VALUE("\g<1>", \g<2>)'),
    (r'\.define\("([\w\[\]\-\(\)\ ,]+)"\)', r'DEFINE("\g<1>")'),
    (r'GPU_SHADER_INTERFACE_INFO\((\w+),[\s\n]+"(\w+)"\)', r'GPU_SHADER_NAMED_INTERFACE_INFO(\g<1>, \g<2>)'),
    (r'GPU_SHADER_INTERFACE_INFO\((\w+),\s""\)', r'GPU_SHADER_INTERFACE_INFO(\g<1>)'),
    (r'(GPU_SHADER_CREATE_INFO[^;]+);', r'\g<1>\nGPU_SHADER_CREATE_END()'),
    (r'(GPU_SHADER_INTERFACE_INFO[^;]+);', r'\g<1>\nGPU_SHADER_INTERFACE_END()'),
    (r'GPU_SHADER_NAMED_INTERFACE_INFO\((\w+),[\s\n]+(\w+)\)([^;]+);',
     r'GPU_SHADER_NAMED_INTERFACE_INFO(\g<1>, \g<2>)\g<3>\nGPU_SHADER_NAMED_INTERFACE_END(\g<2>)'),
    # Add more regex replacement pairs as needed
]

# Run the process
process_folder(folder_path, file_extensions, replacements)

Python script used to do mass renaming (still have issues with the variation macros and some unconventional style): ```python import os import re # Function to perform regex replacements def apply_replacements(content, replacements): for pattern, replacement in replacements: content = re.sub(pattern, replacement, content) return content # Function to process all files in a folder def process_folder(folder_path, file_extensions, replacements): for root, dirs, files in os.walk(folder_path): for file_name in files: # if file_name.endswith("_info.hh") and "infos" in root: if file_name.endswith("_info.hh") and "shaders" in root: file_path = os.path.join(root, file_name) # Read the file with open(file_path, 'r', encoding='utf-8') as file: content = file.read() # # Apply replacements new_content = apply_replacements(content, replacements) # # Write the updated content back to the file with open(file_path, 'w', encoding='utf-8') as file: file.write(new_content) print(f"Updated: {file_path}") # Define the folder to search and the file types to process folder_path = "/Users/clement/Blender/blender/source/blender" file_extensions = [".hh"] # Add more extensions if needed # Define your regex patterns and replacements replacements = [ (r'\.additional_info\([\s\n]*"(\w+)"\)', r'.additional_info("\g<1>")'), (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)"\)', r'.additional_info("\g<1>")\n.additional_info("\g<2>")'), (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)', r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")'), (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)', r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")'), (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)', r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")'), (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)', r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")\n.additional_info("\g<6>")'), (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)', r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")\n.additional_info("\g<6>")\n.additional_info("\g<7>")'), (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)', r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")\n.additional_info("\g<6>")\n.additional_info("\g<7>")\n.additional_info("\g<8>")'), (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)', r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")\n.additional_info("\g<6>")\n.additional_info("\g<7>")\n.additional_info("\g<8>")\n.additional_info("\g<9>")'), (r'\.additional_info\([\s\n]*"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)",[\s\n]+"(\w+)"\)', r'.additional_info("\g<1>")\n.additional_info("\g<2>")\n.additional_info("\g<3>")\n.additional_info("\g<4>")\n.additional_info("\g<5>")\n.additional_info("\g<6>")\n.additional_info("\g<7>")\n.additional_info("\g<8>")\n.additional_info("\g<9>")\n.additional_info("\g<1>0")'), (r'\)\.(\w+)\(', r')\n.\g<1>('), (r'\.push_constant\([\s\n]*Type::(\w+),[\s\n]*"(\w+)"\)', r'PUSH_CONSTANT(\g<1>, \g<2>)'), (r'\.push_constant\([\s\n]*Type::(\w+),[\s\n]*"(\w+)",[\s\n]*(.+)\)', r'PUSH_CONSTANT_ARRAY(\g<1>, \g<2>, \g<3>)'), (r'\.sampler\([\s\n]*(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"(\w+)"\)', r'SAMPLER(\g<1>, \g<2>, \g<3>)'), (r'\.sampler\([\s\n]*(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"(\w+)",[\s\n]*Frequency::(\w+)\)', r'SAMPLER_FREQ(\g<1>, \g<2>, \g<3>, \g<4>)'), (r'\.vertex_out\([\s\n]*(\w+)\)', r'VERTEX_OUT(\g<1>)'), (r'\.flat\([\s\n]*Type::(\w+),[\s\n]*"([\w\[\]]+)"\)', r'FLAT(\g<1>, \g<2>)'), (r'\.smooth\([\s\n]*Type::(\w+),[\s\n]*"([\w\[\]]+)"\)', r'SMOOTH(\g<1>, \g<2>)'), (r'\.no_perspective\([\s\n]*Type::(\w+),[\s\n]*"([\w\[\]]+)"\)', r'NO_PERSPECTIVE(\g<1>, \g<2>)'), (r'\.fragment_out\([\s\n]*(\w+),[\s\n]*Type::(\w+),[\s\n]*"(\w+)"\)', r'FRAGMENT_OUT(\g<1>, \g<2>, \g<3>)'), (r'\.fragment_out\([\s\n]*(\w+),[\s\n]*Type::(\w+),[\s\n]*"(\w+)",[\s\n]*DualBlend::(\w+)\)', r'FRAGMENT_OUT_DUAL(\g<1>, \g<2>, \g<3>, \g<4>)'), (r'\.fragment_out\([\s\n]*(\w+),[\s\n]*Type::(\w+),[\s\n]*"(\w+)",[\s\n]*DualBlend::NONE,[\s\n]*(\w+)\)', r'FRAGMENT_OUT_ROG(\g<1>, \g<2>, \g<3>, \g<4>)'), (r'\.uniform_buf\([\s\n]*(\w+),[\s\n]*"(\w+)",[\s\n]*"([\w\[\]]+)"\)', r'UNIFORM_BUF(\g<1>, \g<2>, \g<3>)'), (r'\.uniform_buf\([\s\n]*(\w+),[\s\n]*"(\w+)",[\s\n]*"([\w\[\]]+)",[\s\n]*Frequency::(\w+)\)', r'UNIFORM_BUF_FREQ(\g<1>, \g<2>, \g<3>, \g<4>)'), (r'\.storage_buf\([\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*"(\w+)",[\s\n]*"([\w\[\]]+)"\)', r'STORAGE_BUF(\g<1>, \g<2>, \g<3>, \g<4>)'), (r'\.storage_buf\([\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*(\w+),[\s\n]*"([\w\[\]]+)"\)', r'STORAGE_BUF(\g<1>, \g<2>, \g<3>, \g<4>)'), (r'\.storage_buf\([\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*"(\w+)",[\s\n]*"([\w\[\]]+)",[\s\n]*Frequency::(\w+)\)', r'STORAGE_BUF_FREQ(\g<1>, \g<2>, \g<3>, \g<4>, \g<5>)'), (r'\.image_out\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"([\w]+)"\)', r'IMAGE_FREQ(\g<1>, \g<2>, WRITE, \g<3>, \g<4>, PASS)'), (r'\.image_out\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*"([\w]+)"\)', r'IMAGE_FREQ(\g<1>, \g<2>, WRITE, FLOAT_2D, \g<3>, PASS)'), (r'\.image_out\([\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*(\w+),[\s\n]*"([\w]+)"\)', r'IMAGE_FREQ(\g<1>, \g<3>, \g<2>, FLOAT_2D, \g<4>, PASS)'), (r'\.uimage_out\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*"([\w]+)"\)', r'IMAGE_FREQ(\g<1>, \g<2>, WRITE, UINT_2D, \g<3>, PASS)'), (r'\.image_in\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*"([\w]+)"\)', r'IMAGE_FREQ(\g<1>, \g<2>, READ, FLOAT_2D, \g<3>, PASS)'), (r'\.image_in\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"([\w]+)"\)', r'IMAGE_FREQ(\g<1>, \g<2>, READ, \g<3>, \g<4>, PASS)'), (r'\.image_array_out\([\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*(\w+),[\s\n]*"([\w]+)"\)', r'IMAGE_FREQ(\g<1>, \g<3>, \g<2>, FLOAT_2D, \g<4>, PASS)'), (r'\.image\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"([\w]+)"\)', r'IMAGE(\g<1>, \g<2>, \g<3>, \g<4>, \g<5>)'), (r'\.image\([\s\n]*(\w+),[\s\n]*(\w+),[\s\n]*Qualifier::(\w+),[\s\n]*ImageType::(\w+),[\s\n]*"([\w]+)",[\s\n]*Frequency::(\w+)\)', r'IMAGE_FREQ(\g<1>, \g<2>, \g<3>, \g<4>, \g<5>, \g<6>)'), (r'\.vertex_in\([\s\n]*(\w+),[\s\n]*Type::(\w+),[\s\n]*"(\w+)"\)', r'VERTEX_IN(\g<1>, \g<2>, \g<3>)'), (r'\.vertex_source\([\s\n]*"([\w\.]+)"\)', r'VERTEX_SOURCE("\g<1>")'), (r'\.geometry_source\([\s\n]*"([\w\.]+)"\)', r'GEOMETRY_SOURCE("\g<1>")'), (r'\.fragment_source\([\s\n]*"([\w\.]+)"\)', r'FRAGMENT_SOURCE("\g<1>")'), (r'\.compute_source\([\s\n]*"([\w\.]+)"\)', r'COMPUTE_SOURCE("\g<1>")'), (r'\.typedef_source\([\s\n]*"([\w\.]+)"\)', r'TYPEDEF_SOURCE("\g<1>")'), (r'\.do_static_compilation\([\s\n]*true\)', r'DO_STATIC_COMPILATION()'), (r'\.local_group_size\([\s\n]*([\w\s,]+)\)', r'LOCAL_GROUP_SIZE(\g<1>)'), (r'\.geometry_layout\([\s\n]*(.*)\)', r'GEOMETRY_LAYOUT(\g<1>)'), (r'\.geometry_out\([\s\n]*(.*)\)', r'GEOMETRY_OUT(\g<1>)'), (r'\.subpass_in\([\s\n]*(\w+),[\s\n]*Type::(\w+),[\s\n]*"(\w+)",[\s\n]*(\w+)\)', r'SUBPASS_IN(\g<1>, \g<2>, \g<3>, \g<4>)'), (r'\.early_fragment_test\([\s\n]*(.*)\)', r'EARLY_FRAGMENT_TEST(\g<1>)'), (r'\.depth_write\([\s\n]*(.*)\)', r'DEPTH_WRITE(\g<1>)'), (r'\.builtins\([\s\n]*(.*)\)', r'BUILTINS(\g<1>)'), (r'\.specialization_constant\([\s\n]*Type::(\w+),[\s\n]*"(\w+)",[\s\n]*([-\w]+)\)', r'SPECIALIZATION_CONSTANT(\g<1>, \g<2>, \g<3>)'), (r'\.auto_resource_location\([\s\n]*true\)', r'AUTO_RESOURCE_LOCATION()'), (r'\.metal_backend_only\([\s\n]*true\)', r'METAL_BACKEND_ONLY()'), (r'\.additional_info\([\s\n]*"(\w+)"\)', r'ADDITIONAL_INFO(\g<1>)'), (r'\.typedef_source\([\s\n]*"([\w\.]+)"\)', r'TYPEDEF_SOURCE("\g<1>")'), (r'\.mtl_max_total_threads_per_threadgroup\([\s\n]*(\d*)\)', r'MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(\g<1>)'), (r'\.define\("([\w\[\]\-\(\)\ ,]+)",[\s\n]*"([^"\n]+)"\)', r'DEFINE_VALUE("\g<1>", "\g<2>")'), (r'\.define\("([\w\[\]\-\(\)\ ,]+)",[\s\n]*([\w\[\]\-\+\*\/\(\)\\.,\ "]+)\)', r'DEFINE_VALUE("\g<1>", \g<2>)'), (r'\.define\("([\w\[\]\-\(\)\ ,]+)"\)', r'DEFINE("\g<1>")'), (r'GPU_SHADER_INTERFACE_INFO\((\w+),[\s\n]+"(\w+)"\)', r'GPU_SHADER_NAMED_INTERFACE_INFO(\g<1>, \g<2>)'), (r'GPU_SHADER_INTERFACE_INFO\((\w+),\s""\)', r'GPU_SHADER_INTERFACE_INFO(\g<1>)'), (r'(GPU_SHADER_CREATE_INFO[^;]+);', r'\g<1>\nGPU_SHADER_CREATE_END()'), (r'(GPU_SHADER_INTERFACE_INFO[^;]+);', r'\g<1>\nGPU_SHADER_INTERFACE_END()'), (r'GPU_SHADER_NAMED_INTERFACE_INFO\((\w+),[\s\n]+(\w+)\)([^;]+);', r'GPU_SHADER_NAMED_INTERFACE_INFO(\g<1>, \g<2>)\g<3>\nGPU_SHADER_NAMED_INTERFACE_END(\g<2>)'), # Add more regex replacement pairs as needed ] # Run the process process_folder(folder_path, file_extensions, replacements) ```
Clément Foucault force-pushed create-info-cpp-macros from d8cddee68b to 2888380ffe 2024-09-26 18:15:08 +02:00 Compare
Clément Foucault added 1 commit 2024-09-26 19:28:54 +02:00
Clément Foucault added 2 commits 2024-09-26 21:28:49 +02:00
Clément Foucault added 24 commits 2024-09-28 13:17:54 +02:00
Clément Foucault added 1 commit 2024-09-28 13:27:05 +02:00
Clément Foucault added 10 commits 2024-09-28 18:28:39 +02:00
Clément Foucault added 5 commits 2024-09-28 19:47:50 +02:00
Clément Foucault changed title from WIP: GPU: Shader Create Info GLSL-C++ stubs to GPU: Shader Create Info GLSL-C++ stubs 2024-09-28 19:48:12 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: fclem/blender#3
No description provided.