Code Improvements and Documentation Enhancements for OSLib #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces several code improvements and documentation enhancements to the OSLib codebase, focusing on better code clarity, maintainability, and performance. Key changes include the addition of inline setter functions for image flags, improved documentation for low-level drawing functions, and the introduction of vertex types for optimized rendering.
Changes
Image Flag Management:
oslImageIsCopySet
,oslImageIsSwizzledSet
, andoslImageSetAutoStrip
. These functions improve code readability and encapsulate flag manipulation, reducing the risk of errors.oslImageIsCopy
,oslImageIsSwizzled
, andoslImageGetAutoStrip
.Texturing Functions:
oslEnableTexturing
andoslDisableTexturing
macros to better manage the state of texturing, ensuring that redundant state changes are avoided.OSL_SLICE_SIZE
and provided guidance on handling image strips when drawing large images.Texture Wrapping:
oslSetTextureWrap
to manage texture wrapping behavior, allowing textures to be repeated or clamped based on user-defined parameters. This change provides a clearer and more controlled way to manage texture behavior when rendering beyond texture bounds.Low-Level Drawing Functions:
OSL_PRECISE_VERTEX
,OSL_FAST_VERTEX
,OSL_FAST_VERTEX_COLOR32
,OSL_LINE_VERTEX
,OSL_LINE_VERTEX_COLOR32
, andOSL_UVFLOAT_VERTEX
). These vertex types offer different trade-offs between precision and performance, improving the efficiency of rendering operations.Internal State Management:
osl_curTexture
,osl_curPalette
,osl_curDrawBuf
, etc.) as internal use only, discouraging external use to prevent misuse and ensure the integrity of internal state management.Miscellaneous:
Impact
These changes improve the robustness, clarity, and performance of the OSLib codebase, making it easier for developers to understand and use the library effectively. The enhanced documentation and code organization will also facilitate future development and maintenance efforts.
Testing