1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-03 11:30:02 +00:00
Commit Graph

548 Commits

Author SHA1 Message Date
Thomas Harte
bda9441620 Made an attempt to clock the AY. 2017-08-02 07:20:59 -04:00
Thomas Harte
55fd9122d0 Slightly relaxed vertical sync testing. 2017-07-30 21:19:42 -04:00
Thomas Harte
0bf4fdc9af Simplified slightly. 2017-07-29 21:37:59 -04:00
Thomas Harte
ed8c73eb14 Ensured lengthy constant sync can't appear to be two sync pulses, regardless of other interruption. 2017-07-29 18:25:04 -04:00
Thomas Harte
3528a7f78b Made an attempt at triggering vertical sync the expected number of time after it begins, regardless of total length. 2017-07-29 17:33:52 -04:00
Thomas Harte
54bcc40192 With an eye towards being more accurate as to vertical sync recognition: acknowledged that the detection period varies between PAL and NTSC. 2017-07-29 14:53:53 -04:00
Thomas Harte
4abd62e62b Standardises on const [Half]Cycles as the thing called and returned, rather than const [Half]Cycles & as it's explicitly defined to be only one int in size, so using a reference is overly weighty. 2017-07-27 22:05:29 -04:00
Thomas Harte
8361756dc4 Switched definitively to the works-for-now approach of requiring an explicit opt-in where somebody wants to clock a whole-cycle receiver from a half-cycle clock. 2017-07-27 07:40:02 -04:00
Thomas Harte
75d67ee770 Relocated ClockReceiver.hpp as it's a dependency for parts of the static analyser, and therefore needs to be distinct from the actual emulation parts. 2017-07-25 20:20:55 -04:00
Thomas Harte
b7f88e8f61 Filter is now a ClockReciever, affecting all sound output devices. 2017-07-24 21:29:13 -04:00
Thomas Harte
92d1dd9a4a Attempts to eliminate all remaining type variations. 2017-07-21 21:54:05 -04:00
Thomas Harte
be750ee427 Eliminated all dangling implicit signedness conversions. 2017-07-21 21:52:37 -04:00
Thomas Harte
449c33ee8b Signedness fixes. 2017-07-21 21:28:04 -04:00
Thomas Harte
ef03c84b21 More definitively removed the old sample-offset blending approach to filtering. 2017-07-21 20:58:55 -04:00
Thomas Harte
5b4c5b0cbf Avoided having two different variables named next_output_run. 2017-07-21 20:46:08 -04:00
Thomas Harte
279f4760d7 Eliminated buffer_size_ as something explicitly stored, and reduced size of delegate call out. 2017-07-16 15:01:39 -04:00
Thomas Harte
f931cd582d Switched to use of std::vector in those few remaining places where I was still using a unique_ptr to a native type and newing for myself. So, some of my earliest bits of code. 2017-07-16 13:54:07 -04:00
Thomas Harte
8ccec37a4b Eliminated a further potential cause of texture/geometry mismatch: the texture retain succeeded but then there wasn't room for geometry. 2017-07-09 19:11:38 -04:00
Thomas Harte
a25c2fd6b5 Got more explicit about what the thinking is here re: multiple sources of action. 2017-07-09 17:54:26 -04:00
Thomas Harte
ee1a9a4781 Eliminates attempts cleverly to shuffle unsubmitted runs, because no mechanism exists to stop them overwriting previously-submitted-but-not-yet-flushed runs. Which implies that the buffer must be fully circular. The cost of which is sometimes having to make two calls to glTexSubImage2D. Also added some TODOs, and a means for reporting when a retain_latest is ineffective, in which situation it would be inappropriate to attempt to generate correlated geometry 2017-07-09 17:50:22 -04:00
Thomas Harte
2f90f35478 Ensured the same write area can be submitted multiple times — this is actively used if a run of data overlaps a flywheel-suggested sync. Which nullifies the idea of not having a write area in the barrel, at least as soon as any one has been allocated. 2017-07-07 23:37:44 -04:00
Thomas Harte
12f7e1b804 Enshrined a default colour burst amplitude. Which now everybody relies on. The 102 figure is derived from the burst apparently being 40 IRE. 2017-07-07 23:35:14 -04:00
Thomas Harte
c7fa2ed11a It makes more sense not to retain the previous texture builder run until vertex storage is confirmed. 2017-07-07 23:21:25 -04:00
Thomas Harte
bfbe12b94b Made an attempt further to tie geometry and texture generation fully together, removing the assumption that the caller will achieve one-to-one calling. 2017-07-07 22:25:05 -04:00
Thomas Harte
ab1374f801 Added an assert on an assumed buffer size alignment. 2017-07-06 21:46:24 -04:00
Thomas Harte
344d267fd2 Introduced sharper chrominance for genuinely black-and-white signals. 2017-07-06 21:38:33 -04:00
Thomas Harte
4211389ac7 Connected machine-supplied colour burst amplitude to shader, discarding hard-coded value. Net effect: the colour component is now discarded for the ZX80 and 81. 2017-07-06 21:29:08 -04:00
Thomas Harte
c6d00ec7d1 Switched phase and amplitude varying to a 3d vector; the third component is 1/amplitude if amplitude is non-zero, and zero otherwise. So you can multiply by that to get chrominance, rather than dividing by amplitude. With the direct effect that detected chrominance should automatically be zero if the colour burst didn't exist (i.e. had zero amplitude). 2017-07-06 21:25:38 -04:00
Thomas Harte
a5075d9eb5 Formalised the reasoning behind the colour phase fix-up and made it an opt-in per-caller value. Only the Oric currently needs to opt in. 2017-05-16 20:31:39 -04:00
Thomas Harte
c2b5a9bb1f Minor fix: given that phase is now a function of position, stop nudging position. 2017-05-13 21:50:48 -04:00
Thomas Harte
b14c892740 Switched to a safer RAII approach to this lock. 2017-05-10 21:29:39 -04:00
Thomas Harte
e01f3f06c8 Completed curly bracket movement. 2017-03-26 14:34:47 -04:00
Thomas Harte
e63229a5e5 Pulled vertical sync detection entirely outside the loop, and gave it greater perspective. 2017-03-06 19:15:33 -05:00
Thomas Harte
ad73379d1c Took vertical sync detection logic entirely out of the loop. 2017-03-05 20:17:55 -05:00
Thomas Harte
4751615623 Fixed NTSC colour cycle count, and hence the 2600's reported line lengths and phase offset. 2017-03-04 17:31:39 -05:00
Thomas Harte
a3fcd15980 Loosened sync charge level requirement. 2017-03-01 22:16:56 -05:00
Thomas Harte
026b418b4a Ensured filtered 1:1 audio resampling is applied. 2017-02-28 21:27:38 -05:00
Thomas Harte
d19f26887d Performed a very naive shuffling of output builder sets onto the OpenGL queue. Which makes the frequency switcher work properly from it's possibly-contextless thread. 2017-02-20 10:39:31 -05:00
Thomas Harte
6cb95b4fc5 Switched to passing around std::strings rather than char *s, because they should be easier to capture. 2017-02-20 10:35:33 -05:00
Thomas Harte
d979a822ac Introduced a deferred task list for the OpenGL thread. 2017-02-19 21:46:07 -05:00
Thomas Harte
fccdce65b9 Switched to lock guards. 2017-02-19 21:45:28 -05:00
Thomas Harte
97cdfea9e9 Resolved spurious static analyser complaint: input_size and output_size aren't supposed to have defined values if input or output is null. But whatever. 2017-02-11 13:36:09 -05:00
Thomas Harte
fcf8cafb5d Sought to ensure that communicating a colour burst in multiple parts doesn't ruin the phase. 2017-02-06 18:27:44 -05:00
Thomas Harte
23f3ccd77a Made a further attempt to prevent overwrites. 2017-02-05 17:47:34 -05:00
Thomas Harte
ebde955356 This needs to be a memmove as the areas may overlap. 2017-01-29 16:12:48 -05:00
Thomas Harte
7fd02e7f4c Added an extra flag to avoid potential race condition on is_full_, being reset from the background despite a write area not having been allocated. 2017-01-29 16:11:29 -05:00
Thomas Harte
c2d7e36c8f Ensured logic for whether composite output is in use is consistent. 2017-01-25 21:25:03 -05:00
Thomas Harte
4d6e78e641 Reinstated temporary Oric-related fix. 2017-01-24 22:16:15 -05:00
Thomas Harte
5761c8267b [Re-]Eliminated connection between colour subcarrier frequency and monitor output mode. 2017-01-24 20:48:54 -05:00
Thomas Harte
b4159295f6 Switched to using quads for intermediate draws. The specific concern is the flexibility offered in the GL spec as to line drawing algorithms. And even if a driver implements exactly to spec then it should omit the final pixel. 2017-01-11 21:18:41 -05:00
Thomas Harte
d0a93409e6 Made an attempt to simplify in-shader phase calculation, now that output position is a direct multiple of phase. 2017-01-11 08:18:00 -05:00
Thomas Harte
4c3669f210 Reduced precision of input phase, but I'm not necessarily persuaded by it as a move. However it's clear that something is off in that whole area. But if phase is locked by output position, do I need to retain this level of complexity? Also ensured that intermediate buffers prior to the final are sampled using the nearest sampling mode, also to reduce precision errors. 2017-01-10 22:08:07 -05:00
Thomas Harte
eeb646868b Switched off filtering, at least temporarily, to try to ensure that sampling is all where it should be. 2017-01-08 19:53:08 -05:00
Thomas Harte
3d789732a2 Switched back to full buffer clearing. Until I can figure out the source of noise. 2017-01-08 19:50:31 -05:00
Thomas Harte
d2a7d39749 Ensured the output lock isn't held while talking to the delegate. 2017-01-08 19:49:21 -05:00
Thomas Harte
9521718120 Colour phase is multiplied by 255, not 256. 2017-01-08 17:21:26 -05:00
Thomas Harte
28909e33ca Eliminated phaseCyclesPerTick as implied. 2017-01-08 16:48:02 -05:00
Thomas Harte
79632b1d34 Instituted de-escalating phase-related extensions, definitively to kill rounding error edges. 2017-01-08 16:24:22 -05:00
Thomas Harte
7ad64ff16b Made further efforts to support throughput via memory barrier. 2017-01-08 14:47:16 -05:00
Thomas Harte
be48c950b4 Started taking steps towards using a texture barrier where possible to reduce all of my framebuffer binds. Some output appears, but it's not correct. 2017-01-08 11:13:20 -05:00
Thomas Harte
0487b8c178 Definitively eliminated the additional y filtering step; if I'm going to work to ensure always four samples per colour cycle, I can put the channel separation coefficients directly into their shaders, cutting down on samples. 2017-01-07 16:02:33 -05:00
Thomas Harte
5740015f56 Temporarily disabled composite processing to show the pure stream. Fixed both automatic calculations of phase — per line and, at input, per pixel. 2017-01-07 12:38:00 -05:00
Thomas Harte
c84004bfa3 Fixed: colour_cycle_numerator_ doesn't need to be multiplied by the time multiplier because it'll get that for free from the calculation of next_run_length. 2017-01-06 21:36:19 -05:00
Thomas Harte
c746a3711f Temporarily disabled my attempt to be clever with bilinear filtering when applying a lowpass filter. Will need to investigate. 2017-01-04 08:06:18 -05:00
Thomas Harte
aa7774a9a6 Experimental: up the chroma accuracy, just let the luma go straight through. Subject to figuring out how I'm still losing so much precision. 2017-01-03 22:41:34 -05:00
Thomas Harte
a836120945 Restored proper colour separation, but somewhere a massive hit in horizontal resolution is happening — much greater than one would expect from the sample size picked. So investigation to come. 2017-01-03 22:32:07 -05:00
Thomas Harte
7d60df9075 Added the option for both intermediate and output shaders to use only a portion of the input/output texture; made an attempt to pick an appropriate proportion in order to align signal sampling with the colour subcarrier. 2017-01-03 22:16:52 -05:00
Thomas Harte
f2b8b26bc4 Started throwing some comments into my shaders. 2017-01-03 21:16:38 -05:00
Thomas Harte
34d213dec4 Decreased Y resolution, again also hopefully temporarily. 2016-12-10 15:35:38 -05:00
Thomas Harte
81a102d951 Upped intermediate buffer size, at least temporarily, while I look for the source of the interference patterns I'm seeing. 2016-12-10 15:20:10 -05:00
Thomas Harte
0e71802b92 Reduced Oric video to single nibble constants. Removed attempt at asynchronous flush as no longer required. 2016-12-10 14:17:46 -05:00
Thomas Harte
a549fd1ecc Introduced the ability simply to piggy-back off the CRT's natural phase for the colour burst, thereby eliminating a couple of redundant independent attempts in the Oric and Electron. 2016-12-10 13:42:34 -05:00
Thomas Harte
5216dda675 Added some brief extra exposition to the texture builder, cut all internal tex_x/y and source_divider stuff from the CRT. 2016-12-06 19:08:55 -05:00
Thomas Harte
33d52bb573 Ensured no over-moving. 2016-12-06 19:02:18 -05:00
Thomas Harte
4ff33254e1 Sought to shift locking back up to the CRT. And to be a bit more RAII-ish. 2016-12-06 18:48:30 -05:00
Thomas Harte
60f9ddfde8 Fixed start test and added incrementation of start locations. 2016-12-06 08:08:57 -05:00
Thomas Harte
f388ba11cc Missed an initialisation. Fixed! 2016-12-06 07:26:23 -05:00
Thomas Harte
0fee8096c1 Made an attempt to shuffle the texture builder to a similar flush/submit pattern as the input builder. Don't care about thread safety yet, as it's obvious I'm going to need to move that back up to the CRT. 2016-12-06 07:24:07 -05:00
Thomas Harte
0edc043378 Started introducing an extra layer of indirection so as to be able to bind the texture builder to the same flush and submit patern as the array builder. 2016-12-03 20:47:19 -05:00
Thomas Harte
cb3c837e30 Simplified interface by baking in last-minute-only updates. 2016-12-03 18:19:12 -05:00
Thomas Harte
0220d33562 Resolved failure of initial state setting, which was causing tests sometimes to fail. 2016-12-03 16:42:10 -05:00
Thomas Harte
c5016a3eaa Completed flight of 'Outputs' to postfix underscores. 2016-12-03 11:02:34 -05:00
Thomas Harte
7c85cb62e4 Moved underscores, removed indirections where they're not necessary, converted those names that were still looking very Objective-C and moved the GL fence variable into the private area, where it should always have been. 2016-11-21 12:14:52 +08:00
Thomas Harte
bc03e12dc5 Switched to suffix underscores. 2016-11-21 11:57:45 +08:00
Thomas Harte
340607e13e Switched the flywheel to suffix underscores. 2016-11-21 11:48:31 +08:00
Thomas Harte
e1285028aa Removed a redundant clear and some dead code. 2016-11-21 11:42:45 +08:00
Thomas Harte
7b38247ab3 Updated outdated comments. 2016-11-21 11:40:13 +08:00
Thomas Harte
d7d0ed378a Only the final intermediate buffer needs clearing, on reflection. 2016-11-21 11:26:07 +08:00
Thomas Harte
c89345c639 Reduced buffer size. 2016-11-21 11:21:14 +08:00
Thomas Harte
32dbfe947d With hindsight, the elimination of this might have been overzealous. 2016-11-20 10:53:35 +08:00
Thomas Harte
ef0367d4a4 Corrected typo. 2016-11-20 09:12:43 +08:00
Thomas Harte
5bc165960a Completed refactoring. 2016-11-20 09:12:06 +08:00
Thomas Harte
fda90c5aef Documented. 2016-11-20 09:11:24 +08:00
Thomas Harte
c2349ee3f4 This thing has clearly becoma a real class. 2016-11-19 20:12:40 +08:00
Thomas Harte
7857ef774f Ensured resets genuinely kill outstanding data. 2016-11-19 20:09:38 +08:00
Thomas Harte
a4c7b00ecd Fixed code that was causing the failing test. 2016-11-19 19:55:30 +08:00
Thomas Harte
f59537bce9 Added a testing hook, but as of yet no tests. 2016-11-17 14:06:16 +08:00
Thomas Harte
aca1fa0577 Returned some video output. Enough significantly to reduce my paranoia. 2016-11-17 13:37:53 +08:00
Thomas Harte
1f91d29434 Progressed to usage of an array builder and a texture builder up to the point of a successful build. 2016-11-17 12:26:04 +08:00
Thomas Harte
0f3b02edb7 Switched to postfix underscores and gave this class ownership of a texture builder and an array builder, though it presently uses neither. 2016-11-17 11:00:11 +08:00
Thomas Harte
57f0648742 Fleshed out first implementation of ArrayBuilder, albeit that I need to implement exhaustion properly, as soon as I think of a sensible way to handle synchronisation. 2016-11-17 10:39:30 +08:00
Thomas Harte
324a1de43d Started pulling out array construction as a separate task. 2016-11-17 09:20:49 +08:00
Thomas Harte
c04a116a05 Fixed comment. 2016-11-16 23:14:56 +08:00
Thomas Harte
edeafd4d94 Wait, OpenGL textures go the other way. 2016-11-16 23:14:15 +08:00
Thomas Harte
6ac20e0066 Pushed responsibility for submitting texture contents up to the texture builder, simplifying the interface. 2016-11-16 23:13:06 +08:00
Thomas Harte
5c5e44874f Even better: why include the 'Input' prefix when there's only one? 2016-11-16 22:57:17 +08:00
Thomas Harte
04b2688683 Attempted to reduce allocations. 2016-11-16 13:25:50 +08:00
Thomas Harte
c1a509910d Documented this interface, albeit that the English could do with a second pass, and very sightly simplified inline with current usage. 2016-11-16 13:15:50 +08:00
Thomas Harte
4d0d5eb919 Renamed the 'input buffer builder' to the 'input texture builder' to be explicit about what sort of buffer, and killed the prefix since it's namespaced. Also switched to std::vector. 2016-11-16 12:31:32 +08:00
Thomas Harte
4ee4400801 Removed dead code. 2016-11-16 11:57:22 +08:00
Thomas Harte
6cb4950db4 Improved run-off area. 2016-11-16 11:53:15 +08:00
Thomas Harte
9ee11d7765 At the expense of API simplicity, at least for now, resolved the most glaring cause of dirty lines. 2016-11-16 11:34:05 +08:00
Thomas Harte
44d3fd6d5b Fixed mistimed reset of the target output line. Now all that's left is occasional noise. 2016-11-16 11:22:12 +08:00
Thomas Harte
7a737e0790 Both pathways start with a buffer that clears to black. So no need to keep going on about it. 2016-11-16 11:12:08 +08:00
Thomas Harte
f63e849092 Sought completely to eliminate the outgoing concept of 'clearing zones'. 2016-11-16 11:10:34 +08:00
Thomas Harte
294adde344 Eliminated zoned clearing, in favour of a complete buffer clear on each load and attempted to reduce locking. But imperfectly. 2016-11-16 10:59:12 +08:00
Thomas Harte
ccedb6bea6 Introduced an intermediate buffer that collects lines before flushing them to the output buffer. 2016-11-16 10:49:18 +08:00
Thomas Harte
ba2adf8bb1 Normalised on std::vector rather than std::unique_ptr<uint8_t *> as (probably?) more idiomatic. Improved structure slightly. Introduced a container for line data, albeit one that isn't yet used. 2016-11-16 10:34:54 +08:00
Thomas Harte
9c550c594a Moved audio work back into its own thread, but this time it queues up an all happens only upon a flush. Hopefully to resolve synchronisation cost concerns. 2016-11-09 21:17:50 -05:00
Thomas Harte
eccfdabeab Temporarily disabled thread hop, until I can find a way to batch these things. 2016-11-03 22:52:02 -04:00
Thomas Harte
4258401384 Implemented flush, added a call to it from the filter speaker's destructor, to ensure no race conditions on accessing the various bits of instance state there and below. 2016-10-19 21:15:04 -04:00
Thomas Harte
c628b7c5c5 This is the real PAL frequency, I think. 2016-10-17 08:05:02 -04:00
Thomas Harte
1f857c619b Fixed timing issues. Static box of frame achieved! 2016-10-12 21:42:36 -04:00
Thomas Harte
00e3ad9b04 Added a bit more ceiling for lowpass filtering on constrained machines. 2016-10-10 07:51:01 -04:00
Thomas Harte
e53455a936 Not having read the C++ synchronisation primitives before, this async task queue is probably incorrect. But nevertheless, let's have a quick go at employing it — in a hideously thread unsafe fashion — for audio generation. What can possibly go wrong? 2016-10-07 16:56:34 -04:00
Thomas Harte
dab3580111 Experimental: can I afford a lower sampling rate if there's a low-pass filter in effect? 2016-08-22 22:18:05 -04:00
Thomas Harte
1541273785 Moved responsibility for throwing in a low-pass filter up to the Vic, appropriately. 2016-08-21 18:13:31 -04:00
Thomas Harte
c783090980 It turns out that the Vic has a 1.6Khz low-pass filter. So added that. 2016-08-21 12:13:41 -04:00
Thomas Harte
fef316932f Moved opening bracket appropriately. 2016-07-04 21:14:28 -04:00
Thomas Harte
8db44eed3e Added a default implementation of Speaker::skip_samples. 2016-07-04 20:48:27 -04:00
Thomas Harte
2bc87ee095 Merge branch 'master' of github.com:TomHarte/CLK 2016-07-01 16:28:18 -04:00
Thomas Harte
eefd0c17b6 Actually, I guess that to fulfil the contract I can't silently decide not to draw if I'm being told I definitely need to draw. 2016-07-01 16:27:45 -04:00
Thomas Harte
ed8f4d0476 Added some minor additional bits of documentation. 2016-06-30 08:46:29 -04:00
Thomas Harte
4ac619f569 glClientWaitSync appears to be a busy wait, at least on my machine. But why wait indefinitely anyway? 2016-06-29 21:32:47 -04:00
Thomas Harte
ff53accca0 Demonstrated that issue is coloured borders, made a guess as to buffer exhaustion, upped limits as a temporary fix. 2016-06-29 21:16:34 -04:00
Thomas Harte
2bd71e7e9b .reset is the more normal way to reassign a unique_ptr. 2016-06-23 20:52:44 -04:00
Thomas Harte
c18cc4c8f5 It appears the Vic's output is sine-ish, after all. Also adjusted centre of display, simultaneously adding some validation on that. 2016-06-14 07:29:35 -04:00
Thomas Harte
fcf4b14344 Extended to allow floating-point sampling rates. Which makes sense. 2016-06-13 19:30:41 -04:00
Thomas Harte
2992183aae Switched to a lookup table for phase, temporarily in YUV colour space, probably. Working on it. 2016-06-12 14:39:17 -04:00
Thomas Harte
68a8851c52 Increased parallelism, allowing a simplification in the GL view. 2016-06-02 22:29:09 -04:00
Thomas Harte
1e0fcbbee8 Made a very basic stab at a couple of the tone generators, added straight-through path for the speaker when input rate exactly equals output rate. 2016-06-01 19:53:16 -04:00
Thomas Harte
5c4f35e13f Finally started on generalising the C++ stuff so as to be able to be able to get a working audio binding on the OS-specific side without further repetition by factoring an appropriate protocol out from the Electron and sketching out the correct speaker class for the Atari. Added a method to ask it what a good output frequency would be. 2016-05-31 21:23:44 -04:00
Thomas Harte
4ad074fc78 Introduced a four-cycle delay between playfield fetch and display, curing Yar's Revenge. Also disabled barrel roll scanling colouring again. I really need to make my mind up on that. 2016-05-16 19:55:56 -04:00
Thomas Harte
9d92ad659f Established the basic timing loop, albeit without clocking delays yet. 2016-05-16 08:01:29 -04:00
Thomas Harte
00a2b42080 Made thread-safe. 2016-05-15 15:19:52 -04:00
Thomas Harte
091516e3cb The semantics might need better exposition but: fixed UniformXfv calls plus matrix calls, documented new semantics on all setters. 2016-05-15 14:59:59 -04:00
Thomas Harte
328fabcd10 Ensured values aren't dangling pointers. 2016-05-14 18:15:10 -04:00
Thomas Harte
492dc7ccbf Made an attempt to queue uniform changes until the next call to bind. That's to allow usage from other threads. 2016-05-14 18:06:55 -04:00
Thomas Harte
30f335fa35 Switched pervasively to using the named slot uniform setters on Shader. 2016-05-13 22:08:32 -04:00
Thomas Harte
8d52765f40 Realised why new shaders weren't taking. Very negligibly decreased Atari drawing cost. 2016-05-12 22:22:24 -04:00