Repository navigation
Conversation
|
🤖 Draft PR — automatic CI is skipped to save runner minutes.
|
5ce7fe7 to
352460d
Compare
352460d to
5d8471c
Compare
|
Based on Discord feedback, I attempted to revert my changes to the shaders and disable the generator in However, even if I comment out the lines for the new tests from those commits while disabling the generator, I still get test failures. With the generator, there are no failed tests. For reference, here is how I'm disabling the generator: <Target Name="RemoveGeneratorAnalyzer" BeforeTargets="CoreCompile">
<ItemGroup>
<Analyzer Remove="@(Analyzer)" Condition="'%(Analyzer.Filename)' == 'Stride.Shaders.Generators'" />
</ItemGroup>
</Target>In light of this, I think that modifying the shaders is necessary. The only alternative I can think of is to move the generated |
This worked well and has been pushed, so this pull request no longer makes any changes to the test shaders. |
|
The file static approach for the test shaders is good, let's do the namespace stuff later. A few things before merging:
public static readonly ValueParameterKey<Color4> EmissiveValue = ParameterKeys.NewValue<Color4>();and it will silently fail any lookup by name. Also for the engine side, a lot of those hand-written key classes shouldn't exist at all. For example FlareArtifactKeys.Count is only used by FlareArtifactEffect.sdfx ( Related: the processor was also running on generated code, and it removed the
Longer term (not for this PR): I'd like registration to be per assembly, with Register/Unregister done by the host like DataSerializerFactory during reload and undo/redo. We need that for plugin unload anyway. The generator from 1. could then just output that list instead of calling Merge, no change needed in user code. |
This comment was marked as outdated.
This comment was marked as outdated.
|
@xen2 I implemented all your requested changes except for the new generator. I have a few follow-up questions about that:
|
3cfbc4e to
6f5b799
Compare
Ensure named parameter keys match their expected generic types for value, object, and permutation parameters. Add descriptive `InvalidCastException` messages and validate missing keys before fallback creation.
Reject null or empty key names and restore duplicate-name detection in `ParameterKey.Merge`. Report conflicts for different property types or owner types while preserving existing registration behavior for valid keys.
Update `VisitShaderFile` to collect every top-level declaration except `UsingShaderNamespace`, remove them from the file root, and place them in the default namespace. Preserve namespace-using declarations at the file root and consistently handle all collected root types.
Derive key-name prefixes from `declaringTypeName`, removing trailing `Keys` when present. Update shader and effect parameter callers to use the simplified signature, and return generated shader keys class names from `GetCurrentShaderClassKeyOwner`.
Add type identity comparison and null-safe owner resolution. Log duplicate key type and owner conflicts instead of throwing, allowing parameter key initialization to continue.
Move permutation parameter definitions into the corresponding `.sdfx` effects, preserving names, types, defaults, and shader references. Remove the obsolete C# key classes, module initializers, and `using params` statements.
Use the static SHA1.HashData API and Convert.ToHexString to generate the same eight-character hash prefix from absolute paths without disposable hashing objects.
6f5b799 to
118b130
Compare
… generator instead
I rebased my changes, implemented the new generator, and made the Stride codebase use that generator. Since I didn't get any answers to the above questions, I made some decisions during development:
|
PR Details
This pull request replaces
ParameterKeyProcessorin the AssemblyProcessor with additional Roslyn source generation inEffectCodeWriter.Related Issue
Part of #1835
Types of changes
Checklist
Notes
I had to modify a bunch of shader names in theRenderTestsfolder because there were conflicting names in the same namespace. Previously, the partial classes for the source generated Keys classes were just being silently merged.deps/AssemblyProcessor, but I included my compiled files.deps/AssemblyProcessorhas a folder for .NET 8 assemblies. I think that should be deleted, but I did not do it in this pull request.