Hi,
I have some external PTX modules, I’d like to use them as direct callables, so that these external work can be used in OptiX. By using optixModuleCreateFromPTX and entryFunctionNameDC, I can register functions to the pipeline, that’s great.
However, I don’t know how to assign the variables of these PTX modules. With cuda, I can use cuModuleGetGlobal. Unfortunately, there seems no way to get cuModule from OptiXModule.
As OptiX 7 is very cuda like, are there any way to assign the variables of external PTX modules?
Example:
.visible .global .align 4 .b8 diffuseColor[12];
.visible .global .align 4 .f32 diffuseRoughness;
.visible .global .align 4 .b8 _ZN21rti_internal_typeinfo12diffuseColorE[8] = {82, 97, 121, 0, 12, 0, 0, 0};
.visible .global .align 4 .b8 _ZN21rti_internal_typeinfo16diffuseRoughnessE[8] = {82, 97, 121, 0, 4, 0, 0, 0};
// .globl __direct_callable__aaa
.visible .func (.param .align 4 .b8 func_retval0[12]) __direct_callable__aaa(
.param .b64 __direct_callable__aaa_param_0,
.param .b64 __direct_callable__aaa_param_1
)
{
.reg .f32 %f<4>;
ld.global.f32 %f1, [diffuseColor];
ld.global.f32 %f2, [diffuseColor+4];
ld.global.f32 %f3, [diffuseColor+8];
st.param.f32 [func_retval0+0], %f1;
st.param.f32 [func_retval0+4], %f2;
st.param.f32 [func_retval0+8], %f3;
ret;
}
// .globl __direct_callable__bbb
.visible .func (.param .align 4 .b8 func_retval0[12]) __direct_callable__bbb(
.param .b64 __direct_callable__bbb_param_0,
.param .b64 __direct_callable__bbb_param_1
)
{
.reg .f32 %f<2>;
ld.global.f32 %f1, [diffuseRoughness];
st.param.f32 [func_retval0+0], %f1;
st.param.f32 [func_retval0+4], %f1;
st.param.f32 [func_retval0+8], %f1;
ret;
}
In this case, I don’t know how to set diffuseColor and diffuseRoughness.
Thanks