Skip to content

Conversation

@danieldresser-ie
Copy link
Contributor

Less fully considered than the corresponding Gaffer PR, but putting it up so you can see this half of it while looking at the Gaffer side.

Copy link
Member

@johnhaddon johnhaddon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the only comment I made regarding correctness was the query about duplicating connections, but I made a bunch of other comments related to making this more readable, since I have to admit to struggling with it.

What else is missing before we can consider merging? Tests and USD support?

@danieldresser-ie
Copy link
Contributor Author

I was humming and hawing about some of this reorganization to try and better fit what you're looking for on Friday, but I realized it's probably more useful if I at least upload it so you have the option of taking a look if you want to.

@danieldresser-ie
Copy link
Contributor Author

I've squashed everything up until when you last glanced at this code, which hopefully makes it easier to review the new stuff, which does involve some rearrangement.

As far as I know, the only outstanding thing is that I haven't tested Appleseed, since we don't have an Appleseed install handy here.

@danieldresser-ie danieldresser-ie marked this pull request as ready for review March 23, 2023 04:26
@danieldresser-ie
Copy link
Contributor Author

The test failure is probably just due to the Appleseed test not being updated for the last commit where I set the unused extra values for OSL to -1, because it is testing the unused values. Should be an easy fix.

Also, I forgot to rename concatStrings to concat, but maybe you can figure out what to call intFromStringView and I can rename that at the same time.

@danieldresser-ie danieldresser-ie force-pushed the rampInputs branch 2 times, most recently from fe97c2d to c90ec86 Compare March 23, 2023 22:46
@danieldresser-ie
Copy link
Contributor Author

OK, I've now updated the string helper names.

I also resolved the Appleseed test, though it did reveal one difference in behaviour: previously, when the renderer backends were calling expandSplineParameters themselves, they could do that on all shaders, not just OSL shaders. But when the backend just calls convertToOSLConventions, it only processes OSL shaders. I think this is reasonable - there are no current examples of where a non-OSL shader would have a spline parameter ... but it's something to think about ( along with it being a good idea for someone with Appleseed handy to briefly test it interactively ).

@johnhaddon johnhaddon changed the base branch from main to RB-10.4 March 27, 2023 14:00
@johnhaddon
Copy link
Member

Note : I've changed the base of this PR to RB-10.4 so I don't later get into another mess caused by incorrectly merging to main.

Copy link
Member

@johnhaddon johnhaddon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Daniel. I've added a few comments inline - mostly nitpicks but I think perhaps one instance of undefined behaviour? And I'm afraid I didn't find the culprit in my review, but in my testing in Gaffer I'm also finding that Constant interpolation mode is broken now, with or without input connections. Can provide an example script if you need, but it should be pretty simple to repro...

const IECore::CompoundDataMap &targetParameters = targetShader->parameters();

int targetSplineKnotOffset = -1;
auto findTargetParameter = targetParameters.find( splineName );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This naming occurs in a few places and tripped me up each time - find is a verb, so findTargetParameter sounds like a function rather than a variable. Is there anything wrong with targetParameter or targetParameterIt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to targetParameterIt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a whole load more of these - findValues, findSplineff etc. I'm going to merge anyway, but might be worth bearing in mind...


void ShaderNetworkAlgo::convertToOSLConventions( ShaderNetwork *network, int oslVersion )
{
std::map< IECore::InternedString, std::pair< IECore::InternedString, size_t > > currentSplineArrayAdapters;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't really thinking about performance, but since you brought it up, I would have assumed two things : that constructing an empty map doesn't allocate, and that adding members after clear() doesn't reuse previous allocations. The former appears to be true for GCC/Clang but perhaps not MSVC, but I think the latter holds for all of them?

@danieldresser-ie
Copy link
Contributor Author

Addressed comments in place. Replied to all of them, except the currentSplineArrayAdapters one which github won't let me reply to, but I did just move the constructor inside the loop for simplicity.

Sorry for the confusion on the issue with constant splines ... it turns out I had gotten used to Gaffer where I always do a full build while testing, and hadn't realized that the last Cortex build I did to test the final duplication commit was just a scons testScene, and it didn't actually install. So turns out I could reproduce the issue fine ... I think it technically is sort of an OSL bug, but the easy work around was just to revert the last commit, and add a comment about why we don't need to duplicate connections for Y.

@johnhaddon johnhaddon merged commit 3e85a27 into ImageEngine:RB-10.4 Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants