video_core: More features and proper spirv feature detection

This commit is contained in:
IndecisiveTurtle 2024-08-27 22:51:26 +03:00
parent f3a4243ad1
commit 914dbdc509
2 changed files with 9 additions and 7 deletions

View File

@ -195,6 +195,12 @@ void DefineEntryPoint(const IR::Program& program, EmitContext& ctx, Id main) {
if (info.has_image_buffers) { if (info.has_image_buffers) {
ctx.AddCapability(spv::Capability::ImageBuffer); ctx.AddCapability(spv::Capability::ImageBuffer);
} }
if (info.has_image_gather) {
ctx.AddCapability(spv::Capability::ImageGatherExtended);
}
if (info.has_image_query) {
ctx.AddCapability(spv::Capability::ImageQuery);
}
switch (program.info.stage) { switch (program.info.stage) {
case Stage::Compute: { case Stage::Compute: {
const std::array<u32, 3> workgroup_size{program.info.workgroup_size}; const std::array<u32, 3> workgroup_size{program.info.workgroup_size};
@ -213,19 +219,13 @@ void DefineEntryPoint(const IR::Program& program, EmitContext& ctx, Id main) {
} else { } else {
ctx.AddExecutionMode(main, spv::ExecutionMode::OriginUpperLeft); ctx.AddExecutionMode(main, spv::ExecutionMode::OriginUpperLeft);
} }
ctx.AddCapability(spv::Capability::GroupNonUniform);
if (info.uses_group_quad) { if (info.uses_group_quad) {
ctx.AddCapability(spv::Capability::GroupNonUniform);
ctx.AddCapability(spv::Capability::GroupNonUniformQuad); ctx.AddCapability(spv::Capability::GroupNonUniformQuad);
} }
if (info.has_discard) { if (info.has_discard) {
ctx.AddCapability(spv::Capability::DemoteToHelperInvocationEXT); ctx.AddCapability(spv::Capability::DemoteToHelperInvocationEXT);
} }
if (info.has_image_gather) {
ctx.AddCapability(spv::Capability::ImageGatherExtended);
}
if (info.has_image_query) {
ctx.AddCapability(spv::Capability::ImageQuery);
}
if (info.stores.Get(IR::Attribute::Depth)) { if (info.stores.Get(IR::Attribute::Depth)) {
ctx.AddExecutionMode(main, spv::ExecutionMode::DepthReplacing); ctx.AddExecutionMode(main, spv::ExecutionMode::DepthReplacing);
} }

View File

@ -187,6 +187,7 @@ vk::Format DemoteImageFormatForDetiling(vk::Format format) {
case vk::Format::eR32Uint: case vk::Format::eR32Uint:
case vk::Format::eR16G16Sfloat: case vk::Format::eR16G16Sfloat:
case vk::Format::eR16G16Unorm: case vk::Format::eR16G16Unorm:
case vk::Format::eB10G11R11UfloatPack32:
return vk::Format::eR32Uint; return vk::Format::eR32Uint;
case vk::Format::eBc1RgbaSrgbBlock: case vk::Format::eBc1RgbaSrgbBlock:
case vk::Format::eBc1RgbaUnormBlock: case vk::Format::eBc1RgbaUnormBlock:
@ -202,6 +203,7 @@ vk::Format DemoteImageFormatForDetiling(vk::Format format) {
case vk::Format::eBc3SrgbBlock: case vk::Format::eBc3SrgbBlock:
case vk::Format::eBc3UnormBlock: case vk::Format::eBc3UnormBlock:
case vk::Format::eBc5UnormBlock: case vk::Format::eBc5UnormBlock:
case vk::Format::eBc5SnormBlock:
case vk::Format::eBc7SrgbBlock: case vk::Format::eBc7SrgbBlock:
case vk::Format::eBc7UnormBlock: case vk::Format::eBc7UnormBlock:
case vk::Format::eBc6HUfloatBlock: case vk::Format::eBc6HUfloatBlock: