Skip to content

SDSL rewrite#3134

Open
xen2 wants to merge 1211 commits intostride3d:masterfrom
xen2:sdsl-rewrite
Open

SDSL rewrite#3134
xen2 wants to merge 1211 commits intostride3d:masterfrom
xen2:sdsl-rewrite

Conversation

@xen2
Copy link
Copy Markdown
Member

@xen2 xen2 commented Apr 14, 2026

PR Details

WIP (created as non-draft for CI testing)

Related Issue

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

xen2 and others added 30 commits March 13, 2026 23:43
Uniform variables with initializers (e.g. stage float x = 2.0f) are now
compiled as constants instead of wrapper functions. This avoids illegal
stores to cbuffer members in the generated HLSL/SPIR-V, and allows
extracting DefaultValue for EffectReflection.
…is shared. Also added ShaderSource in C# format in meta.hlsl
Generic parameters of resource types (Texture2D, Buffer, StructuredBuffer,
ByteAddressBuffer) need the same PointerType wrapping as member variables,
otherwise code accessing them fails with a cast exception.
Add CompositionStageInheritedNotPromotedToRoot test and surface compilation
errors in RenderingTests instead of swallowing them.
…if requested at same time from multiple threads
Add Frozen property and FreezeableDictionary wrapper for Types/ReverseTypes/Names.
Freeze contexts after caching in ShaderCache.RegisterShader to catch accidental
mutations during development. ThrowIfFrozen guards on mutating methods.
xen2 added 24 commits April 25, 2026 13:10
No C# code launches glslangValidator — the binary was only being copied
into output by the legacy Stride.Shaders.Compiler.csproj and the active
Stride.Shaders.Compilers.csproj. Drop both <StrideNativeLib> entries,
the deps/glslang/ payload, the test-linux-game cleanup line that
deleted it from outputs, and update the leftover comment in
RestoreHelper that named it as an example.
The light-probe Z-prepass binds DSV only and was reusing
StrideForwardShadingEffect.ShadowMapCaster, which works but is
semantically a shadow caster. Add a dedicated ZPrepass mixin child
(same alpha-discard branching as ShadowMapCaster) and switch the
GBuffer render stage in DefaultGraphicsCompositorLevel10 to it.

Also move the ShadowMapCaster*/ZPrepass child declarations before
mixin StrideLighting in StrideForwardShadingEffect: depth-only
sub-effects don't need lighting, so the alpha-discard variants no
longer drag the lighting compose chain through base.PSMain().
ShadowMapCasterAlphaDiscard / ShadowMapCasterAlphaDithered used to
chain through base.PSMain(), which writes streams.ColorTarget — that
declared SV_Target0 in the PS output signature. Since shadow casting
and the light-probe Z prepass bind only a depth target, every draw
on those shaders would emit the D3D11 "PS expects RT View bound to
slot 0, but none is bound" warning.

Refactor both shaders to call this.Shading() directly to populate
streams.shadingColorAlpha through the material surface chain, then
clip without ever touching ColorTarget. The merged-effect Shading()
override (MaterialSurfacePixelStageCompositor) runs the layered
material chain identically to the regular pass, so per-layer
contributions to the alpha are preserved.

InterfaceProcessor previously dropped the Fragment entry point when
nothing wrote SV_Target/SV_Depth, which would silently strip these
shaders' PS entirely (clip never runs, transparent cutout pixels
write depth). Detect "empty PSMain" by inspecting the SPIR-V function
body instead — only the no-op PS case (e.g. ShadowMapCasterNoPixelShader)
is dropped, preserving the depth-only fast path. Any side-effecting
body (clip()/discard, stores, calls) keeps the PS bound.
Mini-dumps don't include the managed heap, so post-mortem analysis of
shader-compiler AVs can't dereference any of the captured pointers.
Switch all three Windows test crash-dump paths to full memory:

- DOTNET_DbgMiniDumpType: 1 (Normal) -> 4 (FullMemory)
- WER LocalDumps DumpType: 1 (Mini) -> 2 (Full)
- Stride FirstChance SEH: add MiniDumpWithFullMemory and
  MiniDumpWithHandleData to the previous flag set (the existing
  MiniDumpWithFullMemoryInfo only captures region descriptors, not
  pages)

Linux test workflow has no dump env vars set, so it's unchanged.
These were written next to the source by the old custom MSBuild tool;
they are now produced by the Roslyn source generator into obj/. The
on-disk siblings are dead weight (excluded from build but still in
source trees and version control).

The 4.3 -> 4.4 step in StridePackageUpgrader:
- Renames .sdsl.cs / .sdfx.cs to .bak in the project tree (skipping
  obj/ and bin/) so users can recover without git.
- Strips leftover csproj item nodes referencing those paths.
- Strips obsolete <Generator> / <LastGenOutput> metadata from .sdsl
  and .sdfx items.

Drop the now-unnecessary <Compile Remove> rules from
Stride.Shaders.Compilers.targets. The <None Remove> rules for .sdsl
and .sdfx source files stay -- they keep source files out of the
default <None> glob.
CompileSincos was passing the sincos function's FunctionType to the
GLSL Sin/Cos helpers, which take their result type from
functionType.ReturnType. sincos returns void, so the emitted SPIR-V
was OpExtInst %void Sin %x -- rejected by spirv-val with
"GLSL.std.450 Sin: expected Result Type to be a 16 or 32-bit scalar
or vector float type".

Synthesize a function type whose ReturnType is x's float type and use
that for the Sin/Cos extinsts.
…nctionType

The static intrinsic helpers (CompileFloatUnaryCall,
CompileGLSLFloatUnaryCall, CompileGLSLFloatBinaryCall,
CompileBitcastCall, MultiplyConstant, CompileBoolToScalarBoolCall)
took FunctionType only to read functionType.ReturnType. That coupled
the result-type decision to the intrinsic's declared return type,
which is wrong for void-returning intrinsics like sincos and forced a
"functionType with { ReturnType = ... }" workaround at the call site.

Take SymbolType resultType directly so the result-type intent is
local to each call site. CompileSincos can now pass the float type
without synthesizing a function type.

CompileInterlockedCall, CompileMemoryBarrierCall and
CompileControlBarrierCall never used FunctionType at all -- drop the
parameter.
# Conflicts:
#	.github/workflows/test-linux-game.yml
#	.github/workflows/test-linux-simple.yml
#	.github/workflows/test-windows-game.yml
#	.github/workflows/test-windows-simple.yml
graphics: revert SetMuteDebugOutput, also gates the callback path
# Conflicts:
#	sources/Directory.Packages.props
xen2 added 3 commits May 5, 2026 12:26
- error.log: open with FileShare.ReadWrite|Delete so the orchestrator can copy it while still held
- ScreenshotRunner: WaitForExit after Kill so the OS finishes releasing handles before we copy
- ci: stop continue-on-error for D3D12/Vulkan now that they should be reliable
… same view

ForwardLightingRenderFeature.Prepare threw when two effects in the same RenderView
resolved to different PerView Lighting logical-group layouts (e.g. different light
permutation counts). Mirror the per-hash variant pattern from MaterialRenderFeature:
keep one ParameterCollectionLayout + ParameterCollection per layout hash inside
RenderViewLightData, apply view parameters once per variant per frame, bind each
layout's resource group from its matching variant.
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.

2 participants