35 pass(pipeline, framebuffer)
38 m_vertex_array = std::make_unique<gl::vertex_array>();
44 m_shader_program = shader_template->build();
45 if (!m_shader_program->linked())
47 debug::log_error(
"Failed to build resample shader program: {}", m_shader_program->info());
54 for (
const auto&
command: m_command_buffer)
62 m_source_texture = texture;
63 rebuild_command_buffer();
66 void resample_pass::rebuild_command_buffer()
68 m_command_buffer.clear();
70 if (!m_source_texture || !m_shader_program)
76 m_command_buffer.emplace_back
85 static_cast<float>(viewport_dimensions[0]),
86 static_cast<float>(viewport_dimensions[1])
101 if (
auto source_texture_var = m_shader_program->variable(
"source_texture"))
103 m_command_buffer.emplace_back([&, source_texture_var](){source_texture_var->update(*m_source_texture);});
106 m_command_buffer.emplace_back
constexpr const std::array< std::uint32_t, 2 > & dimensions() const noexcept
Returns the dimensions of the framebuffer.
Graphics pipeline interface.
void set_primitive_topology(primitive_topology topology)
Sets the primitive topology to use for drawing.
void bind_shader_program(const gl::shader_program *shader_program)
Sets the vertex input.
void bind_framebuffer(const gl::framebuffer *framebuffer)
Sets the vertex input.
void set_cull_mode(cull_mode mode)
Sets the triangle culling mode.
void set_viewport(std::uint32_t first_viewport, std::span< const viewport > viewports)
Sets one or more viewports.
void draw(std::uint32_t vertex_count, std::uint32_t instance_count, std::uint32_t first_vertex, std::uint32_t first_instance)
Draws primitives.
constexpr const std::array< std::uint32_t, 2 > & get_default_framebuffer_dimensions() const noexcept
Returns the dimensions of the default framebuffer.
void set_depth_test_enabled(bool enabled)
Controls whether depth testing is enabled.
void bind_vertex_array(const vertex_array *array)
Binds a vertex array.
Template used to for generating one or more shader variants from a single source.
gl::pipeline * m_pipeline
const gl::framebuffer * m_framebuffer
resample_pass(gl::pipeline *pipeline, const gl::framebuffer *framebuffer, resource_manager *resource_manager)
Constructs a resample pass.
void set_source_texture(std::shared_ptr< gl::texture_2d > texture)
Sets the resample source texture.
void render(render::context &ctx) override
Resamples a texture.
Manages the loading, caching, and saving of resources.
std::shared_ptr< T > load(const std::filesystem::path &path)
Loads and caches a resource.
Commands which operate on entity::id components.
log_message< log_message_severity::warning, Args... > log_warning
Formats and logs a warning message.
log_message< log_message_severity::error, Args... > log_error
Formats and logs an error message.
@ back
Back-facing triangles are discarded.
@ vertex
Vertex shader stage.
@ triangle_list
Separate triangle primitives.
Viewport position, dimensions, and depth range.