mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-01 11:49:58 +00:00
Permits tweaking of PhaseLinkedLuminance8
sampling offset.
This commit is contained in:
parent
fd579a019b
commit
a25470ee41
@ -352,7 +352,6 @@ class ConcreteMachine:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void reset_all_keys(Inputs::Keyboard *) override {
|
void reset_all_keys(Inputs::Keyboard *) override {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +530,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
void set_display_type(Outputs::Display::DisplayType display_type) override {
|
void set_display_type(Outputs::Display::DisplayType display_type) override {
|
||||||
// video_output_.set_display_type(display_type);
|
video_output_.set_display_type(display_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
Configurable::SelectionSet get_accurate_selections() override {
|
Configurable::SelectionSet get_accurate_selections() override {
|
||||||
|
@ -21,37 +21,26 @@ namespace {
|
|||||||
const unsigned int PAL60Period = 262*64;
|
const unsigned int PAL60Period = 262*64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// crt_->set_rgb_sampling_function(
|
|
||||||
// "vec3 rgb_sample(usampler2D sampler, vec2 coordinate)"
|
|
||||||
// "{"
|
|
||||||
// "uint texValue = texture(sampler, coordinate).r;"
|
|
||||||
// "return vec3( uvec3(texValue) & uvec3(4u, 2u, 1u));"
|
|
||||||
// "}");
|
|
||||||
// crt_->set_composite_sampling_function(
|
|
||||||
// "float composite_sample(usampler2D sampler, vec2 coordinate, float phase, float amplitude)"
|
|
||||||
// "{"
|
|
||||||
// "uint texValue = uint(dot(texture(sampler, coordinate).rg, uvec2(1, 256)));"
|
|
||||||
// "uint iPhase = uint((phase + 3.141592654 + 0.39269908175) * 2.0 / 3.141592654) & 3u;"
|
|
||||||
// "texValue = (texValue >> (4u*(3u - iPhase))) & 15u;"
|
|
||||||
// "return (float(texValue) - 4.0) / 20.0;"
|
|
||||||
// "}"
|
|
||||||
// );
|
|
||||||
|
|
||||||
VideoOutput::VideoOutput(uint8_t *memory) :
|
VideoOutput::VideoOutput(uint8_t *memory) :
|
||||||
ram_(memory),
|
ram_(memory),
|
||||||
crt_(64*6, 1, Outputs::Display::Type::PAL50, Outputs::Display::InputDataType::PhaseLinkedLuminance8),
|
crt_(64*6, 1, Outputs::Display::Type::PAL50, Outputs::Display::InputDataType::Red1Green1Blue1),
|
||||||
v_sync_start_position_(PAL50VSyncStartPosition), v_sync_end_position_(PAL50VSyncEndPosition),
|
v_sync_start_position_(PAL50VSyncStartPosition), v_sync_end_position_(PAL50VSyncEndPosition),
|
||||||
counter_period_(PAL50Period) {
|
counter_period_(PAL50Period) {
|
||||||
crt_.set_composite_function_type(Outputs::CRT::CRT::CompositeSourceType::DiscreteFourSamplesPerCycle, 1.0f / 8.0f);
|
|
||||||
|
|
||||||
set_display_type(Outputs::Display::DisplayType::CompositeColour);
|
|
||||||
crt_.set_visible_area(crt_.get_rect_for_area(54, 224, 16 * 6, 40 * 6, 4.0f / 3.0f));
|
crt_.set_visible_area(crt_.get_rect_for_area(54, 224, 16 * 6, 40 * 6, 4.0f / 3.0f));
|
||||||
|
crt_.set_phase_linked_luminance_offset(-1.0f / 8.0f);
|
||||||
|
display_type_ = Outputs::Display::DisplayType::RGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoOutput::set_display_type(Outputs::Display::DisplayType display_type) {
|
void VideoOutput::set_display_type(Outputs::Display::DisplayType display_type) {
|
||||||
|
if(display_type_ != display_type) {
|
||||||
display_type_ = display_type;
|
display_type_ = display_type;
|
||||||
crt_.set_display_type(display_type);
|
crt_.set_display_type(display_type);
|
||||||
|
crt_.set_input_data_type(
|
||||||
|
(display_type == Outputs::Display::DisplayType::RGB) ?
|
||||||
|
Outputs::Display::InputDataType::Red1Green1Blue1 :
|
||||||
|
Outputs::Display::InputDataType::PhaseLinkedLuminance8
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoOutput::set_scan_target(Outputs::Display::ScanTarget *scan_target) {
|
void VideoOutput::set_scan_target(Outputs::Display::ScanTarget *scan_target) {
|
||||||
|
@ -88,6 +88,16 @@ void CRT::set_display_type(Outputs::Display::DisplayType display_type) {
|
|||||||
scan_target_->set_modals(scan_target_modals_);
|
scan_target_->set_modals(scan_target_modals_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CRT::set_phase_linked_luminance_offset(float offset) {
|
||||||
|
scan_target_modals_.input_data_tweaks.phase_linked_luminance_offset = offset;
|
||||||
|
scan_target_->set_modals(scan_target_modals_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRT::set_input_data_type(Outputs::Display::InputDataType input_data_type) {
|
||||||
|
scan_target_modals_.input_data_type = input_data_type;
|
||||||
|
scan_target_->set_modals(scan_target_modals_);
|
||||||
|
}
|
||||||
|
|
||||||
void CRT::set_new_display_type(int cycles_per_line, Outputs::Display::Type displayType) {
|
void CRT::set_new_display_type(int cycles_per_line, Outputs::Display::Type displayType) {
|
||||||
switch(displayType) {
|
switch(displayType) {
|
||||||
case Outputs::Display::Type::PAL50:
|
case Outputs::Display::Type::PAL50:
|
||||||
|
@ -265,6 +265,12 @@ class CRT {
|
|||||||
|
|
||||||
/*! Sets the display type that will be nominated to the scan target. */
|
/*! Sets the display type that will be nominated to the scan target. */
|
||||||
void set_display_type(Outputs::Display::DisplayType);
|
void set_display_type(Outputs::Display::DisplayType);
|
||||||
|
|
||||||
|
/*! Sets the offset to apply to phase when using the PhaseLinkedLuminance8 input data type. */
|
||||||
|
void set_phase_linked_luminance_offset(float);
|
||||||
|
|
||||||
|
/*! Sets the input data type. */
|
||||||
|
void set_input_data_type(Outputs::Display::InputDataType);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -100,8 +100,6 @@ ScanTarget::~ScanTarget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScanTarget::set_modals(Modals modals) {
|
void ScanTarget::set_modals(Modals modals) {
|
||||||
modals.display_type = DisplayType::CompositeColour;
|
|
||||||
|
|
||||||
modals_ = modals;
|
modals_ = modals;
|
||||||
|
|
||||||
const auto data_type_size = Outputs::Display::size_for_data_type(modals.input_data_type);
|
const auto data_type_size = Outputs::Display::size_for_data_type(modals.input_data_type);
|
||||||
@ -213,6 +211,7 @@ void Outputs::Display::OpenGL::ScanTarget::set_uniforms(ShaderType type, Shader
|
|||||||
target.set_uniform("rowHeight", GLfloat(1.05f / modals_.expected_vertical_lines));
|
target.set_uniform("rowHeight", GLfloat(1.05f / modals_.expected_vertical_lines));
|
||||||
target.set_uniform("scale", GLfloat(modals_.output_scale.x), GLfloat(modals_.output_scale.y));
|
target.set_uniform("scale", GLfloat(modals_.output_scale.x), GLfloat(modals_.output_scale.y));
|
||||||
target.set_uniform("processingWidth", GLfloat(processing_width_) / 2048.0f);
|
target.set_uniform("processingWidth", GLfloat(processing_width_) / 2048.0f);
|
||||||
|
target.set_uniform("phaseOffset", GLfloat(modals_.input_data_tweaks.phase_linked_luminance_offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::Display::ScanTarget::Scan *ScanTarget::begin_scan() {
|
Outputs::Display::ScanTarget::Scan *ScanTarget::begin_scan() {
|
||||||
|
@ -247,6 +247,7 @@ std::unique_ptr<Shader> ScanTarget::input_shader(InputDataType input_data_type,
|
|||||||
"uniform mat3 lumaChromaToRGB;"
|
"uniform mat3 lumaChromaToRGB;"
|
||||||
"uniform mat3 rgbToLumaChroma;"
|
"uniform mat3 rgbToLumaChroma;"
|
||||||
"uniform usampler2D textureName;"
|
"uniform usampler2D textureName;"
|
||||||
|
"uniform float phaseOffset;"
|
||||||
|
|
||||||
"void main(void) {";
|
"void main(void) {";
|
||||||
|
|
||||||
@ -269,7 +270,7 @@ std::unique_ptr<Shader> ScanTarget::input_shader(InputDataType input_data_type,
|
|||||||
case InputDataType::PhaseLinkedLuminance8:
|
case InputDataType::PhaseLinkedLuminance8:
|
||||||
computed_display_type = DisplayType::CompositeMonochrome;
|
computed_display_type = DisplayType::CompositeMonochrome;
|
||||||
fragment_shader +=
|
fragment_shader +=
|
||||||
"uint iPhase = uint(compositeAngle * 2.0 / 3.141592654) & 3u;"
|
"uint iPhase = uint((compositeAngle * 2.0 / 3.141592654) + phaseOffset*4.0) & 3u;"
|
||||||
"fragColour = vec3(texture(textureName, textureCoordinate)[iPhase] / 255.0);";
|
"fragColour = vec3(texture(textureName, textureCoordinate)[iPhase] / 255.0);";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -142,6 +142,13 @@ struct ScanTarget {
|
|||||||
/// Describes the format of input data.
|
/// Describes the format of input data.
|
||||||
InputDataType input_data_type;
|
InputDataType input_data_type;
|
||||||
|
|
||||||
|
struct InputDataTweaks {
|
||||||
|
/// If using the PhaseLinkedLuminance8 data type, this value provides an offset
|
||||||
|
/// to add to phase before indexing the supplied luminances.
|
||||||
|
float phase_linked_luminance_offset = 0.0f;
|
||||||
|
|
||||||
|
} input_data_tweaks;
|
||||||
|
|
||||||
/// Describes the type of display that the data is being shown on.
|
/// Describes the type of display that the data is being shown on.
|
||||||
DisplayType display_type = DisplayType::SVideo;
|
DisplayType display_type = DisplayType::SVideo;
|
||||||
|
|
||||||
@ -172,6 +179,9 @@ struct ScanTarget {
|
|||||||
/// Describes the usual gamma of the output device these scans would appear on.
|
/// Describes the usual gamma of the output device these scans would appear on.
|
||||||
float intended_gamma = 2.2f;
|
float intended_gamma = 2.2f;
|
||||||
|
|
||||||
|
/// Provides a brightness multiplier for the display output.
|
||||||
|
float brightness = 1.0f;
|
||||||
|
|
||||||
/// Specifies the range of values that will be output for x and y coordinates.
|
/// Specifies the range of values that will be output for x and y coordinates.
|
||||||
struct {
|
struct {
|
||||||
uint16_t x, y;
|
uint16_t x, y;
|
||||||
|
Loading…
Reference in New Issue
Block a user