gonetz / GLideN64

A new generation, open-source graphics plugin for N64 emulators.
Other
769 stars 178 forks source link

[Feature Request] Add support for frame buffer extension API #808

Closed gonetz closed 8 years ago

gonetz commented 8 years ago

Need to implement the following extension to Zilmar's specs:

/** Function: FrameBufferRead Purpose: This function is called to notify the dll that the frame buffer memory is beening read at the given address. DLL should copy content from its render buffer to the frame buffer in N64 RDRAM DLL is responsible to maintain its own frame buffer memory addr list DLL should copy 4KB block content back to RDRAM frame buffer. Emulator should not call this function again if other memory is read within the same 4KB range input: addr rdram address val val size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32 output: none ***/ EXPORT void CALL FBRead(wxUint32 addr)

/** Function: FrameBufferWriteList Purpose: This function is called to notify the dll that the frame buffer has been modified by CPU at the given address. input: FrameBufferModifyEntry plist size = size of the plist, max = 1024 output: none **/ EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32 size)

/** Function: FrameBufferWrite Purpose: This function is called to notify the dll that the frame buffer has been modified by CPU at the given address. input: addr rdram address val val size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32 output: none ***/ EXPORT void CALL FBWrite(wxUint32 addr, wxUint32 size)

/**** Function: FBGetFrameBufferInfo Purpose: This function is called by the emulator core to retrieve frame buffer information from the video plugin in order to be able to notify the video plugin about CPU frame buffer read/write operations

size: = 1 byte = 2 word (16 bit) <-- this is N64 default depth buffer format = 4 dword (32 bit)

when frame buffer information is not available yet, set all values in the FrameBufferInfo structure to 0

input: FrameBufferInfo pinfo[6] pinfo is pointed to a FrameBufferInfo structure which to be filled in by this function output: Values are return in the FrameBufferInfo structure Plugin can return up to 6 frame buffer info ****/ EXPORT void CALL FBGetFrameBufferInfo(void *p)

purplemarshmallow commented 8 years ago

@purplemarshmallow It can be not so easy. If FBRead will be called before FBWrite, RDRAM will be broken.

This still sounds like a problem on 1964's part. The emulator must call FBwrite immediately and this will warn the plugin.

@purplemarshmallow if you're interested in figuring out how to speed up LLE performance in GLideN64, a great game to test is Tower & Shaft. It hardly uses the RSP, yet LLE is significantly slower than HLE with GLideN64.

Thanks. This might be a good game to test

weinerschnitzel commented 8 years ago

For emulator, ignore FBRead if FBWrite has not been called at least once?

purplemarshmallow commented 8 years ago

If FBwrite is called then GLideN64 ignores FBread See https://github.com/gonetz/GLideN64/issues/808#issuecomment-162223042

gonetz commented 8 years ago

I added this branch to master.

Test binary: https://drive.google.com/file/d/0B0YqMPjGo3B2RDgwUjJGZTVnRHM/view?usp=sharing