-
Notifications
You must be signed in to change notification settings - Fork 250
Improve the calculation of location sizes for arrays and structs (revives #513) #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 11 commits
152bc37
605f166
52ac5f5
6df36f4
e5fc2a5
31ab929
d3521a5
a76a184
08d712a
c3a29ea
8548d95
47c7974
b39390f
b720131
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// build-pass | ||
// compile-flags: -C llvm-args=--disassemble-globals | ||
// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" | ||
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> "" | ||
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" | ||
// normalize-stderr-test "OpMemberName %12 0 .0.\n" -> "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's up with this rewrite rule? It seems like it's probably hiding a bug that should be fixed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is here because the ordering of the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, that seems like a bug. |
||
|
||
use spirv_std::{ | ||
self as _, | ||
glam::{DVec3, IVec4, Mat3, Vec4}, | ||
}; | ||
|
||
#[spirv(matrix)] | ||
pub struct Mat4x3 { | ||
pub col_0: Vec4, | ||
pub col_1: Vec4, | ||
pub col_2: Vec4, | ||
} | ||
|
||
#[spirv(fragment)] | ||
pub fn main( | ||
one: [f32; 7], | ||
two: [f32; 3], | ||
three: Mat3, | ||
four: DVec3, | ||
five: IVec4, | ||
six: f32, | ||
seven: Mat4x3, | ||
eight: u32, | ||
) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
OpCapability Float64 | ||
OpCapability Int16 | ||
OpCapability Int64 | ||
OpCapability Int8 | ||
OpCapability ShaderClockKHR | ||
OpCapability Shader | ||
OpExtension "SPV_KHR_shader_clock" | ||
OpMemoryModel Logical Simple | ||
OpEntryPoint Fragment %1 "main" %2 %3 %4 %5 %6 %7 %8 %9 | ||
OpExecutionMode %1 OriginUpperLeft | ||
%10 = OpString "$OPSTRING_FILENAME/array_location_calculation.rs" | ||
OpMemberName %11 0 "x_axis" | ||
OpMemberName %11 1 "y_axis" | ||
OpMemberName %11 2 "z_axis" | ||
OpName %11 "spirv_std::glam::core::storage::Columns3<spirv_std::glam::XYZ<f32>>" | ||
OpName %12 "spirv_std::glam::Mat3" | ||
OpName %13 "array_location_calculation::main" | ||
OpName %2 "one" | ||
OpName %3 "two" | ||
OpName %4 "three" | ||
OpName %5 "four" | ||
OpName %6 "five" | ||
OpName %7 "six" | ||
OpName %8 "seven" | ||
OpName %9 "eight" | ||
OpMemberName %11 0 "x_axis" | ||
OpMemberName %11 1 "y_axis" | ||
OpMemberName %11 2 "z_axis" | ||
OpMemberName %11 0 "x_axis" | ||
OpMemberName %11 1 "y_axis" | ||
OpMemberName %11 2 "z_axis" | ||
OpDecorate %14 ArrayStride 4 | ||
OpDecorate %15 ArrayStride 4 | ||
OpMemberDecorate %11 0 Offset 0 | ||
OpMemberDecorate %11 1 Offset 16 | ||
OpMemberDecorate %11 2 Offset 32 | ||
OpMemberDecorate %12 0 Offset 0 | ||
OpDecorate %2 Location 0 | ||
OpDecorate %3 Location 7 | ||
OpDecorate %4 Location 10 | ||
OpDecorate %5 Location 13 | ||
OpDecorate %6 Location 15 | ||
OpDecorate %7 Location 16 | ||
OpDecorate %8 Location 17 | ||
OpDecorate %9 Location 20 | ||
%16 = OpTypeVoid | ||
%17 = OpTypeFloat 32 | ||
%18 = OpTypeInt 32 0 | ||
%19 = OpConstant %18 7 | ||
%14 = OpTypeArray %17 %19 | ||
%20 = OpConstant %18 3 | ||
%15 = OpTypeArray %17 %20 | ||
%21 = OpTypeVector %17 3 | ||
%11 = OpTypeStruct %21 %21 %21 | ||
%12 = OpTypeStruct %11 | ||
%22 = OpTypeFloat 64 | ||
%23 = OpTypeVector %22 3 | ||
%24 = OpTypeInt 32 1 | ||
%25 = OpTypeVector %24 4 | ||
%26 = OpTypeVector %17 4 | ||
%27 = OpTypeMatrix %26 3 | ||
%28 = OpTypeFunction %16 %14 %15 %12 %23 %25 %17 %27 %18 | ||
%29 = OpTypeFunction %16 | ||
%30 = OpTypePointer Input %14 | ||
%2 = OpVariable %30 Input | ||
%31 = OpTypePointer Input %15 | ||
%3 = OpVariable %31 Input | ||
%32 = OpTypePointer Input %12 | ||
%4 = OpVariable %32 Input | ||
%33 = OpTypePointer Input %23 | ||
%5 = OpVariable %33 Input | ||
%34 = OpTypePointer Input %25 | ||
%6 = OpVariable %34 Input | ||
%35 = OpTypePointer Input %17 | ||
%7 = OpVariable %35 Input | ||
%36 = OpTypePointer Input %27 | ||
%8 = OpVariable %36 Input | ||
%37 = OpTypePointer Input %18 | ||
%9 = OpVariable %37 Input |
Uh oh!
There was an error while loading. Please reload this page.