metaforce/aurora/lib/gfx/movie_player/shader.hpp

41 lines
1.1 KiB
C++
Raw Normal View History

2022-03-05 03:36:54 +00:00
#pragma once
2022-02-18 00:38:31 +00:00
#include "../common.hpp"
namespace aurora::gfx::movie_player {
struct DrawData {
PipelineRef pipeline;
Range vertRange;
Range uniformRange;
2022-02-19 05:33:56 +00:00
BindGroupRef textureBindGroup;
2022-02-18 00:38:31 +00:00
};
struct PipelineConfig {
u32 pad = 0; // empty
2022-02-18 00:38:31 +00:00
};
static_assert(std::has_unique_object_representations_v<PipelineConfig>);
2022-02-19 05:33:56 +00:00
static const std::array INITIAL_PIPELINES{
2022-02-18 00:38:31 +00:00
PipelineConfig{},
};
struct State {
wgpu::ShaderModule shader;
wgpu::BindGroupLayout uniformLayout;
wgpu::BindGroup uniformBindGroup;
wgpu::BindGroupLayout textureLayout;
wgpu::Sampler sampler;
wgpu::PipelineLayout pipelineLayout;
};
2022-02-19 05:33:56 +00:00
2022-02-19 08:28:44 +00:00
struct alignas(4) Vert {
2022-02-19 05:33:56 +00:00
Vec3<float> pos;
Vec2<float> uv;
};
State construct_state();
2022-05-03 05:32:06 +00:00
wgpu::RenderPipeline create_pipeline(const State& state, [[maybe_unused]] const PipelineConfig& config);
2022-02-19 05:33:56 +00:00
DrawData make_draw_data(const State& state, const TextureHandle& tex_y, const TextureHandle& tex_u,
const TextureHandle& tex_v, float h_pad, float v_pad);
2022-02-19 05:33:56 +00:00
void render(const State& state, const DrawData& data, const wgpu::RenderPassEncoder& pass);
2022-02-18 00:38:31 +00:00
} // namespace aurora::gfx::movie_player