forked from suyu/suyu
rasterizer_cache_gl: Implement Texception Pass
This commit is contained in:
parent
8932001610
commit
5bc82d124c
3 changed files with 51 additions and 0 deletions
|
@ -575,6 +575,8 @@ std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
|
||||||
SetupCachedFramebuffer(fbkey, current_state);
|
SetupCachedFramebuffer(fbkey, current_state);
|
||||||
SyncViewport(current_state);
|
SyncViewport(current_state);
|
||||||
|
|
||||||
|
res_cache.SignalPostFramebufferSetup();
|
||||||
|
|
||||||
return current_depth_stencil_usage = {static_cast<bool>(depth_surface), fbkey.stencil_enable};
|
return current_depth_stencil_usage = {static_cast<bool>(depth_surface), fbkey.stencil_enable};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,9 +740,13 @@ void RasterizerOpenGL::DrawArrays() {
|
||||||
shader_program_manager->ApplyTo(state);
|
shader_program_manager->ApplyTo(state);
|
||||||
state.Apply();
|
state.Apply();
|
||||||
|
|
||||||
|
res_cache.SignalPreDrawCall();
|
||||||
|
|
||||||
// Execute draw call
|
// Execute draw call
|
||||||
params.DispatchDraw();
|
params.DispatchDraw();
|
||||||
|
|
||||||
|
res_cache.SignalPostDrawCall();
|
||||||
|
|
||||||
// Disable scissor test
|
// Disable scissor test
|
||||||
state.viewports[0].scissor.enabled = false;
|
state.viewports[0].scissor.enabled = false;
|
||||||
|
|
||||||
|
@ -1013,6 +1019,7 @@ void RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, const Shader& s
|
||||||
texture_samplers[current_bindpoint].SyncWithConfig(texture.tsc);
|
texture_samplers[current_bindpoint].SyncWithConfig(texture.tsc);
|
||||||
|
|
||||||
Surface surface = res_cache.GetTextureSurface(texture, entry);
|
Surface surface = res_cache.GetTextureSurface(texture, entry);
|
||||||
|
res_cache.SignalSurfaceParameter(surface);
|
||||||
if (surface != nullptr) {
|
if (surface != nullptr) {
|
||||||
state.texture_units[current_bindpoint].texture =
|
state.texture_units[current_bindpoint].texture =
|
||||||
entry.IsArray() ? surface->TextureLayer().handle : surface->Texture().handle;
|
entry.IsArray() ? surface->TextureLayer().handle : surface->Texture().handle;
|
||||||
|
|
|
@ -1392,10 +1392,49 @@ bool RasterizerCacheOpenGL::PartialReinterpretSurface(Surface triggering_surface
|
||||||
void RasterizerCacheOpenGL::NotifyFrameBufferChange(Surface triggering_surface) {
|
void RasterizerCacheOpenGL::NotifyFrameBufferChange(Surface triggering_surface) {
|
||||||
if (triggering_surface == nullptr)
|
if (triggering_surface == nullptr)
|
||||||
return;
|
return;
|
||||||
|
run_texception_pass = false;
|
||||||
|
if (texception) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Surface intersect = CollideOnReinterpretedSurface(triggering_surface->GetAddr());
|
Surface intersect = CollideOnReinterpretedSurface(triggering_surface->GetAddr());
|
||||||
if (intersect != nullptr) {
|
if (intersect != nullptr) {
|
||||||
PartialReinterpretSurface(triggering_surface, intersect);
|
PartialReinterpretSurface(triggering_surface, intersect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RasterizerCacheOpenGL::SignalPreDrawCall() {
|
||||||
|
if (texception) {
|
||||||
|
glTextureBarrier();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RasterizerCacheOpenGL::SignalPostDrawCall() {
|
||||||
|
if (!run_texception_pass)
|
||||||
|
return;
|
||||||
|
for (u32 i = 0; i < Maxwell::NumRenderTargets; i++) {
|
||||||
|
if (current_color_buffers[i] != nullptr) {
|
||||||
|
Surface intersect = CollideOnReinterpretedSurface(current_color_buffers[i]->GetAddr());
|
||||||
|
if (intersect != nullptr) {
|
||||||
|
PartialReinterpretSurface(current_color_buffers[i], intersect);
|
||||||
|
texception = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!texception)
|
||||||
|
run_texception_pass = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RasterizerCacheOpenGL::SignalPostFramebufferSetup() {
|
||||||
|
if (!run_texception_pass)
|
||||||
|
texception = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RasterizerCacheOpenGL::SignalSurfaceParameter(Surface& surface) {
|
||||||
|
if (surface == nullptr)
|
||||||
|
return;
|
||||||
|
if (surface->IsReinterpreted()) {
|
||||||
|
run_texception_pass = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace OpenGL
|
} // namespace OpenGL
|
||||||
|
|
|
@ -469,6 +469,11 @@ public:
|
||||||
const Common::Rectangle<u32>& src_rect,
|
const Common::Rectangle<u32>& src_rect,
|
||||||
const Common::Rectangle<u32>& dst_rect);
|
const Common::Rectangle<u32>& dst_rect);
|
||||||
|
|
||||||
|
void SignalPreDrawCall();
|
||||||
|
void SignalPostDrawCall();
|
||||||
|
void SignalSurfaceParameter(Surface& surface);
|
||||||
|
void SignalPostFramebufferSetup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void LoadSurface(const Surface& surface);
|
void LoadSurface(const Surface& surface);
|
||||||
Surface GetSurface(const SurfaceParams& params, bool preserve_contents = true);
|
Surface GetSurface(const SurfaceParams& params, bool preserve_contents = true);
|
||||||
|
|
Loading…
Reference in a new issue