Skip to content

Major Class Refactor

Choose a tag to compare

@stephen-hqxu stephen-hqxu released this 15 Nov 16:23
· 34 commits to master since this release
a9d42f5

Release 0.15.6

Class refactor (#52)

Based on the suggestion in the issue, the following class has been rewritten:

  • STPPermutationGenerator
  • STPErosionBrushGenerator, merged with STPHeightfieldGenerator.
  • Refactor STPBindlessTexture to use the bindless texture handle utility (in STPSmartDeviceObject).
  • Merge STPBindlessBuffer with STPBuffer and remove the wrapper because not making the buffer address non-resident will not cause any damage as long as the buffer itself is deleted properly.
  • STPShaderMangar
  • STPProgramManager and STPPipelineManager are now stateless.

Robust memory management

STPSmartDeviceObject

  • Add managed GL texture and bindless texture memory management.
  • Suffix keyword Resource to makeGLBuffer and makeGLImage function to disambiguate.
  • Remove default parameters when creating managed stream and event.
  • GL texture memory in STPWorldPipeline and STPTextureFactory are now managed by smart pointer.

STPTextureFactory

  • Creates bindless texture handle for every texture object.
    • Because texture sampler state cannot be changed once bindless handle is created, sampler states are not changed via a function passed during construction of STPTextureFactory.
  • STPHeightfieldTerrain now no longer needs to create bindless texture separately.

General fixes and improvement

  • Simplify initial permutation table generation in STPPermutationGenerator.
  • Now you can use left shift key to move twice as fast in the demo program.
  • STPHeightfieldTerrain now generates random noise texture during constructor call.
  • Make some functions in STPSingleHistogramFilter and STPLightSpectrum noexcept.
  • Fix some spelling errors in documentation.

SuperRealism+

  • Make all GL object wrappers noexcept because C API never throws exception, instead we use debug callback to capture any error.
  • Reduce dynamic memory allocation by replacing std::vector with std::initialiser_list in the following function:
    • drawBuffers() function in STPFrameBuffer.
  • setData() function in STPLightSpectrum now takes raw data parameters rather than using template, it is too much work to deduce pixel types information from input type.
  • Add a validate function in STPFrameBuffer to help decoding the framebuffer status flag into an exception.
  • Improve STPLogHandler by using function to set the active log handler rather than using global variable.
  • Add program active state manager to prevent state overrides to program pipeline.
  • Refactor STPDebugCallback, now user is responsible for handling the debug log.
    • Now the demo program will exit if an error GL message is encountered.