Fix another little inconsistency (two uniforms were merged for bad reasons)

This commit is contained in:
Henrik Rydgård 2017-12-07 21:38:02 +01:00
parent fb74c9dfeb
commit b75c8b72c6
8 changed files with 9 additions and 26 deletions

View File

@ -71,9 +71,6 @@ enum : uint64_t {
DIRTY_SHADERBLEND = 1ULL << 17, // Used only for in-shader blending.
DIRTY_UVSCALEOFFSET = 1ULL << 18,
// Texclamp is fairly rare so let's share it's bit with DIRTY_DEPTHRANGE.
DIRTY_TEXCLAMP = 1ULL << 19,
DIRTY_DEPTHRANGE = 1ULL << 19,
DIRTY_WORLDMATRIX = 1ULL << 21,
@ -90,10 +87,13 @@ enum : uint64_t {
// These are for hardware tessellation
DIRTY_BEZIERSPLINE = 1ULL << 32,
DIRTY_TEXCLAMP = 1ULL << 33,
// space for 7 more uniforms.
DIRTY_BONE_UNIFORMS = 0xFF000000ULL,
DIRTY_ALL_UNIFORMS = 0x1FFFFFFFFULL,
DIRTY_ALL_UNIFORMS = 0x3FFFFFFFFULL,
DIRTY_ALL_LIGHTS = DIRTY_LIGHT0 | DIRTY_LIGHT1 | DIRTY_LIGHT2 | DIRTY_LIGHT3,
// Other dirty elements that aren't uniforms!

View File

@ -6,7 +6,6 @@
// Used by the "modern" backends that use uniform buffers. They can share this without issue.
// Pretty much full. Will need more bits for more fine grained dirty tracking for lights.
enum : uint64_t {
DIRTY_BASE_UNIFORMS =
DIRTY_WORLDMATRIX | DIRTY_PROJTHROUGHMATRIX | DIRTY_VIEWMATRIX | DIRTY_TEXMATRIX | DIRTY_ALPHACOLORREF |

View File

@ -836,7 +836,9 @@ void TextureCacheCommon::SetTextureFramebuffer(TexCacheEntry *entry, VirtualFram
gstate_c.bgraTexture = false;
gstate_c.curTextureXOffset = fbInfo.xOffset;
gstate_c.curTextureYOffset = fbInfo.yOffset;
gstate_c.SetNeedShaderTexclamp(gstate_c.curTextureWidth != (u32)gstate.getTextureWidth(0) || gstate_c.curTextureHeight != (u32)gstate.getTextureHeight(0));
u32 texW = (u32)gstate.getTextureWidth(0);
u32 texH = (u32)gstate.getTextureHeight(0);
gstate_c.SetNeedShaderTexclamp(gstate_c.curTextureWidth != texW || gstate_c.curTextureHeight != texH);
if (gstate_c.curTextureXOffset != 0 || gstate_c.curTextureYOffset != 0) {
gstate_c.SetNeedShaderTexclamp(true);
}

View File

@ -426,11 +426,6 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
if (gstate_c.IsDirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS) && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
textureCache_->SetTexture();
gstate_c.Clean(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
if (gstate_c.needShaderTexClamp) {
// We will rarely need to set this, so let's do it every time on use rather than in runloop.
// Most of the time non-framebuffer textures will be used which can be clamped themselves.
gstate_c.Dirty(DIRTY_TEXCLAMP);
}
}
}

View File

@ -103,11 +103,6 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
if (gstate_c.IsDirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS) && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
textureCache_->SetTexture();
gstate_c.Clean(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
if (gstate_c.needShaderTexClamp) {
// We will rarely need to set this, so let's do it every time on use rather than in runloop.
// Most of the time non-framebuffer textures will be used which can be clamped themselves.
gstate_c.Dirty(DIRTY_TEXCLAMP);
}
}
// Start profiling here to skip SetTexture which is already accounted for

View File

@ -134,11 +134,6 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
if (gstate_c.IsDirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS) && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
textureCache_->SetTexture();
gstate_c.Clean(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
if (gstate_c.needShaderTexClamp) {
// We will rarely need to set this, so let's do it every time on use rather than in runloop.
// Most of the time non-framebuffer textures will be used which can be clamped themselves.
gstate_c.Dirty(DIRTY_TEXCLAMP);
}
}
if (!gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE)) {

View File

@ -528,6 +528,8 @@ struct GPUStateCache {
if (need != needShaderTexClamp) {
needShaderTexClamp = need;
Dirty(DIRTY_FRAGMENTSHADER_STATE);
if (need)
Dirty(DIRTY_TEXCLAMP);
}
}
void SetAllowShaderBlend(bool allow) {

View File

@ -619,11 +619,6 @@ void DrawEngineVulkan::DoFlush() {
textureCache_->SetTexture();
gstate_c.Clean(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
textureNeedsApply = true;
if (gstate_c.needShaderTexClamp) {
// We will rarely need to set this, so let's do it every time on use rather than in runloop.
// Most of the time non-framebuffer textures will be used which can be clamped themselves.
gstate_c.Dirty(DIRTY_TEXCLAMP);
}
}
GEPrimitiveType prim = prevPrim_;