[Migrated] MCP: Bindless support
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- rust
- Lĩnh vực
- compilers, computer-graphics
Hướng nghiên cứu
Bắt đầu bằng cách so sánh ví dụ HLSL/DXC SPIR-V với nỗ lực Uniform<&[u32]> hiện tại trong issue. Theo dõi cách các mảng runtime, quyền truy cập có thể thay đổi và việc lập chỉ mục tài nguyên được biểu diễn, sau đó xác định hỗ trợ cho bindless arrays và các kiểu wrapper toàn cục đối với những loại tài nguyên đã nêu. Công việc được xem là hoàn tất khi ví dụ có thể được biên dịch thành cấu trúc runtime-array và lập chỉ mục descriptor như mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/389
Old labels: mcp: accepted,a: ark
Originally creatd by Jasper-Bekkers on 2021-01-21T10:12:41Z
Let's start off with the simplest hlsl shader I can more or less come up with to do bindless support, which I would like to port to rust-gpu.
Notice that instead of ByteArrayBuffer here, for the full feature one should be able to have (RW)Texture2D and other types as well.
ByteAddressBuffer g_byteAddressBuffer[] : register(t0, space3);
RWByteAddressBuffer g_rwByteAddressBuffer[] : register(u0, space4);
[numthreads(64, 1, 1)]
void main(int threadId: SV_DispatchThreadID)
{
g_rwByteAddressBuffer[0].Store(threadId, g_byteAddressBuffer[0].Load(threadId));
}
Emitted SPIR-V from DXC:
; SPIR-V
; Version: 1.0
; Generator: Google spiregg; 0
; Bound: 30
; Schema: 0
OpCapability Shader
OpCapability RuntimeDescriptorArray
OpExtension "SPV_EXT_descriptor_indexing"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID
OpExecutionMode %main LocalSize 64 1 1
OpSource HLSL 660
OpName %type_ByteAddressBuffer "type.ByteAddressBuffer"
OpName %g_byteAddressBuffer "g_byteAddressBuffer"
OpName %type_RWByteAddressBuffer "type.RWByteAddressBuffer"
OpName %g_rwByteAddressBuffer "g_rwByteAddressBuffer"
OpName %main "main"
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %g_byteAddressBuffer DescriptorSet 3
OpDecorate %g_byteAddressBuffer Binding 0
OpDecorate %g_rwByteAddressBuffer DescriptorSet 4
OpDecorate %g_rwByteAddressBuffer Binding 0
OpDecorate %_runtimearr_uint ArrayStride 4
OpMemberDecorate %type_ByteAddressBuffer 0 Offset 0
OpMemberDecorate %type_ByteAddressBuffer 0 NonWritable
OpDecorate %type_ByteAddressBuffer BufferBlock
OpMemberDecorate %type_RWByteAddressBuffer 0 Offset 0
OpDecorate %type_RWByteAddressBuffer BufferBlock
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%uint_0 = OpConstant %uint 0
%_runtimearr_uint = OpTypeRuntimeArray %uint
%type_ByteAddressBuffer = OpTypeStruct %_runtimearr_uint
%_runtimearr_type_ByteAddressBuffer = OpTypeRuntimeArray %type_ByteAddressBuffer
%_ptr_Uniform__runtimearr_type_ByteAddressBuffer = OpTypePointer Uniform %_runtimearr_type_ByteAddressBuffer
%type_RWByteAddressBuffer = OpTypeStruct %_runtimearr_uint
%_runtimearr_type_RWByteAddressBuffer = OpTypeRuntimeArray %type_RWByteAddressBuffer
%_ptr_Uniform__runtimearr_type_RWByteAddressBuffer = OpTypePointer Uniform %_runtimearr_type_RWByteAddressBuffer
%v3int = OpTypeVector %int 3
%_ptr_Input_v3int = OpTypePointer Input %v3int
%void = OpTypeVoid
%20 = OpTypeFunction %void
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%g_byteAddressBuffer = OpVariable %_ptr_Uniform__runtimearr_type_ByteAddressBuffer Uniform
%g_rwByteAddressBuffer = OpVariable %_ptr_Uniform__runtimearr_type_RWByteAddressBuffer Uniform
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3int Input
%main = OpFunction %void None %20
%22 = OpLabel
%23 = OpLoad %v3int %gl_GlobalInvocationID
%24 = OpCompositeExtract %int %23 0
%25 = OpBitcast %uint %24
%26 = OpShiftRightLogical %uint %25 %uint_2
%27 = OpAccessChain %_ptr_Uniform_uint %g_byteAddressBuffer %int_0 %uint_0 %26
%28 = OpLoad %uint %27
%29 = OpAccessChain %_ptr_Uniform_uint %g_rwByteAddressBuffer %int_0 %uint_0 %26
OpStore %29 %28
OpReturn
OpFunctionEnd
First attempt:
#[allow(unused_attributes)]
#[spirv(gl_compute)]
pub fn main_cs(
#[spirv(descriptor_set = 0, binding = 0)] img: Uniform<&[u32]>,
) {
let img = img.load();
let stuff = &img[0];
}
This seems to emit a OpRuntimeArray but then proceed to do some things wrong. I had even more trouble making the slice mutable (for storing data) since that leads to a bunch of compiler errors down the line around .load not being available etc.
Ideally we would also like to declare the bindless arrays as globals, so it's nicer to create our own wrapper types around Image2d and other (so they can do the indirection through the bindless array).
- Ngôn ngữ chính
- Rust
- Star
- 3.4k
- Fork
- 126
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Rust-GPU/rust-gpu
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
enhancement
Rust-GPU/rust-gpu#643 · 2 bình luận · 1 reaction · 1 người được giao ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
-
async functions cause ICE Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Tất cả issue của Rust-GPU/rust-gpu
Issue tương tự
-
risk:low runtime status:in-progress type:test
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
bevyengine/bevy#25861 ·