debug_fix_screen_change #2

Merged
xsl merged 35 commits from debug_fix_screen_change into main 2026-04-26 10:58:01 +08:00
4 changed files with 45 additions and 40 deletions
Showing only changes of commit b6ac86a134 - Show all commits
+5
View File
@@ -5,6 +5,11 @@ layout (binding = 1) uniform sampler2D samplerColor;
layout (location = 0) in vec2 inUV;
layout (location = 1) in vec3 inNormal;
layout(push_constant) uniform PushConstantsFS {
float ux;
float uy;
} pc_fs;
layout (location = 0) out vec4 outFragColor;
Binary file not shown.
+38 -40
View File
@@ -660,6 +660,21 @@ void FaceApp::render(VkCommandBuffer commandBuffer, long long frameTime)
vkCmdPushConstants(commandBuffer, m_pipelineLayout_bg, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(float), &myFloatValue);
float fsValues[2] = { 0, 0 };
if (_curMotionIndex < _curMotions.size())
{
if (_curFrameIndex < _curMotions[_curMotionIndex].frames.size())
{
float ux = _curMotions[_curMotionIndex].frames[_curFrameIndex].x;
float uy = _curMotions[_curMotionIndex].frames[_curFrameIndex].y;
fsValues[0] = ux;
fsValues[1] = uy;
}
}
vkCmdPushConstants(commandBuffer, m_pipelineLayout_bg, VK_SHADER_STAGE_FRAGMENT_BIT, 4, sizeof(fsValues), fsValues);
vkCmdDraw(commandBuffer, 6, 1, 0, 0);
@@ -1081,13 +1096,17 @@ void FaceApp::setup_descriptor_set_layout_bg()
pipeline_layout_create_info.pSetLayouts = &m_descriptorSetLayout_bg;
VkPushConstantRange pushConstantRange{};
pushConstantRange.stageFlags = VK_SHADER_STAGE_VERTEX_BIT; // 只在片段着色器中使用
pushConstantRange.offset = 0;
pushConstantRange.size = sizeof(float); // 或者 sizeof(PushConstants)
VkPushConstantRange pushConstantRanges[2];
pushConstantRanges[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT; // 只在片段着色器中使用
pushConstantRanges[0].offset = 0;
pushConstantRanges[0].size = sizeof(float); // 或者 sizeof(PushConstants)
pipeline_layout_create_info.pushConstantRangeCount = 1;
pipeline_layout_create_info.pPushConstantRanges = &pushConstantRange;
pushConstantRanges[1].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; // 只在片段着色器中使用
pushConstantRanges[1].offset = sizeof(float);
pushConstantRanges[1].size = 2 * sizeof(float); // 或者 sizeof(PushConstants)
pipeline_layout_create_info.pushConstantRangeCount = 2;
pipeline_layout_create_info.pPushConstantRanges = &pushConstantRanges[0];
VK_CHECK(vkCreatePipelineLayout(device, &pipeline_layout_create_info, nullptr, &m_pipelineLayout_bg));
}
@@ -1410,13 +1429,8 @@ void FaceApp::loadMotionThread()
_callback_loadfinish();
}
void FaceApp::changeMotionList(AnimationFinishedCallback callback, bool loop)
void FaceApp::doChangeMotion()
{
if (_isLoadMotion)
{
return;
}
std::unique_lock<std::mutex> lock_changeMotion(changeMotionMtx);
@@ -1433,36 +1447,20 @@ void FaceApp::changeMotionList(AnimationFinishedCallback callback, bool loop)
update_descriptor_set(m_texs);
_curMotions = _preLoadMotions;
_animationFinishedCallback = callback;
_animationLoop = loop;
_curFrameIndex = 0;
_curMotionIndex = 0;
}
void FaceApp::changeMotionList(AnimationFinishedCallback callback, bool loop)
{
if (_isLoadMotion)
{
return;
}
_animationFinishedCallback = callback;
_animationLoop = loop;
_needChangeMotion = true;
// for (int i = 0; i < _curMotion.png_names.size(); ++i)
// {
//
//#ifdef _WIN32
// //string path = _curMotion.type + "/" + _curMotion.technique + "/" + _curMotion.step + "/" + _curMotion.show_type;
// string path = "pic";
// string path_name = path + "/" + _curMotion.type + "/" + _curMotion.png_names[i];// +std::to_string(i) + ".png";
// loadTextureExample(UTF8ToWideString(path_name), m_texs[i], true);
// if (kThick)
// {
// string path_name_ex = path + "/" + _curMotion.type + "/" + _curMotion.png_names[i] + std::to_string(i) + "_thick.png";
// loadTextureExample(UTF8ToWideString(path_name_ex), m_texs_ex[i], true);
// }
//#else
// //string path = _curMotion.type + "/" + _curMotion.technique + "/" + _curMotion.step + "/" + _curMotion.show_type;
// string path = "pic";
// string path_name = path + "/" + _curMotion.type + "/" + _curMotion.png_names[i];// +std::to_string(i) + ".png";
// loadTexture(path_name, m_texs[i], true);
// if (kThick)
// {
// loadTexture(path_name, m_texs_ex[i], true);
// }
//#endif // _WIN32
//
//
// }
}
+2
View File
@@ -155,6 +155,8 @@ public:
void loadMotionThread();
std::thread worker_;
bool _isLoadMotion = false;
bool _needChangeMotion = false;
void doChangeMotion();
Callback _callback_loadfinish;
AnimationFinishedCallback _animationFinishedCallback;
bool _animationLoop = true;