feat: add shader resource file for Qt6 build#574
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a new Qt resource collection for shaders to the Qt6 build and wires it into the CMake resource setup so shader files can be loaded uniformly across Qt5/Qt6 without version checks. Sequence diagram for unified shader loading without Qt version checkssequenceDiagram
participant DOpenGLBlurEffectNode
participant QtResourceSystem
participant ShaderFiles
DOpenGLBlurEffectNode->>QtResourceSystem: request shader(:/shaders/blur.vert)
QtResourceSystem->>ShaderFiles: resolve alias to src/shaders/blur.vert
ShaderFiles-->>QtResourceSystem: shader source
QtResourceSystem-->>DOpenGLBlurEffectNode: shader source
DOpenGLBlurEffectNode->>DOpenGLBlurEffectNode: compile and link shader (no Qt version checks)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
TAG Bot New tag: 6.7.34 |
- Add dtkdeclarative_shaders_ng.qrc to reference shader files from src/shaders - Use alias to map shader paths for Qt6 compatibility - Remove Qt version checks in DOpenGLBlurEffectNode shader loading - Unify shader resource paths across Qt5 and Qt6 Log: add shader resource file for Qt6 build
deepin pr auto review这份代码变更主要是通过Qt资源系统(Qt Resource System, QRC)引入了一组新的着色器文件。以下是对该变更的审查意见,涵盖语法逻辑、代码质量、代码性能和代码安全四个方面: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进建议
修改后的 CMakeLists 片段建议(增加存在性检查): # 定义着色器源文件目录,假设相对于 qt6/src
set(SHADER_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../src/shaders")
# 检查目录是否存在
if(NOT EXISTS "${SHADER_SOURCE_DIR}")
message(FATAL_ERROR "Shader source directory not found: ${SHADER_SOURCE_DIR}")
endif()
# 检查具体的文件是否存在(可选)
set(REQUIRED_SHADERS
dualkawasedown.frag dualkawasedown.vert
dualkawaseup.frag dualkawaseup.vert
noise.vert noise.frag
)
foreach(shader ${REQUIRED_SHADERS})
if(NOT EXISTS "${SHADER_SOURCE_DIR}/${shader}")
message(WARNING "Required shader file missing: ${shader}")
endif()
endforeach()
file(GLOB QML_RCS dtkdeclarative_qml.qrc dtkdeclarative_overridable_qml.qrc)
qt_add_resources(RESOURCES
${QML_RCS}
${ASSETS_RCS}
dtkdeclarative_shaders_ng.qrc
)
target_sources(${LIB_NAME} PRIVATE ${RESOURCES})总结:该变更在语法和功能上是正确的,能够有效地将着色器资源集成到构建系统中。主要的改进点在于优化文件路径的依赖关系,增加构建时的健壮性检查,以及确保项目结构的清晰度。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, wyu71 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
Log: add shader resource file for Qt6 build
Summary by Sourcery
Build: