mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-26 08:29:33 +00:00
Corrects various GCC warnings across the 6560, CPC, TIA, Oric video and elsewhere.
This commit is contained in:
parent
282e5c9d3e
commit
c827d14d97
@ -42,7 +42,7 @@ class Speaker: public ::Outputs::Filter<Speaker> {
|
|||||||
template <class T> class MOS6560 {
|
template <class T> class MOS6560 {
|
||||||
public:
|
public:
|
||||||
MOS6560() :
|
MOS6560() :
|
||||||
crt_(new Outputs::CRT::CRT(65*4, 4, Outputs::CRT::NTSC60, 2)),
|
crt_(new Outputs::CRT::CRT(65*4, 4, Outputs::CRT::DisplayType::NTSC60, 2)),
|
||||||
speaker_(new Speaker) {
|
speaker_(new Speaker) {
|
||||||
crt_->set_composite_sampling_function(
|
crt_->set_composite_sampling_function(
|
||||||
"float composite_sample(usampler2D texID, vec2 coordinate, vec2 iCoordinate, float phase, float amplitude)"
|
"float composite_sample(usampler2D texID, vec2 coordinate, vec2 iCoordinate, float phase, float amplitude)"
|
||||||
@ -104,7 +104,7 @@ template <class T> class MOS6560 {
|
|||||||
switch(output_mode) {
|
switch(output_mode) {
|
||||||
default:
|
default:
|
||||||
chrominances = pal_chrominances;
|
chrominances = pal_chrominances;
|
||||||
display_type = Outputs::CRT::PAL50;
|
display_type = Outputs::CRT::DisplayType::PAL50;
|
||||||
timing_.cycles_per_line = 71;
|
timing_.cycles_per_line = 71;
|
||||||
timing_.line_counter_increment_offset = 0;
|
timing_.line_counter_increment_offset = 0;
|
||||||
timing_.lines_per_progressive_field = 312;
|
timing_.lines_per_progressive_field = 312;
|
||||||
@ -113,7 +113,7 @@ template <class T> class MOS6560 {
|
|||||||
|
|
||||||
case OutputMode::NTSC:
|
case OutputMode::NTSC:
|
||||||
chrominances = ntsc_chrominances;
|
chrominances = ntsc_chrominances;
|
||||||
display_type = Outputs::CRT::NTSC60;
|
display_type = Outputs::CRT::DisplayType::NTSC60;
|
||||||
timing_.cycles_per_line = 65;
|
timing_.cycles_per_line = 65;
|
||||||
timing_.line_counter_increment_offset = 65 - 33; // TODO: this is a bit of a hack; separate vertical and horizontal counting
|
timing_.line_counter_increment_offset = 65 - 33; // TODO: this is a bit of a hack; separate vertical and horizontal counting
|
||||||
timing_.lines_per_progressive_field = 261;
|
timing_.lines_per_progressive_field = 261;
|
||||||
|
@ -300,7 +300,7 @@ class CRTCBusHandler {
|
|||||||
"return vec3(float((sample >> 4) & 3u), float((sample >> 2) & 3u), float(sample & 3u)) / 2.0;"
|
"return vec3(float((sample >> 4) & 3u), float((sample >> 2) & 3u), float(sample & 3u)) / 2.0;"
|
||||||
"}");
|
"}");
|
||||||
crt_->set_visible_area(Outputs::CRT::Rect(0.075f, 0.05f, 0.9f, 0.9f));
|
crt_->set_visible_area(Outputs::CRT::Rect(0.075f, 0.05f, 0.9f, 0.9f));
|
||||||
crt_->set_output_device(Outputs::CRT::Monitor);
|
crt_->set_output_device(Outputs::CRT::OutputDevice::Monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destructs the CRT.
|
/// Destructs the CRT.
|
||||||
|
@ -23,7 +23,7 @@ namespace {
|
|||||||
TIA::TIA(bool create_crt) {
|
TIA::TIA(bool create_crt) {
|
||||||
if(create_crt) {
|
if(create_crt) {
|
||||||
crt_.reset(new Outputs::CRT::CRT(cycles_per_line * 2 - 1, 1, Outputs::CRT::DisplayType::NTSC60, 1));
|
crt_.reset(new Outputs::CRT::CRT(cycles_per_line * 2 - 1, 1, Outputs::CRT::DisplayType::NTSC60, 1));
|
||||||
crt_->set_output_device(Outputs::CRT::Television);
|
crt_->set_output_device(Outputs::CRT::OutputDevice::Television);
|
||||||
set_output_mode(OutputMode::NTSC);
|
set_output_mode(OutputMode::NTSC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ VideoOutput::VideoOutput(uint8_t *memory) :
|
|||||||
);
|
);
|
||||||
crt_->set_composite_function_type(Outputs::CRT::CRT::CompositeSourceType::DiscreteFourSamplesPerCycle, 0.0f);
|
crt_->set_composite_function_type(Outputs::CRT::CRT::CompositeSourceType::DiscreteFourSamplesPerCycle, 0.0f);
|
||||||
|
|
||||||
set_output_device(Outputs::CRT::Television);
|
set_output_device(Outputs::CRT::OutputDevice::Television);
|
||||||
crt_->set_visible_area(crt_->get_rect_for_area(53, 224, 16 * 6, 40 * 6, 4.0f / 3.0f));
|
crt_->set_visible_area(crt_->get_rect_for_area(53, 224, 16 * 6, 40 * 6, 4.0f / 3.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ void VideoOutput::run_for(const Cycles cycles) {
|
|||||||
if(control_byte & 0x60) {
|
if(control_byte & 0x60) {
|
||||||
if(pixel_target_) {
|
if(pixel_target_) {
|
||||||
uint16_t colours[2];
|
uint16_t colours[2];
|
||||||
if(output_device_ == Outputs::CRT::Monitor) {
|
if(output_device_ == Outputs::CRT::OutputDevice::Monitor) {
|
||||||
colours[0] = static_cast<uint8_t>(paper_ ^ inverse_mask);
|
colours[0] = static_cast<uint8_t>(paper_ ^ inverse_mask);
|
||||||
colours[1] = static_cast<uint8_t>(ink_ ^ inverse_mask);
|
colours[1] = static_cast<uint8_t>(ink_ ^ inverse_mask);
|
||||||
} else {
|
} else {
|
||||||
@ -183,7 +183,7 @@ void VideoOutput::run_for(const Cycles cycles) {
|
|||||||
pixel_target_[0] = pixel_target_[1] =
|
pixel_target_[0] = pixel_target_[1] =
|
||||||
pixel_target_[2] = pixel_target_[3] =
|
pixel_target_[2] = pixel_target_[3] =
|
||||||
pixel_target_[4] = pixel_target_[5] =
|
pixel_target_[4] = pixel_target_[5] =
|
||||||
(output_device_ == Outputs::CRT::Monitor) ? paper_ ^ inverse_mask : colour_forms_[paper_ ^ inverse_mask];
|
(output_device_ == Outputs::CRT::OutputDevice::Monitor) ? paper_ ^ inverse_mask : colour_forms_[paper_ ^ inverse_mask];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(pixel_target_) pixel_target_ += 6;
|
if(pixel_target_) pixel_target_ += 6;
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
- (void)setUseTelevisionOutput:(BOOL)useTelevisionOutput {
|
- (void)setUseTelevisionOutput:(BOOL)useTelevisionOutput {
|
||||||
@synchronized(self) {
|
@synchronized(self) {
|
||||||
_useTelevisionOutput = useTelevisionOutput;
|
_useTelevisionOutput = useTelevisionOutput;
|
||||||
_electron->get_crt()->set_output_device(useTelevisionOutput ? Outputs::CRT::Television : Outputs::CRT::Monitor);
|
_electron->get_crt()->set_output_device(useTelevisionOutput ? Outputs::CRT::OutputDevice::Television : Outputs::CRT::OutputDevice::Monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
- (void)setUseCompositeOutput:(BOOL)useCompositeOutput {
|
- (void)setUseCompositeOutput:(BOOL)useCompositeOutput {
|
||||||
@synchronized(self) {
|
@synchronized(self) {
|
||||||
_useCompositeOutput = useCompositeOutput;
|
_useCompositeOutput = useCompositeOutput;
|
||||||
_oric->set_output_device(useCompositeOutput ? Outputs::CRT::Television : Outputs::CRT::Monitor);
|
_oric->set_output_device(useCompositeOutput ? Outputs::CRT::OutputDevice::Television : Outputs::CRT::OutputDevice::Monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,17 +26,17 @@ struct Rect {
|
|||||||
origin({x, y}), size({width, height}) {}
|
origin({x, y}), size({width, height}) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DisplayType {
|
enum class DisplayType {
|
||||||
PAL50,
|
PAL50,
|
||||||
NTSC60
|
NTSC60
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ColourSpace {
|
enum class ColourSpace {
|
||||||
YIQ,
|
YIQ,
|
||||||
YUV
|
YUV
|
||||||
};
|
};
|
||||||
|
|
||||||
enum OutputDevice {
|
enum class OutputDevice {
|
||||||
Monitor,
|
Monitor,
|
||||||
Television
|
Television
|
||||||
};
|
};
|
||||||
|
@ -71,7 +71,7 @@ OpenGLOutputBuilder::~OpenGLOutputBuilder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OpenGLOutputBuilder::get_is_television_output() {
|
bool OpenGLOutputBuilder::get_is_television_output() {
|
||||||
return output_device_ == Television || !rgb_input_shader_program_;
|
return output_device_ == OutputDevice::Television || !rgb_input_shader_program_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int output_height, bool only_if_dirty) {
|
void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int output_height, bool only_if_dirty) {
|
||||||
@ -369,6 +369,8 @@ void OpenGLOutputBuilder::set_colour_space_uniforms() {
|
|||||||
fromRGB = rgbToYUV;
|
fromRGB = rgbToYUV;
|
||||||
toRGB = yuvToRGB;
|
toRGB = yuvToRGB;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default: assert(false); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(composite_input_shader_program_) composite_input_shader_program_->set_colour_conversion_matrices(fromRGB, toRGB);
|
if(composite_input_shader_program_) composite_input_shader_program_->set_colour_conversion_matrices(fromRGB, toRGB);
|
||||||
|
@ -32,7 +32,7 @@ std::unique_ptr<IntermediateShader> IntermediateShader::make_shader(const std::s
|
|||||||
const char *input_variable = input_is_inputPosition ? "inputPosition" : "outputPosition";
|
const char *input_variable = input_is_inputPosition ? "inputPosition" : "outputPosition";
|
||||||
|
|
||||||
char *vertex_shader;
|
char *vertex_shader;
|
||||||
asprintf(&vertex_shader,
|
(void)asprintf(&vertex_shader,
|
||||||
"#version 150\n"
|
"#version 150\n"
|
||||||
|
|
||||||
"in vec2 inputStart;"
|
"in vec2 inputStart;"
|
||||||
@ -108,7 +108,7 @@ std::unique_ptr<IntermediateShader> IntermediateShader::make_shader(const std::s
|
|||||||
"}", sampler_type, input_variable);
|
"}", sampler_type, input_variable);
|
||||||
|
|
||||||
std::unique_ptr<IntermediateShader> shader(new IntermediateShader(vertex_shader, fragment_shader, bindings));
|
std::unique_ptr<IntermediateShader> shader(new IntermediateShader(vertex_shader, fragment_shader, bindings));
|
||||||
free(vertex_shader);
|
std::free(vertex_shader);
|
||||||
|
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ std::unique_ptr<IntermediateShader> IntermediateShader::make_source_conversion_s
|
|||||||
char *derived_composite_sample = nullptr;
|
char *derived_composite_sample = nullptr;
|
||||||
const char *composite_sample = composite_shader.c_str();
|
const char *composite_sample = composite_shader.c_str();
|
||||||
if(!composite_shader.size()) {
|
if(!composite_shader.size()) {
|
||||||
asprintf(&derived_composite_sample,
|
(void)asprintf(&derived_composite_sample,
|
||||||
"%s\n"
|
"%s\n"
|
||||||
"uniform mat3 rgbToLumaChroma;"
|
"uniform mat3 rgbToLumaChroma;"
|
||||||
"float composite_sample(usampler2D texID, vec2 coordinate, vec2 iCoordinate, float phase, float amplitude)"
|
"float composite_sample(usampler2D texID, vec2 coordinate, vec2 iCoordinate, float phase, float amplitude)"
|
||||||
@ -132,7 +132,7 @@ std::unique_ptr<IntermediateShader> IntermediateShader::make_source_conversion_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *fragment_shader;
|
char *fragment_shader;
|
||||||
asprintf(&fragment_shader,
|
(void)asprintf(&fragment_shader,
|
||||||
"#version 150\n"
|
"#version 150\n"
|
||||||
|
|
||||||
"in vec2 inputPositionsVarying[11];"
|
"in vec2 inputPositionsVarying[11];"
|
||||||
@ -150,17 +150,17 @@ std::unique_ptr<IntermediateShader> IntermediateShader::make_source_conversion_s
|
|||||||
"fragColour = vec4(composite_sample(texID, inputPositionsVarying[5], iInputPositionVarying, phaseAndAmplitudeVarying.x, phaseAndAmplitudeVarying.y));"
|
"fragColour = vec4(composite_sample(texID, inputPositionsVarying[5], iInputPositionVarying, phaseAndAmplitudeVarying.x, phaseAndAmplitudeVarying.y));"
|
||||||
"}"
|
"}"
|
||||||
, composite_sample);
|
, composite_sample);
|
||||||
free(derived_composite_sample);
|
std::free(derived_composite_sample);
|
||||||
|
|
||||||
std::unique_ptr<IntermediateShader> shader = make_shader(fragment_shader, true, true);
|
std::unique_ptr<IntermediateShader> shader = make_shader(fragment_shader, true, true);
|
||||||
free(fragment_shader);
|
std::free(fragment_shader);
|
||||||
|
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<IntermediateShader> IntermediateShader::make_rgb_source_shader(const std::string &rgb_shader) {
|
std::unique_ptr<IntermediateShader> IntermediateShader::make_rgb_source_shader(const std::string &rgb_shader) {
|
||||||
char *fragment_shader;
|
char *fragment_shader;
|
||||||
asprintf(&fragment_shader,
|
(void)asprintf(&fragment_shader,
|
||||||
"#version 150\n"
|
"#version 150\n"
|
||||||
|
|
||||||
"in vec2 inputPositionsVarying[11];"
|
"in vec2 inputPositionsVarying[11];"
|
||||||
@ -180,7 +180,7 @@ std::unique_ptr<IntermediateShader> IntermediateShader::make_rgb_source_shader(c
|
|||||||
, rgb_shader.c_str());
|
, rgb_shader.c_str());
|
||||||
|
|
||||||
std::unique_ptr<IntermediateShader> shader = make_shader(fragment_shader, true, true);
|
std::unique_ptr<IntermediateShader> shader = make_shader(fragment_shader, true, true);
|
||||||
free(fragment_shader);
|
std::free(fragment_shader);
|
||||||
|
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
@ -340,8 +340,8 @@ void IntermediateShader::set_filter_coefficients(float sampling_rate, float cuto
|
|||||||
|
|
||||||
// int sample = 0;
|
// int sample = 0;
|
||||||
// int c = 0;
|
// int c = 0;
|
||||||
memset(weights, 0, sizeof(float)*12);
|
std::memset(weights, 0, sizeof(float)*12);
|
||||||
memset(offsets, 0, sizeof(float)*5);
|
std::memset(offsets, 0, sizeof(float)*5);
|
||||||
|
|
||||||
unsigned int half_size = (taps >> 1);
|
unsigned int half_size = (taps >> 1);
|
||||||
for(unsigned int c = 0; c < taps; c++) {
|
for(unsigned int c = 0; c < taps; c++) {
|
||||||
|
@ -25,7 +25,7 @@ std::unique_ptr<OutputShader> OutputShader::make_shader(const char *fragment_met
|
|||||||
const char *sampler_type = use_usampler ? "usampler2D" : "sampler2D";
|
const char *sampler_type = use_usampler ? "usampler2D" : "sampler2D";
|
||||||
|
|
||||||
char *vertex_shader;
|
char *vertex_shader;
|
||||||
asprintf(&vertex_shader,
|
(void)asprintf(&vertex_shader,
|
||||||
"#version 150\n"
|
"#version 150\n"
|
||||||
|
|
||||||
"in vec2 horizontal;"
|
"in vec2 horizontal;"
|
||||||
@ -64,7 +64,7 @@ std::unique_ptr<OutputShader> OutputShader::make_shader(const char *fragment_met
|
|||||||
"}", sampler_type);
|
"}", sampler_type);
|
||||||
|
|
||||||
char *fragment_shader;
|
char *fragment_shader;
|
||||||
asprintf(&fragment_shader,
|
(void)asprintf(&fragment_shader,
|
||||||
"#version 150\n"
|
"#version 150\n"
|
||||||
|
|
||||||
"in float lateralVarying;"
|
"in float lateralVarying;"
|
||||||
@ -85,8 +85,8 @@ std::unique_ptr<OutputShader> OutputShader::make_shader(const char *fragment_met
|
|||||||
sampler_type, fragment_methods, colour_expression);
|
sampler_type, fragment_methods, colour_expression);
|
||||||
|
|
||||||
std::unique_ptr<OutputShader> result(new OutputShader(vertex_shader, fragment_shader, bindings));
|
std::unique_ptr<OutputShader> result(new OutputShader(vertex_shader, fragment_shader, bindings));
|
||||||
free(vertex_shader);
|
std::free(vertex_shader);
|
||||||
free(fragment_shader);
|
std::free(fragment_shader);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user