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

[D2DEnableRuntimeCompilation] is ignored if [assembly: D2DShaderProfile(...)] is used #792

Closed
rickbrew opened this issue May 7, 2024 · 2 comments
Labels
needs author feedback 📝 This issue needs more info from the author

Comments

@rickbrew
Copy link
Collaborator

rickbrew commented May 7, 2024

As per our Discord conversation, it appears that [assembly: D2DShaderProfile(...)] takes precedence over (non-assembly-wide) [D2DEnableRuntimeCompilation].

Either I should be able to use [D2DEnableRuntimeCompilation] on specific shaders in order to disable compile-time compilation ...

... or it should emit a compile-time error/diagnostic

I do want to be able to use the attribute in this way so I can diagnose some build performance issues.

@rickbrew rickbrew added bug 🐛 Something isn't working untriaged 🧰 A new issue that needs initial triage labels May 7, 2024
@Sergio0694
Copy link
Owner

The diagnostic already exists and there is a test for this scenario as well:

[TestMethod]
public async Task ShaderWithPrecompiledBytecode_FromAssembly_WithUnnecessaryD2DEnableRuntimeCompilation_Warns()
{
const string source = """
using ComputeSharp;
using ComputeSharp.D2D1;
[assembly: D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DInputCount(0)]
[{|CMPSD2D0078:D2DEnableRuntimeCompilation|}]
[D2DGeneratedPixelShaderDescriptor]
internal partial struct MyType : ID2D1PixelShader
{
public Float4 Execute()
{
return 0;
}
}
""";
await CSharpAnalyzerWithLanguageVersionTest<D2DEnableRuntimeCompilationOnTypeAnalyzer>.VerifyAnalyzerAsync(source);
}

Checking the code also seems fine. Are you using an older version maybe? Can you try with the latest nightly?

@Sergio0694 Sergio0694 added needs author feedback 📝 This issue needs more info from the author and removed bug 🐛 Something isn't working untriaged 🧰 A new issue that needs initial triage labels May 23, 2024
@rickbrew
Copy link
Collaborator Author

rickbrew commented Jun 5, 2024

Okay it looks like your diagnostic does fire, so I must've been on a nightly build that was before you implemented that

I'd still like the ability to override this on a per-shader basis, but I did figure out my build perf problems and they weren't CS related. So this isn't a high priority item for me at all.

image

@rickbrew rickbrew closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs author feedback 📝 This issue needs more info from the author
Projects
None yet
Development

No branches or pull requests

2 participants