Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed snprintf formatting to satisfy some compilers. #1640

Merged
merged 1 commit into from
Jan 27, 2023

Conversation

pellerington
Copy link
Contributor

@pellerington pellerington commented Jan 25, 2023

Signed-off-by: Peter Ellerington elleringtonp@gmail.com

Description

When building OSL my compiler (GCC 11.3 on Ubuntu) was complaining about these snprintfs format strings not being a string literal.
Writing them to a "%s" seems to satisfy it and should produce the same result.

Tests

no changes in tests

Checklist:

  • I have read the contribution guidelines.
  • I have previously submitted a Contributor License Agreement.
  • I have updated the documentation, if applicable.
  • I have ensured that the change is tested somewhere in the testsuite (adding new test cases if necessary).
  • My code follows the prevailing code style of this project.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 25, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Collaborator

@lgritz lgritz left a comment

Choose a reason for hiding this comment

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

Oh wow, yes. Thanks for the fix.

Can you please get the CLA squared away, and then I'll merge this.

Signed-off-by: Peter Ellerington <elleringtonp@gmail.com>
@pellerington
Copy link
Contributor Author

Okay, I think I've done everything now.

I've made some other modifications to make integrating my renderer easier. Let me know if your interested!

@lgritz
Copy link
Collaborator

lgritz commented Jan 27, 2023

Sure, what other modifications did you have in mind?

@lgritz lgritz merged commit a8d3ac0 into AcademySoftwareFoundation:main Jan 27, 2023
@pellerington
Copy link
Contributor Author

The main change I added was a optional register closure which lets that closure allocate with a unique function.
Eg. for microfacet instead of "osl_allocate_closure_component(...)" being run a function of the form "osl_microfacet(sg, weight, distribution, normal, roughnes ... )" gets run.

It's slightly more work because the renderer needs to implement a function for each closure and copy the arguments more manually, but there's much more freedom.

It let me do processing/interfacing with my renderer memory directly in that function (rather than storing args then looping back over everything after OSL had run).
It also meant I didn't have to deal with ClosureComponent data and offset calculations/alignment issues on the gpu. I could just define a class (eg. ClosureMicrofacet) and copy the data there.
Also a simpler register closure function because you just have to list the args (not their alignment/size in the struct).

lgritz pushed a commit to lgritz/OpenShadingLanguage that referenced this pull request Feb 20, 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