Merge pull request #13406 from unknownbrackets/cull-through

Enable cull in through mode
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2020-09-09 07:07:07 +02:00
commit 8eb999ebd4
8 files changed
+22 -30

No files matched your search

+1 -1
View File
@@ -1853,7 +1853,7 @@ bool TextureCacheCommon::CheckFullHash(TexCacheEntry *entry, bool &doDelete) {
return true;
}
} else {
// It wasn't found, so we're about to throw away entry and rebuild a texture.
// It wasn't found, so we're about to throw away the entry and rebuild a texture.
// Let's save this in the secondary cache in case it gets used again.
secondKey = entry->fullhash | ((u64)entry->cluthash << 32);
secondCacheSizeEstimate_ += EstimateTexMemoryUsage(entry);
+3 -4
View File
@@ -276,14 +276,13 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
if (gstate_c.IsDirty(DIRTY_RASTER_STATE)) {
keys_.raster.value = 0;
bool wantCull = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
keys_.raster.cullMode = wantCull ? (gstate.getCullMode() ? D3D11_CULL_FRONT : D3D11_CULL_BACK) : D3D11_CULL_NONE;
if (gstate.isModeClear() || gstate.isModeThrough()) {
keys_.raster.cullMode = D3D11_CULL_NONE;
// TODO: Might happen in clear mode if not through...
keys_.raster.depthClipEnable = 1;
} else {
// Set cull
bool wantCull = prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
keys_.raster.cullMode = wantCull ? (gstate.getCullMode() ? D3D11_CULL_FRONT : D3D11_CULL_BACK) : D3D11_CULL_NONE;
if (gstate.getDepthRangeMin() == 0 || gstate.getDepthRangeMax() == 65535) {
// TODO: Still has a bug where we clamp to depth range if one is not the full range.
// But the alternate is not clamping in either direction...
+2 -5
View File
@@ -202,15 +202,12 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
} else {
dxstate.dither.disable();
}
bool wantCull = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
dxstate.cullMode.set(wantCull, gstate.getCullMode());
if (gstate.isModeClear()) {
// Set Cull
dxstate.cullMode.set(false, false);
// Well, probably doesn't matter...
dxstate.shadeMode.set(D3DSHADE_GOURAUD);
} else {
// Set cull
bool wantCull = !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
dxstate.cullMode.set(wantCull, gstate.getCullMode());
dxstate.shadeMode.set(gstate.getShadeMode() == GE_SHADE_GOURAUD ? D3DSHADE_GOURAUD : D3DSHADE_FLAT);
}
}
+1 -7
View File
@@ -259,13 +259,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
bool cullEnable;
GLenum cullMode = cullingMode[gstate.getCullMode() ^ !useBufferedRendering];
if (gstate.isModeClear()) {
// Culling
cullEnable = false;
} else {
// Set cull
cullEnable = !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
}
cullEnable = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
renderManager->SetRaster(cullEnable, GL_CCW, cullMode, dither);
}
+1 -1
View File
@@ -206,7 +206,7 @@ void ProcessRect(const VertexData& v0, const VertexData& v1)
VertexData* bottomleft = &buf[2];
VertexData* bottomright = &buf[3];
// Um. Why is this stuff needed?
// DrawTriangle always culls, so sort out the drawing order.
for (int i = 0; i < 4; ++i) {
if (buf[i].screenpos.x < topleft->screenpos.x && buf[i].screenpos.y < topleft->screenpos.y)
topleft = &buf[i];
+3 -1
View File
@@ -237,8 +237,10 @@ bool RectangleFastPath(const VertexData &v0, const VertexData &v1) {
bool coord_check =
(xdiff == udiff || xdiff == -udiff) &&
(ydiff == vdiff || ydiff == -vdiff);
// Currently only works for TL/BR, which is the most common but not required.
bool orient_check = xdiff >= 0 && ydiff >= 0;
bool state_check = !gstate.isModeClear(); // TODO: Add support for clear modes in Rasterizer::DrawSprite.
if ((coord_check || !gstate.isTextureMapEnabled()) && state_check) {
if ((coord_check || !gstate.isTextureMapEnabled()) && orient_check && state_check) {
Rasterizer::DrawSprite(v0, v1);
return true;
}
+3 -3
View File
@@ -255,14 +255,14 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
}
if (gstate_c.IsDirty(DIRTY_RASTER_STATE)) {
bool wantCull = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
key.cullMode = wantCull ? (gstate.getCullMode() ? VK_CULL_MODE_FRONT_BIT : VK_CULL_MODE_BACK_BIT) : VK_CULL_MODE_NONE;
if (gstate.isModeClear() || gstate.isModeThrough()) {
key.cullMode = VK_CULL_MODE_NONE;
// TODO: Might happen in clear mode if not through...
key.depthClampEnable = false;
} else {
// Set cull
bool wantCull = prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
key.cullMode = wantCull ? (gstate.getCullMode() ? VK_CULL_MODE_FRONT_BIT : VK_CULL_MODE_BACK_BIT) : VK_CULL_MODE_NONE;
if (gstate.getDepthRangeMin() == 0 || gstate.getDepthRangeMax() == 65535) {
// TODO: Still has a bug where we clamp to depth range if one is not the full range.
// But the alternate is not clamping in either direction...
+8 -8
View File
@@ -328,14 +328,6 @@ int main(int argc, const char* argv[])
if (testFilenames.empty())
return printUsage(argv[0], argc <= 1 ? NULL : "No executables specified");
HeadlessHost *headlessHost = getHost(gpuCore);
headlessHost->SetGraphicsCore(gpuCore);
host = headlessHost;
std::string error_string;
GraphicsContext *graphicsContext = nullptr;
bool glWorking = host->InitGraphics(&error_string, &graphicsContext);
LogManager::Init(&g_Config.bEnableLogging);
LogManager *logman = LogManager::GetInstance();
@@ -348,6 +340,14 @@ int main(int argc, const char* argv[])
}
logman->AddListener(printfLogger);
HeadlessHost *headlessHost = getHost(gpuCore);
headlessHost->SetGraphicsCore(gpuCore);
host = headlessHost;
std::string error_string;
GraphicsContext *graphicsContext = nullptr;
bool glWorking = host->InitGraphics(&error_string, &graphicsContext);
CoreParameter coreParameter;
coreParameter.cpuCore = cpuCore;
coreParameter.gpuCore = glWorking ? gpuCore : GPUCORE_NULL;