Move framebuffer blit mapping to renderer gl
This commit is contained in:
@@ -32,6 +32,7 @@ constexpr std::uint32_t gl_framebuffer_incomplete_read_buffer = 0x8CDCU;
|
||||
constexpr std::uint32_t gl_framebuffer_unsupported = 0x8CDDU;
|
||||
constexpr std::uint32_t gl_framebuffer_undefined = 0x8219U;
|
||||
constexpr std::uint32_t gl_framebuffer_incomplete_multisample = 0x8D56U;
|
||||
constexpr std::uint32_t gl_color_buffer_bit = 0x00004000U;
|
||||
constexpr std::uint32_t gl_texture_cube_map_positive_x = 0x8515U;
|
||||
constexpr std::uint32_t gl_texture_cube_map_negative_x = 0x8516U;
|
||||
constexpr std::uint32_t gl_texture_cube_map_positive_y = 0x8517U;
|
||||
@@ -39,6 +40,7 @@ constexpr std::uint32_t gl_texture_cube_map_negative_y = 0x8518U;
|
||||
constexpr std::uint32_t gl_texture_cube_map_positive_z = 0x8519U;
|
||||
constexpr std::uint32_t gl_texture_cube_map_negative_z = 0x851AU;
|
||||
constexpr std::uint32_t gl_linear = 0x2601U;
|
||||
constexpr std::uint32_t gl_nearest = 0x2600U;
|
||||
constexpr std::uint32_t gl_texture_mag_filter = 0x2800U;
|
||||
constexpr std::uint32_t gl_texture_min_filter = 0x2801U;
|
||||
constexpr std::uint32_t gl_texture_wrap_s = 0x2802U;
|
||||
@@ -145,6 +147,16 @@ const char* framebuffer_status_name(std::uint32_t status) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
std::uint32_t framebuffer_color_buffer_mask() noexcept
|
||||
{
|
||||
return gl_color_buffer_bit;
|
||||
}
|
||||
|
||||
std::uint32_t framebuffer_blit_filter(bool linear) noexcept
|
||||
{
|
||||
return linear ? gl_linear : gl_nearest;
|
||||
}
|
||||
|
||||
std::uint32_t index_type_for_index_size(std::uint32_t index_size_bytes) noexcept
|
||||
{
|
||||
switch (index_size_bytes) {
|
||||
|
||||
@@ -39,6 +39,8 @@ struct OpenGlTextureParameter {
|
||||
[[nodiscard]] std::uint32_t texture_upload_type_for_internal_format(std::uint32_t internal_format) noexcept;
|
||||
[[nodiscard]] OpenGlPixelFormat texture_format_for_channel_count(std::uint32_t channel_count) noexcept;
|
||||
[[nodiscard]] const char* framebuffer_status_name(std::uint32_t status) noexcept;
|
||||
[[nodiscard]] std::uint32_t framebuffer_color_buffer_mask() noexcept;
|
||||
[[nodiscard]] std::uint32_t framebuffer_blit_filter(bool linear) noexcept;
|
||||
[[nodiscard]] std::uint32_t index_type_for_index_size(std::uint32_t index_size_bytes) noexcept;
|
||||
[[nodiscard]] std::uint32_t primitive_mode_for_fill_count(std::uint32_t vertex_or_index_count) noexcept;
|
||||
[[nodiscard]] std::uint32_t primitive_mode_for_stroke_count(std::uint32_t vertex_or_index_count) noexcept;
|
||||
|
||||
18
src/rtt.cpp
18
src/rtt.cpp
@@ -85,7 +85,17 @@ bool RTT::resize(int width, int height)
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, new_rtt.fboID);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, fboID);
|
||||
glBlitFramebuffer(0, 0, w, h, 0, 0, new_rtt.w, new_rtt.h, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
glBlitFramebuffer(
|
||||
0,
|
||||
0,
|
||||
w,
|
||||
h,
|
||||
0,
|
||||
0,
|
||||
new_rtt.w,
|
||||
new_rtt.h,
|
||||
static_cast<GLbitfield>(pp::renderer::gl::framebuffer_color_buffer_mask()),
|
||||
static_cast<GLenum>(pp::renderer::gl::framebuffer_blit_filter(true)));
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, oldDFboID);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, oldRFboID);
|
||||
@@ -147,7 +157,8 @@ void RTT::copy(const RTT & source)
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboID);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, source.fboID);
|
||||
glBlitFramebuffer(0, 0, source.w, source.h, 0, 0, w, h,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
static_cast<GLbitfield>(pp::renderer::gl::framebuffer_color_buffer_mask()),
|
||||
static_cast<GLenum>(pp::renderer::gl::framebuffer_blit_filter(true)));
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, old_draw);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, old_read);
|
||||
@@ -170,7 +181,8 @@ void RTT::copy(const RTT& source, const glm::vec4& rect)
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboID);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, source.fboID);
|
||||
glBlitFramebuffer(r.x, r.y, r.z, r.w, r.x, r.y, r.z, r.w,
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
static_cast<GLbitfield>(pp::renderer::gl::framebuffer_color_buffer_mask()),
|
||||
static_cast<GLenum>(pp::renderer::gl::framebuffer_blit_filter(false)));
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, old_draw);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, old_read);
|
||||
|
||||
Reference in New Issue
Block a user