Name every vertex input TEXCOORD<location>, as SDL's D3D12 backend does - #35
Merged
Merged
Conversation
No pipeline could be created on Windows. Every SDL_CreateGPUGraphicsPipeline call failed with a bare E_INVALIDARG (0x80070057); the D3D12 debug layer had the real reason: CreateInputLayout: The provided input signature expects to read an element with SemanticName/Index: 'POSITION'/0, but the declaration doesn't provide a matching name. [CREATEINPUTLAYOUT_MISSINGELEMENT] SDL_GPUVertexAttribute has no semantic field -- SPIR-V and MSL bind vertex inputs by location, so there is nothing for it to carry. D3D12 does need one, and its backend invents it: every D3D12_INPUT_ELEMENT_DESC gets SemanticName "TEXCOORD" and SemanticIndex = the attribute's location. A shader declaring POSITION, COLOR0, NORMAL or BLENDINDICES names elements the layout will never provide, and CreateInputLayout refuses it. Windows is the only platform this reaches, because it is the only one that compiles our HLSL as HLSL -- dxc straight to DXIL, semantics intact. Linux and macOS launder them through SPIR-V, where the names are dropped and the locations are all that survive. So the semantics now spell out the location instead of the D3D9 usage. Where an #if drops an attribute from the middle of a layout (object3dx, rigid lods carry no blend weights) the ones after it renumber with it, matching how SDLObject3dxRenderer::pipelineFor numbers the attributes it actually binds. Locations are untouched: compiling all 27 vertex entry points before and after gives identical attribute types and bindings on the SPIR-V/MSL route, so Vulkan and Metal see no change. Verified rendering unchanged on macOS. Also stop four renderers reporting "pipeline ready" from their constructor. They only create shaders there and build pipelines lazily, so the Windows log read as if grass, cloud shadows, environment earth and the post-effects were fine while every other renderer failed -- when in fact they had not yet tried. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.