mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 01:24:11 +01:00
[dxvk] Use custom border colors if available
This commit is contained in:
parent
0648314451
commit
1fc6e3adbe
@ -7,6 +7,12 @@ namespace dxvk {
|
||||
DxvkDevice* device,
|
||||
const DxvkSamplerCreateInfo& info)
|
||||
: m_vkd(device->vkd()) {
|
||||
VkSamplerCustomBorderColorCreateInfoEXT borderColorInfo;
|
||||
borderColorInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT;
|
||||
borderColorInfo.pNext = nullptr;
|
||||
borderColorInfo.customBorderColor = info.borderColor;
|
||||
borderColorInfo.format = VK_FORMAT_UNDEFINED;
|
||||
|
||||
VkSamplerCreateInfo samplerInfo;
|
||||
samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
||||
samplerInfo.pNext = nullptr;
|
||||
@ -32,6 +38,9 @@ namespace dxvk {
|
||||
|| samplerInfo.addressModeW == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)
|
||||
samplerInfo.borderColor = getBorderColor(device, info);
|
||||
|
||||
if (samplerInfo.borderColor == VK_BORDER_COLOR_FLOAT_CUSTOM_EXT)
|
||||
samplerInfo.pNext = &borderColorInfo;
|
||||
|
||||
if (m_vkd->vkCreateSampler(m_vkd->device(),
|
||||
&samplerInfo, nullptr, &m_sampler) != VK_SUCCESS)
|
||||
throw DxvkError("DxvkSampler::DxvkSampler: Failed to create sampler");
|
||||
@ -61,11 +70,12 @@ namespace dxvk {
|
||||
return e.second;
|
||||
}
|
||||
|
||||
Logger::warn(str::format(
|
||||
"DXVK: No matching border color found for (",
|
||||
info.borderColor.float32[0], ",", info.borderColor.float32[1], ",",
|
||||
info.borderColor.float32[2], ",", info.borderColor.float32[3], ")"));
|
||||
return VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
|
||||
if (!device->features().extCustomBorderColor.customBorderColorWithoutFormat) {
|
||||
Logger::warn("DXVK: Custom border colors not supported");
|
||||
return VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
|
||||
}
|
||||
|
||||
return VK_BORDER_COLOR_FLOAT_CUSTOM_EXT;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user