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

Refactor IRenderStateNotationParser #74

Closed
TheMostDiligent opened this issue Dec 16, 2021 · 1 comment
Closed

Refactor IRenderStateNotationParser #74

TheMostDiligent opened this issue Dec 16, 2021 · 1 comment
Assignees

Comments

@TheMostDiligent
Copy link
Contributor

TheMostDiligent commented Dec 16, 2021

In current implementation render state notation parser extracts state descriptions only, which requires extra effort from the application. It also introduces a lot of additional structs that largely duplicate core structs with only difference that instead of object pointers they use object names (e.g. pVS vs pVSName).
To make the render state notion API more convenient to use it is proposed to change the API as follows:

  • Add pDevice member to RenderStateNotationParserCreateInfo
    • This could be a serialization device or any actual rendering device
  • Add DeviceBits member that will only be used for archiver
  • Replace all current methods Get*ByName and Get*ByIndex with Create and Create*ByIndex
  • To make object creation more flexible, add callbacks to override the state:
struct ParsePipelineStateAttribs
{
    const char* Name = nullptr;
    Uint32 Index   = ~0u;

    void (*ModifyPipelineStateCreateInfo)(PipelineStateCreateInfo REF PipelineCI, void* pUserData) = nullptr;
};

VIRTUAL void METHOD(ParsePipelineState)(THIS_
                                        const ParsePipelineStateAttribs REF Attribs,
                                        IPipelineState* ppPSO) CONST PURE;

Similar for other object types.

This should make the parser API much more concise and convenient to use - API objects can be created directly, while required states can be easily overriden

@TheMostDiligent
Copy link
Contributor Author

In GLTF viewer, these two functions are copy-pastes of one another.
The entire function should be just one call to pParser->CreatePipelineState()

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

No branches or pull requests

2 participants