/
redgpu
/
raygpu
Обзор
Документация
Войти
/
redgpu
/
raygpu
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
v0.1
examples/textures_array.c
23 строки
806 B
manuel
Add texture2d_array support for WebGPU
21 фев 2025, 11:27
21 фев 2025, 11:27
66249cd
Код
Авторство
О чём код?
#include <raygpu.h> const char computeSource[] = R"( @group(0) @binding(0) var output: texture_storage_2d_array<rgba8unorm, write>; //@group(0) @binding(1) var<write> velBuffer: array<vec2<f32>>; @compute @workgroup_size(1, 1, 1) fn compute_main(@builtin(global_invocation_id) id: vec3<u32>) { textureStore(output, id.xy, 0, vec4<f32>(0,0,0,0)); //posBuffer[id.x * 16 + id.y] = posBuffer[id.x * 16 + id.y] + velBuffer[id.x * 16 + id.y]; })"; int main(void){ InitWindow(800, 600, "Texture Array"); DescribedComputePipeline* cpl = LoadComputePipeline(computeSource); Texture2DArray input = LoadTextureArray(100, 100, 100, RGBA8); Texture2DArray output = LoadTextureArray(100, 100, 100, RGBA8); while(!WindowShouldClose()){ BeginDrawing(); EndDrawing(); } }