Skip to content

Comments

Support for multiple SPIRV entrypoints#56

Merged
chaoticbob merged 5 commits intoKhronosGroup:masterfrom
sean-purcell:multi-entrypoint
Jul 26, 2018
Merged

Support for multiple SPIRV entrypoints#56
chaoticbob merged 5 commits intoKhronosGroup:masterfrom
sean-purcell:multi-entrypoint

Conversation

@sean-purcell
Copy link
Contributor

This adds support for handling multiple entry points in a single module and walking the static call tree of each to determine which descriptor sets/bindings, interface variables, and push constant blocks are actually used by each. The interface is a little awkward in places as I didn't want to change behaviour of the single-entry point mode. Apologies for the large PR, a lot of it is fluff due to essentially creating an extra copy of everything function in the interface.

The tests for the multiple entrypoints are a bit awkward to set up, as glslc and glslang don't support multiple entrypoints, so I set it up as a glsl file with a patch to apply to the disassembled spirv.

Ignore the first commit here, this PR depends on #55, so it should disappear when thats merged.

@sean-purcell
Copy link
Contributor Author

Rebased on top of the merge of #55, thanks @cdwfs

spirv_reflect.c Outdated

*res = NULL;
if (*res_size > 0) {
*res = (uint32_t*)calloc(*res_size, sizeof(*res));
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be sizeof(**res)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks

sean-purcell added a commit to sean-purcell/gapid that referenced this pull request Jul 18, 2018
SPIRV-Reflect offers tools to analyze the interface exposed by a spirv
module.  It's used here to parse the descriptor sets that a given entry
point of a module uses.  NOTE: Upstream is currently
iburinoc/SPIRV-Reflect, this should be switched to
chaoticbob/SPIRV-Reflect once KhronosGroup/SPIRV-Reflect#56 and
KhronosGroup/SPIRV-Reflect#58 are merged.
spirv_reflect.h Outdated
@return
*/
inline const char* ShaderModule::GetEntryPointName(uint32_t index) const {
return m_module.entry_points[0].name;
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this use index?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, yes.

spirv_reflect.h Outdated
@param entry_point
@param count
@param p_binding_numbers
@param p_set_numbers
Copy link
Contributor

Choose a reason for hiding this comment

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

are these 3 right?

Copy link
Contributor

Choose a reason for hiding this comment

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

same for the functions below: are the parameter names right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, the documentation for the original functions I copied from is also wrong, I'll fix those too.

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.

3 participants