ShaderGlobals/AiTextureHandleAccess in Custom Camera

ShaderGlobals/AiTextureHandleAccess in Custom Camera

Anonymous
Not applicable
678 Views
1 Reply
Message 1 of 2

ShaderGlobals/AiTextureHandleAccess in Custom Camera

Anonymous
Not applicable

We're writing a custom camera for Arnold, and running into a simple texture access issue.

Trying to call;

AtRGBA lensmapSample = AiTextureHandleAccess(sg, data->texturehandle, *(data->textureparams));

....results in a segfault if used on multiple cores (works fine on a single core).

Unlike shader_evaluate(), sg isn't defined for camera_create_ray, so we're having to declare & init it with;

AtShaderGlobals* sg = AiShaderGlobals();

... and then pass that along to AiTextureHandleAccess, but my guess is that it's not getting initialized per thread or something like that because any number of threads beyond 1 causes a crash (with 1 thread, it works as expected).

Anyone know how this is supposed to be invoked? Is there an alternate texture access method that should be used at the camera_create_ray step?

Oh, two of the more common errors that appear in the segfault are:

/home/thiago/oiio-arnold/src/libtexture/imagecache.cpp:1449: failed assertion 'memsize() == 0 && size > OIIO_SIMD_MAX_SIZE_BYTES'

and

* signal caught: SIGSEGV -- Invalid memory reference (address not mapped to object)

My guess is that the first error is likely just another version of the second.

0 Likes
679 Views
1 Reply
Reply (1)
Message 2 of 2

Stephen.Blair
Community Manager
Community Manager

It's a problem with the sg returned by AiShaderGlobals. Fix in next update.



// Stephen Blair
// Arnold Renderer Support
0 Likes