mirror of
https://github.com/TomHarte/CLK.git
synced 2026-03-13 19:16:40 +00:00
Enable vertex attributes.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#include "CompositionShader.hpp"
|
||||
#include "Outputs/ScanTargets/BufferingScanTarget.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -369,6 +370,61 @@ OpenGL::Shader OpenGL::composition_shader(
|
||||
prefix + fragment_shader
|
||||
);
|
||||
|
||||
// TODO: bind inputs to match ScanTarget::Scan.
|
||||
return std::move(shader);
|
||||
#define rt_offset_of(field) reinterpret_cast<void *>((reinterpret_cast<uint8_t *>(&scan.field) - reinterpret_cast<uint8_t *>(&scan)))
|
||||
BufferingScanTarget::Scan scan;
|
||||
|
||||
for(int c = 0; c < 2; c++) {
|
||||
const std::string endpoint = std::string("scanEndpoint") + std::to_string(c);
|
||||
|
||||
shader.enable_vertex_attribute_with_pointer(
|
||||
endpoint + "DataOffset",
|
||||
1, GL_UNSIGNED_SHORT, GL_FALSE,
|
||||
sizeof(scan),
|
||||
rt_offset_of(scan.end_points[c].data_offset),
|
||||
1
|
||||
);
|
||||
|
||||
shader.enable_vertex_attribute_with_pointer(
|
||||
endpoint + "CyclesSinceRetrace",
|
||||
1, GL_UNSIGNED_SHORT, GL_FALSE,
|
||||
sizeof(scan),
|
||||
rt_offset_of(scan.end_points[c].cycles_since_end_of_horizontal_retrace),
|
||||
1
|
||||
);
|
||||
|
||||
shader.enable_vertex_attribute_with_pointer(
|
||||
endpoint + "CompositeAngle",
|
||||
1, GL_UNSIGNED_BYTE, GL_FALSE,
|
||||
sizeof(scan),
|
||||
rt_offset_of(scan.end_points[c].cycles_since_end_of_horizontal_retrace),
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
shader.enable_vertex_attribute_with_pointer(
|
||||
"scanDataY",
|
||||
1, GL_UNSIGNED_SHORT, GL_FALSE,
|
||||
sizeof(scan),
|
||||
rt_offset_of(data_y),
|
||||
1
|
||||
);
|
||||
|
||||
shader.enable_vertex_attribute_with_pointer(
|
||||
"scanLine",
|
||||
1, GL_UNSIGNED_SHORT, GL_FALSE,
|
||||
sizeof(scan),
|
||||
rt_offset_of(line),
|
||||
1
|
||||
);
|
||||
|
||||
shader.enable_vertex_attribute_with_pointer(
|
||||
"scanCompositeAmplitude",
|
||||
1, GL_UNSIGNED_BYTE, GL_FALSE,
|
||||
sizeof(scan),
|
||||
rt_offset_of(scan.composite_amplitude),
|
||||
1
|
||||
);
|
||||
#undef rt_offset_of
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user