summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Sam Moore [Fri, 25 Apr 2014 16:37:43 +0000 (00:37 +0800)]
Test representations of floats working*
The boat is floating for now, we just need to make sure it doesn't sink.
BitsToReal and BitsFromReal are consistent with each other...
*Actually looking at the results, for <5,10> vs IEEE half precision... something is wrong
The plot still looks float-ish though.
Sam Moore [Wed, 23 Apr 2014 16:36:25 +0000 (00:36 +0800)]
Yeah it's broken
Sam Moore [Wed, 23 Apr 2014 16:33:13 +0000 (00:33 +0800)]
Change float representations to be more IEEE-ish
Implemented BitsToReal WRONGLY for like 6 hours.
It's probably still wrong. It works for 8 bit (2,5) floats but probably only because I got lucky.
I am a bit shit at bit shifting.
Sam Moore [Tue, 22 Apr 2014 18:00:24 +0000 (02:00 +0800)]
Tester for exploring the mapping of a float to a real
To visualise the mapping and how you get the trade off between precision and range.
Use low precision, custom, float representations.
Convert via memcpy(3) and copious bit shifting to a Real
Even though Real is actually also a float (default double) at the moment, it's good enough to treat as being an exact representation
when the custom float is 8 bits. Besides, gnuplot can only plot within double precision anyway.
I say "custom" because I have an explicit sign bit for the exponent, which itself is unsigned.
I *think* standard representations have the exponent be a signed int so the sign bit is implied.
Not sure why the mantissa is treated as being unsigned with an explicit sign bit but the exponent isn't?
HFPA says the exponent is between e_min and e_max which is a bit confusing. Is e_min != -e_max normally?
Will do some plots and experiment a bit after sleep.
Sam Moore [Tue, 22 Apr 2014 10:34:43 +0000 (18:34 +0800)]
Tester based on Handbook of Floating-Point Arithmetic 1.1
See also ipdf/documents
David Gow [Tue, 22 Apr 2014 08:35:52 +0000 (16:35 +0800)]
Hideously useless buffer perf optimization.
Sam Moore [Tue, 22 Apr 2014 07:53:33 +0000 (15:53 +0800)]
Fix Makefile
The $(BIN) target needed to include the dependencies for header files included via main.cpp
David Gow [Tue, 22 Apr 2014 07:43:45 +0000 (15:43 +0800)]
Horrible debug font bufferification. (Sorry)
David Gow [Tue, 22 Apr 2014 03:29:25 +0000 (11:29 +0800)]
Don't re-render the display if nothing has changed
We now render to an offscreen buffer, and blit that
to the screen. This probably breaks the bitmap stuff, and I'll
fix that soon.
David Gow [Tue, 22 Apr 2014 02:14:55 +0000 (10:14 +0800)]
Slightly less broken GraphicsBuffer implementation.
I copied the original out of some terrible code I'd
written ages ago. It now is less overtly broken.
I'd still like to do an optimized version with Persistant
Mapped Buffers and manual memory control, but that can wait
until post-shaderification.
Sam Moore [Mon, 21 Apr 2014 16:55:49 +0000 (00:55 +0800)]
Real that uses Fast2Sum for addition
I have a feeling this isn't going to improve things at all.
Sam Moore [Mon, 21 Apr 2014 08:47:20 +0000 (16:47 +0800)]
Ability to define Real as long double
`make DEF=-DREAL=2` to compile using long double as Real
Also changed calculatepi to include long double.
And also, only actually integrate using Real if it is something other than float, double, long double.
Sam Moore [Mon, 21 Apr 2014 06:27:00 +0000 (14:27 +0800)]
Remove DebugDumpObjects call
You almost crashed my gedit embedded terminal plugin!
David Gow [Mon, 21 Apr 2014 05:46:46 +0000 (13:46 +0800)]
Store everything in a VBO, making things faster.
Also 1024*1024 grid of boxes, for extreme slowness. Yay!
David Gow [Mon, 21 Apr 2014 04:35:36 +0000 (12:35 +0800)]
Merge branch 'master' of git.ucc.asn.au:ipdf/code
Conflicts:
src/Makefile
src/main.h
src/real.h
src/screen.cpp
src/view.h
This was one hell of a merge. I have more code coming, but
it breaks other things, so it'll take a little while.
David Gow [Sun, 20 Apr 2014 04:31:41 +0000 (12:31 +0800)]
Support doing coordinate transforms on the CPU
So because OpenGL (by default at least), does everything with
32-bit IEEE floats, even when our "Real" type is a double, we lost
precision when rendering it.
This commit adds support for running the coordinate transform on the
CPU using the Real datatype, and only truncating the results, making
things work properly with doubles. This will be slower on documents
with a large number of objects, but there's no real difference in
our unoptimized code at the moment.
Right-click to switch between CPU and GPU transforms.
David Gow [Sat, 19 Apr 2014 12:46:15 +0000 (20:46 +0800)]
Hacky debug font system, performance counter.
Sam Moore [Thu, 17 Apr 2014 12:04:35 +0000 (20:04 +0800)]
Allow setting type of Real at compilation time
Use a REAL preprocessor definition.
Pass it from the Makefile in variable DEF
Can change using `make DEF=REAL=X`
Also allowed changing bounds with arguments in main.
Probably not that useful. Might remove later.
Tried to make a tester that overlays a series of BMPs but
the RenderBMP -> ScreenShot approach only works once; subsequent attempts lead to entirely filled images.
Sam Moore [Thu, 17 Apr 2014 06:31:36 +0000 (14:31 +0800)]
Merge branch 'master' of git.ucc.asn.au:/ipdf/code
Conflicts:
src/screen.cpp
David's way is better.
Sam Moore [Thu, 17 Apr 2014 06:05:34 +0000 (14:05 +0800)]
Fix Screen::ScreenShot
Something to do with the OpenGL buffers meant that the rendered BMP wasn't in the buffer before the glReadPixels call.
I have no idea why the screenshot worked for the rectangles and not for a texture, but oh well.
David Gow [Thu, 17 Apr 2014 06:00:16 +0000 (14:00 +0800)]
Bunch-a-bugfixes!
- Screenshots work properly.
- Alpha works properly
- New screen clear function, so we don't throw away things we need.
Sam Moore [Thu, 17 Apr 2014 05:02:02 +0000 (13:02 +0800)]
Fix colour in ScreenShot
GL_RGBA -> GL_BGRA
Although... should probably have a means to detect which it is supposed to be
since it might be different on other machines?
David Gow [Thu, 17 Apr 2014 02:52:45 +0000 (10:52 +0800)]
Merge branch 'master' of git.ucc.asn.au:ipdf/code
Sam Moore [Wed, 16 Apr 2014 18:00:36 +0000 (02:00 +0800)]
Can render a BMP but things are still going wrong
If Screen::RenderBMP is called before Screen::ScreenShot, the resulting BMP is blank.
NOTE: Testing colours: If -c 1 0 0 1 is passed, rectangle is rendered RED.
However, if Screen::ScreenShot is called, the rectangle is BLUE.
Something stupid going on with colours?
Tried messing with alpha channel, but things seem to always render regardless of their alpha value.
Should give up and do something actually important.
Sam Moore [Wed, 16 Apr 2014 16:22:06 +0000 (00:22 +0800)]
Implement Pointless Broken Things
Trying to overlay the screenshot on an existing bmp to make it easier to combine the outputs of
different implementations (ie: Recompile program with a different typedef instead of using templates).
Rendering the existing bmp is proving to be a pain.
This is also using ancient opengl.
Cannot see what is wrong. I get something in the window but it does not resemble the bmp I saved at all.
And then the screenshot of *that* is just totally black.
Sam Moore [Tue, 15 Apr 2014 18:34:15 +0000 (02:34 +0800)]
Add grid lines
It seemed like a good idea at the time.
Sam Moore [Tue, 15 Apr 2014 17:50:18 +0000 (01:50 +0800)]
Screenshot using glReadPixels instead
Which SDL2 is calling underneath somewhere in that "SDL_RenderReadPixels" call.
Sam Moore [Tue, 15 Apr 2014 17:19:33 +0000 (01:19 +0800)]
Screenshot using convoluted SDL2 approach
David has just told me I should have used glReadPixels
Stay tuned for another commit.
Sam Moore [Mon, 14 Apr 2014 16:29:51 +0000 (00:29 +0800)]
Actual fix for when `uname -i` doesn't work
Just use `uname -m`
Sam Moore [Mon, 14 Apr 2014 15:28:19 +0000 (23:28 +0800)]
Reflect fixes to I/O in ipdf/vfpu
Commits in ipdf/vfpu:
354bf006d86abdfad9dbb915facec36f99af77bc
e005897cffaf46cbbed14b3cc1ef74a390c93fef
Only using 1 hex character for opcode (3 bits) and rmode (2 bits) as opposed to 1 char per bit (...)
Also no need to print extra newline; it was a bug in ipdf/vfpu
Sam Moore [Fri, 11 Apr 2014 09:31:41 +0000 (17:31 +0800)]
Remove REAL_HALF as it doesn't actually implement a half precision float
More to it than just masking bits because the sizes of the exponent differ.
Could just mask bits in the mantissa but I have horrible plans involving VFPU...
Sam Moore [Fri, 11 Apr 2014 07:12:30 +0000 (15:12 +0800)]
Allow VFPU to save output vcd file
That was amazingly simple.
Can run `gtkwave` on the output vcd file to see all the signals!
Sam Moore [Fri, 11 Apr 2014 05:36:31 +0000 (13:36 +0800)]
Modify symlinks
Using a symlink to a symlink... I don't know why. Because I can.
Sam Moore [Fri, 11 Apr 2014 05:30:53 +0000 (13:30 +0800)]
Add rounding mode to VFPU
For some reason it needs an extra newline?
It would be much better if this used binary read/write.
Will look into getting that to happen in the ipdf/vfpu repo at some point.
Sam Moore [Wed, 9 Apr 2014 17:45:06 +0000 (01:45 +0800)]
VFPU now using std::bitset instead of just float typedef
It's still 32 bits. However it might not break if I change it?
Can't test it at the moment because the virtual FPU is 32 bits still.
Sam Moore [Wed, 9 Apr 2014 15:41:58 +0000 (23:41 +0800)]
An interface for a FPU compiled from VHDL
I have tested with the FPU from https://github.com/jop-devel/jop
The way this works is really awful...
1. Make (or steal from jop) a VHDL FPU
2. Make (or steal from jop) a testbench that uses stdio to read operands and ops
- The jop one reads from a generated file, but it is trivial to change to "STD_INPUT" and remove all the assertion tests.
3. Compile testbench into an executable with ghdl
4. Call VFPU::Start which does the following:
- Create a socketpair(2)
- fork(2) and in the child dup(2) stdin/stdout to the socketpair
- Redirect stderr to /dev/null because the testbench generates 10^3 warning messages
- in the child, exec(3) the testbench FPU
5. Call VFPU::Exec passing the desired operands and opcodes
- The operands and opcodes are written as hex strings over the socketpair
- The child executing the FPU program does its thing
- The result is read back as a hex string
6. When finished, call VFPU::Halt to kill(2) the FPU
I tried to get ghdl and gcc/g++ to make a static library to call ghdl_main instead
of exec'ing things. But that didn't work. The fork and socketpair would have still been
required for that approach anyway.
TODO:
- Make the interface (not the FPU) deal with arbitrary size registers
- Wrap a Real type around it so we can #define REAL_SIMULATED_FPU
I haven't put any of the VHDL in the git repo for obvious reasons.
If I actually start messing with it, it will probably get a seperate repo.
This may end up being a complete waste of time?
Although potentially being able to run an arbitrary FPU albeit in a horrible manner does seem cool.
David Gow [Wed, 9 Apr 2014 12:17:14 +0000 (20:17 +0800)]
Merge branch 'master' of git.ucc.asn.au:ipdf/code
David Gow [Wed, 9 Apr 2014 08:22:34 +0000 (16:22 +0800)]
Fix RealToFloat test (hopefully)
Sam Moore [Wed, 9 Apr 2014 08:10:27 +0000 (16:10 +0800)]
Use x86_64 when uname is broken
Wierd...
>> sam@daedalus:~$ uname -i
>> unknown
>> sam@daedalus:~$ uname -a
>> Linux daedalus 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux
David Gow [Wed, 9 Apr 2014 08:01:54 +0000 (16:01 +0800)]
Zoom in and out with the mouse wheel.
Note that zoom-out is totally broken with half-precision,
so single-precision is the default. You can still see some artefacts
in single precision mode if you zoom in enough.
Zoom into the corner of a rectangle and then click on the corner an try to drag it.
Eventually you'll notice the reduced precision, and the rectangle will jump around.
David Gow [Wed, 9 Apr 2014 06:54:25 +0000 (14:54 +0800)]
Don't get Filled and Outline the wrong way around.
David Gow [Wed, 9 Apr 2014 06:40:43 +0000 (14:40 +0800)]
You can move around a document with Click+Drag!
Uses some scary C++11 features, so no idea if this will break the CS Lab machines
and their ancient version of gcc.
David Gow [Mon, 7 Apr 2014 04:28:51 +0000 (12:28 +0800)]
It works on the lab machines now, I swear.
David Gow [Mon, 7 Apr 2014 04:18:23 +0000 (12:18 +0800)]
Magic SDL2 sauce! Now with 32-bit!
(My deepest and most sincere apologies to anyone who tries to read the Makefile now)
David Gow [Mon, 7 Apr 2014 03:58:59 +0000 (11:58 +0800)]
David's secret SDL2 magic sauce!
Sam Moore [Thu, 3 Apr 2014 09:19:35 +0000 (17:19 +0800)]
Add tester for numerical calculation of PI
Calculate PI using float, double and Real and compare the error and performance.
Traditional floats have a point (hardware dependent) where the error starts to behave unpredictably
rather than decreasing with number of intervals - due to rounding/precision errors.
Can see that doubles are better than single precision floats but they still do it.
An infinite precision Real would not have these problems (hah!)
We can at least aim to do better than double.
Based on PHYS CQM/pprog courses from 2012.
Should probably find a literature reference for this.
David Gow [Mon, 31 Mar 2014 12:48:09 +0000 (20:48 +0800)]
Save/Load chunks.
Sam Moore [Wed, 26 Mar 2014 17:42:04 +0000 (01:42 +0800)]
Tester to compare custom Real to IEEE float
Also got the endianness right this time. I think.
Sam Moore [Wed, 26 Mar 2014 17:20:20 +0000 (01:20 +0800)]
Make real.h so we can change reals
Needed to fix view.cpp to call Float where it expects GLfloat
Had an attempt at making a half precision float, but it didn't go very well.
I don't think half precision floats are *that* terrible...
Probably got the bit masking wrong.
Sam Moore [Wed, 26 Mar 2014 16:27:44 +0000 (00:27 +0800)]
Merge branch 'master' of git.ucc.asn.au:/ipdf/code
Conflicts:
src/main.cpp
Fixed that and also fixed other things.
Sam Moore [Wed, 26 Mar 2014 16:17:12 +0000 (00:17 +0800)]
Tweak Makefile to make testing nicer
Who said you needed fancy high level languages to do unit testing?
It can't just be done using Make though; a bash script was also needed.
David Gow [Wed, 26 Mar 2014 16:15:01 +0000 (00:15 +0800)]
Crazy std::vector<T> loader and saver.
David Gow [Wed, 26 Mar 2014 15:57:37 +0000 (23:57 +0800)]
CMake support. We don't have to use it, but it's there if we do.
David Gow [Wed, 26 Mar 2014 10:54:18 +0000 (18:54 +0800)]
It now is all the working.
David Gow [Wed, 26 Mar 2014 10:50:28 +0000 (18:50 +0800)]
Merge branch 'master' of git.ucc.asn.au:ipdf/code
Sam Moore [Wed, 26 Mar 2014 10:50:14 +0000 (18:50 +0800)]
Add ObjectType for Object Type
David Gow [Wed, 26 Mar 2014 10:49:25 +0000 (18:49 +0800)]
Initial outline rendering.
Sam Moore [Wed, 26 Mar 2014 10:23:11 +0000 (18:23 +0800)]
Implement document saving and loading
Also implemented a tester to test it doesn't explode.
We should set this up to make replacing main() easy.
David Gow [Wed, 26 Mar 2014 10:17:00 +0000 (18:17 +0800)]
All of the SDL2 graphics stuff.
(With deprecated, obsolete OpenGL functions! Woo!)
David Gow [Wed, 26 Mar 2014 09:19:13 +0000 (17:19 +0800)]
Fix makefile.
Sam Moore [Wed, 26 Mar 2014 09:17:14 +0000 (17:17 +0800)]
Added Document and View classes
And member functions for doing stuff.
Document Format completed (not really).
Sam Moore [Wed, 26 Mar 2014 08:33:02 +0000 (16:33 +0800)]
ipdf.h and Real type
Real == float for now. Can make a class and overload it later.
Naming convention:
void ThisIsAFunction(Type this_is_a_var);
David Gow [Wed, 26 Mar 2014 08:29:53 +0000 (16:29 +0800)]
Some makefile changes
Sam Moore [Wed, 26 Mar 2014 08:20:30 +0000 (16:20 +0800)]
Add basic code
Log functions & Makefil
David Gow [Wed, 26 Mar 2014 07:36:34 +0000 (15:36 +0800)]
The code repository exists....?
UCC git Repository :: git.ucc.asn.au