Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    177
  • comments
    531
  • views
    164122

I want D3DFMT_P9 not P8 :(

Sign in to follow this  
Scet

176 views

So anyway the reason I haven't updated this thing(with any real posts) is because I've been trying to rewrite the graphics core so it wasn't a complete hack.

First attempt:
There are 4 256x256 background textures and 12 sprite textures(due to various sizes). To write a pixel I had to lock each one, plus I had to do the conversion between B5G5B5(GBA format) and A1R5G5B5 for each write. When (finally) done with the texture I would use the D3DXsprite interface to draw it. I got stuck here when it came to rotation and alpha blending.

Second:
The screen is one big 256x256 byte array and I'm using a D3DFMT_P8 surface. It was great at first and really fast. Then I got to adding the second palette. I had to put 512 colours on a P8 surface and well that didn't work too well.

Third:
A big 256x256 long array using A8R8G8B8 format. Rather than do the conversions per pixel I just have a 512 long array and calculate them at vblank. So to write a pixel I just do: "ScreenMemory[Y][X]=Palette[Number]" not as fast as P8 but multiple palettes and alpha blending shouldn't be an issue.

And to render the screen now instead of multiple D3DXSprite calls I can just:

BBuffer.GetBackBuffer(0);
TileSrfc.LoadMemory((unsigned long *)ScreenMemory,1024,D3DFMT_A8R8G8B8,D3DX_FILTER_NONE,NULL);
TileSrfc.Copy(0,0,240,160, BBuffer);
BBuffer.Release();

(I made my own surface class)

Here's another screenshot to arouse you:



(again this isn't the actual game, just a dump of the video ram)

(the shitty FPS is from D3D streching the backbuffer, at 1x it's 60FPS)
Sign in to follow this  


3 Comments


Recommended Comments

Emulator authors make my programming life approximately 284.23 times easier. I salute you!

Share this comment


Link to comment
Emulator authors that add debugger tools like in VBA, make my programming life approximately 284.24 times easier. I salute them!

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!