mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-15 18:12:48 +00:00
Merge pull request #3434 from namkazt/patch-2
vk_shader: Implement ImageLoad
This commit is contained in:
commit
ef27b4b7b5
|
@ -107,6 +107,8 @@ bool VKDevice::Create(const vk::DispatchLoaderDynamic& dldi, vk::Instance instan
|
|||
features.occlusionQueryPrecise = true;
|
||||
features.fragmentStoresAndAtomics = true;
|
||||
features.shaderImageGatherExtended = true;
|
||||
features.shaderStorageImageReadWithoutFormat =
|
||||
is_shader_storage_img_read_without_format_supported;
|
||||
features.shaderStorageImageWriteWithoutFormat = true;
|
||||
features.textureCompressionASTC_LDR = is_optimal_astc_supported;
|
||||
|
||||
|
@ -465,6 +467,8 @@ void VKDevice::SetupFamilies(const vk::DispatchLoaderDynamic& dldi, vk::SurfaceK
|
|||
|
||||
void VKDevice::SetupFeatures(const vk::DispatchLoaderDynamic& dldi) {
|
||||
const auto supported_features{physical.getFeatures(dldi)};
|
||||
is_shader_storage_img_read_without_format_supported =
|
||||
supported_features.shaderStorageImageReadWithoutFormat;
|
||||
is_optimal_astc_supported = IsOptimalAstcSupported(supported_features, dldi);
|
||||
}
|
||||
|
||||
|
|
|
@ -122,6 +122,11 @@ public:
|
|||
return properties.limits.maxPushConstantsSize;
|
||||
}
|
||||
|
||||
/// Returns true if Shader storage Image Read Without Format supported.
|
||||
bool IsShaderStorageImageReadWithoutFormatSupported() const {
|
||||
return is_shader_storage_img_read_without_format_supported;
|
||||
}
|
||||
|
||||
/// Returns true if ASTC is natively supported.
|
||||
bool IsOptimalAstcSupported() const {
|
||||
return is_optimal_astc_supported;
|
||||
|
@ -227,6 +232,8 @@ private:
|
|||
bool ext_depth_range_unrestricted{}; ///< Support for VK_EXT_depth_range_unrestricted.
|
||||
bool ext_shader_viewport_index_layer{}; ///< Support for VK_EXT_shader_viewport_index_layer.
|
||||
bool nv_device_diagnostic_checkpoints{}; ///< Support for VK_NV_device_diagnostic_checkpoints.
|
||||
bool is_shader_storage_img_read_without_format_supported{}; ///< Support for shader storage
|
||||
///< image read without format
|
||||
|
||||
// Telemetry parameters
|
||||
std::string vendor_name; ///< Device's driver name.
|
||||
|
|
|
@ -292,6 +292,10 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (device.IsShaderStorageImageReadWithoutFormatSupported()) {
|
||||
AddCapability(spv::Capability::StorageImageReadWithoutFormat);
|
||||
}
|
||||
|
||||
if (device.IsFloat16Supported()) {
|
||||
AddCapability(spv::Capability::Float16);
|
||||
}
|
||||
|
@ -1755,8 +1759,16 @@ private:
|
|||
}
|
||||
|
||||
Expression ImageLoad(Operation operation) {
|
||||
UNIMPLEMENTED();
|
||||
return {};
|
||||
if (!device.IsShaderStorageImageReadWithoutFormatSupported()) {
|
||||
return {v_float_zero, Type::Float};
|
||||
}
|
||||
|
||||
const auto& meta{std::get<MetaImage>(operation.GetMeta())};
|
||||
|
||||
const Id coords = GetCoordinates(operation, Type::Int);
|
||||
const Id texel = OpImageRead(t_uint4, GetImage(operation), coords);
|
||||
|
||||
return {OpCompositeExtract(t_uint, texel, meta.element), Type::Uint};
|
||||
}
|
||||
|
||||
Expression ImageStore(Operation operation) {
|
||||
|
|
Loading…
Reference in a new issue