rsx: Restructure and simplify some header include chains

This commit is contained in:
kd-11 2020-12-13 14:54:43 +03:00 committed by kd-11
parent d775c8dc73
commit f83c2f0b6b
17 changed files with 138 additions and 124 deletions

View File

@ -1,5 +1,6 @@
#pragma once
#include "texture_cache_utils.h"
#include "texture_cache_predictor.h"
#include "texture_cache_helpers.h"

View File

@ -0,0 +1,120 @@
#pragma once
#include "Emu/system_config.h"
namespace rsx
{
/**
* Helper enums/structs
*/
enum invalidation_chain_policy
{
invalidation_chain_none, // No chaining: Only sections that overlap the faulting page get invalidated.
invalidation_chain_full, // Full chaining: Sections overlapping the faulting page get invalidated, as well as any sections overlapping invalidated sections.
invalidation_chain_nearby // Invalidations chain if they are near to the fault (<X pages away)
};
enum invalidation_chain_direction
{
chain_direction_both,
chain_direction_forward, // Only higher-base-address sections chain (unless they overlap the fault)
chain_direction_backward, // Only lower-base-address pages chain (unless they overlap the fault)
};
enum texture_create_flags
{
default_component_order = 0,
native_component_order = 1,
swapped_native_component_order = 2,
};
enum memory_read_flags
{
flush_always = 0,
flush_once = 1
};
struct invalidation_cause
{
enum enum_type
{
invalid = 0,
read,
deferred_read,
write,
deferred_write,
unmap, // fault range is being unmapped
reprotect, // we are going to reprotect the fault range
superseded_by_fbo, // used by texture_cache::locked_memory_region
committed_as_fbo // same as superseded_by_fbo but without locking or preserving page flags
} cause;
constexpr bool valid() const
{
return cause != invalid;
}
constexpr bool is_read() const
{
AUDIT(valid());
return (cause == read || cause == deferred_read);
}
constexpr bool deferred_flush() const
{
AUDIT(valid());
return (cause == deferred_read || cause == deferred_write);
}
constexpr bool destroy_fault_range() const
{
AUDIT(valid());
return (cause == unmap);
}
constexpr bool keep_fault_range_protection() const
{
AUDIT(valid());
return (cause == unmap || cause == reprotect || cause == superseded_by_fbo);
}
constexpr bool skip_fbos() const
{
AUDIT(valid());
return (cause == superseded_by_fbo || cause == committed_as_fbo);
}
constexpr bool skip_flush() const
{
AUDIT(valid());
return (cause == unmap) || (!g_cfg.video.strict_texture_flushing && cause == superseded_by_fbo);
}
constexpr invalidation_cause undefer() const
{
AUDIT(deferred_flush());
if (cause == deferred_read)
return read;
else if (cause == deferred_write)
return write;
else
fmt::throw_exception("Unreachable");
}
constexpr invalidation_cause defer() const
{
AUDIT(!deferred_flush());
if (cause == read)
return deferred_read;
else if (cause == write)
return deferred_write;
else
fmt::throw_exception("Unreachable");
}
constexpr invalidation_cause() : cause(invalid) {}
constexpr invalidation_cause(enum_type _cause) : cause(_cause) {}
operator enum_type&() { return cause; }
constexpr operator enum_type() const { return cause; }
};
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "../rsx_cache.h"
#include "texture_cache_types.h"
#include "texture_cache_predictor.h"
#include "TextureUtils.h"
@ -9,122 +10,6 @@
namespace rsx
{
/**
* Helper enums/structs
*/
enum invalidation_chain_policy
{
invalidation_chain_none, // No chaining: Only sections that overlap the faulting page get invalidated.
invalidation_chain_full, // Full chaining: Sections overlapping the faulting page get invalidated, as well as any sections overlapping invalidated sections.
invalidation_chain_nearby // Invalidations chain if they are near to the fault (<X pages away)
};
enum invalidation_chain_direction
{
chain_direction_both,
chain_direction_forward, // Only higher-base-address sections chain (unless they overlap the fault)
chain_direction_backward, // Only lower-base-address pages chain (unless they overlap the fault)
};
enum texture_create_flags
{
default_component_order = 0,
native_component_order = 1,
swapped_native_component_order = 2,
};
enum memory_read_flags
{
flush_always = 0,
flush_once = 1
};
struct invalidation_cause
{
enum enum_type
{
invalid = 0,
read,
deferred_read,
write,
deferred_write,
unmap, // fault range is being unmapped
reprotect, // we are going to reprotect the fault range
superseded_by_fbo, // used by texture_cache::locked_memory_region
committed_as_fbo // same as superseded_by_fbo but without locking or preserving page flags
} cause;
constexpr bool valid() const
{
return cause != invalid;
}
constexpr bool is_read() const
{
AUDIT(valid());
return (cause == read || cause == deferred_read);
}
constexpr bool deferred_flush() const
{
AUDIT(valid());
return (cause == deferred_read || cause == deferred_write);
}
constexpr bool destroy_fault_range() const
{
AUDIT(valid());
return (cause == unmap);
}
constexpr bool keep_fault_range_protection() const
{
AUDIT(valid());
return (cause == unmap || cause == reprotect || cause == superseded_by_fbo);
}
constexpr bool skip_fbos() const
{
AUDIT(valid());
return (cause == superseded_by_fbo || cause == committed_as_fbo);
}
constexpr bool skip_flush() const
{
AUDIT(valid());
return (cause == unmap) || (!g_cfg.video.strict_texture_flushing && cause == superseded_by_fbo);
}
constexpr invalidation_cause undefer() const
{
AUDIT(deferred_flush());
if (cause == deferred_read)
return read;
else if (cause == deferred_write)
return write;
else
fmt::throw_exception("Unreachable");
}
constexpr invalidation_cause defer() const
{
AUDIT(!deferred_flush());
if (cause == read)
return deferred_read;
else if (cause == write)
return deferred_write;
else
fmt::throw_exception("Unreachable");
}
constexpr invalidation_cause() : cause(invalid) {}
constexpr invalidation_cause(enum_type _cause) : cause(_cause) {}
operator enum_type&() { return cause; }
constexpr operator enum_type() const { return cause; }
};
/**
* List structure used in Ranged Storage Blocks
* List of Arrays

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "GLGSRender.h"
#include "../rsx_methods.h"
#include "../Common/BufferUtils.h"
namespace gl

View File

@ -5,6 +5,7 @@
#include "GLCompute.h"
#include "GLVertexProgram.h"
#include "Emu/Memory/vm_locking.h"
#include "Emu/RSX/rsx_methods.h"
#define DUMP_VERTEX_DATA 0

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "GLGSRender.h"
#include "Emu/RSX/rsx_methods.h"
color_format rsx::internals::surface_color_format_to_gl(rsx::surface_color_format color_format)
{

View File

@ -3,6 +3,7 @@
#include "GLGSRender.h"
#include "GLVertexProgram.h"
#include "GLFragmentProgram.h"
#include "../rsx_methods.h"
#include "../Common/ShaderInterpreter.h"
#include "../Common/GLSLCommon.h"

View File

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "GLGSRender.h"
#include "../Common/BufferUtils.h"
#include "../rsx_methods.h"
#include "GLGSRender.h"
#include "GLHelpers.h"
namespace

View File

@ -17,6 +17,7 @@
#include "Utilities/StrUtil.h"
#include <cereal/archives/binary.hpp>
#include <cereal/types/unordered_map.hpp>
#include "util/asm.hpp"

View File

@ -12,9 +12,8 @@
#include "RSXOffload.h"
#include "RSXVertexProgram.h"
#include "RSXFragmentProgram.h"
#include "rsx_methods.h"
#include "rsx_utils.h"
#include "Common/texture_cache_utils.h"
#include "Common/texture_cache_types.h"
#include "Utilities/Thread.h"
#include "Utilities/geometry.h"

View File

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "VKGSRender.h"
#include "../Common/BufferUtils.h"
#include "../rsx_methods.h"
#include "VKGSRender.h"
namespace vk
{

View File

@ -6,6 +6,7 @@
#include "VKRenderPass.h"
#include "VKResourceManager.h"
#include "VKCommandStream.h"
#include "Emu/RSX/rsx_methods.h"
#include "Emu/Memory/vm_locking.h"
namespace vk

View File

@ -10,6 +10,7 @@
#include "VKCommandStream.h"
#include "VKRenderPass.h"
#include "Emu/RSX/rsx_methods.h"
#include "Utilities/mutex.h"
#include "Utilities/lockless.h"

View File

@ -3,8 +3,10 @@
#include "VKVertexProgram.h"
#include "VKFragmentProgram.h"
#include "VKGSRender.h"
#include "../Common/GLSLCommon.h"
#include "../Common/ShaderInterpreter.h"
#include "../rsx_methods.h"
namespace vk
{

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "VKGSRender.h"
#include "../rsx_methods.h"
#include "../Common/BufferUtils.h"
#include "../rsx_methods.h"
namespace vk
{

View File

@ -13,9 +13,6 @@
#include "rsx_utils.h"
#include "Utilities/geometry.h"
#include <cereal/types/array.hpp>
#include <cereal/types/unordered_map.hpp>
extern u64 get_system_time();
extern bool is_primitive_disjointed(rsx::primitive_type);

View File

@ -36,6 +36,7 @@
#include "util/logs.hpp"
#include "cereal/archives/binary.hpp"
#include <cereal/types/unordered_map.hpp>
#include <thread>
#include <typeinfo>