Restore the whole mip chain of textures narrowed by a GL render pass
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- cpp
- Lĩnh vực
- computer-graphics
Hướng nghiên cứu
Start by reading source/renderer/ore/gl/ore_render_pass_gl.cpp around applySampledLevels() and finish(), then inspect ore_texture_gl.cpp and the matching headers. Trace how sampled mip ranges are applied and restored, and check the renderer’s existing OpenGL tests. Done means narrowed textures regain their full mip chain when the render pass finishes, with regression coverage for that behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Restore the whole mip chain of textures narrowed by a GL render pass.
- source/renderer/ore/gl/ore_texture_gl.hpp: Ore GL: TextureGL::restoreSampledLevels hands a narrowed texture its whole mip chain back
- source/renderer/ore/gl/ore_texture_gl.cpp: Ore GL: TextureGL::restoreSampledLevels implementation
- source/renderer/ore/gl/ore_render_pass_gl.hpp: Ore GL: a render pass remembers the textures it narrowed to a mip range
- source/renderer/ore/gl/ore_render_pass_gl.cpp: Ore GL applySampledLevels: record textures narrowed to a mip range
- source/renderer/ore/gl/ore_render_pass_gl.cpp: Ore GL finish: restore the whole mip chain of narrowed textures so the GL object leaves the pass unnarrowed
diff --git a/source/renderer/ore/gl/ore_render_pass_gl.cpp b/source/renderer/ore/gl/ore_render_pass_gl.cpp
index e07f50f468d37e9ea61544032056ee17d5e9fe8e..4871dbe3f4defe12c109cb2e271436bed70283e9 100644
--- a/source/renderer/ore/gl/ore_render_pass_gl.cpp
+++ b/source/renderer/ore/gl/ore_render_pass_gl.cpp
@@ -615,7 +615,18 @@ void RenderPassGL::applySampledLevels()
}
}
for (const auto& l : m_sampledLevels)
+ {
l.texture->setSampledLevels(l.unit, l.base, l.max);
+ const bool narrowed =
+ l.base != 0 || l.max + 1 < std::max(l.texture->numMipmaps(), 1u);
+ if (narrowed &&
+ std::none_of(m_narrowedTextures.begin(),
+ m_narrowedTextures.end(),
+ [&](const auto& t) { return t.get() == l.texture; }))
+ {
+ m_narrowedTextures.push_back(ref_rcp(l.texture));
+ }
+ }
}
void RenderPassGL::setViewport(
@@ -741,6 +752,10 @@ void RenderPassGL::finish()
m_currentPipeline = nullptr;
releaseBoundResources();
+ for (const auto& texture : m_narrowedTextures)
+ texture->restoreSampledLevels();
+ m_narrowedTextures.clear();
+
glDisable(GL_SCISSOR_TEST);
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
diff --git a/source/renderer/ore/gl/ore_render_pass_gl.hpp b/source/renderer/ore/gl/ore_render_pass_gl.hpp
index 544c779effc3228e480ef4cdc38d4bc9b2c1a942..773bcaf1daf06ab3219013c8d7e3694adf5913b9 100644
--- a/source/renderer/ore/gl/ore_render_pass_gl.hpp
+++ b/source/renderer/ore/gl/ore_render_pass_gl.hpp
@@ -83,6 +83,8 @@ private:
uint32_t max;
};
std::vector<SampledLevels> m_sampledLevels;
+ // Textures this pass narrowed, restored to their whole chain at finish().
+ std::vector<rcp<TextureGL>> m_narrowedTextures;
// Buffers and textures at the pipeline's units, which differ from the
// layout's when the layout came from another shader.
diff --git a/source/renderer/ore/gl/ore_texture_gl.cpp b/source/renderer/ore/gl/ore_texture_gl.cpp
index 82d21e1049c6d0faf222e4b410f8e1648672a970..c2d4a0dbf37126e6e0e58b1a4aa70abea61cbf9c 100644
--- a/source/renderer/ore/gl/ore_texture_gl.cpp
+++ b/source/renderer/ore/gl/ore_texture_gl.cpp
@@ -340,6 +340,17 @@ void TextureGL::setSampledLevels(uint32_t unit, uint32_t base, uint32_t max)
m_glMaxLevel = max;
}
+void TextureGL::restoreSampledLevels()
+{
+ const uint32_t max = std::max(numMipmaps(), 1u) - 1;
+ if (m_glBaseLevel == 0 && m_glMaxLevel == max)
+ return;
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(m_glTarget, m_glTexture);
+ setSampledLevels(0, 0, max);
+ glBindTexture(m_glTarget, 0);
+}
+
TextureGL::~TextureGL()
{
if (m_glRenderbuffer != 0 && m_glOwnsTexture)
diff --git a/source/renderer/ore/gl/ore_texture_gl.hpp b/source/renderer/ore/gl/ore_texture_gl.hpp
index 62ea3852b16849cf3438a8dc6a5488b5199fff06..0466a32b220df7f5ca59022cbe084736536b038c 100644
--- a/source/renderer/ore/gl/ore_texture_gl.hpp
+++ b/source/renderer/ore/gl/ore_texture_gl.hpp
@@ -15,6 +15,9 @@ public:
// GLES3 has no texture views, so a sampled view's mip range is texture
// state. Expects the texture bound at `unit`.
void setSampledLevels(uint32_t unit, uint32_t base, uint32_t max);
+ // Hands the whole mip chain back, so GL users outside ore never inherit a
+ // narrowed view's range. Binds and unbinds the texture on unit 0.
+ void restoreSampledLevels();
private:
friend class ContextGL;
- Ngôn ngữ chính
- C++
- Star
- 1.3k
- Fork
- 133
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rive-app/rive-runtime
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 83/100
rive-app/rive-runtime#143 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rive-app/rive-runtime#141 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
rive-app/rive-runtime#140 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
rive-app/rive-runtime#137 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
rive-app/rive-runtime#134 ·
Tất cả issue của rive-app/rive-runtime
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
charmplusplus/charm#4210 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] VPN auth dialog spawned by the secret agent fails with "TLS support is not available" on NixOSĐang mởbug nixos umbriel
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
noctalia-dev/noctalia#5310 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/docdb kind/bug priority/medium status/awaiting-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
yugabyte/yugabyte-db#37426 ·
Maintainer thường phản hồi trong vòng 1 ngày