chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer, web workflow engine and protocol, tooling, docs and task records. Large generated evidence, user-testing archives, build snapshots and imported test assets remain untracked. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""Web Blender: native GPU compute with a read/write storage buffer.
|
||||
|
||||
Run from the Web Text Editor on a WebGPU-capable, isolated browser page.
|
||||
The kernel executes on the GPU. This template is a usage example, not an
|
||||
acceptance test and does not modify the current scene.
|
||||
"""
|
||||
|
||||
import array
|
||||
import gpu
|
||||
|
||||
# Group 0 binding indices match the order of `buffers`.
|
||||
source = """
|
||||
#version 450
|
||||
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
|
||||
layout(set = 0, binding = 0, std430) buffer Values {
|
||||
float data[];
|
||||
};
|
||||
void main() {
|
||||
uint index = gl_GlobalInvocationID.x;
|
||||
if (index < uint(data.length())) {
|
||||
data[index] = 2.0 * data[index] + 1.0;
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
values = array.array("f", [0.0, 1.0, 2.0, 3.0])
|
||||
outputs = gpu.compute.dispatch_glsl(
|
||||
source,
|
||||
buffers=[values],
|
||||
workgroups=(1, 1, 1),
|
||||
binding_types=["storage"],
|
||||
timeout_ms=30000,
|
||||
)
|
||||
result = array.array("f")
|
||||
result.frombytes(outputs[0])
|
||||
print("GPU storage-buffer output:", result.tolist())
|
||||
Reference in New Issue
Block a user