1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Made an attempt to get RGB output mode up and running, and showing at least a box where pixels would be.

This commit is contained in:
Thomas Harte 2016-01-09 21:32:56 -05:00
parent a900bfed65
commit b4f31edea3
4 changed files with 19 additions and 4 deletions

View File

@ -244,3 +244,12 @@ inline void Machine::update_display()
}
}
}
const char *Machine::get_signal_decoder()
{
return
"vec4 sample(vec2 coordinate)\n"
"{\n"
"return vec4(1.0, 1.0, 0.0, 1.0);\n"
"}";
}

View File

@ -49,6 +49,7 @@ class Machine: public CPU6502::Processor<Machine> {
void set_rom(ROMSlot slot, size_t length, const uint8_t *data);
Outputs::CRT *get_crt() { return _crt; }
const char *get_signal_decoder();
private:
uint8_t _os[16384], _basic[16384], _ram[32768];

View File

@ -261,6 +261,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
- (void)setSignalDecoder:(nonnull NSString *)signalDecoder type:(CSCathodeRayViewSignalType)type
{
_signalType = type;
_signalDecoder = [signalDecoder copy];
OSAtomicIncrement32(&_signalDecoderGeneration);
}
@ -343,6 +344,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
"uniform float alpha;\n"
"\n"
"%@\n"
"%%@\n"
"\n"
"void main(void)\n"
"{\n"
@ -354,9 +356,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
"in float phase;\n"
"\n"
"// for conversion from i and q are in the range [-0.5, 0.5] (so i needs to be multiplied by 1.1914 and q by 1.0452)\n"
"const mat3 yiqToRGB = mat3(1.0, 1.0, 1.0, 1.1389784, -0.3240608, -1.3176884, 0.6490692, -0.6762444, 1.7799756);\n"
"\n"
"\%@\n";
"const mat3 yiqToRGB = mat3(1.0, 1.0, 1.0, 1.1389784, -0.3240608, -1.3176884, 0.6490692, -0.6762444, 1.7799756);\n";
NSString *const ntscFragmentShaderBody =
@"vec4 angles = vec4(phase) + vec4(-2.35619449019234, -0.78539816339745, 0.78539816339745, 2.35619449019234);\n"
@ -379,7 +379,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
@"";
NSString *const rgbFragmentShaderBody =
@"fragColour = texture(srcCoordinatesVarying, srcCoordinatesVarying);//sin(lateralVarying));\n";
@"fragColour = texture(shadowMaskTexID, shadowMaskCoordinates) * sample(srcCoordinatesVarying);//sin(lateralVarying));\n";
switch(_signalType)
{

View File

@ -31,4 +31,9 @@
_electron.get_crt()->set_delegate(delegate);
}
- (void)setView:(CSCathodeRayView *)view {
[super setView:view];
[view setSignalDecoder:[NSString stringWithUTF8String:_electron.get_signal_decoder()] type:CSCathodeRayViewSignalTypeRGB];
}
@end