{"record":{"id":"e977770edb85fa67","repo":"stride3d/stride","slug":"samplerstate-parameter-parameter-name-not-implemented","errorCode":null,"errorMessage":"SamplerState parameter '{parameter.Name}' not implemented","messagePattern":"SamplerState parameter '(.+?)' not implemented","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/ShaderElements.MethodOrMember.cs","lineNumber":115,"sourceCode":"                    break;\n                case \"MinLOD\":\n                    minLOD = BitConverter.SingleToInt32Bits((float)((FloatLiteral)parameter.Value).Value);\n                    break;\n                case \"MaxLOD\":\n                    maxLOD = BitConverter.SingleToInt32Bits((float)((FloatLiteral)parameter.Value).Value);\n                    break;\n                case \"BorderColor\":\n                    {\n                        if (parameter.Value is not VectorLiteral { TypeName.Name: \"float4\", Values: { Count: 4 } args })\n                            throw new NotSupportedException($\"BorderColor must be float4(r, g, b, a)\");\n                        borderR = BitConverter.SingleToInt32Bits((float)((NumberLiteral)args[0]).DoubleValue);\n                        borderG = BitConverter.SingleToInt32Bits((float)((NumberLiteral)args[1]).DoubleValue);\n                        borderB = BitConverter.SingleToInt32Bits((float)((NumberLiteral)args[2]).DoubleValue);\n                        borderA = BitConverter.SingleToInt32Bits((float)((NumberLiteral)args[3]).DoubleValue);\n                        break;\n                    }\n                default:\n                    throw new NotImplementedException($\"SamplerState parameter '{parameter.Name}' not implemented\");\n            }\n        }\n        // Only emit immutable sampler state when the declaration has explicit parameters.\n        // Samplers without inline state (e.g. \"stage SamplerState Sampler;\") are dynamic\n        // and set at runtime via Parameters.Set().\n        if (Parameters.Count > 0)\n        {\n            context.Add(new OpDecorate(variableId, Specification.Decoration.SamplerStateSDSL, [\n                filter, addressU, addressV, addressW, mipLODBias, maxAnisotropy, comparisonFunc, minLOD, maxLOD,\n                borderR, borderG, borderB, borderA\n            ]));\n        }\n\n        var variable = builder.Insert(new OpVariableSDSL(registeredType, variableId, Specification.StorageClass.UniformConstant, IsStaged ? Specification.VariableFlagsMask.Stage : Specification.VariableFlagsMask.None, null));\n        context.AddName(variable.ResultId, Name);\n        Symbol!.IdRef = variableId;\n\n        RGroup.DecorateVariableLinkInfo(table, shader, context, Info, Name, Attributes, variable);","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/ShaderElements.MethodOrMember.cs#L97-L133","documentation":"The SDSL-to-SPIR-V compiler supports only a fixed set of inline SamplerState parameters (e.g. MinLOD, MaxLOD, BorderColor). Any other parameter name hits Compile's switch default and throws NotImplementedException, meaning that sampler state option has no SPIR-V translation yet.","triggerScenarios":"Declaring a sampler with an inline parameter that has no case in Compile's switch, e.g. `SamplerState Sampler : AddressU(CLAMP);` or MaxAnisotropy.","commonSituations":"Porting D3D11_SAMPLER_DESC fields (Filter, ComparisonFunc, MaxAnisotropy, addressing modes) into SDSL inline parameters unsupported by the SPIR-V backend.","solutions":["Remove the unsupported inline parameter and configure that state at runtime via Parameters.Set().","Use only the parameter names supported by the compiler (see the switch in ShaderElements.MethodOrMember.cs).","Implement the equivalent behavior in shader code if no parameter equivalent exists."],"exampleFix":"// before\nSamplerState Sampler : MaxAnisotropy(8);\n// after\nSamplerState Sampler; // configure at runtime via Parameters.Set()","handlingStrategy":"validation","validationCode":"var supported = new HashSet<string> { \"MinLOD\", \"MaxLOD\", \"BorderColor\" };\nforeach (var p in sampler.Parameters)\n    if (!supported.Contains(p.Name)) Console.WriteLine($\"Unsupported sampler parameter: {p.Name}\");","typeGuard":null,"tryCatchPattern":"try { sampler.Compile(); }\ncatch (NotImplementedException ex) when (ex.Message.StartsWith(\"SamplerState parameter\"))\n{\n    // move that state to runtime Parameters.Set() and recompile\n}","preventionTips":["Use only inline sampler parameters supported by the SPIR-V backend.","Configure exotic sampler state at runtime via Parameters.Set() rather than inline declarations."],"tags":["shader","sdsl","samplers","not-implemented"],"backgroundTag":"method-not-implemented","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}