#pragma pack_matrix(row_major) cbuffer CBPerObj : register(b2) { row_major float4x4 gWorld; row_major float4x4 gWorldInvTranspose; // 深度阶段不用,但保持 CPU 布局契约一致 }; cbuffer CBShadow : register(b3) { row_major float4x4 gLightViewProjection; float4 gShadowParams; }; struct VSInput { float3 positionOS : POSITION; }; float4 VSMain(VSInput input) : SV_POSITION { const float4 positionWS = mul(float4(input.positionOS, 1.0f), gWorld); return mul(positionWS, gLightViewProjection); }