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;
|
uint8_t clearStencil = clearColor >> 24;
|
||||||
draw_->Clear(clearFlag, clearColor, clearDepth, clearStencil);
|
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 scissorX1 = gstate.getScissorX1();
|
||||||
int scissorY1 = gstate.getScissorY1();
|
int scissorY1 = gstate.getScissorY1();
|
||||||
int scissorX2 = gstate.getScissorX2() + 1;
|
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
|
// No need to flush before the tex scale/offset commands if we are baking
|
||||||
// the tex scale/offset into the vertices anyway.
|
// the tex scale/offset into the vertices anyway.
|
||||||
UpdateCmdInfo();
|
UpdateCmdInfo();
|
||||||
gstate_c.useFlags = CheckGPUFeatures();
|
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||||
|
|
||||||
BuildReportingInfo();
|
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
|
// No need to flush before the tex scale/offset commands if we are baking
|
||||||
// the tex scale/offset into the vertices anyway.
|
// the tex scale/offset into the vertices anyway.
|
||||||
UpdateCmdInfo();
|
UpdateCmdInfo();
|
||||||
gstate_c.useFlags = CheckGPUFeatures();
|
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||||
|
|
||||||
BuildReportingInfo();
|
BuildReportingInfo();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||||
: GPUCommon(gfxCtx, draw), drawEngine_(draw), fragmentTestCache_(draw) {
|
: GPUCommon(gfxCtx, draw), drawEngine_(draw), fragmentTestCache_(draw) {
|
||||||
UpdateVsyncInterval(true);
|
UpdateVsyncInterval(true);
|
||||||
gstate_c.useFlags = CheckGPUFeatures();
|
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||||
|
|
||||||
shaderManagerGL_ = new ShaderManagerGLES(draw);
|
shaderManagerGL_ = new ShaderManagerGLES(draw);
|
||||||
framebufferManagerGL_ = new FramebufferManagerGLES(draw);
|
framebufferManagerGL_ = new FramebufferManagerGLES(draw);
|
||||||
@ -146,7 +146,7 @@ GPU_GLES::~GPU_GLES() {
|
|||||||
delete textureCacheGL_;
|
delete textureCacheGL_;
|
||||||
|
|
||||||
// Clear features so they're not visible in system info.
|
// 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.
|
// 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 });
|
initialize.push_back({ &u_tess_weights_v, 0, TEX_SLOT_SPLINE_WEIGHTS_V });
|
||||||
|
|
||||||
GLRProgramFlags flags{};
|
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)) {
|
if (!VSID.Bit(VS_BIT_IS_THROUGH) && gstate_c.Use(GPU_USE_DEPTH_CLAMP)) {
|
||||||
flags.useClipDistance0 = true;
|
flags.useClipDistance0 = true;
|
||||||
if (VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Use(GPU_USE_CLIP_DISTANCE))
|
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)) {
|
if (!f.ReadArray(&header, 1)) {
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
diskCachePending_.start = time_now_d();
|
diskCachePending_.start = time_now_d();
|
||||||
@ -1108,7 +1108,7 @@ void ShaderManagerGLES::Save(const Path &filename) {
|
|||||||
header.magic = CACHE_HEADER_MAGIC;
|
header.magic = CACHE_HEADER_MAGIC;
|
||||||
header.version = CACHE_VERSION;
|
header.version = CACHE_VERSION;
|
||||||
header.reserved = 0;
|
header.reserved = 0;
|
||||||
header.useFlags = gstate_c.useFlags;
|
header.useFlags = gstate_c.GetUseFlags();
|
||||||
header.numVertexShaders = GetNumVertexShaders();
|
header.numVertexShaders = GetNumVertexShaders();
|
||||||
header.numFragmentShaders = GetNumFragmentShaders();
|
header.numFragmentShaders = GetNumFragmentShaders();
|
||||||
header.numLinkedPrograms = GetNumPrograms();
|
header.numLinkedPrograms = GetNumPrograms();
|
||||||
|
@ -636,7 +636,7 @@ void GPUCommon::ClearCacheNextFrame() {
|
|||||||
void GPUCommon::CheckConfigChanged() {
|
void GPUCommon::CheckConfigChanged() {
|
||||||
if (configChanged_) {
|
if (configChanged_) {
|
||||||
ClearCacheNextFrame();
|
ClearCacheNextFrame();
|
||||||
gstate_c.useFlags = CheckGPUFeatures();
|
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||||
drawEngineCommon_->NotifyConfigChanged();
|
drawEngineCommon_->NotifyConfigChanged();
|
||||||
textureCache_->NotifyConfigChanged();
|
textureCache_->NotifyConfigChanged();
|
||||||
framebufferManager_->NotifyConfigChanged();
|
framebufferManager_->NotifyConfigChanged();
|
||||||
@ -1244,7 +1244,7 @@ void GPUCommon::BeginFrame() {
|
|||||||
|
|
||||||
if (drawEngineCommon_->EverUsedExactEqualDepth() && !sawExactEqualDepth_) {
|
if (drawEngineCommon_->EverUsedExactEqualDepth() && !sawExactEqualDepth_) {
|
||||||
sawExactEqualDepth_ = true;
|
sawExactEqualDepth_ = true;
|
||||||
gstate_c.useFlags = CheckGPUFeatures();
|
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,8 +524,8 @@ enum class SubmitType {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct GPUStateCache {
|
struct GPUStateCache {
|
||||||
bool Use(u32 flags) { return (useFlags & flags) != 0; } // Return true if ANY of 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.
|
bool UseAll(u32 flags) { return (useFlags_ & flags) == flags; } // Return true if ALL flags are true.
|
||||||
|
|
||||||
uint64_t GetDirtyUniforms() { return dirty & DIRTY_ALL_UNIFORMS; }
|
uint64_t GetDirtyUniforms() { return dirty & DIRTY_ALL_UNIFORMS; }
|
||||||
void Dirty(u64 what) {
|
void Dirty(u64 what) {
|
||||||
@ -578,9 +578,21 @@ struct GPUStateCache {
|
|||||||
Dirty(DIRTY_FRAGMENTSHADER_STATE);
|
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 vertexAddr;
|
||||||
u32 indexAddr;
|
u32 indexAddr;
|
||||||
u32 offsetAddr;
|
u32 offsetAddr;
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||||
: GPUCommon(gfxCtx, draw), drawEngine_(draw) {
|
: GPUCommon(gfxCtx, draw), drawEngine_(draw) {
|
||||||
gstate_c.useFlags = CheckGPUFeatures();
|
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||||
drawEngine_.InitDeviceObjects();
|
drawEngine_.InitDeviceObjects();
|
||||||
|
|
||||||
VulkanContext *vulkan = (VulkanContext *)gfxCtx->GetAPIContext();
|
VulkanContext *vulkan = (VulkanContext *)gfxCtx->GetAPIContext();
|
||||||
@ -497,7 +497,7 @@ void GPU_Vulkan::DeviceRestore() {
|
|||||||
GPUCommon::DeviceRestore();
|
GPUCommon::DeviceRestore();
|
||||||
InitDeviceObjects();
|
InitDeviceObjects();
|
||||||
|
|
||||||
gstate_c.useFlags = CheckGPUFeatures();
|
gstate_c.SetUseFlags(CheckGPUFeatures());
|
||||||
BuildReportingInfo();
|
BuildReportingInfo();
|
||||||
UpdateCmdInfo();
|
UpdateCmdInfo();
|
||||||
|
|
||||||
|
@ -515,8 +515,8 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) {
|
|||||||
WARN_LOG(G3D, "Shader cache version mismatch, %d, expected %d", header.version, CACHE_VERSION);
|
WARN_LOG(G3D, "Shader cache version mismatch, %d, expected %d", header.version, CACHE_VERSION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (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.useFlags);
|
WARN_LOG(G3D, "Shader cache useFlags mismatch, %08x, expected %08x", header.useFlags, gstate_c.GetUseFlags());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ void ShaderManagerVulkan::SaveCache(FILE *f) {
|
|||||||
VulkanCacheHeader header{};
|
VulkanCacheHeader header{};
|
||||||
header.magic = CACHE_HEADER_MAGIC;
|
header.magic = CACHE_HEADER_MAGIC;
|
||||||
header.version = CACHE_VERSION;
|
header.version = CACHE_VERSION;
|
||||||
header.useFlags = gstate_c.useFlags;
|
header.useFlags = gstate_c.GetUseFlags();
|
||||||
header.reserved = 0;
|
header.reserved = 0;
|
||||||
header.numVertexShaders = (int)vsCache_.size();
|
header.numVertexShaders = (int)vsCache_.size();
|
||||||
header.numFragmentShaders = (int)fsCache_.size();
|
header.numFragmentShaders = (int)fsCache_.size();
|
||||||
|
@ -619,7 +619,7 @@ void SystemInfoScreen::CreateViews() {
|
|||||||
deviceSpecs->Add(new InfoItem("Moga", moga));
|
deviceSpecs->Add(new InfoItem("Moga", moga));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gstate_c.useFlags != 0) {
|
if (gstate_c.GetUseFlags()) {
|
||||||
// We're in-game, and can determine these.
|
// We're in-game, and can determine these.
|
||||||
// TODO: Call a static version of GPUCommon::CheckGPUFeatures() and derive them here directly.
|
// TODO: Call a static version of GPUCommon::CheckGPUFeatures() and derive them here directly.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user