problem with integer geometry attributes and batched shader execution
维护者通常 1 天内回复
@AlexMWells 已经在做这个了。
开始于 2025年2月8日。
评估
这个 Issue 还没有评估数据。
描述
I'm seeing a problem with batched execution that I've managed to distill to the repro case below with testshade. Basically, if I have an integer geometry attribute, then batched OSL execution seems to disregard what the renderer writes to the destination depending on what the default value is specified in the shader. For eample, suppose I have a shader with the following parameter declaration, int face_idx = 0 [[int lockgeom=0]], the value returned by the renderer doesn't make it to the shader. But in this case it does: face_idx = 2 [[int lockgeom=0]]. FWIW, a value of '1' also fails.
This is based on OSL-v1.14.2.0 which goes dates back to September so it's possible this has been fixed?
Here's my example shader:
shader example(int face_idx = 0 [[int lockgeom = 0]],
output color dst = 0)
{
dst = color(face_idx * 0.25, 0, 0);
}
A patch to add the face_idx user-data to batched testshade:
diff --git a/src/testshade/batched_simplerend.cpp b/src/testshade/batched_simplerend.cpp
index ea2acbdf..6618fba7 100644
--- a/src/testshade/batched_simplerend.cpp
+++ b/src/testshade/batched_simplerend.cpp
@@ -21,6 +21,7 @@ struct UniqueStringCache {
, red("red")
, green("green")
, blue("blue")
+ , face_idx("face_idx")
, lookupTable("lookupTable")
, blahblah("blahblah")
, options("options")
@@ -51,6 +52,7 @@ struct UniqueStringCache {
ustring red;
ustring green;
ustring blue;
+ ustring face_idx;
ustring lookupTable;
ustring blahblah;
ustring options;
@@ -663,7 +665,17 @@ BatchedSimpleRenderer<WidthT>::get_userdata(ustringhash name,
// For testing of interactions with default values
// may not provide data for all lanes
- if (name == ucache().s && Masked<float>::is(val)) {
+ if (name == ucache().face_idx && Masked<int>::is(val)) {
+ printf("found face_idx!\n");
+ Masked<int> out(val);
+ for (int i = 0; i < WidthT; ++i) {
+ if (out[i].is_on()) {
+ out[i] = int(4 * bsg->varying.u[i]);
+ }
+ }
+ return out.mask();
+ }
+ else if (name == ucache().s && Masked<float>::is(val)) {
Masked<float> out(val);
for (int i = 0; i < WidthT; ++i) {
// NOTE: assigning to out[i] will mask by itself
Command line:
env TESTSHADE_BATCH_SIZE=16 testshade --batched --res 256 256 -o dst output.exr example
Here are the images I get:
With face_idx = 0 [[in lockgeom=0]] I get the wrong image:
With face_idx = 2 [[in lockgeom=0]] I get the expected image:
Is anyone able to reproduce this?
Thanks!
- 主要语言
- C++
- 星标
- 2.3k
- 派生
- 415
- 平均合并
- 2 天 10 小时
- 30 天内合并 PR
- 14
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AcademySoftwareFoundation/OpenShadingLanguage 的其他 Issue
-
build / testing / port / CI
难度 2/5 1-3 小时 新手友好度 68/100
AcademySoftwareFoundation/OpenShadingLanguage#2148 · 5 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
AcademySoftwareFoundation/OpenShadingLanguage#2109 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 38/100
AcademySoftwareFoundation/OpenShadingLanguage#2175 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
AcademySoftwareFoundation/OpenShadingLanguage#2146 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
AcademySoftwareFoundation/OpenShadingLanguage#2135 ·
维护者通常 1 天内回复
查看 AcademySoftwareFoundation/OpenShadingLanguage 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
tenstorrent/tt-metal#58057 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
maplibre/maplibre-native#4690 ·
维护者通常 1 天内回复
-
comp-query-execution
难度 2/5 1-3 小时 新手友好度 84/100
ClickHouse/ClickHouse#122569 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100