mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +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;
|
||||
|
||||
if (isUav) {
|
||||
m_module.enableCapability(spv::CapabilityStorageImageReadWithoutFormat);
|
||||
if (m_options.useStorageImageReadWithoutFormat)
|
||||
m_module.enableCapability(spv::CapabilityStorageImageReadWithoutFormat);
|
||||
m_module.enableCapability(spv::CapabilityStorageImageWriteWithoutFormat);
|
||||
}
|
||||
|
||||
@ -3136,6 +3137,13 @@ namespace dxvk {
|
||||
const DxbcRegisterValue texCoord = emitRegisterLoad(
|
||||
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
|
||||
DxbcRegisterValue uavValue;
|
||||
uavValue.type.ctype = uavInfo.sampledType;
|
||||
|
@ -3,27 +3,23 @@
|
||||
namespace dxvk {
|
||||
|
||||
DxbcOptions::DxbcOptions(const Rc<DxvkDevice>& device) {
|
||||
const VkPhysicalDeviceProperties deviceProps
|
||||
= device->adapter()->deviceProperties();
|
||||
const VkPhysicalDeviceProperties devProps = device->adapter()->deviceProperties();
|
||||
const VkPhysicalDeviceFeatures devFeatures = device->features();
|
||||
|
||||
const DxvkGpuVendor vendor
|
||||
= static_cast<DxvkGpuVendor>(deviceProps.vendorID);
|
||||
// Apply driver-specific workarounds
|
||||
const DxvkGpuVendor vendor = static_cast<DxvkGpuVendor>(devProps.vendorID);
|
||||
|
||||
if (vendor == DxvkGpuVendor::Nvidia) {
|
||||
// The driver expects the coordinate
|
||||
// vector to have an extra component
|
||||
// Older versions of the driver expect the
|
||||
// coordinate vector to have an extra component
|
||||
this->addExtraDrefCoordComponent = true;
|
||||
|
||||
// From vkd3d: NMin/NMax/NClamp crash the driver.
|
||||
// From vkd3d: NMin/NMax/NClamp may crash the driver.
|
||||
this->useSimpleMinMaxClamp = true;
|
||||
}
|
||||
|
||||
// Inform the user about which workarounds are enabled
|
||||
if (this->addExtraDrefCoordComponent)
|
||||
Logger::warn("DxbcOptions: Growing coordinate vector for Dref operations");
|
||||
|
||||
if (this->useSimpleMinMaxClamp)
|
||||
Logger::warn("DxbcOptions: Using FMin/FMax/FClamp instead of NMin/NMax/NClamp");
|
||||
// Enable certain features if they are supported by the device
|
||||
this->useStorageImageReadWithoutFormat = devFeatures.shaderStorageImageReadWithoutFormat;
|
||||
}
|
||||
|
||||
}
|
@ -20,6 +20,10 @@ namespace dxvk {
|
||||
|
||||
/// Use Fmin/Fmax instead of Nmin/Nmax.
|
||||
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,
|
||||
spv::ImageFormat format) {
|
||||
for (auto ins : m_typeConstDefs) {
|
||||
bool match = ins.arg(1) == imageType;
|
||||
|
||||
if (match) {
|
||||
if (ins.arg(1) == imageType
|
||||
&& ins.arg(8) == spv::ImageFormatUnknown)
|
||||
ins.setArg(8, format);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user