Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CosmosOS RenderSurface Developing #31

Open
prepare opened this issue Jul 4, 2018 · 24 comments
Open

CosmosOS RenderSurface Developing #31

prepare opened this issue Jul 4, 2018 · 24 comments

Comments

@prepare
Copy link
Member

prepare commented Jul 4, 2018

CosmosOS Render Surface

1st thing, Thank you to all developers of the CosmosOS for their C# OS.

2nd , It would be 'another way' to help its GUI system with our 'Rendering Tech'.

AIMS :

To Bring the PixelFarm (pure C# software part) + Typography + HtmlRenderer to the CosmosOS.


I create a project that track some problems to visit it again =>here


Hello @jp2masa, @fanoI

since I'm very new to the CosmosOS,

I may ask you something that look easy to you, but please help me too.

I create an issue here since this is in early development stage.
=> so this will not interrupt your Github issue panel.


(I have to modify some parts of current PixelFarm)

This is a snapshot with bugs

This is a red polygon that is 'painted' with a MiniAggPainter (pure C# software renderer).
(a blue rect is painted with original cosmos)

cosmos_02

pic 1: a MiniAggPainter paints a red polygon on left-upper corner, Cosmos, SVGAII


Yes with Antialias side and another side still has bug (no AA)

cosmos_03

pic 2: Zoom in,with AA and Bugs


Compare with PixelFarm on Win7

This is a reference img.

cosmos_px_ref1

pic 3: same code, on Win7, and zoom pic

2 pictures (pic 1 and 3) are generated with the 'same' PixelFarm code.

I will analyze the bug later.


I think it may not too long way :)

@prepare
Copy link
Member Author

prepare commented Jul 4, 2018

@prepare
Copy link
Member Author

prepare commented Jul 6, 2018

Today, I've fixed that bug in my lib.

And This is the result :)

cosmos_04

pic 4: Anti-alias polygon! , MiniAgg painting on Cosmos Render Surface

On the 'same' .netstd code =>
The same rendering quality when compare with MiniAgg on Win7 (pic 3),

@prepare
Copy link
Member Author

prepare commented Jul 6, 2018

32 bits color blending

cosmos_06

pic 5: Yellow polygon with alpha channel = 180, Cosmos OS, SVGAII


cosmos_07

pic 5: Yellow polygon with alpha channel = 180, Cosmos OS, SVGAII


What Next ? =>
Text Rendering with Typography.

@prepare
Copy link
Member Author

prepare commented Jul 6, 2018

Hello @valentinbreiz,

I invite you to visit here :)

This may help your Aura-Operating-System.


I may ask some help from you too, about how to generate SSE from IL2CPU


@prepare
Copy link
Member Author

prepare commented Jul 6, 2018

Our pure C# Software renderer (PixelFarm's MiniAgg)
is ported from @larsbrubaker 's agg-sharp. 👍

@fanoI
Copy link

fanoI commented Jul 7, 2018

Excellent work!

But are you using CGS (Cosmos Graphic Subsystem) as backend to do this?

@prepare
Copy link
Member Author

prepare commented Jul 7, 2018

Yes, I will contribute back.

Very Simple=> I just modify your code , and add another method called 'Blit(srcX,srcY,srcW,srcH, destX,destY).

I use 32 bits int[] Bitmap buffer internally
and I just 'Blit' it to the screen buffer surface.

:)


@prepare
Copy link
Member Author

prepare commented Jul 7, 2018

The PixelFarm render everything independently from the Host platform.

so It render as it run on Win7.

Then I just blits the output to screen buffer

@fanoI
Copy link

fanoI commented Jul 7, 2018

Excellent! It was exactly how I imagined this should have been done.

@valentinbreiz
Copy link

Wow great work @prepare!

@prepare
Copy link
Member Author

prepare commented Jul 8, 2018

I push the code of the example above to the github in 2 repo

  1. CosmosOS=> use this dev branch => prepare/Cosmos@6d945ee. You will see I modify some parts of the original.

  2. PixelFarm => use this cosmos_01 branch => https://github.com/PaintLab/PixelFarm/tree/cosmos_01


Solution Explorer View

cosmos_px_sln

pic 1: I add a reference to PixelFarm.Cosmos.One project (red boxes)


Test with (latest) fresh build again. This is a result.

Red and yellow polygons on left upper corner on black bg, 100x100px, is blitted from PixelFarm.

The blue and green rects are render with original CGS.

cosmos_08

pic 2: red and yellow polygon on left upper corner, 100x100px, is blitted from PixelFarm

@valentinbreiz
Copy link

Is it fast?

@prepare
Copy link
Member Author

prepare commented Jul 8, 2018

In this version. It is not fast as I think.

Below gif image shows my screen recording.

Render each image (800 x 600 px) frame every 10 ms => I found some flickers...

(the gif format lowers that actual image quality, but you can see color blend and antialias)

test01

pic 1: some flickers between each frame


I think the bottle neck may be in 'Blit' step (from internal int[] buffer to screen buffer).

I need to do some investigation about how can it be done faster.

(eg. how to swap screen buffer by switching screen's frame-buffer memory pointer)


@prepare
Copy link
Member Author

prepare commented Jul 8, 2018

I will add FPS info (text) on-screen soon

@prepare
Copy link
Member Author

prepare commented Jul 8, 2018

A software-rendering part of the PixelFarm (MiniAgg) is not slow.

The following gif is on Win7

This is a reference images

reference_on_win7

pic 1: software-only, MiniAgg, win7, 800 x 600px

(Each frame, starts from: Vectex list => scanline => internal-32-img-buffer =>Blit to Win7 Hdc)

I think Cosmos render surface should be in the same speed level ?

@fanoI
Copy link

fanoI commented Jul 9, 2018

I ask you to create a Pull Request so we can comment your modifications on the official Cosmos repository.
I've looked fast to what you had done and I think the Blit method should be part of the Canvas Abstract Class on the System ring not of the SVGA driver in the HAL ring.
This work should be - obviously - usable by Bochs and any GPU we want to support.

We had already predisposed a method similar to "blit" in Canvas:

https://github.com/CosmosOS/Cosmos/blob/master/source/Cosmos.System2/Graphics/Canvas.cs#103

and this from that you have to start.

You will have to overwrite this method in SVGAScreen and VBEScreen (Bochs GPU not real VBE), so if SVGA has hardware acceleration for this you can optimize for it... for VBE you surely have to use some sort of "memcpy" you can try to follow what I've done for Fill (memset) to optimize it with SSE.

@prepare
Copy link
Member Author

prepare commented Jul 9, 2018

@fanoI , I sent the pull request => CosmosOS/Cosmos#1005


Thank you, I'm very new to the Cosmos and SVGA.

so Feel free to edit/ comment until it fit what you need.

Then I will pull it back.

@prepare
Copy link
Member Author

prepare commented Jul 10, 2018

IL2CPU can't compile Typography.

(not about Plug missing).

I will report error later.

@valentinbreiz
Copy link

Any news about your work on Cosmos ? :)

@prepare
Copy link
Member Author

prepare commented Sep 3, 2018

Running on Cosmos is my dream!

But these next 2-3 weeks are too busy.

Then I will revisit this ...

IL2CPU can't compile Typography.

again :)

@valentinbreiz
Copy link

Cool :)

@fanoI
Copy link

fanoI commented Sep 4, 2018

OK in some way I've worked for you too these summer holidays, I've added a very fast MemoryOperation.Copy now VBE is able to show Bitmap very fast! DrawFilledRectangle has been optimized too...

@MishaTy
Copy link

MishaTy commented Dec 1, 2020

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants