mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxbc] Lift ShaderStorageImageReadWithoutFormat requirement
This commit is contained in:
parent
fcff10aae7
commit
584ee6b6f0
@ -741,7 +741,8 @@ namespace dxvk {
|
|||||||
const bool isUav = ins.op == DxbcOpcode::DclUavTyped;
|
const bool isUav = ins.op == DxbcOpcode::DclUavTyped;
|
||||||
|
|
||||||
if (isUav) {
|
if (isUav) {
|
||||||
m_module.enableCapability(spv::CapabilityStorageImageReadWithoutFormat);
|
if (m_options.useStorageImageReadWithoutFormat)
|
||||||
|
m_module.enableCapability(spv::CapabilityStorageImageReadWithoutFormat);
|
||||||
m_module.enableCapability(spv::CapabilityStorageImageWriteWithoutFormat);
|
m_module.enableCapability(spv::CapabilityStorageImageWriteWithoutFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3136,6 +3137,13 @@ namespace dxvk {
|
|||||||
const DxbcRegisterValue texCoord = emitRegisterLoad(
|
const DxbcRegisterValue texCoord = emitRegisterLoad(
|
||||||
ins.src[0], getTexCoordMask(uavInfo.imageInfo));
|
ins.src[0], getTexCoordMask(uavInfo.imageInfo));
|
||||||
|
|
||||||
|
// If the read-without-format capability is not
|
||||||
|
// set. we must define the image format explicitly.
|
||||||
|
if (!m_options.useStorageImageReadWithoutFormat) {
|
||||||
|
m_module.setImageTypeFormat(uavInfo.imageTypeId,
|
||||||
|
getScalarImageFormat(uavInfo.sampledType));
|
||||||
|
}
|
||||||
|
|
||||||
// Load source value from the UAV
|
// Load source value from the UAV
|
||||||
DxbcRegisterValue uavValue;
|
DxbcRegisterValue uavValue;
|
||||||
uavValue.type.ctype = uavInfo.sampledType;
|
uavValue.type.ctype = uavInfo.sampledType;
|
||||||
|
@ -3,27 +3,23 @@
|
|||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
DxbcOptions::DxbcOptions(const Rc<DxvkDevice>& device) {
|
DxbcOptions::DxbcOptions(const Rc<DxvkDevice>& device) {
|
||||||
const VkPhysicalDeviceProperties deviceProps
|
const VkPhysicalDeviceProperties devProps = device->adapter()->deviceProperties();
|
||||||
= device->adapter()->deviceProperties();
|
const VkPhysicalDeviceFeatures devFeatures = device->features();
|
||||||
|
|
||||||
const DxvkGpuVendor vendor
|
// Apply driver-specific workarounds
|
||||||
= static_cast<DxvkGpuVendor>(deviceProps.vendorID);
|
const DxvkGpuVendor vendor = static_cast<DxvkGpuVendor>(devProps.vendorID);
|
||||||
|
|
||||||
if (vendor == DxvkGpuVendor::Nvidia) {
|
if (vendor == DxvkGpuVendor::Nvidia) {
|
||||||
// The driver expects the coordinate
|
// Older versions of the driver expect the
|
||||||
// vector to have an extra component
|
// coordinate vector to have an extra component
|
||||||
this->addExtraDrefCoordComponent = true;
|
this->addExtraDrefCoordComponent = true;
|
||||||
|
|
||||||
// From vkd3d: NMin/NMax/NClamp crash the driver.
|
// From vkd3d: NMin/NMax/NClamp may crash the driver.
|
||||||
this->useSimpleMinMaxClamp = true;
|
this->useSimpleMinMaxClamp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inform the user about which workarounds are enabled
|
// Enable certain features if they are supported by the device
|
||||||
if (this->addExtraDrefCoordComponent)
|
this->useStorageImageReadWithoutFormat = devFeatures.shaderStorageImageReadWithoutFormat;
|
||||||
Logger::warn("DxbcOptions: Growing coordinate vector for Dref operations");
|
|
||||||
|
|
||||||
if (this->useSimpleMinMaxClamp)
|
|
||||||
Logger::warn("DxbcOptions: Using FMin/FMax/FClamp instead of NMin/NMax/NClamp");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -20,6 +20,10 @@ namespace dxvk {
|
|||||||
|
|
||||||
/// Use Fmin/Fmax instead of Nmin/Nmax.
|
/// Use Fmin/Fmax instead of Nmin/Nmax.
|
||||||
bool useSimpleMinMaxClamp = false;
|
bool useSimpleMinMaxClamp = false;
|
||||||
|
|
||||||
|
/// If \c false, image read operations can only be performed
|
||||||
|
/// on storage images with a scalar 32-bit image formats.
|
||||||
|
bool useStorageImageReadWithoutFormat = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -624,12 +624,9 @@ namespace dxvk {
|
|||||||
uint32_t imageType,
|
uint32_t imageType,
|
||||||
spv::ImageFormat format) {
|
spv::ImageFormat format) {
|
||||||
for (auto ins : m_typeConstDefs) {
|
for (auto ins : m_typeConstDefs) {
|
||||||
bool match = ins.arg(1) == imageType;
|
if (ins.arg(1) == imageType
|
||||||
|
&& ins.arg(8) == spv::ImageFormatUnknown)
|
||||||
if (match) {
|
|
||||||
ins.setArg(8, format);
|
ins.setArg(8, format);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user