Proposal to support passing target version when cross compiling#18
Proposal to support passing target version when cross compiling#18etinquis wants to merge 1 commit into
Conversation
* adds TargetVersion to CrossCompileInfo so that the caller can control the target compilation version (if 0 is passed, the behavior is as before) * adds targetVersion param to SpirvCompilation.CompileCompute/CompileVertexFragment * adds SpirvCompilation.SetDefaultTargetVersionForCrossCompileTarget(CrossCompileTarget, uint version) to allow caller to set global default to avoid having to pass versions into every Compile call
| return (major * 10000) + (minor * 100) + patch; | ||
| } | ||
|
|
||
| private static uint GetDefaultTargetVersion(CrossCompileTarget target, bool isCompute) |
There was a problem hiding this comment.
Depending on where you think defaults should live, I can replace this with 0-by-default and let the cpp code handle all non-user-specified defaults.
| byte[] vsBytes, | ||
| byte[] fsBytes, | ||
| CrossCompileTarget target, | ||
| uint targetVersion, |
There was a problem hiding this comment.
Could also make this nullable to be clearer with 'unspecified' default.
| /// <param name="minor">MSL minor version</param> | ||
| /// <param name="patch">MSL patch version</param> | ||
| /// <returns></returns> | ||
| public static uint MakeMSLVersion(uint major, uint minor = 0, uint patch = 0) |
There was a problem hiding this comment.
I didn't look to closely at the details of the various version formats, but I'm not really content with having this dangling off the API like this.
Would you rather see something more strongly typed like struct TargetVersion(uint major, uint minor, uint patch) exposed to callers in the public interface, and then uint GetTargetVersion(Target, TargetVersion) internally? Or target-specific version structs MslVersion(major, minor, patch), GlslVersion(major, minor), or what have you?
|
Just wanted to chime in and say that veldrid-spirv translation generates shaders with different versions and causes |
the target compilation version (if 0 is passed, the behavior is as
before)
SpirvCompilation.SetDefaultTargetVersionForCrossCompileTarget(CrossCompileTarget,
uint version) to allow caller to set global default to avoid having to
pass versions into every Compile call
While working on the PBR sample, I found that I ran into compilation errors due to the default MSL version being too low. This change allows me to set the MSL version as seen here.