Correct LogicOp API support detection

This commit is contained in:
Henrik Rydgård 2022-09-03 22:41:57 +02:00
parent d3309dd8e9
commit 5f1ffeae70
5 changed files with 8 additions and 3 deletions

View file

@ -275,10 +275,11 @@ D3D11DrawContext::D3D11DrawContext(ID3D11Device *device, ID3D11DeviceContext *de
if (SUCCEEDED(result)) {
if (options.OutputMergerLogicOp) {
// Actually, need to check that the format supports logic ops as well.
// Which normal UNORM formats don't seem to do. So meh.
// Which normal UNORM formats don't seem to do in D3D11. So meh. We can't enable logicOp support.
// caps_.logicOpSupported = true;
}
}
IDXGIDevice* dxgiDevice = nullptr;
IDXGIAdapter* adapter = nullptr;
HRESULT hr = device_->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void**>(&dxgiDevice));

View file

@ -569,6 +569,10 @@ OpenGLContext::OpenGLContext() {
caps_.fragmentShaderDepthWriteSupported = true;
}
#ifndef USING_GLES2
caps_.logicOpSupported = true;
#endif
// 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

@ -795,6 +795,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit)
caps_.fragmentShaderInt32Supported = true;
caps_.textureNPOTFullySupported = true;
caps_.fragmentShaderDepthWriteSupported = true;
caps_.logicOpSupported = vulkan->GetDeviceFeatures().enabled.logicOp != 0;
auto deviceProps = vulkan->GetPhysicalDeviceProperties(vulkan_->GetCurrentPhysicalDeviceIndex()).properties;
switch (deviceProps.vendorID) {

View file

@ -937,7 +937,6 @@ static void ApplyLogicOp(BlendFactor &srcBlend, BlendFactor &dstBlend, BlendEq &
}
}
// Try to simulate some common logic ops.
void ApplyStencilReplaceAndLogicOpIgnoreBlend(ReplaceAlphaType replaceAlphaWithStencil, GenericBlendState &blendState) {
StencilValueType stencilType = STENCIL_VALUE_KEEP;
if (replaceAlphaWithStencil == REPLACE_ALPHA_YES) {

View file

@ -254,7 +254,7 @@ void GPU_Vulkan::CheckGPUFeatures() {
features |= GPU_SUPPORTS_DUALSOURCE_BLEND;
}
}
if (enabledFeatures.logicOp) {
if (draw_->GetDeviceCaps().logicOpSupported) {
features |= GPU_SUPPORTS_LOGIC_OP;
}
if (draw_->GetDeviceCaps().anisoSupported) {