KhronosGroup / KhronosGroup/GLSL

Template Programming

Open
#141 18 comments 15 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
458
Forks
114
Avg merge
4m
Merged PRs (30d)
1

Description

Metal SL has this.

its getting really tedious to write functions that only differ in variable types, see this library of GLSL code which I've made:
https://github.com/buildaworldnet/IrrlichtBAW/tree/property_pool/include/irr/builtin/glsl

Especially the code for parallel data primitives:
https://github.com/buildaworldnet/IrrlichtBAW/tree/property_pool/include/irr/builtin/glsl/subgroup
https://github.com/buildaworldnet/IrrlichtBAW/tree/property_pool/include/irr/builtin/glsl/workgroup

I've had to use very ugly macros as crutches. in order not to have heaps of duplicate code.

Also there's no way for me to 100% ensure certain things get unrolled, template metaprogramming could help a lot with this.

I sense that using GLSL I will eventually come to a point where inventing or stripping down an existing language (CUDA or C++) and compiling it straight to SPIR-V will make economical sense for me.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the linked GLSL code, especially the subgroup and workgroup directories, to understand the duplicated functions and macro workarounds described. Compare the requested template programming and unrolling behavior with the current GLSL specification and extensions; done would require an agreed language design and specification changes.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.