mirror of
https://github.com/encounter/boo2.git
synced 2026-03-30 11:03:46 -07:00
27 lines
1.1 KiB
C++
27 lines
1.1 KiB
C++
#include "testpipeline.hpp"
|
|
#include "testpipeline.cpp.hshhead"
|
|
|
|
using namespace hsh::pipeline;
|
|
|
|
struct DrawSomething : pipeline<color_attachment<>> {
|
|
DrawSomething(hsh::uniform_buffer<UniformData> u,
|
|
hsh::vertex_buffer<MyFormat> v, hsh::texture2d tex0) {
|
|
position = u->xf * hsh::float4{v->position, 1.f};
|
|
color_out[0] = hsh::float4{1.f, 1.f, 0.f, 1.f};
|
|
}
|
|
};
|
|
|
|
Binding BuildPipeline() {
|
|
auto uni = hsh::create_dynamic_uniform_buffer<UniformData>();
|
|
std::array<MyFormat, 3> VtxData{MyFormat{hsh::float3{-1.f, -1.f, 0.f}, {}},
|
|
MyFormat{hsh::float3{1.f, -1.f, 0.f}, {}},
|
|
MyFormat{hsh::float3{1.f, 1.f, 0.f}, {}}};
|
|
auto vtx = hsh::create_vertex_buffer(VtxData);
|
|
auto tex = hsh::create_texture2d(
|
|
{1024, 1024}, hsh::Format::RGBA8_UNORM, 10,
|
|
[](void* buf, std::size_t size) { std::memset(buf, 0, size); });
|
|
Binding ret{std::move(uni), std::move(vtx), std::move(tex), {}};
|
|
ret.Binding.hsh_DrawSomething(
|
|
DrawSomething(ret.Uniform.get(), ret.VBO.get(), ret.Tex.get()));
|
|
return ret;
|
|
} |