mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #16734 from hrydgard/remove-nonindexed-optimization-vk
Vulkan: Don't use non-indexed draws for pure tristrips and fans (only PowerVR for now)
This commit is contained in:
commit
0604e51272
6 changed files with 42 additions and 10 deletions
|
@ -861,6 +861,11 @@ VKContext::VKContext(VulkanContext *vulkan)
|
|||
break;
|
||||
}
|
||||
|
||||
if (caps_.vendor == GPUVendor::VENDOR_IMGTEC) {
|
||||
// Enable some things that cut down pipeline counts but may have other costs.
|
||||
caps_.verySlowShaderCompiler = true;
|
||||
}
|
||||
|
||||
// Hide D3D9 when we know it likely won't work well.
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
caps_.supportsD3D9 = true;
|
||||
|
|
|
@ -577,6 +577,8 @@ struct DeviceCaps {
|
|||
bool isTilingGPU; // This means that it benefits from correct store-ops, msaa without backing memory, etc.
|
||||
bool sampleRateShadingSupported;
|
||||
|
||||
bool verySlowShaderCompiler;
|
||||
|
||||
// From the other backends, we can detect if D3D9 support is known bad (like on Xe) and disable it.
|
||||
bool supportsD3D9;
|
||||
|
||||
|
|
|
@ -47,6 +47,15 @@ public:
|
|||
}
|
||||
|
||||
GEPrimitiveType Prim() const { return prim_; }
|
||||
GEPrimitiveType GeneralPrim() const {
|
||||
switch (prim_) {
|
||||
case GE_PRIM_LINE_STRIP: return GE_PRIM_LINES; break;
|
||||
case GE_PRIM_TRIANGLE_STRIP:
|
||||
case GE_PRIM_TRIANGLE_FAN: return GE_PRIM_TRIANGLES; break;
|
||||
default:
|
||||
return prim_;
|
||||
}
|
||||
}
|
||||
|
||||
void AddPrim(int prim, int vertexCount, bool clockwise);
|
||||
void TranslatePrim(int prim, int numInds, const u8 *inds, int indexOffset, bool clockwise);
|
||||
|
|
|
@ -956,7 +956,7 @@ enum class CacheDetectFlags {
|
|||
};
|
||||
|
||||
#define CACHE_HEADER_MAGIC 0x83277592
|
||||
#define CACHE_VERSION 25
|
||||
#define CACHE_VERSION 26
|
||||
|
||||
struct CacheHeader {
|
||||
uint32_t magic;
|
||||
|
|
|
@ -582,6 +582,10 @@ void DrawEngineVulkan::DoFlush() {
|
|||
uint32_t ibOffset;
|
||||
uint32_t vbOffset;
|
||||
|
||||
// The optimization to avoid indexing isn't really worth it on Vulkan since it means creating more pipelines.
|
||||
// This could be avoided with the new dynamic state extensions, but not available enough on mobile.
|
||||
const bool forceIndexed = draw_->GetDeviceCaps().verySlowShaderCompiler;
|
||||
|
||||
if (useHWTransform) {
|
||||
int vertexCount = 0;
|
||||
bool useElements = true;
|
||||
|
@ -668,13 +672,19 @@ void DrawEngineVulkan::DoFlush() {
|
|||
DecodeVertsToPushBuffer(vertexCache_, &vai->vbOffset, &vai->vb);
|
||||
_dbg_assert_msg_(gstate_c.vertBounds.minV >= gstate_c.vertBounds.maxV, "Should not have checked UVs when caching.");
|
||||
vai->numVerts = indexGen.VertexCount();
|
||||
vai->prim = indexGen.Prim();
|
||||
vai->maxIndex = indexGen.MaxIndex();
|
||||
vai->flags = gstate_c.vertexFullAlpha ? VAIVULKAN_FLAG_VERTEXFULLALPHA : 0;
|
||||
useElements = !indexGen.SeenOnlyPurePrims();
|
||||
if (!useElements && indexGen.PureCount()) {
|
||||
vai->numVerts = indexGen.PureCount();
|
||||
if (forceIndexed) {
|
||||
vai->prim = indexGen.GeneralPrim();
|
||||
useElements = true;
|
||||
} else {
|
||||
vai->prim = indexGen.Prim();
|
||||
useElements = !indexGen.SeenOnlyPurePrims();
|
||||
if (!useElements && indexGen.PureCount()) {
|
||||
vai->numVerts = indexGen.PureCount();
|
||||
}
|
||||
}
|
||||
|
||||
if (useElements) {
|
||||
u32 size = sizeof(uint16_t) * indexGen.VertexCount();
|
||||
void *dest = vertexCache_->Push(size, &vai->ibOffset, &vai->ib);
|
||||
|
@ -743,12 +753,18 @@ void DrawEngineVulkan::DoFlush() {
|
|||
|
||||
rotateVBO:
|
||||
gpuStats.numUncachedVertsDrawn += indexGen.VertexCount();
|
||||
useElements = !indexGen.SeenOnlyPurePrims();
|
||||
|
||||
vertexCount = indexGen.VertexCount();
|
||||
if (!useElements && indexGen.PureCount()) {
|
||||
vertexCount = indexGen.PureCount();
|
||||
if (forceIndexed) {
|
||||
useElements = true;
|
||||
prim = indexGen.GeneralPrim();
|
||||
} else {
|
||||
useElements = !indexGen.SeenOnlyPurePrims();
|
||||
if (!useElements && indexGen.PureCount()) {
|
||||
vertexCount = indexGen.PureCount();
|
||||
}
|
||||
prim = indexGen.Prim();
|
||||
}
|
||||
prim = indexGen.Prim();
|
||||
}
|
||||
|
||||
bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE;
|
||||
|
|
|
@ -511,7 +511,7 @@ enum class VulkanCacheDetectFlags {
|
|||
};
|
||||
|
||||
#define CACHE_HEADER_MAGIC 0xff51f420
|
||||
#define CACHE_VERSION 39
|
||||
#define CACHE_VERSION 40
|
||||
|
||||
struct VulkanCacheHeader {
|
||||
uint32_t magic;
|
||||
|
|
Loading…
Add table
Reference in a new issue