@@ -66,7 +66,7 @@ rs_get_inverse_matrix_space_time(OSL::OpaqueExecContextPtr ec,
6666 using OSL::Matrix44;
6767
6868
69- auto rs = OSL::get_rs<RenderState>(ec);
69+ auto rs = OSL::get_rs<RenderState>(ec)-> context ;
7070 if (to == OSL::Hashes::camera || to == OSL::Hashes::screen
7171 || to == OSL::Hashes::NDC || to == RS::Hashes::raster) {
7272 Matrix44 M { rs->world_to_camera };
@@ -372,11 +372,8 @@ rs_trace_get(OSL::OpaqueExecContextPtr ec, OSL::ustringhash name,
372372OSL_RSOP OSL_HOSTDEVICE void *
373373rs_allocate_closure (OSL::OpaqueExecContextPtr ec, size_t size, size_t alignment)
374374{
375- auto sg = (OSL::ShaderGlobals*)ec;
376- uintptr_t ptr = OIIO::round_to_multiple_of_pow2 ((uintptr_t )sg->renderstate ,
377- alignment);
378- sg->renderstate = (void *)(ptr + size);
379- return (void *)ptr;
375+ auto rs = OSL::get_rs<RenderState>(ec);
376+ return rs->closure_pool ->allocate (size, alignment);
380377}
381378#endif
382379
@@ -503,7 +500,7 @@ rs_get_attribute(OSL::OpaqueExecContextPtr oec, OSL::ustringhash_pod object_,
503500 auto object = OSL::ustringhash_from (object_);
504501 auto name = OSL::ustringhash_from (name_);
505502 const OSL::TypeDesc type = OSL::TypeDesc_from (_type);
506- auto rs = OSL::get_rs<RenderState>(oec);
503+ auto rs = OSL::get_rs<RenderState>(oec)-> context ;
507504
508505 // The many branches in the code below handle the case where we don't know
509506 // the attribute name at compile time. In the case it is known, dead-code
@@ -648,7 +645,7 @@ rs_errorfmt(OSL::OpaqueExecContextPtr ec, OSL::ustringhash fmt_specification,
648645 int32_t arg_count, const OSL::EncodedType* argTypes,
649646 uint32_t argValuesSize, uint8_t * argValues)
650647{
651- auto rs = OSL::get_rs<RenderState>(ec);
648+ auto rs = OSL::get_rs<RenderState>(ec)-> context ;
652649
653650 OSL::journal::Writer jw { rs->journal_buffer };
654651 jw.record_errorfmt (OSL::get_thread_index (ec), OSL::get_shade_index (ec),
@@ -661,7 +658,7 @@ rs_warningfmt(OSL::OpaqueExecContextPtr ec, OSL::ustringhash fmt_specification,
661658 int32_t arg_count, const OSL::EncodedType* argTypes,
662659 uint32_t argValuesSize, uint8_t * argValues)
663660{
664- auto rs = OSL::get_rs<RenderState>(ec);
661+ auto rs = OSL::get_rs<RenderState>(ec)-> context ;
665662
666663 OSL::journal::Writer jw { rs->journal_buffer };
667664 jw.record_warningfmt (OSL::get_max_warnings_per_thread (ec),
@@ -676,7 +673,7 @@ rs_printfmt(OSL::OpaqueExecContextPtr ec, OSL::ustringhash fmt_specification,
676673 int32_t arg_count, const OSL::EncodedType* argTypes,
677674 uint32_t argValuesSize, uint8_t * argValues)
678675{
679- auto rs = OSL::get_rs<RenderState>(ec);
676+ auto rs = OSL::get_rs<RenderState>(ec)-> context ;
680677
681678 OSL::journal::Writer jw { rs->journal_buffer };
682679 jw.record_printfmt (OSL::get_thread_index (ec), OSL::get_shade_index (ec),
@@ -691,7 +688,7 @@ rs_filefmt(OSL::OpaqueExecContextPtr ec, OSL::ustringhash filename_hash,
691688 const OSL::EncodedType* argTypes, uint32_t argValuesSize,
692689 uint8_t * argValues)
693690{
694- auto rs = OSL::get_rs<RenderState>(ec);
691+ auto rs = OSL::get_rs<RenderState>(ec)-> context ;
695692
696693 OSL::journal::Writer jw { rs->journal_buffer };
697694 jw.record_filefmt (OSL::get_thread_index (ec), OSL::get_shade_index (ec),
0 commit comments