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 parameters to info structs and add debug support #71

Merged
merged 6 commits into from
Dec 19, 2024

Conversation

thatcosmonaut
Copy link
Collaborator

@thatcosmonaut thatcosmonaut commented Dec 18, 2024

For future-proofing the API now takes info structs with a SDL_PropertiesID for extensions.

This PR also adds shader debug info support and source debugging in HLSL -> SPIR-V debug workflows in RenderDoc should work out of the box now.

Resolves #64
Resolves #66
Supersedes #65

@thatcosmonaut thatcosmonaut changed the title Refactor parameters to info structs Refactor parameters to info structs and add debug support Dec 18, 2024
@thatcosmonaut thatcosmonaut requested a review from madebr December 18, 2024 23:41
@@ -45,15 +45,15 @@ typedef enum SDL_ShaderCross_ShaderStage
SDL_SHADERCROSS_SHADERSTAGE_COMPUTE
} SDL_ShaderCross_ShaderStage;

typedef struct SDL_ShaderCross_GraphicsShaderInfo
typedef struct SDL_ShaderCross_GraphicsShaderMetadata
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this type sufficiently future proof?
I mean, we'll never need more metadata of a shader?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Properties in an out struct is kind of awkward no? I guess this would be a problem if we extended SDL's CreateShaderInfo though

include/SDL3_shadercross/SDL_shadercross.h Outdated Show resolved Hide resolved
include/SDL3_shadercross/SDL_shadercross.h Outdated Show resolved Hide resolved
include/SDL3_shadercross/SDL_shadercross.h Outdated Show resolved Hide resolved
bool enableDebug; /**< Allows debug info to be emitted when relevant. Can be useful for graphics debuggers like RenderDoc. */
const char *name; /**< A UTF-8 name to associate with the shader. Optional, can be NULL. */

SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
Copy link
Contributor

Choose a reason for hiding this comment

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

Windows creation has an easy entry point (SDL_CreateWindow) and an "advanced mode" (SDL_CreateWindowFromProperties).
Can shadercross do the same? I'd like to avoid properties and struct member values to clash.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe, but we'd be almost doubling the API surface which is pretty cumbersome.

include/SDL3_shadercross/SDL_shadercross.h Outdated Show resolved Hide resolved
@thatcosmonaut
Copy link
Collaborator Author

I'd like to get this refactor in so I can tackle some other immediate concerns. I think the gist of this is right and we just need to resolve some other unrelated design questions before we tag a release.

Tracking the remaining issues here: #72 and #73

@thatcosmonaut thatcosmonaut merged commit 93876db into libsdl-org:main Dec 19, 2024
5 checks passed
@thatcosmonaut thatcosmonaut deleted the argument_refactor branch December 19, 2024 21:49
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.

Filename in diagnostics when compiling HLSL is wrong CLI: Debug Information in SPIR-V output
2 participants