mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-10 19:12:12 +00:00
Remove fbo_preferred_z_bitdepth
This commit is contained in:
parent
e42f5e6f46
commit
be557fc323
@ -485,11 +485,6 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
}
|
||||
}
|
||||
|
||||
// HACK
|
||||
int fbo_preferred_z_bitdepth() {
|
||||
return 24;
|
||||
}
|
||||
|
||||
GPU_GLES::~GPU_GLES() {
|
||||
framebufferManagerGL_->DestroyAllFBOs(true);
|
||||
shaderManagerGL_->ClearCache(true);
|
||||
@ -610,14 +605,15 @@ void GPU_GLES::CheckGPUFeatures() {
|
||||
features |= GPU_SUPPORTS_TEXTURE_FLOAT;
|
||||
|
||||
// If we already have a 16-bit depth buffer, we don't need to round.
|
||||
if (fbo_preferred_z_bitdepth() > 16) {
|
||||
bool prefer24 = draw_->GetDeviceCaps().preferredDepthBufferFormat == Draw::DataFormat::D24_S8;
|
||||
if (prefer24) {
|
||||
if (!g_Config.bHighQualityDepth && (features & GPU_SUPPORTS_ACCURATE_DEPTH) != 0) {
|
||||
features |= GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT;
|
||||
} else if (PSP_CoreParameter().compat.flags().PixelDepthRounding) {
|
||||
if (!gl_extensions.IsGLES || gl_extensions.GLES3) {
|
||||
// Use fragment rounding on desktop and GLES3, most accurate.
|
||||
features |= GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT;
|
||||
} else if (fbo_preferred_z_bitdepth() == 24 && (features & GPU_SUPPORTS_ACCURATE_DEPTH) != 0) {
|
||||
} else if (prefer24 && (features & GPU_SUPPORTS_ACCURATE_DEPTH) != 0) {
|
||||
// Here we can simulate a 16 bit depth buffer by scaling.
|
||||
// Note that the depth buffer is fixed point, not floating, so dividing by 256 is pretty good.
|
||||
features |= GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT;
|
||||
|
@ -567,8 +567,6 @@ public:
|
||||
virtual void CopyFramebufferImage(Framebuffer *src, int level, int x, int y, int z, Framebuffer *dst, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth) = 0;
|
||||
virtual bool BlitFramebuffer(Framebuffer *src, int srcX1, int srcY1, int srcX2, int srcY2, Framebuffer *dst, int dstX1, int dstY1, int dstX2, int dstY2, int channelBits, FBBlitFilter filter) = 0;
|
||||
|
||||
virtual int fbo_preferred_z_bitdepth() = 0;
|
||||
|
||||
// These functions should be self explanatory.
|
||||
virtual void BindFramebufferAsRenderTarget(Framebuffer *fbo) = 0;
|
||||
// color must be 0, for now.
|
||||
|
@ -41,21 +41,19 @@ public:
|
||||
ShaderModule *CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize) override;
|
||||
Framebuffer *CreateFramebuffer(const FramebufferDesc &desc) override;
|
||||
|
||||
void fbo_copy_image(Framebuffer *src, int level, int x, int y, int z, Framebuffer *dst, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth) override;
|
||||
void CopyFramebufferImage(Framebuffer *src, int level, int x, int y, int z, Framebuffer *dst, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth) override;
|
||||
bool BlitFramebuffer(Framebuffer *src, int srcX1, int srcY1, int srcX2, int srcY2, Framebuffer *dst, int dstX1, int dstY1, int dstX2, int dstY2, int channelBits, FBBlitFilter filter) override;
|
||||
|
||||
int fbo_preferred_z_bitdepth() override;
|
||||
|
||||
// These functions should be self explanatory.
|
||||
void BindFramebufferAsRenderTarget(Framebuffer *fbo) override;
|
||||
// color must be 0, for now.
|
||||
void fbo_bind_as_texture(Framebuffer *fbo, int binding, FBChannel channelBit, int attachment) override;
|
||||
void fbo_bind_for_read(Framebuffer *fbo) override;
|
||||
void BindFramebufferAsTexture(Framebuffer *fbo, int binding, FBChannel channelBit, int attachment) override;
|
||||
void BindFramebufferForRead(Framebuffer *fbo) override;
|
||||
|
||||
void fbo_bind_backbuffer_as_render_target() override;
|
||||
uintptr_t fbo_get_api_texture(Framebuffer *fbo, int channelBit, int attachment) override;
|
||||
void BindBackbufferAsRenderTarget() override;
|
||||
uintptr_t GetFramebufferAPITexture(Framebuffer *fbo, int channelBit, int attachment) override;
|
||||
|
||||
void fbo_get_dimensions(Framebuffer *fbo, int *w, int *h) override;
|
||||
void GetFramebufferDimensions(Framebuffer *fbo, int *w, int *h) override;
|
||||
|
||||
void BindTextures(int start, int count, Texture **textures) override;
|
||||
void BindSamplerStates(int start, int count, SamplerState **states) override;
|
||||
@ -554,21 +552,19 @@ Framebuffer *D3D11DrawContext::CreateFramebuffer(const FramebufferDesc &desc) {
|
||||
return fb;
|
||||
}
|
||||
|
||||
void D3D11DrawContext::fbo_copy_image(Framebuffer *src, int level, int x, int y, int z, Framebuffer *dst, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth) {}
|
||||
void D3D11DrawContext::CopyFramebufferImage(Framebuffer *src, int level, int x, int y, int z, Framebuffer *dst, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth) {}
|
||||
bool D3D11DrawContext::BlitFramebuffer(Framebuffer *src, int srcX1, int srcY1, int srcX2, int srcY2, Framebuffer *dst, int dstX1, int dstY1, int dstX2, int dstY2, int channelBits, FBBlitFilter filter) { return true; }
|
||||
|
||||
int D3D11DrawContext::fbo_preferred_z_bitdepth() { return 24; }
|
||||
|
||||
// These functions should be self explanatory.
|
||||
void D3D11DrawContext::BindFramebufferAsRenderTarget(Framebuffer *fbo) {}
|
||||
// color must be 0, for now.
|
||||
void D3D11DrawContext::fbo_bind_as_texture(Framebuffer *fbo, int binding, FBChannel channelBit, int attachment) {}
|
||||
void D3D11DrawContext::fbo_bind_for_read(Framebuffer *fbo) {}
|
||||
void D3D11DrawContext::BindFramebufferAsTexture(Framebuffer *fbo, int binding, FBChannel channelBit, int attachment) {}
|
||||
void D3D11DrawContext::BindFramebufferForRead(Framebuffer *fbo) {}
|
||||
|
||||
void D3D11DrawContext::fbo_bind_backbuffer_as_render_target() {}
|
||||
uintptr_t D3D11DrawContext::fbo_get_api_texture(Framebuffer *fbo, int channelBit, int attachment) { return 0; }
|
||||
void D3D11DrawContext::BindBackbufferAsRenderTarget() {}
|
||||
uintptr_t D3D11DrawContext::GetFramebufferAPITexture(Framebuffer *fbo, int channelBit, int attachment) { return 0; }
|
||||
|
||||
void D3D11DrawContext::fbo_get_dimensions(Framebuffer *fbo, int *w, int *h) {
|
||||
void D3D11DrawContext::GetFramebufferDimensions(Framebuffer *fbo, int *w, int *h) {
|
||||
D3D11Framebuffer *fb = (D3D11Framebuffer *)fbo;
|
||||
*w = fb->width;
|
||||
*h = fb->height;
|
||||
|
@ -553,8 +553,6 @@ public:
|
||||
void CopyFramebufferImage(Framebuffer *src, int level, int x, int y, int z, Framebuffer *dst, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth) override {}
|
||||
bool BlitFramebuffer(Framebuffer *src, int srcX1, int srcY1, int srcX2, int srcY2, Framebuffer *dst, int dstX1, int dstY1, int dstX2, int dstY2, int channelBits, FBBlitFilter filter) override;
|
||||
|
||||
int fbo_preferred_z_bitdepth() override { return 24; }
|
||||
|
||||
// These functions should be self explanatory.
|
||||
void BindFramebufferAsRenderTarget(Framebuffer *fbo) override;
|
||||
// color must be 0, for now.
|
||||
@ -664,7 +662,9 @@ D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, ID
|
||||
caps_.multiViewport = false;
|
||||
caps_.anisoSupported = true;
|
||||
caps_.depthRangeMinusOneToOne = false;
|
||||
|
||||
caps_.preferredDepthBufferFormat = DataFormat::D24_S8;
|
||||
caps_.dualSourceBlend = false;
|
||||
caps_.tesselationShaderSupported = false;
|
||||
if (d3d) {
|
||||
D3DDISPLAYMODE displayMode;
|
||||
d3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &displayMode);
|
||||
|
@ -523,8 +523,6 @@ public:
|
||||
void CopyFramebufferImage(Framebuffer *src, int level, int x, int y, int z, Framebuffer *dst, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth) override;
|
||||
bool BlitFramebuffer(Framebuffer *src, int srcX1, int srcY1, int srcX2, int srcY2, Framebuffer *dst, int dstX1, int dstY1, int dstX2, int dstY2, int channelBits, FBBlitFilter filter) override;
|
||||
|
||||
int fbo_preferred_z_bitdepth() override;
|
||||
|
||||
// These functions should be self explanatory.
|
||||
void BindFramebufferAsRenderTarget(Framebuffer *fbo) override;
|
||||
// color must be 0, for now.
|
||||
@ -655,7 +653,17 @@ private:
|
||||
|
||||
OpenGLContext::OpenGLContext() {
|
||||
CreatePresets();
|
||||
// TODO: Detect caps
|
||||
|
||||
// TODO: Detect more caps
|
||||
if (gl_extensions.IsGLES) {
|
||||
if (gl_extensions.OES_packed_depth_stencil || gl_extensions.OES_depth24) {
|
||||
caps_.preferredDepthBufferFormat = DataFormat::D24_S8;
|
||||
} else {
|
||||
caps_.preferredDepthBufferFormat = DataFormat::D16;
|
||||
}
|
||||
} else {
|
||||
caps_.preferredDepthBufferFormat = DataFormat::D24_S8;
|
||||
}
|
||||
}
|
||||
|
||||
OpenGLContext::~OpenGLContext() {
|
||||
@ -1301,18 +1309,6 @@ OpenGLFramebuffer *OpenGLContext::fbo_ext_create(const FramebufferDesc &desc) {
|
||||
}
|
||||
#endif
|
||||
|
||||
int OpenGLContext::fbo_preferred_z_bitdepth() {
|
||||
// This matches the CreateFramebuffer() logic.
|
||||
if (gl_extensions.IsGLES) {
|
||||
if (gl_extensions.OES_packed_depth_stencil) {
|
||||
return 24;
|
||||
}
|
||||
return gl_extensions.OES_depth24 ? 24 : 16;
|
||||
} else {
|
||||
return 24;
|
||||
}
|
||||
}
|
||||
|
||||
Framebuffer *OpenGLContext::CreateFramebuffer(const FramebufferDesc &desc) {
|
||||
CheckGLExtensions();
|
||||
|
||||
|
@ -372,8 +372,6 @@ public:
|
||||
void CopyFramebufferImage(Framebuffer *src, int level, int x, int y, int z, Framebuffer *dst, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth) override;
|
||||
bool BlitFramebuffer(Framebuffer *src, int srcX1, int srcY1, int srcX2, int srcY2, Framebuffer *dst, int dstX1, int dstY1, int dstX2, int dstY2, int channelBits, FBBlitFilter filter) override;
|
||||
|
||||
int fbo_preferred_z_bitdepth() override;
|
||||
|
||||
// These functions should be self explanatory.
|
||||
void BindFramebufferAsRenderTarget(Framebuffer *fbo) override;
|
||||
// color must be 0, for now.
|
||||
@ -1292,8 +1290,6 @@ Framebuffer *VKContext::CreateFramebuffer(const FramebufferDesc &desc) {
|
||||
void VKContext::CopyFramebufferImage(Framebuffer *src, int level, int x, int y, int z, Framebuffer *dst, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth) {}
|
||||
bool VKContext::BlitFramebuffer(Framebuffer *src, int srcX1, int srcY1, int srcX2, int srcY2, Framebuffer *dst, int dstX1, int dstY1, int dstX2, int dstY2, int channelBits, FBBlitFilter filter) { return true; }
|
||||
|
||||
int VKContext::fbo_preferred_z_bitdepth() { return 24; }
|
||||
|
||||
// These functions should be self explanatory.
|
||||
void VKContext::BindFramebufferAsRenderTarget(Framebuffer *fbo) {}
|
||||
// color must be 0, for now.
|
||||
|
Loading…
x
Reference in New Issue
Block a user