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

Generate the SPIR-V shaders automatically at build time #2200

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ahesham-arm
Copy link
Contributor

Add custom commands and targets to automatically assemble and validate the SPIR-V shaders used by the test.

Automatic assembly depends on finding python3, spirv-as and spirv-val. SPIRV_TOOLS_DIR can be defined by the user during configuration to provide an override path. Default behaviour assumes that the binaries exist in PATH.

`FindPython3` and `FindPython2` were added in version 3.12. Used by
the spirv_new suite.

Signed-off-by: Ahmed Hesham <[email protected]>
Move the SPIR-V assembly helper Python script to the `spirv_asm`
subdirectory.

Add custom commands and targets to automatically assemble and validate
the SPIR-V shaders used by the test.

Automatic assembly depends on finding `python3`, `spirv-as` and
`spirv-val`. `SPIRV_TOOLS_DIR` can be defined by the user during
configuration to provide an override path. Default behaviour assumes
that the binaries exist in PATH.

Signed-off-by: Ahmed Hesham <[email protected]>
else()
message(STATUS "Skipping automatic build of SPIR-V files for spirv_new")
# Empty custom target
add_custom_target(spirv_new_shaders)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
add_custom_target(spirv_new_shaders)
add_custom_target(spirv_new_binaries)

Copy link
Member

Choose a reason for hiding this comment

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

For the spirv_new tests, "shaders" isn't really the correct term as none of them declare the Shader Capability. I would suggest to refer to them as "SPIR-V binaries", which aligns with the --spirv-binaries-path option name.

return()
endif()

set(shader_sources
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
set(shader_sources
set(spirv_sources

vector_times_scalar_half.spvasm32
vector_times_scalar_half.spvasm64)

set(assembled_shaders "")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
set(assembled_shaders "")
set(assembled_spirv_binaries "")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants