OpenXR 超详细的spec--Chapter 3 API初始化介绍

 3.API 初始化

3.1 Exported Functions

实现API loader的动态链接库(so/dll)必须export all core OpenXR API functions。然而application可以通过使用xrGetInstanceProcAddr()来获取指向extension函数的指针。

3.2 Function Pointers

OpenXR所有函数的指针都可以通过函数xrGetInstanceProcAddr()得到。

XrResult xrGetInstanceProcAddr(
    XrInstance                                  instance,
    const char*                                 name,
    PFN_xrVoidFunction*                         function);
  • instance: XrInstance类型,可以是NULL,也可以是任何有效的instance;
  • name:待获取fp的函数名称;
  • function:返回的函数指针fp。

Loader必须导出所有OpenXR核心函数的函数符号,这样application就可以不用使用xrGetInsanceProcAddr()来使用OpenXR core functions。

xrGetInstanceProcAddr的参数instance和name不同,返回的值也是不同,参考下表。

instance parametername parameterreturn value

*

NULL

undefined

invalid instance

*

undefined

NULL

xrEnumerateInstanceExtensionProperties

fp

NULL

xrEnumerateApiLayerProperties

fp

NULL

xrCreateInstance

fp

NULL

* (any name not covered above)

NULL

instance

core OpenXR function

fp1

instance

enabled extension function for instance

fp1

instance

* (any name not covered above)

NULL

  • 当参数instance是NULL时,但是name是xrEnumerateInstanceExtensionProperties/ xrEnumerateApiLayerProperties/ xrCreateInstance中任意一个,则返回对应name的函数fp。
  • 当instance是有效的对象时,如果name是core OpenXR function或者使能的扩展层extension的function,则会返回对应name的函数fp。
  • 如果name是不存在的函数名称,无论instance是否有效,都会返回NULL。

3.3  Runtime interface Negotiation

待完成

  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值