Skip to content

Commit dd091ca

Browse files
committed
Rename variables
Signed-off-by: Curtis Black <curtis.w.black@gmail.com>
1 parent da25a77 commit dd091ca

4 files changed

Lines changed: 60 additions & 60 deletions

File tree

src/testshade/rs_simplerend.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,32 @@ rs_get_inverse_matrix_space_time(OSL::OpaqueExecContextPtr ec,
6666
using OSL::Matrix44;
6767

6868

69-
auto rs = OSL::get_rs<RenderState>(ec)->context;
69+
auto rc = 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) {
72-
Matrix44 M { rs->world_to_camera };
72+
Matrix44 M { rc->world_to_camera };
7373

7474
if (to == OSL::Hashes::screen || to == OSL::Hashes::NDC
7575
|| to == RS::Hashes::raster) {
76-
float depthrange = (double)rs->yon - (double)rs->hither;
77-
OSL::ustringhash proj = rs->projection;
76+
float depthrange = (double)rc->yon - (double)rc->hither;
77+
OSL::ustringhash proj = rc->projection;
7878

7979
if (proj == RS::Hashes::perspective) {
80-
float tanhalffov = OIIO::fast_tan(0.5f * rs->fov * M_PI
80+
float tanhalffov = OIIO::fast_tan(0.5f * rc->fov * M_PI
8181
/ 180.0);
8282
// clang-format off
8383
Matrix44 camera_to_screen (1/tanhalffov, 0, 0, 0,
8484
0, 1/tanhalffov, 0, 0,
85-
0, 0, rs->yon/depthrange, 1,
86-
0, 0, -(rs->yon*rs->hither)/depthrange, 0);
85+
0, 0, rc->yon/depthrange, 1,
86+
0, 0, -(rc->yon*rc->hither)/depthrange, 0);
8787
// clang-format on
8888
M = M * camera_to_screen;
8989
} else {
9090
// clang-format off
9191
Matrix44 camera_to_screen (1, 0, 0, 0,
9292
0, 1, 0, 0,
9393
0, 0, 1/depthrange, 0,
94-
0, 0, -(rs->hither)/depthrange, 1);
94+
0, 0, -(rc->hither)/depthrange, 1);
9595
// clang-format on
9696
M = M * camera_to_screen;
9797
}
@@ -107,8 +107,8 @@ rs_get_inverse_matrix_space_time(OSL::OpaqueExecContextPtr ec,
107107
M = M * screen_to_ndc;
108108
if (to == RS::Hashes::raster) {
109109
// clang-format off
110-
Matrix44 ndc_to_raster (rs->xres, 0, 0, 0,
111-
0, rs->yres, 0, 0,
110+
Matrix44 ndc_to_raster (rc->xres, 0, 0, 0,
111+
0, rc->yres, 0, 0,
112112
0, 0, 1, 0,
113113
0, 0, 0, 1);
114114
M = M * ndc_to_raster;
@@ -500,7 +500,7 @@ rs_get_attribute(OSL::OpaqueExecContextPtr oec, OSL::ustringhash_pod object_,
500500
auto object = OSL::ustringhash_from(object_);
501501
auto name = OSL::ustringhash_from(name_);
502502
const OSL::TypeDesc type = OSL::TypeDesc_from(_type);
503-
auto rs = OSL::get_rs<RenderState>(oec)->context;
503+
auto rc = OSL::get_rs<RenderState>(oec)->context;
504504

505505
// The many branches in the code below handle the case where we don't know
506506
// the attribute name at compile time. In the case it is known, dead-code
@@ -509,38 +509,38 @@ rs_get_attribute(OSL::OpaqueExecContextPtr oec, OSL::ustringhash_pod object_,
509509
return rs_get_attribute_constant_int(OSL_VERSION, result);
510510
if (name == RS::Hashes::camera_resolution
511511
&& type == OSL::TypeDesc(OSL::TypeDesc::INT, 2))
512-
return rs_get_attribute_constant_int2(rs->xres, rs->yres, result);
512+
return rs_get_attribute_constant_int2(rc->xres, rc->yres, result);
513513
if (name == RS::Hashes::camera_projection && type == OSL::TypeString)
514-
return rs_get_attribute_constant_string(rs->projection, result);
514+
return rs_get_attribute_constant_string(rc->projection, result);
515515
if (name == RS::Hashes::camera_pixelaspect && type == OSL::TypeFloat)
516-
return rs_get_attribute_constant_float(rs->pixelaspect, derivatives,
516+
return rs_get_attribute_constant_float(rc->pixelaspect, derivatives,
517517
result);
518518
if (name == RS::Hashes::camera_screen_window
519519
&& type == OSL::TypeDesc(OSL::TypeDesc::FLOAT, 4))
520-
return rs_get_attribute_constant_float4(rs->screen_window[0],
521-
rs->screen_window[1],
522-
rs->screen_window[2],
523-
rs->screen_window[3],
520+
return rs_get_attribute_constant_float4(rc->screen_window[0],
521+
rc->screen_window[1],
522+
rc->screen_window[2],
523+
rc->screen_window[3],
524524
derivatives, result);
525525
if (name == RS::Hashes::camera_fov && type == OSL::TypeFloat)
526-
return rs_get_attribute_constant_float(rs->fov, derivatives, result);
526+
return rs_get_attribute_constant_float(rc->fov, derivatives, result);
527527
if (name == RS::Hashes::camera_clip
528528
&& type == OSL::TypeDesc(OSL::TypeDesc::FLOAT, 2))
529-
return rs_get_attribute_constant_float2(rs->hither, rs->yon,
529+
return rs_get_attribute_constant_float2(rc->hither, rc->yon,
530530
derivatives, result);
531531
if (name == RS::Hashes::camera_clip_near && type == OSL::TypeFloat)
532-
return rs_get_attribute_constant_float(rs->hither, derivatives, result);
532+
return rs_get_attribute_constant_float(rc->hither, derivatives, result);
533533
if (name == RS::Hashes::camera_clip_far && type == OSL::TypeFloat)
534-
return rs_get_attribute_constant_float(rs->yon, derivatives, result);
534+
return rs_get_attribute_constant_float(rc->yon, derivatives, result);
535535
if (name == RS::Hashes::camera_shutter
536536
&& type == OSL::TypeDesc(OSL::TypeDesc::FLOAT, 2))
537-
return rs_get_attribute_constant_float2(rs->shutter[0], rs->shutter[1],
537+
return rs_get_attribute_constant_float2(rc->shutter[0], rc->shutter[1],
538538
derivatives, result);
539539
if (name == RS::Hashes::camera_shutter_open && type == OSL::TypeFloat)
540-
return rs_get_attribute_constant_float(rs->shutter[0], derivatives,
540+
return rs_get_attribute_constant_float(rc->shutter[0], derivatives,
541541
result);
542542
if (name == RS::Hashes::camera_shutter_close && type == OSL::TypeFloat)
543-
return rs_get_attribute_constant_float(rs->shutter[1], derivatives,
543+
return rs_get_attribute_constant_float(rc->shutter[1], derivatives,
544544
result);
545545

546546
if (name == RS::Hashes::shading_index && type == OSL::TypeInt)
@@ -652,9 +652,9 @@ rs_errorfmt(OSL::OpaqueExecContextPtr ec, OSL::ustringhash fmt_specification,
652652
int32_t arg_count, const OSL::EncodedType* argTypes,
653653
uint32_t argValuesSize, uint8_t* argValues)
654654
{
655-
auto rs = OSL::get_rs<RenderState>(ec)->context;
655+
auto rc = OSL::get_rs<RenderState>(ec)->context;
656656

657-
OSL::journal::Writer jw { rs->journal_buffer };
657+
OSL::journal::Writer jw { rc->journal_buffer };
658658
jw.record_errorfmt(OSL::get_thread_index(ec), OSL::get_shade_index(ec),
659659
fmt_specification, arg_count, argTypes, argValuesSize,
660660
argValues);
@@ -665,9 +665,9 @@ rs_warningfmt(OSL::OpaqueExecContextPtr ec, OSL::ustringhash fmt_specification,
665665
int32_t arg_count, const OSL::EncodedType* argTypes,
666666
uint32_t argValuesSize, uint8_t* argValues)
667667
{
668-
auto rs = OSL::get_rs<RenderState>(ec)->context;
668+
auto rc = OSL::get_rs<RenderState>(ec)->context;
669669

670-
OSL::journal::Writer jw { rs->journal_buffer };
670+
OSL::journal::Writer jw { rc->journal_buffer };
671671
jw.record_warningfmt(OSL::get_max_warnings_per_thread(ec),
672672
OSL::get_thread_index(ec), OSL::get_shade_index(ec),
673673
fmt_specification, arg_count, argTypes, argValuesSize,
@@ -680,9 +680,9 @@ rs_printfmt(OSL::OpaqueExecContextPtr ec, OSL::ustringhash fmt_specification,
680680
int32_t arg_count, const OSL::EncodedType* argTypes,
681681
uint32_t argValuesSize, uint8_t* argValues)
682682
{
683-
auto rs = OSL::get_rs<RenderState>(ec)->context;
683+
auto rc = OSL::get_rs<RenderState>(ec)->context;
684684

685-
OSL::journal::Writer jw { rs->journal_buffer };
685+
OSL::journal::Writer jw { rc->journal_buffer };
686686
jw.record_printfmt(OSL::get_thread_index(ec), OSL::get_shade_index(ec),
687687
fmt_specification, arg_count, argTypes, argValuesSize,
688688
argValues);
@@ -695,9 +695,9 @@ rs_filefmt(OSL::OpaqueExecContextPtr ec, OSL::ustringhash filename_hash,
695695
const OSL::EncodedType* argTypes, uint32_t argValuesSize,
696696
uint8_t* argValues)
697697
{
698-
auto rs = OSL::get_rs<RenderState>(ec)->context;
698+
auto rc = OSL::get_rs<RenderState>(ec)->context;
699699

700-
OSL::journal::Writer jw { rs->journal_buffer };
700+
OSL::journal::Writer jw { rc->journal_buffer };
701701
jw.record_filefmt(OSL::get_thread_index(ec), OSL::get_shade_index(ec),
702702
filename_hash, fmt_specification, arg_count, argTypes,
703703
argValuesSize, argValues);

src/testshade/simplerend.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,22 +1058,22 @@ SimpleRenderer::add_output(string_view varname_, string_view filename,
10581058

10591059

10601060
void
1061-
SimpleRenderer::export_state(RenderContext& state) const
1061+
SimpleRenderer::export_context(RenderContext& context) const
10621062
{
1063-
state.xres = m_xres;
1064-
state.yres = m_yres;
1065-
state.fov = m_fov;
1066-
state.hither = m_hither;
1067-
state.yon = m_yon;
1068-
1069-
state.world_to_camera = OSL::Matrix44(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
1070-
0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0,
1071-
0.0, 1.0);
1063+
context.xres = m_xres;
1064+
context.yres = m_yres;
1065+
context.fov = m_fov;
1066+
context.hither = m_hither;
1067+
context.yon = m_yon;
1068+
1069+
context.world_to_camera = OSL::Matrix44(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
1070+
0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0,
1071+
0.0, 1.0);
10721072
//perspective is not a member of StringParams (i.e not in strdecls.h)
1073-
state.projection = RS::Hashes::perspective;
1074-
state.pixelaspect = m_pixelaspect;
1075-
std::copy_n(m_screen_window, 4, state.screen_window);
1076-
std::copy_n(m_shutter, 2, state.shutter);
1073+
context.projection = RS::Hashes::perspective;
1074+
context.pixelaspect = m_pixelaspect;
1075+
std::copy_n(m_screen_window, 4, context.screen_window);
1076+
std::copy_n(m_shutter, 2, context.shutter);
10771077
}
10781078

10791079
void
@@ -1082,8 +1082,8 @@ SimpleRenderer::errorfmt(OSL::ShaderGlobals* sg,
10821082
const EncodedType* arg_types, uint32_t arg_values_size,
10831083
uint8_t* argValues)
10841084
{
1085-
RenderContext* rs = reinterpret_cast<RenderState*>(sg->renderstate)->context;
1086-
OSL::journal::Writer jw { rs->journal_buffer };
1085+
RenderContext* rc = reinterpret_cast<RenderState*>(sg->renderstate)->context;
1086+
OSL::journal::Writer jw { rc->journal_buffer };
10871087
jw.record_errorfmt(OSL::get_thread_index(sg), OSL::get_shade_index(sg),
10881088
fmt_specification, arg_count, arg_types, arg_values_size,
10891089
argValues);
@@ -1095,8 +1095,8 @@ SimpleRenderer::warningfmt(OSL::ShaderGlobals* sg,
10951095
int32_t arg_count, const EncodedType* arg_types,
10961096
uint32_t arg_values_size, uint8_t* argValues)
10971097
{
1098-
RenderContext* rs = reinterpret_cast<RenderState*>(sg->renderstate)->context;
1099-
OSL::journal::Writer jw { rs->journal_buffer };
1098+
RenderContext* rc = reinterpret_cast<RenderState*>(sg->renderstate)->context;
1099+
OSL::journal::Writer jw { rc->journal_buffer };
11001100
jw.record_warningfmt(OSL::get_max_warnings_per_thread(sg),
11011101
OSL::get_thread_index(sg), OSL::get_shade_index(sg),
11021102
fmt_specification, arg_count, arg_types,
@@ -1111,8 +1111,8 @@ SimpleRenderer::printfmt(OSL::ShaderGlobals* sg,
11111111
const EncodedType* arg_types, uint32_t arg_values_size,
11121112
uint8_t* argValues)
11131113
{
1114-
RenderContext* rs = reinterpret_cast<RenderState*>(sg->renderstate)->context;
1115-
OSL::journal::Writer jw { rs->journal_buffer };
1114+
RenderContext* rc = reinterpret_cast<RenderState*>(sg->renderstate)->context;
1115+
OSL::journal::Writer jw { rc->journal_buffer };
11161116
jw.record_printfmt(OSL::get_thread_index(sg), OSL::get_shade_index(sg),
11171117
fmt_specification, arg_count, arg_types, arg_values_size,
11181118
argValues);
@@ -1124,8 +1124,8 @@ SimpleRenderer::filefmt(OSL::ShaderGlobals* sg, OSL::ustringhash filename_hash,
11241124
const EncodedType* arg_types, uint32_t arg_values_size,
11251125
uint8_t* argValues)
11261126
{
1127-
RenderContext* rs = reinterpret_cast<RenderState*>(sg->renderstate)->context;
1128-
OSL::journal::Writer jw { rs->journal_buffer };
1127+
RenderContext* rc = reinterpret_cast<RenderState*>(sg->renderstate)->context;
1128+
OSL::journal::Writer jw { rc->journal_buffer };
11291129
jw.record_filefmt(OSL::get_thread_index(sg), OSL::get_shade_index(sg),
11301130
filename_hash, fmt_specification, arg_count, arg_types,
11311131
arg_values_size, argValues);

src/testshade/simplerend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class SimpleRenderer : public RendererServices {
145145
size_t noutputs() const { return m_outputbufs.size(); }
146146

147147
virtual void init_shadingsys(ShadingSystem* ss) { shadingsys = ss; }
148-
virtual void export_state(RenderContext&) const;
148+
virtual void export_context(RenderContext&) const;
149149
virtual void prepare_render() {}
150150
virtual void warmup() {}
151151
virtual void render(int /*xres*/, int /*yres*/) {}

src/testshade/testshade.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ setup_transformations(SimpleRenderer& rend, OSL::Matrix44& Mshad,
946946
}
947947

948948
// A single render context shared by all render threads.
949-
static RenderContext theRenderState;
949+
static RenderContext theRenderContext;
950950

951951

952952
// Set up the ShaderGlobals fields for pixel (x,y).
@@ -959,7 +959,7 @@ setup_shaderglobals(ShaderGlobals& sg, ShadingSystem* shadingsys,
959959

960960
// Any state data needed by SimpleRenderer or its free function equivalent
961961
// will need to be passed here the ShaderGlobals.
962-
renderState.context = &theRenderState;
962+
renderState.context = &theRenderContext;
963963
renderState.closure_pool = nullptr; // Use inbuilt closure pool.
964964
sg.renderstate = &renderState;
965965

@@ -2143,7 +2143,7 @@ test_shade(int argc, const char* argv[])
21432143
rend->prepare_render();
21442144
if (use_rs_bitcode) {
21452145
// SimpleRend to supply the required state for render service free functions
2146-
rend->export_state(theRenderState);
2146+
rend->export_context(theRenderContext);
21472147
}
21482148

21492149
double setuptime = timer.lap();
@@ -2171,7 +2171,7 @@ test_shade(int argc, const char* argv[])
21712171

21722172

21732173
//Send the populated Journal Buffer to the renderer
2174-
theRenderState.journal_buffer = jbuffer.get();
2174+
theRenderContext.journal_buffer = jbuffer.get();
21752175

21762176

21772177
// Allow a settable number of iterations to "render" the whole image,

0 commit comments

Comments
 (0)