mirror of
https://github.com/TomHarte/CLK.git
synced 2026-03-13 19:16:40 +00:00
Propagate aspect ratio information into a LineOutputShader.
This commit is contained in:
@@ -241,7 +241,7 @@ void ScanTarget::setup_pipeline() {
|
||||
is_svideo(modals.display_type) ? CompositionTextureUnit : SeparationTextureUnit
|
||||
);
|
||||
|
||||
line_output_shader_ = OpenGL::line_output_shader(
|
||||
line_output_shader_ = LineOutputShader(
|
||||
api_,
|
||||
buffer_width, LineBufferHeight,
|
||||
sample_multiplier,
|
||||
@@ -427,8 +427,8 @@ void ScanTarget::update(const int output_width, const int output_height) {
|
||||
BufferingScanTarget::modals(),
|
||||
float(output_buffer_width) / float(output_buffer_height)
|
||||
);
|
||||
(void)framing;
|
||||
// TODO: apply framing to the line_output_shader_ and the scan_output_shader_.
|
||||
line_output_shader_.set_aspect_ratio_transformation(framing);
|
||||
// TODO: apply framing to scan_output_shader_, once it exists.
|
||||
}
|
||||
|
||||
// Do S-Video or composite line decoding.
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "Shaders/CopyShader.hpp"
|
||||
#include "Shaders/DirtyZone.hpp"
|
||||
#include "Shaders/LineOutputShader.hpp"
|
||||
#include "Shaders/KernelShaders.hpp"
|
||||
#include "Shaders/Rectangle.hpp"
|
||||
|
||||
@@ -113,7 +114,7 @@ private:
|
||||
Shader composition_shader_;
|
||||
Shader separation_shader_;
|
||||
Shader demodulation_shader_;
|
||||
Shader line_output_shader_;
|
||||
LineOutputShader line_output_shader_;
|
||||
CopyShader copy_shader_;
|
||||
FillShader fill_shader_;
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ void main(void) {
|
||||
|
||||
using namespace Outputs::Display;
|
||||
|
||||
OpenGL::Shader OpenGL::line_output_shader(
|
||||
OpenGL::LineOutputShader::LineOutputShader(
|
||||
const API api,
|
||||
const int source_width,
|
||||
const int source_height,
|
||||
@@ -93,7 +93,7 @@ OpenGL::Shader OpenGL::line_output_shader(
|
||||
const VertexArray &vertex_array,
|
||||
const GLenum source_texture_unit
|
||||
) {
|
||||
auto shader = OpenGL::Shader(
|
||||
shader_ = OpenGL::Shader(
|
||||
api,
|
||||
vertex_shader,
|
||||
fragment_shader,
|
||||
@@ -103,7 +103,7 @@ OpenGL::Shader OpenGL::line_output_shader(
|
||||
BufferingScanTarget::Line line;
|
||||
vertex_array.bind_all();
|
||||
const auto enable = [&](const std::string &name, uint16_t &element, const GLint size) {
|
||||
shader.enable_vertex_attribute_with_pointer(
|
||||
shader_.enable_vertex_attribute_with_pointer(
|
||||
name,
|
||||
size,
|
||||
GL_UNSIGNED_SHORT,
|
||||
@@ -119,11 +119,17 @@ OpenGL::Shader OpenGL::line_output_shader(
|
||||
enable("lineEndpoint1CyclesSinceRetrace", line.end_points[1].cycles_since_end_of_horizontal_retrace, 1);
|
||||
enable("lineLine", line.line, 1);
|
||||
|
||||
shader.set_uniform("lineHeight", 1.05f / GLfloat(expected_vertical_lines));
|
||||
shader.set_uniform("positionScale", GLfloat(scale_x), GLfloat(scale_y));
|
||||
shader.set_uniform("sourceSize", GLfloat(source_width) / cycle_multiplier, GLfloat(source_height));
|
||||
shader.set_uniform("source", GLint(source_texture_unit - GL_TEXTURE0));
|
||||
shader.set_uniform("alpha", GLfloat(alpha));
|
||||
|
||||
return shader;
|
||||
shader_.set_uniform("lineHeight", 1.05f / GLfloat(expected_vertical_lines));
|
||||
shader_.set_uniform("positionScale", GLfloat(scale_x), GLfloat(scale_y));
|
||||
shader_.set_uniform("sourceSize", GLfloat(source_width) / cycle_multiplier, GLfloat(source_height));
|
||||
shader_.set_uniform("source", GLint(source_texture_unit - GL_TEXTURE0));
|
||||
shader_.set_uniform("alpha", GLfloat(alpha));
|
||||
}
|
||||
|
||||
void OpenGL::LineOutputShader::set_aspect_ratio_transformation(const std::array<float, 9> &) {
|
||||
|
||||
}
|
||||
|
||||
void OpenGL::LineOutputShader::bind() {
|
||||
shader_.bind();
|
||||
}
|
||||
|
||||
@@ -11,22 +11,36 @@
|
||||
#include "Outputs/OpenGL/Primitives/VertexArray.hpp"
|
||||
#include "Outputs/OpenGL/Primitives/Shader.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace Outputs::Display::OpenGL {
|
||||
|
||||
/*!
|
||||
Using `Line`s as input, draws output spans.
|
||||
*/
|
||||
Shader line_output_shader(
|
||||
API,
|
||||
int source_width,
|
||||
int source_height,
|
||||
float cycle_multiplier,
|
||||
int expected_vertical_lines,
|
||||
int scale_x,
|
||||
int scale_y,
|
||||
float alpha,
|
||||
const VertexArray &,
|
||||
GLenum source_texture_unit
|
||||
);
|
||||
class LineOutputShader {
|
||||
public:
|
||||
LineOutputShader(
|
||||
API,
|
||||
int source_width,
|
||||
int source_height,
|
||||
float cycle_multiplier,
|
||||
int expected_vertical_lines,
|
||||
int scale_x,
|
||||
int scale_y,
|
||||
float alpha,
|
||||
const VertexArray &,
|
||||
GLenum source_texture_unit
|
||||
);
|
||||
LineOutputShader() = default;
|
||||
|
||||
void set_aspect_ratio_transformation(const std::array<float, 9> &);
|
||||
void bind();
|
||||
void reset() {
|
||||
shader_.reset();
|
||||
}
|
||||
private:
|
||||
Shader shader_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user