mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-10-07 10:53:31 +00:00
Add accessor for UseFlags
This commit is contained in:
parent
2302a82c3e
commit
ee19db091f
@ -712,7 +712,7 @@ rotateVBO:
|
||||
uint8_t clearStencil = clearColor >> 24;
|
||||
draw_->Clear(clearFlag, clearColor, clearDepth, clearStencil);
|
||||
|
||||
if ((gstate_c.useFlags & GPU_USE_CLEAR_RAM_HACK) && gstate.isClearModeColorMask() && (gstate.isClearModeAlphaMask() || gstate_c.framebufFormat == GE_FORMAT_565)) {
|
||||
if (gstate_c.Use(GPU_USE_CLEAR_RAM_HACK) && gstate.isClearModeColorMask() && (gstate.isClearModeAlphaMask() || gstate_c.framebufFormat == GE_FORMAT_565)) {
|
||||
int scissorX1 = gstate.getScissorX1();
|
||||
int scissorY1 = gstate.getScissorY1();
|
||||
int scissorX2 = gstate.getScissorX2() + 1;
|
||||
|
@ -82,7 +82,7 @@ GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
// No need to flush before the tex scale/offset commands if we are baking
|
||||
// the tex scale/offset into the vertices anyway.
|
||||
UpdateCmdInfo();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||
|
||||
BuildReportingInfo();
|
||||
|
||||
|
@ -81,7 +81,7 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
// No need to flush before the tex scale/offset commands if we are baking
|
||||
// the tex scale/offset into the vertices anyway.
|
||||
UpdateCmdInfo();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||
|
||||
BuildReportingInfo();
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
||||
GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
: GPUCommon(gfxCtx, draw), drawEngine_(draw), fragmentTestCache_(draw) {
|
||||
UpdateVsyncInterval(true);
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||
|
||||
shaderManagerGL_ = new ShaderManagerGLES(draw);
|
||||
framebufferManagerGL_ = new FramebufferManagerGLES(draw);
|
||||
@ -146,7 +146,7 @@ GPU_GLES::~GPU_GLES() {
|
||||
delete textureCacheGL_;
|
||||
|
||||
// Clear features so they're not visible in system info.
|
||||
gstate_c.useFlags = 0;
|
||||
gstate_c.SetUseFlags(0);
|
||||
}
|
||||
|
||||
// Take the raw GL extension and versioning data and turn into feature flags.
|
||||
|
@ -195,7 +195,7 @@ LinkedShader::LinkedShader(GLRenderManager *render, VShaderID VSID, Shader *vs,
|
||||
initialize.push_back({ &u_tess_weights_v, 0, TEX_SLOT_SPLINE_WEIGHTS_V });
|
||||
|
||||
GLRProgramFlags flags{};
|
||||
flags.supportDualSource = (gstate_c.useFlags & GPU_USE_DUALSOURCE_BLEND) != 0;
|
||||
flags.supportDualSource = gstate_c.Use(GPU_USE_DUALSOURCE_BLEND);
|
||||
if (!VSID.Bit(VS_BIT_IS_THROUGH) && gstate_c.Use(GPU_USE_DEPTH_CLAMP)) {
|
||||
flags.useClipDistance0 = true;
|
||||
if (VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Use(GPU_USE_CLIP_DISTANCE))
|
||||
@ -952,7 +952,7 @@ void ShaderManagerGLES::Load(const Path &filename) {
|
||||
if (!f.ReadArray(&header, 1)) {
|
||||
return;
|
||||
}
|
||||
if (header.magic != CACHE_HEADER_MAGIC || header.version != CACHE_VERSION || header.useFlags != gstate_c.useFlags) {
|
||||
if (header.magic != CACHE_HEADER_MAGIC || header.version != CACHE_VERSION || header.useFlags != gstate_c.GetUseFlags()) {
|
||||
return;
|
||||
}
|
||||
diskCachePending_.start = time_now_d();
|
||||
@ -1108,7 +1108,7 @@ void ShaderManagerGLES::Save(const Path &filename) {
|
||||
header.magic = CACHE_HEADER_MAGIC;
|
||||
header.version = CACHE_VERSION;
|
||||
header.reserved = 0;
|
||||
header.useFlags = gstate_c.useFlags;
|
||||
header.useFlags = gstate_c.GetUseFlags();
|
||||
header.numVertexShaders = GetNumVertexShaders();
|
||||
header.numFragmentShaders = GetNumFragmentShaders();
|
||||
header.numLinkedPrograms = GetNumPrograms();
|
||||
|
@ -636,7 +636,7 @@ void GPUCommon::ClearCacheNextFrame() {
|
||||
void GPUCommon::CheckConfigChanged() {
|
||||
if (configChanged_) {
|
||||
ClearCacheNextFrame();
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||
drawEngineCommon_->NotifyConfigChanged();
|
||||
textureCache_->NotifyConfigChanged();
|
||||
framebufferManager_->NotifyConfigChanged();
|
||||
@ -1244,7 +1244,7 @@ void GPUCommon::BeginFrame() {
|
||||
|
||||
if (drawEngineCommon_->EverUsedExactEqualDepth() && !sawExactEqualDepth_) {
|
||||
sawExactEqualDepth_ = true;
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -524,8 +524,8 @@ enum class SubmitType {
|
||||
};
|
||||
|
||||
struct GPUStateCache {
|
||||
bool Use(u32 flags) { return (useFlags & flags) != 0; } // Return true if ANY of flags are true.
|
||||
bool UseAll(u32 flags) { return (useFlags & flags) == flags; } // Return true if ALL flags are true.
|
||||
bool Use(u32 flags) { return (useFlags_ & flags) != 0; } // Return true if ANY of flags are true.
|
||||
bool UseAll(u32 flags) { return (useFlags_ & flags) == flags; } // Return true if ALL flags are true.
|
||||
|
||||
uint64_t GetDirtyUniforms() { return dirty & DIRTY_ALL_UNIFORMS; }
|
||||
void Dirty(u64 what) {
|
||||
@ -578,9 +578,21 @@ struct GPUStateCache {
|
||||
Dirty(DIRTY_FRAGMENTSHADER_STATE);
|
||||
}
|
||||
}
|
||||
void SetUseFlags(u32 newFlags) {
|
||||
if (newFlags != useFlags_) {
|
||||
useFlags_ = newFlags;
|
||||
// Recompile shaders and stuff?
|
||||
}
|
||||
}
|
||||
|
||||
u32 useFlags;
|
||||
// When checking for a single flag, use Use()/UseAll().
|
||||
u32 GetUseFlags() const {
|
||||
return useFlags_;
|
||||
}
|
||||
|
||||
private:
|
||||
u32 useFlags_;
|
||||
public:
|
||||
u32 vertexAddr;
|
||||
u32 indexAddr;
|
||||
u32 offsetAddr;
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
: GPUCommon(gfxCtx, draw), drawEngine_(draw) {
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||
drawEngine_.InitDeviceObjects();
|
||||
|
||||
VulkanContext *vulkan = (VulkanContext *)gfxCtx->GetAPIContext();
|
||||
@ -497,7 +497,7 @@ void GPU_Vulkan::DeviceRestore() {
|
||||
GPUCommon::DeviceRestore();
|
||||
InitDeviceObjects();
|
||||
|
||||
gstate_c.useFlags = CheckGPUFeatures();
|
||||
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||
BuildReportingInfo();
|
||||
UpdateCmdInfo();
|
||||
|
||||
|
@ -515,8 +515,8 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) {
|
||||
WARN_LOG(G3D, "Shader cache version mismatch, %d, expected %d", header.version, CACHE_VERSION);
|
||||
return false;
|
||||
}
|
||||
if (header.useFlags != gstate_c.useFlags) {
|
||||
WARN_LOG(G3D, "Shader cache useFlags mismatch, %08x, expected %08x", header.useFlags, gstate_c.useFlags);
|
||||
if (header.useFlags != gstate_c.GetUseFlags()) {
|
||||
WARN_LOG(G3D, "Shader cache useFlags mismatch, %08x, expected %08x", header.useFlags, gstate_c.GetUseFlags());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -584,7 +584,7 @@ void ShaderManagerVulkan::SaveCache(FILE *f) {
|
||||
VulkanCacheHeader header{};
|
||||
header.magic = CACHE_HEADER_MAGIC;
|
||||
header.version = CACHE_VERSION;
|
||||
header.useFlags = gstate_c.useFlags;
|
||||
header.useFlags = gstate_c.GetUseFlags();
|
||||
header.reserved = 0;
|
||||
header.numVertexShaders = (int)vsCache_.size();
|
||||
header.numFragmentShaders = (int)fsCache_.size();
|
||||
|
@ -619,7 +619,7 @@ void SystemInfoScreen::CreateViews() {
|
||||
deviceSpecs->Add(new InfoItem("Moga", moga));
|
||||
#endif
|
||||
|
||||
if (gstate_c.useFlags != 0) {
|
||||
if (gstate_c.GetUseFlags()) {
|
||||
// We're in-game, and can determine these.
|
||||
// TODO: Call a static version of GPUCommon::CheckGPUFeatures() and derive them here directly.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user