mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-20 17:59:08 +02:00
Unify ApplyShaderBlending
This commit is contained in:
1 parent
4538edad14
commit
08d173ceee
10 files changed
+34
-88
No files matched your search
@@ -466,3 +466,31 @@ u32 DrawEngineCommon::NormalizeVertices(u8 *outPtr, u8 *bufPtr, const u8 *inPtr,
|
||||
// Okay, there we are! Return the new type (but keep the index bits)
|
||||
return GE_VTYPE_TC_FLOAT | GE_VTYPE_COL_8888 | GE_VTYPE_NRM_FLOAT | GE_VTYPE_POS_FLOAT | (vertType & (GE_VTYPE_IDX_MASK | GE_VTYPE_THROUGH));
|
||||
}
|
||||
|
||||
bool DrawEngineCommon::ApplyShaderBlending() {
|
||||
if (gstate_c.featureFlags & GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static const int MAX_REASONABLE_BLITS_PER_FRAME = 24;
|
||||
|
||||
static int lastFrameBlit = -1;
|
||||
static int blitsThisFrame = 0;
|
||||
if (lastFrameBlit != gpuStats.numFlips) {
|
||||
if (blitsThisFrame > MAX_REASONABLE_BLITS_PER_FRAME) {
|
||||
WARN_LOG_REPORT_ONCE(blendingBlit, G3D, "Lots of blits needed for obscure blending: %d per frame, blend %d/%d/%d", blitsThisFrame, gstate.getBlendFuncA(), gstate.getBlendFuncB(), gstate.getBlendEq());
|
||||
}
|
||||
blitsThisFrame = 0;
|
||||
lastFrameBlit = gpuStats.numFlips;
|
||||
}
|
||||
++blitsThisFrame;
|
||||
if (blitsThisFrame > MAX_REASONABLE_BLITS_PER_FRAME * 2) {
|
||||
WARN_LOG_ONCE(blendingBlit2, G3D, "Skipping additional blits needed for obscure blending: %d per frame, blend %d/%d/%d", blitsThisFrame, gstate.getBlendFuncA(), gstate.getBlendFuncB(), gstate.getBlendEq());
|
||||
return false;
|
||||
}
|
||||
|
||||
fboTexNeedBind_ = true;
|
||||
|
||||
gstate_c.Dirty(DIRTY_SHADERBLEND);
|
||||
return true;
|
||||
}
|
||||
@@ -63,6 +63,7 @@ protected:
|
||||
u32 NormalizeVertices(u8 *outPtr, u8 *bufPtr, const u8 *inPtr, int lowerBound, int upperBound, u32 vertType);
|
||||
|
||||
void ApplyClearToMemory(int x1, int y1, int x2, int y2, u32 clearColor);
|
||||
bool ApplyShaderBlending();
|
||||
|
||||
VertexDecoder *GetVertexDecoder(u32 vtype);
|
||||
|
||||
|
||||
@@ -162,7 +162,6 @@ private:
|
||||
|
||||
void ApplyDrawState(int prim);
|
||||
void ApplyDrawStateLate(bool applyStencilRef, uint8_t stencilRef);
|
||||
bool ApplyShaderBlending();
|
||||
void ResetShaderBlending();
|
||||
|
||||
ID3D11InputLayout *SetupDecFmtForDraw(D3D11VertexShader *vshader, const DecVtxFormat &decFmt, u32 pspFmt);
|
||||
|
||||
@@ -121,30 +121,6 @@ static const D3D11_LOGIC_OP logicOps[] = {
|
||||
};
|
||||
*/
|
||||
|
||||
bool DrawEngineD3D11::ApplyShaderBlending() {
|
||||
static const int MAX_REASONABLE_BLITS_PER_FRAME = 24;
|
||||
|
||||
static int lastFrameBlit = -1;
|
||||
static int blitsThisFrame = 0;
|
||||
if (lastFrameBlit != gpuStats.numFlips) {
|
||||
if (blitsThisFrame > MAX_REASONABLE_BLITS_PER_FRAME) {
|
||||
WARN_LOG_REPORT_ONCE(blendingBlit, G3D, "Lots of blits needed for obscure blending: %d per frame, blend %d/%d/%d", blitsThisFrame, gstate.getBlendFuncA(), gstate.getBlendFuncB(), gstate.getBlendEq());
|
||||
}
|
||||
blitsThisFrame = 0;
|
||||
lastFrameBlit = gpuStats.numFlips;
|
||||
}
|
||||
++blitsThisFrame;
|
||||
if (blitsThisFrame > MAX_REASONABLE_BLITS_PER_FRAME * 2) {
|
||||
WARN_LOG_ONCE(blendingBlit2, G3D, "Skipping additional blits needed for obscure blending: %d per frame, blend %d/%d/%d", blitsThisFrame, gstate.getBlendFuncA(), gstate.getBlendFuncB(), gstate.getBlendEq());
|
||||
return false;
|
||||
}
|
||||
|
||||
fboTexNeedBind_ = true;
|
||||
|
||||
gstate_c.Dirty(DIRTY_SHADERBLEND);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DrawEngineD3D11::ResetShaderBlending() {
|
||||
if (fboTexBound_) {
|
||||
ID3D11ShaderResourceView *srv = nullptr;
|
||||
|
||||
@@ -162,7 +162,6 @@ private:
|
||||
|
||||
void ApplyDrawState(int prim);
|
||||
void ApplyDrawStateLate();
|
||||
bool ApplyShaderBlending();
|
||||
void ResetShaderBlending();
|
||||
|
||||
IDirect3DVertexDeclaration9 *SetupDecFmtForDraw(VSShader *vshader, const DecVtxFormat &decFmt, u32 pspFmt);
|
||||
|
||||
@@ -90,34 +90,6 @@ static const D3DSTENCILOP stencilOps[] = {
|
||||
D3DSTENCILOP_KEEP, // reserved
|
||||
};
|
||||
|
||||
bool DrawEngineDX9::ApplyShaderBlending() {
|
||||
if (gstate_c.featureFlags & GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static const int MAX_REASONABLE_BLITS_PER_FRAME = 24;
|
||||
|
||||
static int lastFrameBlit = -1;
|
||||
static int blitsThisFrame = 0;
|
||||
if (lastFrameBlit != gpuStats.numFlips) {
|
||||
if (blitsThisFrame > MAX_REASONABLE_BLITS_PER_FRAME) {
|
||||
WARN_LOG_REPORT_ONCE(blendingBlit, G3D, "Lots of blits needed for obscure blending: %d per frame, blend %d/%d/%d", blitsThisFrame, gstate.getBlendFuncA(), gstate.getBlendFuncB(), gstate.getBlendEq());
|
||||
}
|
||||
blitsThisFrame = 0;
|
||||
lastFrameBlit = gpuStats.numFlips;
|
||||
}
|
||||
++blitsThisFrame;
|
||||
if (blitsThisFrame > MAX_REASONABLE_BLITS_PER_FRAME * 2) {
|
||||
WARN_LOG_ONCE(blendingBlit2, G3D, "Skipping additional blits needed for obscure blending: %d per frame, blend %d/%d/%d", blitsThisFrame, gstate.getBlendFuncA(), gstate.getBlendFuncB(), gstate.getBlendEq());
|
||||
return false;
|
||||
}
|
||||
|
||||
fboTexNeedBind_ = true;
|
||||
|
||||
gstate_c.Dirty(DIRTY_SHADERBLEND);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void DrawEngineDX9::ResetShaderBlending() {
|
||||
if (fboTexBound_) {
|
||||
pD3Ddevice->SetTexture(1, nullptr);
|
||||
|
||||
@@ -170,7 +170,6 @@ private:
|
||||
void DoFlush();
|
||||
void ApplyDrawState(int prim);
|
||||
void ApplyDrawStateLate();
|
||||
bool ApplyShaderBlending();
|
||||
void ResetShaderBlending();
|
||||
|
||||
GLuint AllocateBuffer(size_t sz);
|
||||
|
||||
@@ -120,34 +120,6 @@ static const GLushort logicOps[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
bool DrawEngineGLES::ApplyShaderBlending() {
|
||||
if (gstate_c.featureFlags & GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static const int MAX_REASONABLE_BLITS_PER_FRAME = 24;
|
||||
|
||||
static int lastFrameBlit = -1;
|
||||
static int blitsThisFrame = 0;
|
||||
if (lastFrameBlit != gpuStats.numFlips) {
|
||||
if (blitsThisFrame > MAX_REASONABLE_BLITS_PER_FRAME) {
|
||||
WARN_LOG_REPORT_ONCE(blendingBlit, G3D, "Lots of blits needed for obscure blending: %d per frame, blend %d/%d/%d", blitsThisFrame, gstate.getBlendFuncA(), gstate.getBlendFuncB(), gstate.getBlendEq());
|
||||
}
|
||||
blitsThisFrame = 0;
|
||||
lastFrameBlit = gpuStats.numFlips;
|
||||
}
|
||||
++blitsThisFrame;
|
||||
if (blitsThisFrame > MAX_REASONABLE_BLITS_PER_FRAME * 2) {
|
||||
WARN_LOG_ONCE(blendingBlit2, G3D, "Skipping additional blits needed for obscure blending: %d per frame, blend %d/%d/%d", blitsThisFrame, gstate.getBlendFuncA(), gstate.getBlendFuncB(), gstate.getBlendEq());
|
||||
return false;
|
||||
}
|
||||
|
||||
fboTexNeedBind_ = true;
|
||||
|
||||
gstate_c.Dirty(DIRTY_SHADERBLEND);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void DrawEngineGLES::ResetShaderBlending() {
|
||||
if (fboTexBound_) {
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "GPU/Common/VertexDecoderCommon.h"
|
||||
#include "GPU/Common/DrawEngineCommon.h"
|
||||
#include "GPU/Common/GPUStateUtils.h"
|
||||
#include "GPU/Vulkan/StateMappingVulkan.h"
|
||||
|
||||
struct DecVtxFormat;
|
||||
struct UVScale;
|
||||
@@ -132,6 +133,8 @@ public:
|
||||
private:
|
||||
struct FrameData;
|
||||
|
||||
void ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManager, ShaderManagerVulkan *shaderManager, int prim, VulkanPipelineRasterStateKey &key, VulkanDynamicState &dynState);
|
||||
|
||||
void InitDeviceObjects();
|
||||
void DestroyDeviceObjects();
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "GPU/Vulkan/TextureCacheVulkan.h"
|
||||
#include "GPU/Vulkan/FramebufferVulkan.h"
|
||||
#include "GPU/Vulkan/ShaderManagerVulkan.h"
|
||||
#include "GPU/Vulkan/DrawEngineVulkan.h"
|
||||
//#include "GPU/Vulkan/PixelShaderGeneratorVulkan.h"
|
||||
|
||||
// These tables all fit into u8s.
|
||||
@@ -120,10 +121,6 @@ static const VkLogicOp logicOps[] = {
|
||||
VK_LOGIC_OP_SET,
|
||||
};
|
||||
|
||||
bool ApplyShaderBlending() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void ResetShaderBlending() {
|
||||
//
|
||||
}
|
||||
@@ -131,7 +128,7 @@ void ResetShaderBlending() {
|
||||
// TODO: Do this more progressively. No need to compute the entire state if the entire state hasn't changed.
|
||||
// In Vulkan, we simply collect all the state together into a "pipeline key" - we don't actually set any state here
|
||||
// (the caller is responsible for setting the little dynamic state that is supported, dynState).
|
||||
void ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManager, ShaderManagerVulkan *shaderManager, int prim, VulkanPipelineRasterStateKey &key, VulkanDynamicState &dynState) {
|
||||
void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManager, ShaderManagerVulkan *shaderManager, int prim, VulkanPipelineRasterStateKey &key, VulkanDynamicState &dynState) {
|
||||
memset(&key, 0, sizeof(key));
|
||||
memset(&dynState, 0, sizeof(dynState));
|
||||
// Unfortunately, this isn't implemented yet.
|
||||
|
||||
Reference in new issue
Block a user