1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// This file is part of the 64k demo project.
// It declares helper functions for post-processing effects.
#pragma once
#include "gpu/gpu.h"
#include "gpu/sequence.h"
#include "util/mini_math.h"
// Standard post-process bind group layout (group 0):
#define PP_BINDING_SAMPLER 0
#define PP_BINDING_TEXTURE 1
#define PP_BINDING_UNIFORMS 2
#define PP_BINDING_EFFECT_PARAMS 3
WGPURenderPipeline create_post_process_pipeline(WGPUDevice device,
WGPUTextureFormat format,
const char* shader_code);
// No effect params, 3 bindings only
WGPURenderPipeline create_post_process_pipeline_simple(WGPUDevice device,
WGPUTextureFormat format,
const char* shader_code);
void pp_update_bind_group(WGPUDevice device, WGPURenderPipeline pipeline,
WGPUBindGroup* bind_group, WGPUTextureView input_view,
GpuBuffer uniforms, GpuBuffer effect_params);
// Upload a mat4 to a GPU buffer, transposing from C++ row-major to WGSL column-major.
void gpu_upload_mat4(WGPUQueue queue, WGPUBuffer buffer, size_t offset,
const mat4& m);
|