#include "util/timespec.h"
#include "util/u_atomic.h"
#include "compiler/glsl_types.h"
-#include "util/xmlpool.h"
+#include "util/driconf.h"
static struct radv_timeline_point *
radv_timeline_find_point_at_least_locked(struct radv_device *device,
unsigned type_count = 0;
- if (device->rad_info.has_dedicated_vram) {
- if (vram_index >= 0) {
- device->memory_domains[type_count] = RADEON_DOMAIN_VRAM;
- device->memory_flags[type_count] = RADEON_FLAG_NO_CPU_ACCESS;
- device->memory_properties.memoryTypes[type_count++] = (VkMemoryType) {
- .propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
- .heapIndex = vram_index,
- };
- }
- } else {
- if (visible_vram_index >= 0) {
- device->memory_domains[type_count] = RADEON_DOMAIN_VRAM;
- device->memory_flags[type_count] = RADEON_FLAG_NO_CPU_ACCESS;
- device->memory_properties.memoryTypes[type_count++] = (VkMemoryType) {
- .propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
- .heapIndex = visible_vram_index,
- };
- }
+ if (vram_index >= 0 || visible_vram_index >= 0) {
+ device->memory_domains[type_count] = RADEON_DOMAIN_VRAM;
+ device->memory_flags[type_count] = RADEON_FLAG_NO_CPU_ACCESS;
+ device->memory_properties.memoryTypes[type_count++] = (VkMemoryType) {
+ .propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
+ .heapIndex = vram_index >= 0 ? vram_index : visible_vram_index,
+ };
}
if (gart_index >= 0) {
static const char *
radv_get_compiler_string(struct radv_physical_device *pdevice)
{
- if (pdevice->use_aco) {
+ if (!pdevice->use_llvm) {
/* Some games like SotTR apply shader workarounds if the LLVM
* version is too old or if the LLVM version string is
* missing. This gives 2-5% performance with SotTR and ACO.
device->local_fd = fd;
device->ws->query_info(device->ws, &device->rad_info);
- device->use_aco = instance->perftest_flags & RADV_PERFTEST_ACO;
+ device->use_llvm = instance->debug_flags & RADV_DEBUG_LLVM;
snprintf(device->name, sizeof(device->name),
"AMD RADV %s (%s)",
}
/* These flags affect shader compilation. */
- uint64_t shader_env_flags = (device->use_aco ? 0x2 : 0);
+ uint64_t shader_env_flags = (device->use_llvm ? 0 : 0x2);
/* The gpu id is already embedded in the uuid so we just pass "radv"
* when creating the cache.
disk_cache_format_hex_id(buf, device->cache_uuid, VK_UUID_SIZE * 2);
device->disk_cache = disk_cache_create(device->name, buf, shader_env_flags);
- if (device->rad_info.chip_class < GFX8)
+ if (device->rad_info.chip_class < GFX8 || !device->use_llvm)
fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
radv_get_driver_uuid(&device->driver_uuid);
device->dcc_msaa_allowed =
(device->instance->perftest_flags & RADV_PERFTEST_DCC_MSAA);
- device->use_shader_ballot = (device->use_aco && device->rad_info.chip_class >= GFX8) ||
- (device->instance->perftest_flags & RADV_PERFTEST_SHADER_BALLOT);
-
device->use_ngg = device->rad_info.chip_class >= GFX10 &&
device->rad_info.family != CHIP_NAVI14 &&
!(device->instance->debug_flags & RADV_DEBUG_NO_NGG);
/* TODO: Implement NGG GS with ACO. */
- device->use_ngg_gs = device->use_ngg && !device->use_aco;
+ device->use_ngg_gs = device->use_ngg && device->use_llvm;
device->use_ngg_streamout = false;
/* Determine the number of threads per wave for all stages. */
fail_alloc:
vk_free(&instance->alloc, device);
fail_fd:
- close(fd);
+ if (fd != -1)
+ close(fd);
if (master_fd != -1)
close(master_fd);
return result;
{"checkir", RADV_DEBUG_CHECKIR},
{"nothreadllvm", RADV_DEBUG_NOTHREADLLVM},
{"nobinning", RADV_DEBUG_NOBINNING},
- {"noloadstoreopt", RADV_DEBUG_NO_LOAD_STORE_OPT},
{"nongg", RADV_DEBUG_NO_NGG},
- {"noshaderballot", RADV_DEBUG_NO_SHADER_BALLOT},
{"allentrypoints", RADV_DEBUG_ALL_ENTRYPOINTS},
{"metashaders", RADV_DEBUG_DUMP_META_SHADERS},
{"nomemorycache", RADV_DEBUG_NO_MEMORY_CACHE},
+ {"llvm", RADV_DEBUG_LLVM},
{NULL, 0}
};
{"localbos", RADV_PERFTEST_LOCAL_BOS},
{"dccmsaa", RADV_PERFTEST_DCC_MSAA},
{"bolist", RADV_PERFTEST_BO_LIST},
- {"shader_ballot", RADV_PERFTEST_SHADER_BALLOT},
{"tccompatcmask", RADV_PERFTEST_TC_COMPAT_CMASK},
{"cswave32", RADV_PERFTEST_CS_WAVE_32},
{"pswave32", RADV_PERFTEST_PS_WAVE_32},
{"gewave32", RADV_PERFTEST_GE_WAVE_32},
{"dfsm", RADV_PERFTEST_DFSM},
- {"aco", RADV_PERFTEST_ACO},
{NULL, 0}
};
const VkApplicationInfo *info)
{
const char *name = info ? info->pApplicationName : NULL;
-
- if (!name)
- return;
-
- if (!strcmp(name, "DOOM_VFR")) {
- /* Work around a Doom VFR game bug */
- instance->debug_flags |= RADV_DEBUG_NO_DYNAMIC_BOUNDS;
- } else if (!strcmp(name, "MonsterHunterWorld.exe")) {
- /* Workaround for a WaW hazard when LLVM moves/merges
- * load/store memory operations.
- * See https://reviews.llvm.org/D61313
- */
- if (LLVM_VERSION_MAJOR < 9)
- instance->debug_flags |= RADV_DEBUG_NO_LOAD_STORE_OPT;
- } else if (!strcmp(name, "Wolfenstein: Youngblood")) {
- if (!(instance->debug_flags & RADV_DEBUG_NO_SHADER_BALLOT) &&
- !(instance->perftest_flags & RADV_PERFTEST_ACO)) {
- /* Force enable VK_AMD_shader_ballot because it looks
- * safe and it gives a nice boost (+20% on Vega 56 at
- * this time). It also prevents corruption on LLVM.
+ const char *engine_name = info ? info->pEngineName : NULL;
+
+ if (name) {
+ if (!strcmp(name, "DOOM_VFR")) {
+ /* Work around a Doom VFR game bug */
+ instance->debug_flags |= RADV_DEBUG_NO_DYNAMIC_BOUNDS;
+ } else if (!strcmp(name, "Fledge")) {
+ /*
+ * Zero VRAM for "The Surge 2"
+ *
+ * This avoid a hang when when rendering any level. Likely
+ * uninitialized data in an indirect draw.
*/
- instance->perftest_flags |= RADV_PERFTEST_SHADER_BALLOT;
+ instance->debug_flags |= RADV_DEBUG_ZERO_VRAM;
+ } else if (!strcmp(name, "No Man's Sky")) {
+ /* Work around a NMS game bug */
+ instance->debug_flags |= RADV_DEBUG_DISCARD_TO_DEMOTE;
+ } else if (!strcmp(name, "DOOMEternal")) {
+ /* Zero VRAM for Doom Eternal to fix rendering issues. */
+ instance->debug_flags |= RADV_DEBUG_ZERO_VRAM;
+ } else if (!strcmp(name, "Red Dead Redemption 2")) {
+ /* Work around a RDR2 game bug */
+ instance->debug_flags |= RADV_DEBUG_DISCARD_TO_DEMOTE;
+ }
+ }
+
+ if (engine_name) {
+ if (!strcmp(engine_name, "vkd3d")) {
+ /* Zero VRAM for all VKD3D (DX12->VK) games to fix
+ * rendering issues.
+ */
+ instance->debug_flags |= RADV_DEBUG_ZERO_VRAM;
+ } else if (!strcmp(engine_name, "Quantic Dream Engine")) {
+ /* Fix various artifacts in Detroit: Become Human */
+ instance->debug_flags |= RADV_DEBUG_ZERO_VRAM;
}
- } else if (!strcmp(name, "Fledge")) {
- /*
- * Zero VRAM for "The Surge 2"
- *
- * This avoid a hang when when rendering any level. Likely
- * uninitialized data in an indirect draw.
- */
- instance->debug_flags |= RADV_DEBUG_ZERO_VRAM;
- } else if (!strcmp(name, "No Man's Sky")) {
- /* Work around a NMS game bug */
- instance->debug_flags |= RADV_DEBUG_DISCARD_TO_DEMOTE;
}
+
+ instance->enable_mrt_output_nan_fixup =
+ driQueryOptionb(&instance->dri_options,
+ "radv_enable_mrt_output_nan_fixup");
+
+ if (driQueryOptionb(&instance->dri_options, "radv_no_dynamic_bounds"))
+ instance->debug_flags |= RADV_DEBUG_NO_DYNAMIC_BOUNDS;
}
static const char radv_dri_options_xml[] =
DRI_CONF_ADAPTIVE_SYNC("true")
DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(0)
DRI_CONF_VK_X11_STRICT_IMAGE_COUNT("false")
+ DRI_CONF_VK_X11_ENSURE_MIN_IMAGE_COUNT("false")
DRI_CONF_RADV_REPORT_LLVM9_VERSION_STRING("false")
+ DRI_CONF_RADV_ENABLE_MRT_OUTPUT_NAN_FIXUP("false")
+ DRI_CONF_RADV_NO_DYNAMIC_BOUNDS("false")
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
instance->perftest_flags = parse_debug_string(getenv("RADV_PERFTEST"),
radv_perftest_options);
- if (instance->perftest_flags & RADV_PERFTEST_ACO)
- fprintf(stderr, "WARNING: Experimental compiler backend enabled. Here be dragons! Incorrect rendering, GPU hangs and/or resets are likely\n");
-
if (instance->debug_flags & RADV_DEBUG_STARTUP)
radv_logi("Created an instance");
.shaderCullDistance = true,
.shaderFloat64 = true,
.shaderInt64 = true,
- .shaderInt16 = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8,
+ .shaderInt16 = true,
.sparseBinding = true,
.variableMultisampleRate = true,
.shaderResourceMinLod = true,
};
}
+static void
+radv_get_physical_device_features_1_1(struct radv_physical_device *pdevice,
+ VkPhysicalDeviceVulkan11Features *f)
+{
+ assert(f->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES);
+
+ f->storageBuffer16BitAccess = true;
+ f->uniformAndStorageBuffer16BitAccess = true;
+ f->storagePushConstant16 = true;
+ f->storageInputOutput16 = pdevice->rad_info.has_packed_math_16bit && (LLVM_VERSION_MAJOR >= 9 || !pdevice->use_llvm);
+ f->multiview = true;
+ f->multiviewGeometryShader = true;
+ f->multiviewTessellationShader = true;
+ f->variablePointersStorageBuffer = true;
+ f->variablePointers = true;
+ f->protectedMemory = false;
+ f->samplerYcbcrConversion = true;
+ f->shaderDrawParameters = true;
+}
+
+static void
+radv_get_physical_device_features_1_2(struct radv_physical_device *pdevice,
+ VkPhysicalDeviceVulkan12Features *f)
+{
+ assert(f->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES);
+
+ f->samplerMirrorClampToEdge = true;
+ f->drawIndirectCount = true;
+ f->storageBuffer8BitAccess = true;
+ f->uniformAndStorageBuffer8BitAccess = true;
+ f->storagePushConstant8 = true;
+ f->shaderBufferInt64Atomics = LLVM_VERSION_MAJOR >= 9 || !pdevice->use_llvm;
+ f->shaderSharedInt64Atomics = LLVM_VERSION_MAJOR >= 9 || !pdevice->use_llvm;
+ f->shaderFloat16 = pdevice->rad_info.has_packed_math_16bit;
+ f->shaderInt8 = true;
+
+ f->descriptorIndexing = true;
+ f->shaderInputAttachmentArrayDynamicIndexing = true;
+ f->shaderUniformTexelBufferArrayDynamicIndexing = true;
+ f->shaderStorageTexelBufferArrayDynamicIndexing = true;
+ f->shaderUniformBufferArrayNonUniformIndexing = true;
+ f->shaderSampledImageArrayNonUniformIndexing = true;
+ f->shaderStorageBufferArrayNonUniformIndexing = true;
+ f->shaderStorageImageArrayNonUniformIndexing = true;
+ f->shaderInputAttachmentArrayNonUniformIndexing = true;
+ f->shaderUniformTexelBufferArrayNonUniformIndexing = true;
+ f->shaderStorageTexelBufferArrayNonUniformIndexing = true;
+ f->descriptorBindingUniformBufferUpdateAfterBind = true;
+ f->descriptorBindingSampledImageUpdateAfterBind = true;
+ f->descriptorBindingStorageImageUpdateAfterBind = true;
+ f->descriptorBindingStorageBufferUpdateAfterBind = true;
+ f->descriptorBindingUniformTexelBufferUpdateAfterBind = true;
+ f->descriptorBindingStorageTexelBufferUpdateAfterBind = true;
+ f->descriptorBindingUpdateUnusedWhilePending = true;
+ f->descriptorBindingPartiallyBound = true;
+ f->descriptorBindingVariableDescriptorCount = true;
+ f->runtimeDescriptorArray = true;
+
+ f->samplerFilterMinmax = true;
+ f->scalarBlockLayout = pdevice->rad_info.chip_class >= GFX7;
+ f->imagelessFramebuffer = true;
+ f->uniformBufferStandardLayout = true;
+ f->shaderSubgroupExtendedTypes = true;
+ f->separateDepthStencilLayouts = true;
+ f->hostQueryReset = true;
+ f->timelineSemaphore = pdevice->rad_info.has_syncobj_wait_for_submit;
+ f->bufferDeviceAddress = true;
+ f->bufferDeviceAddressCaptureReplay = false;
+ f->bufferDeviceAddressMultiDevice = false;
+ f->vulkanMemoryModel = false;
+ f->vulkanMemoryModelDeviceScope = false;
+ f->vulkanMemoryModelAvailabilityVisibilityChains = false;
+ f->shaderOutputViewportIndex = true;
+ f->shaderOutputLayer = true;
+ f->subgroupBroadcastDynamicId = true;
+}
+
void radv_GetPhysicalDeviceFeatures2(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures2 *pFeatures)
{
RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
+ radv_GetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features);
+
+ VkPhysicalDeviceVulkan11Features core_1_1 = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES,
+ };
+ radv_get_physical_device_features_1_1(pdevice, &core_1_1);
+
+ VkPhysicalDeviceVulkan12Features core_1_2 = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
+ };
+ radv_get_physical_device_features_1_2(pdevice, &core_1_2);
+
+#define CORE_FEATURE(major, minor, feature) \
+ features->feature = core_##major##_##minor.feature
+
vk_foreach_struct(ext, pFeatures->pNext) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES: {
VkPhysicalDeviceVariablePointersFeatures *features = (void *)ext;
- features->variablePointersStorageBuffer = true;
- features->variablePointers = true;
+ CORE_FEATURE(1, 1, variablePointersStorageBuffer);
+ CORE_FEATURE(1, 1, variablePointers);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES: {
VkPhysicalDeviceMultiviewFeatures *features = (VkPhysicalDeviceMultiviewFeatures*)ext;
- features->multiview = true;
- features->multiviewGeometryShader = true;
- features->multiviewTessellationShader = true;
+ CORE_FEATURE(1, 1, multiview);
+ CORE_FEATURE(1, 1, multiviewGeometryShader);
+ CORE_FEATURE(1, 1, multiviewTessellationShader);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES: {
VkPhysicalDeviceShaderDrawParametersFeatures *features =
(VkPhysicalDeviceShaderDrawParametersFeatures*)ext;
- features->shaderDrawParameters = true;
+ CORE_FEATURE(1, 1, shaderDrawParameters);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES: {
VkPhysicalDeviceProtectedMemoryFeatures *features =
(VkPhysicalDeviceProtectedMemoryFeatures*)ext;
- features->protectedMemory = false;
+ CORE_FEATURE(1, 1, protectedMemory);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: {
VkPhysicalDevice16BitStorageFeatures *features =
(VkPhysicalDevice16BitStorageFeatures*)ext;
- bool enable = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
- features->storageBuffer16BitAccess = enable;
- features->uniformAndStorageBuffer16BitAccess = enable;
- features->storagePushConstant16 = enable;
- features->storageInputOutput16 = pdevice->rad_info.has_double_rate_fp16 && (LLVM_VERSION_MAJOR >= 9 || pdevice->use_aco);
+ CORE_FEATURE(1, 1, storageBuffer16BitAccess);
+ CORE_FEATURE(1, 1, uniformAndStorageBuffer16BitAccess);
+ CORE_FEATURE(1, 1, storagePushConstant16);
+ CORE_FEATURE(1, 1, storageInputOutput16);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: {
VkPhysicalDeviceSamplerYcbcrConversionFeatures *features =
(VkPhysicalDeviceSamplerYcbcrConversionFeatures*)ext;
- features->samplerYcbcrConversion = true;
+ CORE_FEATURE(1, 1, samplerYcbcrConversion);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES: {
VkPhysicalDeviceDescriptorIndexingFeatures *features =
(VkPhysicalDeviceDescriptorIndexingFeatures*)ext;
- features->shaderInputAttachmentArrayDynamicIndexing = true;
- features->shaderUniformTexelBufferArrayDynamicIndexing = true;
- features->shaderStorageTexelBufferArrayDynamicIndexing = true;
- features->shaderUniformBufferArrayNonUniformIndexing = true;
- features->shaderSampledImageArrayNonUniformIndexing = true;
- features->shaderStorageBufferArrayNonUniformIndexing = true;
- features->shaderStorageImageArrayNonUniformIndexing = true;
- features->shaderInputAttachmentArrayNonUniformIndexing = true;
- features->shaderUniformTexelBufferArrayNonUniformIndexing = true;
- features->shaderStorageTexelBufferArrayNonUniformIndexing = true;
- features->descriptorBindingUniformBufferUpdateAfterBind = true;
- features->descriptorBindingSampledImageUpdateAfterBind = true;
- features->descriptorBindingStorageImageUpdateAfterBind = true;
- features->descriptorBindingStorageBufferUpdateAfterBind = true;
- features->descriptorBindingUniformTexelBufferUpdateAfterBind = true;
- features->descriptorBindingStorageTexelBufferUpdateAfterBind = true;
- features->descriptorBindingUpdateUnusedWhilePending = true;
- features->descriptorBindingPartiallyBound = true;
- features->descriptorBindingVariableDescriptorCount = true;
- features->runtimeDescriptorArray = true;
+ CORE_FEATURE(1, 2, shaderInputAttachmentArrayDynamicIndexing);
+ CORE_FEATURE(1, 2, shaderUniformTexelBufferArrayDynamicIndexing);
+ CORE_FEATURE(1, 2, shaderStorageTexelBufferArrayDynamicIndexing);
+ CORE_FEATURE(1, 2, shaderUniformBufferArrayNonUniformIndexing);
+ CORE_FEATURE(1, 2, shaderSampledImageArrayNonUniformIndexing);
+ CORE_FEATURE(1, 2, shaderStorageBufferArrayNonUniformIndexing);
+ CORE_FEATURE(1, 2, shaderStorageImageArrayNonUniformIndexing);
+ CORE_FEATURE(1, 2, shaderInputAttachmentArrayNonUniformIndexing);
+ CORE_FEATURE(1, 2, shaderUniformTexelBufferArrayNonUniformIndexing);
+ CORE_FEATURE(1, 2, shaderStorageTexelBufferArrayNonUniformIndexing);
+ CORE_FEATURE(1, 2, descriptorBindingUniformBufferUpdateAfterBind);
+ CORE_FEATURE(1, 2, descriptorBindingSampledImageUpdateAfterBind);
+ CORE_FEATURE(1, 2, descriptorBindingStorageImageUpdateAfterBind);
+ CORE_FEATURE(1, 2, descriptorBindingStorageBufferUpdateAfterBind);
+ CORE_FEATURE(1, 2, descriptorBindingUniformTexelBufferUpdateAfterBind);
+ CORE_FEATURE(1, 2, descriptorBindingStorageTexelBufferUpdateAfterBind);
+ CORE_FEATURE(1, 2, descriptorBindingUpdateUnusedWhilePending);
+ CORE_FEATURE(1, 2, descriptorBindingPartiallyBound);
+ CORE_FEATURE(1, 2, descriptorBindingVariableDescriptorCount);
+ CORE_FEATURE(1, 2, runtimeDescriptorArray);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT: {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES: {
VkPhysicalDeviceScalarBlockLayoutFeatures *features =
(VkPhysicalDeviceScalarBlockLayoutFeatures *)ext;
- features->scalarBlockLayout = pdevice->rad_info.chip_class >= GFX7;
+ CORE_FEATURE(1, 2, scalarBlockLayout);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT: {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES: {
VkPhysicalDeviceBufferDeviceAddressFeatures *features =
(VkPhysicalDeviceBufferDeviceAddressFeatures *)ext;
- features->bufferDeviceAddress = true;
- features->bufferDeviceAddressCaptureReplay = false;
- features->bufferDeviceAddressMultiDevice = false;
+ CORE_FEATURE(1, 2, bufferDeviceAddress);
+ CORE_FEATURE(1, 2, bufferDeviceAddressCaptureReplay);
+ CORE_FEATURE(1, 2, bufferDeviceAddressMultiDevice);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT: {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES: {
VkPhysicalDeviceHostQueryResetFeatures *features =
(VkPhysicalDeviceHostQueryResetFeatures *)ext;
- features->hostQueryReset = true;
+ CORE_FEATURE(1, 2, hostQueryReset);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES: {
VkPhysicalDevice8BitStorageFeatures *features =
(VkPhysicalDevice8BitStorageFeatures *)ext;
- bool enable = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
- features->storageBuffer8BitAccess = enable;
- features->uniformAndStorageBuffer8BitAccess = enable;
- features->storagePushConstant8 = enable;
+ CORE_FEATURE(1, 2, storageBuffer8BitAccess);
+ CORE_FEATURE(1, 2, uniformAndStorageBuffer8BitAccess);
+ CORE_FEATURE(1, 2, storagePushConstant8);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES: {
VkPhysicalDeviceShaderFloat16Int8Features *features =
(VkPhysicalDeviceShaderFloat16Int8Features*)ext;
- features->shaderFloat16 = pdevice->rad_info.has_double_rate_fp16 && !pdevice->use_aco;
- features->shaderInt8 = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
+ CORE_FEATURE(1, 2, shaderFloat16);
+ CORE_FEATURE(1, 2, shaderInt8);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES: {
VkPhysicalDeviceShaderAtomicInt64Features *features =
(VkPhysicalDeviceShaderAtomicInt64Features *)ext;
- features->shaderBufferInt64Atomics = LLVM_VERSION_MAJOR >= 9;
- features->shaderSharedInt64Atomics = LLVM_VERSION_MAJOR >= 9;
+ CORE_FEATURE(1, 2, shaderBufferInt64Atomics);
+ CORE_FEATURE(1, 2, shaderSharedInt64Atomics);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT: {
VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT *features =
(VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT *)ext;
- features->shaderDemoteToHelperInvocation = pdevice->use_aco;
+ features->shaderDemoteToHelperInvocation = LLVM_VERSION_MAJOR >= 9 || !pdevice->use_llvm;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT: {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES: {
VkPhysicalDeviceUniformBufferStandardLayoutFeatures *features =
(VkPhysicalDeviceUniformBufferStandardLayoutFeatures *)ext;
- features->uniformBufferStandardLayout = true;
+ CORE_FEATURE(1, 2, uniformBufferStandardLayout);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT: {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES: {
VkPhysicalDeviceImagelessFramebufferFeatures *features =
(VkPhysicalDeviceImagelessFramebufferFeatures *)ext;
- features->imagelessFramebuffer = true;
+ CORE_FEATURE(1, 2, imagelessFramebuffer);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR: {
VkPhysicalDeviceShaderClockFeaturesKHR *features =
(VkPhysicalDeviceShaderClockFeaturesKHR *)ext;
features->shaderSubgroupClock = true;
- features->shaderDeviceClock = false;
+ features->shaderDeviceClock = pdevice->rad_info.chip_class >= GFX8;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT: {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES: {
VkPhysicalDeviceTimelineSemaphoreFeatures *features =
(VkPhysicalDeviceTimelineSemaphoreFeatures *) ext;
- features->timelineSemaphore = true;
+ CORE_FEATURE(1, 2, timelineSemaphore);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT: {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES: {
VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures *features =
(VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures *)ext;
- features->shaderSubgroupExtendedTypes = !pdevice->use_aco;
+ CORE_FEATURE(1, 2, shaderSubgroupExtendedTypes);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES_KHR: {
VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR *features =
(VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR *)ext;
- features->separateDepthStencilLayouts = true;
+ CORE_FEATURE(1, 2, separateDepthStencilLayouts);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: {
- VkPhysicalDeviceVulkan11Features *features =
- (VkPhysicalDeviceVulkan11Features *)ext;
- bool storage16_enable = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
- features->storageBuffer16BitAccess = storage16_enable;
- features->uniformAndStorageBuffer16BitAccess = storage16_enable;
- features->storagePushConstant16 = storage16_enable;
- features->storageInputOutput16 = pdevice->rad_info.has_double_rate_fp16 && (LLVM_VERSION_MAJOR >= 9 || pdevice->use_aco);
- features->multiview = true;
- features->multiviewGeometryShader = true;
- features->multiviewTessellationShader = true;
- features->variablePointersStorageBuffer = true;
- features->variablePointers = true;
- features->protectedMemory = false;
- features->samplerYcbcrConversion = true;
- features->shaderDrawParameters = true;
+ radv_get_physical_device_features_1_1(pdevice, (void *)ext);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES: {
- VkPhysicalDeviceVulkan12Features *features =
- (VkPhysicalDeviceVulkan12Features *)ext;
- bool int8_enable = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
- features->samplerMirrorClampToEdge = true;
- features->drawIndirectCount = true;
- features->storageBuffer8BitAccess = int8_enable;
- features->uniformAndStorageBuffer8BitAccess = int8_enable;
- features->storagePushConstant8 = int8_enable;
- features->shaderBufferInt64Atomics = LLVM_VERSION_MAJOR >= 9;
- features->shaderSharedInt64Atomics = LLVM_VERSION_MAJOR >= 9;
- features->shaderFloat16 = pdevice->rad_info.has_double_rate_fp16 && !pdevice->use_aco;
- features->shaderInt8 = int8_enable;
- features->descriptorIndexing = true;
- features->shaderInputAttachmentArrayDynamicIndexing = true;
- features->shaderUniformTexelBufferArrayDynamicIndexing = true;
- features->shaderStorageTexelBufferArrayDynamicIndexing = true;
- features->shaderUniformBufferArrayNonUniformIndexing = true;
- features->shaderSampledImageArrayNonUniformIndexing = true;
- features->shaderStorageBufferArrayNonUniformIndexing = true;
- features->shaderStorageImageArrayNonUniformIndexing = true;
- features->shaderInputAttachmentArrayNonUniformIndexing = true;
- features->shaderUniformTexelBufferArrayNonUniformIndexing = true;
- features->shaderStorageTexelBufferArrayNonUniformIndexing = true;
- features->descriptorBindingUniformBufferUpdateAfterBind = true;
- features->descriptorBindingSampledImageUpdateAfterBind = true;
- features->descriptorBindingStorageImageUpdateAfterBind = true;
- features->descriptorBindingStorageBufferUpdateAfterBind = true;
- features->descriptorBindingUniformTexelBufferUpdateAfterBind = true;
- features->descriptorBindingStorageTexelBufferUpdateAfterBind = true;
- features->descriptorBindingUpdateUnusedWhilePending = true;
- features->descriptorBindingPartiallyBound = true;
- features->descriptorBindingVariableDescriptorCount = true;
- features->runtimeDescriptorArray = true;
- features->samplerFilterMinmax = true;
- features->scalarBlockLayout = pdevice->rad_info.chip_class >= GFX7;
- features->imagelessFramebuffer = true;
- features->uniformBufferStandardLayout = true;
- features->shaderSubgroupExtendedTypes = !pdevice->use_aco;
- features->separateDepthStencilLayouts = true;
- features->hostQueryReset = true;
- features->timelineSemaphore = pdevice->rad_info.has_syncobj_wait_for_submit;
- features->bufferDeviceAddress = true;
- features->bufferDeviceAddressCaptureReplay = false;
- features->bufferDeviceAddressMultiDevice = false;
- features->vulkanMemoryModel = false;
- features->vulkanMemoryModelDeviceScope = false;
- features->vulkanMemoryModelAvailabilityVisibilityChains = false;
- features->shaderOutputViewportIndex = true;
- features->shaderOutputLayer = true;
- features->subgroupBroadcastDynamicId = true;
+ radv_get_physical_device_features_1_2(pdevice, (void *)ext);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT: {
break;
}
}
- radv_GetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features);
+#undef CORE_FEATURE
}
static size_t
.maxCullDistances = 8,
.maxCombinedClipAndCullDistances = 8,
.discreteQueuePriorities = 2,
- .pointSizeRange = { 0.0, 8192.0 },
- .lineWidthRange = { 0.0, 8192.0 },
+ .pointSizeRange = { 0.0, 8191.875 },
+ .lineWidthRange = { 0.0, 8191.875 },
.pointSizeGranularity = (1.0 / 8.0),
.lineWidthGranularity = (1.0 / 8.0),
.strictLines = false, /* FINISHME */
VK_SUBGROUP_FEATURE_ARITHMETIC_BIT |
VK_SUBGROUP_FEATURE_BALLOT_BIT |
VK_SUBGROUP_FEATURE_CLUSTERED_BIT |
- VK_SUBGROUP_FEATURE_QUAD_BIT;
-
- if (((pdevice->rad_info.chip_class == GFX6 ||
- pdevice->rad_info.chip_class == GFX7) && !pdevice->use_aco) ||
- pdevice->rad_info.chip_class >= GFX8) {
- p->subgroupSupportedOperations |= VK_SUBGROUP_FEATURE_SHUFFLE_BIT |
- VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT;
- }
+ VK_SUBGROUP_FEATURE_QUAD_BIT |
+ VK_SUBGROUP_FEATURE_SHUFFLE_BIT |
+ VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT;
p->subgroupQuadOperationsInAllStages = true;
p->pointClippingBehavior = VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES;
/* On AMD hardware, denormals and rounding modes for fp16/fp64 are
* controlled by the same config register.
*/
- if (pdevice->rad_info.has_double_rate_fp16) {
+ if (pdevice->rad_info.has_packed_math_16bit) {
p->denormBehaviorIndependence = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY_KHR;
p->roundingModeIndependence = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY_KHR;
} else {
p->shaderSignedZeroInfNanPreserveFloat32 = true;
p->shaderDenormFlushToZeroFloat16 = false;
- p->shaderDenormPreserveFloat16 = pdevice->rad_info.has_double_rate_fp16;
- p->shaderRoundingModeRTEFloat16 = pdevice->rad_info.has_double_rate_fp16;
+ p->shaderDenormPreserveFloat16 = pdevice->rad_info.has_packed_math_16bit;
+ p->shaderRoundingModeRTEFloat16 = pdevice->rad_info.has_packed_math_16bit;
p->shaderRoundingModeRTZFloat16 = false;
- p->shaderSignedZeroInfNanPreserveFloat16 = pdevice->rad_info.has_double_rate_fp16;
+ p->shaderSignedZeroInfNanPreserveFloat16 = pdevice->rad_info.has_packed_math_16bit;
p->shaderDenormFlushToZeroFloat64 = false;
p->shaderDenormPreserveFloat64 = pdevice->rad_info.chip_class >= GFX8;
properties->shaderArraysPerEngineCount =
pdevice->rad_info.max_sh_per_se;
properties->computeUnitsPerShaderArray =
- pdevice->rad_info.num_good_cu_per_sh;
+ pdevice->rad_info.min_good_cu_per_sa;
properties->simdPerComputeUnit =
pdevice->rad_info.num_simd_per_compute_unit;
properties->wavefrontsPerSimd =
device->border_color_data.colors_gpu_ptr =
device->ws->buffer_map(device->border_color_data.bo);
+ if (!device->border_color_data.colors_gpu_ptr)
+ return vk_error(device->physical_device->instance, VK_ERROR_OUT_OF_DEVICE_MEMORY);
pthread_mutex_init(&device->border_color_data.mutex, NULL);
return VK_SUCCESS;
}
*max_offchip_buffers_p = max_offchip_buffers;
- if (device->physical_device->rad_info.chip_class >= GFX7) {
+ if (device->physical_device->rad_info.chip_class >= GFX10_3) {
+ hs_offchip_param = S_03093C_OFFCHIP_BUFFERING_GFX103(max_offchip_buffers - 1) |
+ S_03093C_OFFCHIP_GRANULARITY_GFX103(offchip_granularity);
+ } else if (device->physical_device->rad_info.chip_class >= GFX7) {
if (device->physical_device->rad_info.chip_class >= GFX8)
--max_offchip_buffers;
hs_offchip_param =
if (descriptor_bo != queue->descriptor_bo) {
uint32_t *map = (uint32_t*)queue->device->ws->buffer_map(descriptor_bo);
+ if (!map)
+ goto fail;
if (scratch_bo) {
uint64_t scratch_va = radv_buffer_get_va(scratch_bo);
RADV_CMD_FLAG_START_PIPELINE_STATS, 0);
}
- if (!queue->device->ws->cs_finalize(cs))
+ if (queue->device->ws->cs_finalize(cs) != VK_SUCCESS)
goto fail;
}
}
pthread_mutex_unlock(&queue->pending_mutex);
- queue->device->ws->ctx_wait_idle(queue->hw_ctx,
- radv_queue_family_to_ring(queue->queue_family_index),
- queue->queue_idx);
+ if (!queue->device->ws->ctx_wait_idle(queue->hw_ctx,
+ radv_queue_family_to_ring(queue->queue_family_index),
+ queue->queue_idx))
+ return VK_ERROR_DEVICE_LOST;
+
return VK_SUCCESS;
}
for (unsigned i = 0; i < RADV_MAX_QUEUE_FAMILIES; i++) {
for (unsigned q = 0; q < device->queue_count[i]; q++) {
- radv_QueueWaitIdle(radv_queue_to_handle(&device->queues[i][q]));
+ VkResult result =
+ radv_QueueWaitIdle(radv_queue_to_handle(&device->queues[i][q]));
+
+ if (result != VK_SUCCESS)
+ return result;
}
}
return VK_SUCCESS;
return VK_SUCCESS;
}
-
+static void radv_destroy_event(struct radv_device *device,
+ const VkAllocationCallbacks* pAllocator,
+ struct radv_event *event)
+{
+ device->ws->buffer_destroy(event->bo);
+ vk_object_base_finish(&event->base);
+ vk_free2(&device->vk.alloc, pAllocator, event);
+}
VkResult radv_CreateEvent(
VkDevice _device,
}
event->map = (uint64_t*)device->ws->buffer_map(event->bo);
+ if (!event->map) {
+ radv_destroy_event(device, pAllocator, event);
+ return vk_error(device->instance, VK_ERROR_OUT_OF_DEVICE_MEMORY);
+ }
*pEvent = radv_event_to_handle(event);
if (!event)
return;
- device->ws->buffer_destroy(event->bo);
- vk_object_base_finish(&event->base);
- vk_free2(&device->vk.alloc, pAllocator, event);
+
+ radv_destroy_event(device, pAllocator, event);
}
VkResult radv_GetEventStatus(
.pipe_aligned = 1,
};
- if (iview->image->dcc_offset)
+ if (surf->dcc_offset)
meta = surf->u.gfx9.dcc;
cb->cb_color_attrib |= S_028C74_COLOR_SW_MODE(surf->u.gfx9.surf.swizzle_mode) |
/* CMASK variables */
va = radv_buffer_get_va(iview->bo) + iview->image->offset;
- va += iview->image->cmask_offset;
+ va += surf->cmask_offset;
cb->cb_color_cmask = va >> 8;
va = radv_buffer_get_va(iview->bo) + iview->image->offset;
- va += iview->image->dcc_offset;
+ va += surf->dcc_offset;
if (radv_dcc_enabled(iview->image, iview->base_mip) &&
device->physical_device->rad_info.chip_class <= GFX8)
}
if (radv_image_has_fmask(iview->image)) {
- va = radv_buffer_get_va(iview->bo) + iview->image->offset + iview->image->fmask_offset;
+ va = radv_buffer_get_va(iview->bo) + iview->image->offset + surf->fmask_offset;
cb->cb_color_fmask = va >> 8;
cb->cb_color_fmask |= surf->fmask_tile_swizzle;
} else {
/* Use all of the htile_buffer for depth if there's no stencil. */
ds->db_stencil_info |= S_02803C_TILE_STENCIL_DISABLE(1);
va = radv_buffer_get_va(iview->bo) + iview->image->offset +
- iview->image->htile_offset;
+ surf->htile_offset;
ds->db_htile_data_base = va >> 8;
ds->db_htile_surface = S_028ABC_FULL_CACHE(1) |
S_028ABC_PIPE_ALIGNED(1);
ds->db_stencil_info |= S_028044_TILE_STENCIL_DISABLE(1);
va = radv_buffer_get_va(iview->bo) + iview->image->offset +
- iview->image->htile_offset;
+ surf->htile_offset;
ds->db_htile_data_base = va >> 8;
ds->db_htile_surface = S_028ABC_FULL_CACHE(1);