Class: OpenXR::Extension
- Inherits:
-
Struct
- Object
- Struct
- OpenXR::Extension
- Extended by:
- API
- Includes:
- API
- Defined in:
- lib/openxr/extension.rb
Overview
An OpenXR instance extension.
Constant Summary
Constants included from ABI
ABI::XR_CURRENT_API_VERSION, ABI::XR_ERROR_HANDLE_INVALID, ABI::XR_ERROR_RUNTIME_FAILURE, ABI::XR_ERROR_VALIDATION_FAILURE, ABI::XR_FALSE, ABI::XR_FORM_FACTOR_HANDHELD_DISPLAY, ABI::XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY, ABI::XR_FORM_FACTOR_MAX_ENUM, ABI::XR_MAX_ACTION_NAME_SIZE, ABI::XR_MAX_ACTION_SET_NAME_SIZE, ABI::XR_MAX_API_LAYER_DESCRIPTION_SIZE, ABI::XR_MAX_API_LAYER_NAME_SIZE, ABI::XR_MAX_APPLICATION_NAME_SIZE, ABI::XR_MAX_ENGINE_NAME_SIZE, ABI::XR_MAX_EXTENSION_NAME_SIZE, ABI::XR_MAX_LOCALIZED_ACTION_NAME_SIZE, ABI::XR_MAX_LOCALIZED_ACTION_SET_NAME_SIZE, ABI::XR_MAX_PATH_LENGTH, ABI::XR_MAX_RESULT_STRING_SIZE, ABI::XR_MAX_RUNTIME_NAME_SIZE, ABI::XR_MAX_STRUCTURE_NAME_SIZE, ABI::XR_MAX_SYSTEM_NAME_SIZE, ABI::XR_MIN_COMPOSITION_LAYERS_SUPPORTED, ABI::XR_SUCCESS, ABI::XR_TRUE, ABI::XR_TYPE_API_LAYER_PROPERTIES, ABI::XR_TYPE_EXTENSION_PROPERTIES, ABI::XR_TYPE_INSTANCE_CREATE_INFO, ABI::XR_TYPE_SESSION_CREATE_INFO, ABI::XR_TYPE_SYSTEM_GET_INFO, ABI::XR_TYPE_SYSTEM_PROPERTIES, ABI::XR_TYPE_UNKNOWN, ABI::XR_TYPE_VIEW, ABI::XR_TYPE_VIEW_LOCATE_INFO, ABI::XrBaseInStructure, ABI::XrBaseOutStructure, ABI::XrBool32, ABI::XrDuration, ABI::XrFlags64, ABI::XrFormFactor, ABI::XrInstanceCreateFlags, ABI::XrPath, ABI::XrResult, ABI::XrSessionCreateFlags, ABI::XrStructureType, ABI::XrSystemId, ABI::XrTime, ABI::XrVersion
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
- .count ⇒ Integer
- .each {|extension| ... } ⇒ Enumerator
- .list ⇒ Array<Extension>
- .query ⇒ Hash<Symbol, Extension>
Methods included from ABI
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
12 13 14 |
# File 'lib/openxr/extension.rb', line 12 def name @name end |
#version ⇒ Object
Returns the value of attribute version
12 13 14 |
# File 'lib/openxr/extension.rb', line 12 def version @version end |
Class Method Details
.count ⇒ Integer
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/openxr/extension.rb', line 18 def self.count response = FFI::MemoryPointer.new(:uint32) begin # https://www.khronos.org/registry/OpenXR/specs/1.0/man/html/openxr.html#_xrenumerateinstanceextensionproperties3 case result = xrEnumerateInstanceExtensionProperties(nil, 0, response, nil) when XR_SUCCESS then response.read(:uint32) else raise OpenXR::Result.new(result, :xrEnumerateInstanceExtensionProperties) end ensure response&.free end end |
.each {|extension| ... } ⇒ Enumerator
34 35 36 37 |
# File 'lib/openxr/extension.rb', line 34 def self.each(&block) return self.to_enum(:each) unless block_given? self.list.each(&block) end |
.list ⇒ Array<Extension>
41 42 43 |
# File 'lib/openxr/extension.rb', line 41 def self.list self.query.values end |
.query ⇒ Hash<Symbol, Extension>
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/openxr/extension.rb', line 47 def self.query request_count = self.count response_count = FFI::MemoryPointer.new(:uint32) response_array = FFI::MemoryPointer.new(XrExtensionProperties, request_count) begin request_count.times do |i| XrExtensionProperties.new(response_array[i])[:base][:type] = XR_TYPE_EXTENSION_PROPERTIES end # https://www.khronos.org/registry/OpenXR/specs/1.0/man/html/openxr.html#_xrenumerateinstanceextensionproperties3 case result = xrEnumerateInstanceExtensionProperties(nil, request_count, response_count, response_array) when XR_SUCCESS response_count.read(:uint32).times.inject({}) do |available, i| response = XrExtensionProperties.new(response_array[i]) extension_name = response[:extensionName].to_s.to_sym extension_version = response[:extensionVersion] available[extension_name] = self.new(extension_name, extension_version) available end else raise OpenXR::Result.new(result, :xrEnumerateInstanceExtensionProperties) end ensure response_array&.free response_count&.free end end |