Merge pull request #86 from skylersaleh/ColorDepthCacheUpdates

Color and depth cache updates
This commit is contained in:
wheremyfoodat 2023-07-09 00:15:11 +03:00 committed by GitHub
commit b2c6a5e801
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View file

@ -43,8 +43,8 @@ class Renderer {
float oldDepthOffset = 0.0;
bool oldDepthmapEnable = false;
SurfaceCache<DepthBuffer, 10> depthBufferCache;
SurfaceCache<ColourBuffer, 10> colourBufferCache;
SurfaceCache<DepthBuffer, 10, true> depthBufferCache;
SurfaceCache<ColourBuffer, 10, true> colourBufferCache;
SurfaceCache<Texture, 256, true> textureCache;
OpenGL::uvec2 fbSize; // The size of the framebuffer (ie both the colour and depth buffer)'

View file

@ -46,7 +46,7 @@ public:
OptionalRef findFromAddress(u32 address) {
for (auto& e : buffer) {
if (e.location == address && e.valid)
if (e.location <= address && e.location+e.sizeInBytes() > address && e.valid)
return e;
}

View file

@ -60,8 +60,10 @@ struct ColourBuffer {
void free() {
valid = false;
if (texture.exists() || fbo.exists())
Helpers::panic("Make this buffer free itself");
if (texture.exists() || fbo.exists()){
texture.free();
fbo.free();
}
}
bool matches(ColourBuffer& other) {
@ -128,8 +130,10 @@ struct DepthBuffer {
}
void free() {
if(texture.exists()){
texture.free();
}
valid = false;
printf("Make this depth buffer free itself\n");
}
bool matches(DepthBuffer& other) {