-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Closed
Copy link
Labels
Description
Given the following sample
// RUN: %clang --driver-mode=dxc %s -T ps_6_8 -E main -O3 -spirv
/* Copyright (c) 2025, Sascha Willems
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
struct VSOutput
{
float4 Position : SV_POSITION;
[[vk::location(0)]] float3 Color : COLOR0;
};
float4 main(VSOutput input) : SV_TARGET
{
return float4(input.Color, 1.0);
}
The generated IR is:
%0 = load <3 x float>, ptr addrspace(7) @COLOR0, align 16
%1 = shufflevector <3 x float> %0, <3 x float> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 poison>
%vecinit78.i = insertelement <4 x float> %1, float 1.000000e+00, i64 3
store <4 x float> %vecinit78.i, ptr addrspace(8) @SV_TARGET0, align 16
Issue is the poison being used in the shufflevector index.
This is lowered as a -1
in the backend, which causes a validation error.
Emitting any other valid index like 0
should be fine since the value is overriden just after.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Closed