Shader source from expressions: MathS.Shaders.Hlsl and Glsl
Maintainer thường phản hồi trong vòng 1 ngày
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
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp
- Lĩnh vực
- computer-graphics
Hướng nghiên cứu
The payload names an existing implementation on feat/shader-source: start by reading Functions/Compilation/IntoSource/* and Convenience/MathS.Shaders.cs, then run Tests/UnitTests/Convenience/ShadersTest.cs. Done means the HLSL and GLSL printers meet the stated contract, including the documented unsupported cases and numerical comparisons; note that implementation work is already underway.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What it is. Print expressions as straight-line HLSL or GLSL: one assignment per output, each repeated subexpression computed once into a local, sincos for a sin/cos pair in HLSL.
Entity r = "sqrt(x^2 + y^2)";
MathS.Shaders.Hlsl(new Dictionary<string, Entity> { ["g.x"] = r.Differentiate("x"), ["g.y"] = r.Differentiate("y") }.ToList(),
new Dictionary<Entity.Variable, string> { ["x"] = "p.x", ["y"] = "p.y" }).Code;
// float am0 = (0.5 * rsqrt(((p.x * p.x) + (p.y * p.y))));
// g.x = (am0 * (2.0 * p.x));
// g.y = (am0 * (2.0 * p.y));
Why. Exact gradients and Hessians of signed distance fields, and closed forms of physical laws, derived on the CPU and run on the GPU. Measured in practice: an exact SDF normal replaced a 4-sample finite difference at 1509 → 466 instructions, and a second one ran 1.23× faster while being exact where the finite difference was 30° off at creases. #552 (Unity) is the same audience.
Contract.
- Computes the real-valued reading that
Compile<double, …>computes. The tests hold it to that: the same printer writes C# against helpers named as HLSL's intrinsics, Roslyn compiles that text, and it is compared withCompile<double, double, double>at 200 points per case (28 cases). - One difference to agree on: if #2288 lands,
Compile<double>answers NaN for a division by zero, wherex / 0.0on a GPU is ±inf. The printer writes/as is; guarding every division would cost a branch per quotient. The proposal is to document the difference rather than pay for it. - Declines, naming the node, what has no faithful form: complex constants, non-identifier names,
Providedf(a shader cannot say "no value here";Differentiateattaches one to tanh's exponential form, so the caller unwraps it where the condition cannot fail), piecewise without a final always-true case,Roundf(tie rules differ), factorial, sets. - Adds no referenced assembly:
KernelDependenciesTestcaught a first draft that usedRegex. - Integer powers multiplied out to the 4th; higher as
pow(abs(x), n)with the sign restored for oddn, becausepowof a negative base is undefined in both languages. modprinted floored, asModfis (fmodtruncates).- Nothing is simplified.
Packaging. No clause fires (pure managed, string output) → kernel, beside IntoLinq. Arguably (C) "consumes rather than composes"; the SymPy exporter is the precedent for an output format in the kernel.
Implementation, for judging the design against working code. Branch feat/shader-source, one commit on master 87a0eff: Functions/Compilation/IntoSource/*, Convenience/MathS.Shaders.cs, Tests/UnitTests/Convenience/ShadersTest.cs, +17 lines of PublicApi.txt. UnitTests 18332 passed / 13 skipped, FSharpWrapperUnitTests 134 passed. The pull request will follow Accepted.
Worked use, together with dimensional analysis (#2292). A water wave from ω² = g k tanh(k h): the emitted HLSL matches the library to 4e-16 in double, and to 3e-5 of the amplitude in fp32 out to k h = 300.
Milestone: 2.7.0 (additive).
- Ngôn ngữ chính
- C#
- Star
- 831
- Fork
- 79
- Merge trung bình
- 1 giờ 11 phút
- Pull request đã merge (30 ngày)
- 523
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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 ASC-Community/AngouriMath
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ASC-Community/AngouriMath#2220 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
ASC-Community/AngouriMath#2298 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
The kernel under WebAssembly: 1.26 MB Brotli over the bare runtime, and 0.2 s to the first SimplifyĐang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 48/100
ASC-Community/AngouriMath#2296 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
ASC-Community/AngouriMath#2292 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A Taylor expansion differentiates without simplifying, so sin(x)/x to 11 terms runs out of memoryCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
ASC-Community/AngouriMath#2291 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ASC-Community/AngouriMath
Issue tương tự
-
[Format]: .dartĐang mởformats
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
KnifeLemon/Filee#980 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug effort:S P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nightscout/nocturne#3219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày