Add provoking vertex to caps, flip the flag around

This commit is contained in:
Henrik Rydgård 2024-07-17 12:37:20 +02:00
parent f6aa86dfee
commit 665f03ff62
11 changed files with 18 additions and 8 deletions

View file

@ -281,6 +281,8 @@ D3D11DrawContext::D3D11DrawContext(ID3D11Device *device, ID3D11DeviceContext *de
caps_.blendMinMaxSupported = true;
caps_.multiSampleLevelsMask = 1; // More could be supported with some work.
caps_.provokingVertexLast = false; // D3D has it first, unfortunately. (and no way to change it).
caps_.presentInstantModeChange = true;
caps_.presentMaxInterval = 4;
caps_.presentModesSupported = PresentMode::FIFO | PresentMode::IMMEDIATE;

View file

@ -786,6 +786,8 @@ D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, ID
caps_.presentMaxInterval = 1;
caps_.presentModesSupported = PresentMode::FIFO;
caps_.provokingVertexLast = false; // D3D has it first, unfortunately (and no way to change it).
if ((caps.RasterCaps & D3DPRASTERCAPS_ANISOTROPY) != 0 && caps.MaxAnisotropy > 1) {
caps_.anisoSupported = true;
}

View file

@ -598,6 +598,9 @@ OpenGLContext::OpenGLContext(bool canChangeSwapInterval) : renderManager_(frameT
// GLES has no support for logic framebuffer operations. There doesn't even seem to exist any such extensions.
caps_.logicOpSupported = !gl_extensions.IsGLES;
// Always the case in GL (which is what we want for PSP flat shade).
caps_.provokingVertexLast = true;
// Interesting potential hack for emulating GL_DEPTH_CLAMP (use a separate varying, force depth in fragment shader):
// This will induce a performance penalty on many architectures though so a blanket enable of this
// is probably not a good idea.

View file

@ -913,6 +913,9 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread)
caps_.sampleRateShadingSupported = vulkan->GetDeviceFeatures().enabled.standard.sampleRateShading != 0;
caps_.textureSwizzleSupported = true;
// Note that it must also be enabled on the pipelines (which we do).
caps_.provokingVertexLast = vulkan->GetDeviceFeatures().enabled.provokingVertex.provokingVertexLast;
// Present mode stuff
caps_.presentMaxInterval = 1;
caps_.presentInstantModeChange = false; // TODO: Fix this with some work in VulkanContext

View file

@ -612,7 +612,7 @@ struct DeviceCaps {
bool setMaxFrameLatencySupported;
bool textureSwizzleSupported;
bool requiresHalfPixelOffset;
bool provokingVertexLast; // GL behavior, what the PSP does
bool verySlowShaderCompiler;
// From the other backends, we can detect if D3D9 support is known bad (like on Xe) and disable it.

View file

@ -203,7 +203,7 @@ void SoftwareTransform::Transform(int prim, u32 vertType, const DecVtxFormat &de
}
int provokeIndOffset = 0;
if (params_.provokeFlatFirst) {
if (!params_.provokingVertexLast) {
provokeIndOffset = ColorIndexOffset(prim, gstate.getShadeMode(), gstate.isModeClear());
}

View file

@ -57,9 +57,9 @@ struct SoftwareTransformParams {
TextureCacheCommon *texCache;
bool allowClear;
bool allowSeparateAlphaClear;
bool provokeFlatFirst;
bool flippedY;
bool usesHalfZ;
bool provokingVertexLast;
};
class SoftwareTransform {

View file

@ -382,7 +382,7 @@ void DrawEngineD3D11::DoFlush() {
params.texCache = textureCache_;
params.allowClear = true;
params.allowSeparateAlphaClear = false; // D3D11 doesn't support separate alpha clears
params.provokeFlatFirst = true;
params.provokingVertexLast = false;
params.flippedY = false;
params.usesHalfZ = true;

View file

@ -334,7 +334,7 @@ void DrawEngineDX9::DoFlush() {
params.texCache = textureCache_;
params.allowClear = true;
params.allowSeparateAlphaClear = false;
params.provokeFlatFirst = true;
params.provokingVertexLast = false;
params.flippedY = false;
params.usesHalfZ = true;

View file

@ -356,7 +356,7 @@ void DrawEngineGLES::DoFlush() {
params.texCache = textureCache_;
params.allowClear = true; // Clear in OpenGL respects scissor rects, so we'll use it.
params.allowSeparateAlphaClear = true;
params.provokeFlatFirst = false;
params.provokingVertexLast = true;
params.flippedY = framebufferManager_->UseBufferedRendering();
params.usesHalfZ = false;

View file

@ -407,9 +407,9 @@ void DrawEngineVulkan::DoFlush() {
params.allowSeparateAlphaClear = false;
if (renderManager->GetVulkanContext()->GetDeviceFeatures().enabled.provokingVertex.provokingVertexLast) {
// We can get the OpenGL behavior, no need for workarounds.
params.provokeFlatFirst = false;
params.provokingVertexLast = true;
} else {
params.provokeFlatFirst = true;
params.provokingVertexLast = false;
}
params.flippedY = true;
params.usesHalfZ = true;