Merge pull request #5 from yxc0915/steelbrain/static-attachment-feedback
🐛 Use static Vulkan attachment feedback for Windows
This commit is contained in:
3 files changed
+123
-1
No files matched your search
@@ -20,7 +20,8 @@ Alpha 编号与挂起兼容判定见 [Alpha 运行时编号与挂起兼容性规
|
||||
| [`reims-util-parallel-offline-download.patch`](reims-util-parallel-offline-download.patch) | `steelbrain/reims-util` | 有 Apple 分块校验数据时并发下载离线安装包,按顺序验证并写入镜像。 |
|
||||
| [`metal2vulkan-snapshot-replay.patch`](metal2vulkan-snapshot-replay.patch) | `steelbrain/metal2vulkan` | 读取和恢复缓冲、纹理及事件状态,为 GPU 挂起重放提供依赖。 |
|
||||
| [`metal2vulkan-psb-address-carry.patch`](metal2vulkan-psb-address-carry.patch) | `steelbrain/metal2vulkan` | 恢复 64 位 GPU 地址时显式处理低位进位。 [组织 fork 提交](https://github.com/reims-go/metal2vulkan/commit/729d91d23bb56a99f2b5b74d3d3445c65cc1cdf1) |
|
||||
| [`metal2vulkan-dynamic-attachment-feedback.patch`](metal2vulkan-dynamic-attachment-feedback.patch) | `steelbrain/metal2vulkan` | 需要动态反馈状态才启用原生附件反馈。其余设备通过影子纹理读取附件。 [组织 fork 提交](https://github.com/reims-go/metal2vulkan/commit/ea695f945626f15c27ac9b463ba4160c65530b43) |
|
||||
| [`metal2vulkan-dynamic-attachment-feedback.patch`](metal2vulkan-dynamic-attachment-feedback.patch) | `steelbrain/metal2vulkan` | 原生附件反馈要求设备同时报告反馈布局和动态反馈能力,其余设备通过影子纹理读取附件。 [组织 fork 提交](https://github.com/reims-go/metal2vulkan/commit/ea695f945626f15c27ac9b463ba4160c65530b43) |
|
||||
| [`metal2vulkan-static-attachment-feedback.patch`](metal2vulkan-static-attachment-feedback.patch) | `steelbrain/metal2vulkan` | 保留上述能力要求,以静态颜色附件反馈管线替代逐 draw 切换动态状态,修复桌面暗屏。 |
|
||||
|
||||
构建通过 Cargo 的本地源码覆盖使用已打补丁的 `metal2vulkan`。客户端的运行时包格式见[便携运行时规范](https://github.com/Nwflower/Reims-Go/blob/main/docs/portable-runtime-spec.md)。
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md
|
||||
index 083011698..bec52546a 100644
|
||||
--- a/crates/metal2vulkan-runtime/README.md
|
||||
+++ b/crates/metal2vulkan-runtime/README.md
|
||||
@@ -4710,8 +4710,8 @@ cache is answered compile-required on both.
|
||||
from the layout the pass renders it in, the rest from home), and the rendering begins again
|
||||
with the attachment in that layout; the pass's second barrier moves the whole image home. Until then every draw of the
|
||||
pass reads the image's textures through their second elements (Set 1), a texture that reaches
|
||||
- no rendered level among them. Render pipelines declare `VK_DYNAMIC_STATE_ATTACHMENT_FEEDBACK_LOOP_ENABLE_EXT`;
|
||||
- the encoder enables color feedback while an attachment is in the feedback layout. Each draw that
|
||||
+ no rendered level among them. Eligible render pipelines declare
|
||||
+ `VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT`. Each draw that
|
||||
reads an attachment through the loop, through a texture or by a fetch (below), counts in
|
||||
`Metrics::attachment_loop_reads`, its barriers in `Metrics::barriers`.
|
||||
- Through a copy, on a device without the feedback loop, and for a surface plane whose image took
|
||||
@@ -5494,7 +5494,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported.
|
||||
| `VK_KHR_portability_enumeration` | instance, where offered | listing portability devices, each checked against the floor as any other |
|
||||
| `VK_KHR_portability_subset` | device, where listed | Vulkan requires it enabled where a device lists it; the device is asked for the portability features below |
|
||||
| `VK_EXT_attachment_feedback_loop_layout` | device, with the feedback loop | a draw's read of an attachment of its own pass through a texture in the feedback layout |
|
||||
-| `VK_EXT_attachment_feedback_loop_dynamic_state` | device, with the feedback loop | enables feedback for the color aspect while an attachment is in the feedback layout |
|
||||
+| `VK_EXT_attachment_feedback_loop_dynamic_state` | device, with the feedback loop | qualifies the device for native attachment feedback |
|
||||
| `VK_KHR_vertex_attribute_divisor` | device, where listed | a vertex layout stepped per instance at a rate above 1, through the step-rate feature below |
|
||||
| `VK_EXT_vertex_attribute_divisor` | device, where listed | the same, on a device that lists only this extension, which the KHR was promoted from with the same feature and pipeline structures |
|
||||
| `VK_EXT_external_memory_host` | device, where listed | importing host memory by its address (`Device::import_host_memory`) |
|
||||
@@ -5845,7 +5845,7 @@ a copy of the image into its shadow (Render encoders), a known gap.
|
||||
| Attachment-read feature | Structure | Used for |
|
||||
|---|---|---|
|
||||
| `attachmentFeedbackLoopLayout` | `VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT` | the feedback layout and usage |
|
||||
-| `attachmentFeedbackLoopDynamicState` | `VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT` | enables feedback for the color aspect at draw time |
|
||||
+| `attachmentFeedbackLoopDynamicState` | `VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT` | qualifies the device for native attachment feedback |
|
||||
|
||||
### Bound kernel buffers
|
||||
|
||||
diff --git a/crates/metal2vulkan-runtime/src/render.rs b/crates/metal2vulkan-runtime/src/render.rs
|
||||
index 89ceff148..53a5dfd6e 100644
|
||||
--- a/crates/metal2vulkan-runtime/src/render.rs
|
||||
+++ b/crates/metal2vulkan-runtime/src/render.rs
|
||||
@@ -1513,11 +1513,6 @@ impl RenderCompiled {
|
||||
.discard
|
||||
.then_some(vk::DynamicState::RASTERIZER_DISCARD_ENABLE),
|
||||
)
|
||||
- .chain(
|
||||
- core.feedback_loop
|
||||
- .as_ref()
|
||||
- .map(|_| vk::DynamicState::ATTACHMENT_FEEDBACK_LOOP_ENABLE_EXT),
|
||||
- )
|
||||
.collect();
|
||||
let dynamic_states = vk::PipelineDynamicStateCreateInfo::default().dynamic_states(&states);
|
||||
let mut rendering = vk::PipelineRenderingCreateInfo::default()
|
||||
@@ -1525,6 +1520,13 @@ impl RenderCompiled {
|
||||
.depth_attachment_format(fixed.depth)
|
||||
.stencil_attachment_format(fixed.stencil);
|
||||
let mut info = vk::GraphicsPipelineCreateInfo::default()
|
||||
+ // The attachments a draw can sample depend on its bindings. Declare color
|
||||
+ // feedback on every eligible pipeline without changing the feature gate.
|
||||
+ .flags(if core.feedback_loop.is_some() {
|
||||
+ vk::PipelineCreateFlags::COLOR_ATTACHMENT_FEEDBACK_LOOP_EXT
|
||||
+ } else {
|
||||
+ vk::PipelineCreateFlags::empty()
|
||||
+ })
|
||||
.push_next(&mut rendering)
|
||||
.stages(&stages)
|
||||
.vertex_input_state(&vertex_input)
|
||||
diff --git a/crates/metal2vulkan-runtime/src/render_encoder.rs b/crates/metal2vulkan-runtime/src/render_encoder.rs
|
||||
index bd43630a4..b2c27c940 100644
|
||||
--- a/crates/metal2vulkan-runtime/src/render_encoder.rs
|
||||
+++ b/crates/metal2vulkan-runtime/src/render_encoder.rs
|
||||
@@ -34,8 +34,8 @@
|
||||
//! attachment layout, the rest from home), and the rendering begins again with the attachment in
|
||||
//! that layout; the pass's second barrier moves the whole image home. While it is there, every
|
||||
//! draw of the pass reads the image's textures through their elements in that layout
|
||||
-//! (`crate::arrays`). Render pipelines declare dynamic feedback state. The encoder enables
|
||||
-//! color feedback for draws while an attachment is in the feedback layout.
|
||||
+//! (`crate::arrays`). Render pipelines on a device with native feedback use the
|
||||
+//! static color-attachment feedback flag.
|
||||
//!
|
||||
//! What such a draw reads that an earlier draw of the pass rendered, Metal orders by a memory
|
||||
//! barrier between the two. A memory barrier after draws that wrote no memory, where the pass
|
||||
@@ -2741,14 +2741,6 @@ impl RenderCommandEncoder {
|
||||
core.device.cmd_set_rasterizer_discard_enable(command, true);
|
||||
}
|
||||
}
|
||||
- if let Some(feedback) = &core.feedback_loop {
|
||||
- let aspects = if self.moved.is_empty() {
|
||||
- vk::ImageAspectFlags::empty()
|
||||
- } else {
|
||||
- vk::ImageAspectFlags::COLOR
|
||||
- };
|
||||
- (feedback.fp().cmd_set_attachment_feedback_loop_enable_ext)(command, aspects);
|
||||
- }
|
||||
self.record_state(topology, restart, hidden);
|
||||
// A mode's query begins at its first draw, after what that draw ended the rendering
|
||||
// to record first: the command buffer is inside the pass's rendering, and keeps the
|
||||
diff --git a/crates/metal2vulkan-runtime/src/tests/draw.rs b/crates/metal2vulkan-runtime/src/tests/draw.rs
|
||||
index a7601ae11..c6756f4ac 100644
|
||||
--- a/crates/metal2vulkan-runtime/src/tests/draw.rs
|
||||
+++ b/crates/metal2vulkan-runtime/src/tests/draw.rs
|
||||
@@ -3065,18 +3065,18 @@ define internal void @_GLOBAL__sub_I_() section "air.static_init" {
|
||||
});
|
||||
}
|
||||
|
||||
- /// A draw can sample its attachment with dynamic feedback enabled. The following draw can
|
||||
+ /// A draw can sample its attachment with native feedback enabled. The following draw can
|
||||
/// bind a different pipeline and write to the same attachment in the feedback layout.
|
||||
#[test]
|
||||
- fn a_draw_reads_an_attachment_with_dynamic_feedback() {
|
||||
+ fn a_draw_reads_an_attachment_across_pipeline_changes() {
|
||||
let Some(library) = examples() else {
|
||||
return;
|
||||
};
|
||||
let plain = descriptor(&library, "colored_fragment", PixelFormat::RGBA8Unorm);
|
||||
let own = descriptor(&library, "own_pixel_fragment", PixelFormat::RGBA8Unorm);
|
||||
- each_device("dynamic_feedback", |name, _, device| {
|
||||
+ each_device("feedback_pipeline_change", |name, _, device| {
|
||||
if device.core().feedback_loop.is_none() {
|
||||
- println!("{name}: no dynamic attachment feedback support");
|
||||
+ println!("{name}: no native attachment feedback support");
|
||||
return;
|
||||
}
|
||||
let plain = state(name, &device, &plain);
|
||||
@@ -8,3 +8,4 @@ reims-util reims-util-parallel-offline-download.patch
|
||||
metal2vulkan metal2vulkan-snapshot-replay.patch
|
||||
metal2vulkan metal2vulkan-psb-address-carry.patch
|
||||
metal2vulkan metal2vulkan-dynamic-attachment-feedback.patch
|
||||
metal2vulkan metal2vulkan-static-attachment-feedback.patch
|
||||
Reference in new issue
Block a user