Module: RLSL::UniformTypes::Catalog
- Included in:
- RLSL::UniformTypes
- Defined in:
- lib/rlsl/types/catalog.rb
Instance Method Summary collapse
- #c_type(type) ⇒ Object
- #compiled_spec(type) ⇒ Object
- #compiled_types ⇒ Object
- #fetch(type) ⇒ Object
- #function_shorthand_types ⇒ Object
- #metal_spec(type) ⇒ Object
- #runtime_types ⇒ Object
- #supported?(type) ⇒ Boolean
Instance Method Details
#c_type(type) ⇒ Object
16 17 18 |
# File 'lib/rlsl/types/catalog.rb', line 16 def c_type(type) fetch(type).c_type end |
#compiled_spec(type) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/rlsl/types/catalog.rb', line 24 def compiled_spec(type) spec = fetch(type) return spec if spec.compiled? raise ArgumentError, "Unsupported compiled uniform type: #{type}" end |
#compiled_types ⇒ Object
20 21 22 |
# File 'lib/rlsl/types/catalog.rb', line 20 def compiled_types @compiled_types ||= UNIFORM_TYPE_SPECS.select { |_type, spec| spec.compiled? }.keys.freeze end |
#fetch(type) ⇒ Object
10 11 12 13 14 |
# File 'lib/rlsl/types/catalog.rb', line 10 def fetch(type) UNIFORM_TYPE_SPECS.fetch(type) do raise ArgumentError, "Unsupported uniform type: #{type.inspect}" end end |
#function_shorthand_types ⇒ Object
42 43 44 |
# File 'lib/rlsl/types/catalog.rb', line 42 def function_shorthand_types @function_shorthand_types ||= UNIFORM_TYPE_SPECS.select { |_type, spec| spec.function_shorthand? }.keys.freeze end |
#metal_spec(type) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/rlsl/types/catalog.rb', line 31 def (type) spec = fetch(type) return spec if spec. raise ArgumentError, "Unsupported Metal uniform type: #{type}" end |
#runtime_types ⇒ Object
38 39 40 |
# File 'lib/rlsl/types/catalog.rb', line 38 def runtime_types @runtime_types ||= UNIFORM_TYPE_SPECS.select { |_type, spec| spec.runtime_supported? }.keys.freeze end |
#supported?(type) ⇒ Boolean
6 7 8 |
# File 'lib/rlsl/types/catalog.rb', line 6 def supported?(type) UNIFORM_TYPE_SPECS.key?(type.to_sym) end |