Module: RLSL::UniformTypes::Catalog

Included in:
RLSL::UniformTypes
Defined in:
lib/rlsl/types/catalog.rb

Instance Method Summary collapse

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

Raises:

  • (ArgumentError)


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_typesObject



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_typesObject



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

Raises:

  • (ArgumentError)


31
32
33
34
35
36
# File 'lib/rlsl/types/catalog.rb', line 31

def metal_spec(type)
  spec = fetch(type)
  return spec if spec.metal_packable?

  raise ArgumentError, "Unsupported Metal uniform type: #{type}"
end

#runtime_typesObject



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

Returns:

  • (Boolean)


6
7
8
# File 'lib/rlsl/types/catalog.rb', line 6

def supported?(type)
  UNIFORM_TYPE_SPECS.key?(type.to_sym)
end