mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-06 02:33:44 -04:00
renderer_gl: Add layer/level specifier to MSAA resolves
This commit is contained in:
parent
5e9b2aa33a
commit
c1e1b2b93a
5 changed files with 12 additions and 12 deletions
|
|
@ -162,7 +162,7 @@ bool BlitHelper::ConvertDS24S8ToRGBA8(Surface& source, Surface& dest,
|
||||||
|
|
||||||
if (multisample) {
|
if (multisample) {
|
||||||
// Resolve the destination image if needed
|
// Resolve the destination image if needed
|
||||||
ResolveTexture(dest);
|
ResolveTexture(dest, copy.dst_level, copy.dst_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -188,13 +188,13 @@ bool BlitHelper::ConvertRGBA4ToRGB5A1(Surface& source, Surface& dest,
|
||||||
|
|
||||||
if (multisample) {
|
if (multisample) {
|
||||||
// Resolve the destination image if needed
|
// Resolve the destination image if needed
|
||||||
ResolveTexture(dest);
|
ResolveTexture(dest, copy.dst_level, copy.dst_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlitHelper::ResolveTexture(Surface& surface) {
|
void BlitHelper::ResolveTexture(Surface& surface, u32 level, u32 layer) {
|
||||||
OpenGLState prev_state = OpenGLState::GetCurState();
|
OpenGLState prev_state = OpenGLState::GetCurState();
|
||||||
SCOPE_EXIT({ prev_state.Apply(); });
|
SCOPE_EXIT({ prev_state.Apply(); });
|
||||||
|
|
||||||
|
|
@ -205,8 +205,8 @@ void BlitHelper::ResolveTexture(Surface& surface) {
|
||||||
state.texture_units[2].texture_2d = 0;
|
state.texture_units[2].texture_2d = 0;
|
||||||
state.Apply();
|
state.Apply();
|
||||||
|
|
||||||
surface.Attach(GL_READ_FRAMEBUFFER, 0, 0, 3);
|
surface.Attach(GL_READ_FRAMEBUFFER, level, layer, 3);
|
||||||
surface.Attach(GL_DRAW_FRAMEBUFFER, 0, 0, 1);
|
surface.Attach(GL_DRAW_FRAMEBUFFER, level, layer, 1);
|
||||||
const GLbitfield buffer_mask = surface.type == SurfaceType::Depth ? GL_DEPTH_BUFFER_BIT
|
const GLbitfield buffer_mask = surface.type == SurfaceType::Depth ? GL_DEPTH_BUFFER_BIT
|
||||||
: surface.type == SurfaceType::DepthStencil
|
: surface.type == SurfaceType::DepthStencil
|
||||||
? (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)
|
? (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public:
|
||||||
|
|
||||||
bool ConvertRGBA4ToRGB5A1(Surface& source, Surface& dest, const VideoCore::TextureCopy& copy);
|
bool ConvertRGBA4ToRGB5A1(Surface& source, Surface& dest, const VideoCore::TextureCopy& copy);
|
||||||
|
|
||||||
void ResolveTexture(Surface& surface);
|
void ResolveTexture(Surface& surface, u32 level = 0, u32 layer = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void FilterAnime4K(Surface& surface, const VideoCore::TextureBlit& blit);
|
void FilterAnime4K(Surface& surface, const VideoCore::TextureBlit& blit);
|
||||||
|
|
|
||||||
|
|
@ -652,14 +652,14 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
|
||||||
if (framebuffer->color_id != VideoCore::SurfaceId{}) {
|
if (framebuffer->color_id != VideoCore::SurfaceId{}) {
|
||||||
Surface& color_surface = res_cache.GetSurface(framebuffer->color_id);
|
Surface& color_surface = res_cache.GetSurface(framebuffer->color_id);
|
||||||
if (color_surface.GetSampleCount() > 1) {
|
if (color_surface.GetSampleCount() > 1) {
|
||||||
runtime.ResolveTexture(color_surface);
|
runtime.ResolveTexture(color_surface, framebuffer->color_level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (framebuffer->depth_id != VideoCore::SurfaceId{}) {
|
if (framebuffer->depth_id != VideoCore::SurfaceId{}) {
|
||||||
Surface& depth_surface = res_cache.GetSurface(framebuffer->depth_id);
|
Surface& depth_surface = res_cache.GetSurface(framebuffer->depth_id);
|
||||||
if (depth_surface.GetSampleCount() > 1) {
|
if (depth_surface.GetSampleCount() > 1) {
|
||||||
runtime.ResolveTexture(depth_surface);
|
runtime.ResolveTexture(depth_surface, framebuffer->depth_level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -306,10 +306,10 @@ bool TextureRuntime::BlitTextures(Surface& source, Surface& dest,
|
||||||
// Must resolve images first
|
// Must resolve images first
|
||||||
// Todo(wunk): Add a "dirty" flag for msaa resolves to avoid redundant image resolves
|
// Todo(wunk): Add a "dirty" flag for msaa resolves to avoid redundant image resolves
|
||||||
if (source.sample_count > 1) {
|
if (source.sample_count > 1) {
|
||||||
blit_helper.ResolveTexture(source);
|
blit_helper.ResolveTexture(source, blit.src_level, blit.src_layer);
|
||||||
}
|
}
|
||||||
if (dest.sample_count > 1) {
|
if (dest.sample_count > 1) {
|
||||||
blit_helper.ResolveTexture(dest);
|
blit_helper.ResolveTexture(dest, blit.dst_level, blit.dst_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGLState state = OpenGLState::GetCurState();
|
OpenGLState state = OpenGLState::GetCurState();
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,8 @@ public:
|
||||||
void GenerateMipmaps(Surface& surface);
|
void GenerateMipmaps(Surface& surface);
|
||||||
|
|
||||||
/// Resolve a surface's MSAA texture into the surface's appropriate non-MSAA texture
|
/// Resolve a surface's MSAA texture into the surface's appropriate non-MSAA texture
|
||||||
void ResolveTexture(Surface& surface) {
|
void ResolveTexture(Surface& surface, u32 level = 0, u32 layer = 0) {
|
||||||
blit_helper.ResolveTexture(surface);
|
blit_helper.ResolveTexture(surface, level, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue