AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage

[BUG] Bad output indices from `pointcloud_search()` with batched shading

Đang mở
#2,001 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C++
Star
2.3k
Fork
415
Merge trung bình
3 ngày 1 giờ
Pull request đã merge (30 ngày)
10

Mô tả

**Describe the bug**

When using `pointcloud_search()` with batched shader execution, the output `indices` array is not being filled correctly. It looks a little like OSL thinks the output is a uniform rather than a varying value, but I don't know enough about what is going on under the hood to be sure.

**OSL version and dependencies**

* OSL branch/version: 1.14.5.1
* OS: Rocky 8.8
* C++ compiler: GCC 11.2.1
* LLVM version: 15.0.7
* OIIO version: 3.0.6.1

**To Reproduce**

Steps to reproduce the behavior:

1. `oslc search.osl` (source code in section below).
2. `testshade -g 16 16 -batched -param file cloud.geo search.oso -o Cout batched.png`
3. `testshade -g 16 16 -param file cloud.geo search.oso -o Cout unbatched.png`
4. Compare `batched.png` to `unbatched.png`. The latter has the expected results, and the former does not.

In the above commands, `cloud.geo` is `testsuite/pointcloud-fold/cloud.geo` from the OSL repo.

**Evidence**

search.osl

```
shader search( string file = "", output color Cout = 0 )
{
int indices[1];

// Uncommenting this workaround gives the expected results in batched
// mode. I suspect it works by tricking OSL into realising that `indices`
// is a varying quantity.
// indices[0] = P[0];

if( pointcloud_search( file, P, 1, 1, "index", indices ) )
{
Cout = color( indices[0] / 15.0 );
}
else
{
Cout = color( 1, 0, 0 );
}
}
```

batched.png :

unbatched.png :

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Chạy các lệnh oslc và testshade được liệt kê bằng testsuite/pointcloud-fold/cloud.geo, sau đó so sánh đầu ra theo lô và đầu ra không theo lô. Bắt đầu từ điểm vào pointcloud_search và theo dõi cách mảng chỉ số đầu ra được xử lý trong quá trình thực thi theo lô. Hoàn thành khi batched.png khớp với các kết quả không theo lô mong đợi mà không cần workaround.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp
Lĩnh vực
computer-graphics
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
40/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.