| 679 | return nullptr; |
| 680 | } |
| 681 | void CodeEditorUI::UpdateAutoRecompileItems() |
| 682 | { |
| 683 | if (m_contentChanged && m_lastAutoRecompile.GetElapsedTime() > 0.8f) { |
| 684 | for (int i = 0; i < m_changedEditors.size(); i++) { |
| 685 | for (int j = 0; j < m_editor.size(); j++) { |
| 686 | if (m_editor[j] == m_changedEditors[i] && m_items[j] != nullptr) { |
| 687 | if (m_items[j]->Type == PipelineItem::ItemType::ShaderPass) { |
| 688 | std::string vs = "", ps = "", gs = "", tcs = "", tes = ""; |
| 689 | if (m_shaderStage[j] == ShaderStage::Vertex) |
| 690 | vs = m_editor[j]->GetText(); |
| 691 | else if (m_shaderStage[j] == ShaderStage::Pixel) |
| 692 | ps = m_editor[j]->GetText(); |
| 693 | else if (m_shaderStage[j] == ShaderStage::Geometry) |
| 694 | gs = m_editor[j]->GetText(); |
| 695 | else if (m_shaderStage[j] == ShaderStage::TessellationControl) |
| 696 | tcs = m_editor[j]->GetText(); |
| 697 | else if (m_shaderStage[j] == ShaderStage::TessellationEvaluation) |
| 698 | tes = m_editor[j]->GetText(); |
| 699 | m_data->Renderer.RecompileFromSource(m_items[j]->Name, vs, ps, gs, tcs, tes); |
| 700 | } |
| 701 | else if (m_items[j]->Type == PipelineItem::ItemType::ComputePass) |
| 702 | m_data->Renderer.RecompileFromSource(m_items[j]->Name, m_editor[j]->GetText()); |
| 703 | else if (m_items[j]->Type == PipelineItem::ItemType::AudioPass) |
| 704 | m_data->Renderer.RecompileFromSource(m_items[j]->Name, m_editor[j]->GetText()); |
| 705 | else if (m_items[j]->Type == PipelineItem::ItemType::PluginItem) { |
| 706 | std::string pluginCode = m_editor[j]->GetText(); |
| 707 | ((pipe::PluginItemData*)m_items[j]->Data)->Owner->HandleRecompileFromSource(m_items[j]->Name, (int)m_shaderStage[j], pluginCode.c_str(), pluginCode.size()); |
| 708 | } |
| 709 | |
| 710 | break; |
| 711 | } |
| 712 | } |
| 713 | } |
| 714 | for (int i = 0; i < m_changedPluginEditors.size(); i++) { |
| 715 | for (int j = 0; j < m_pluginEditor.size(); j++) { |
| 716 | int langID = m_changedPluginEditors[i]->LanguageID; |
| 717 | int editorID = m_changedPluginEditors[i]->ID; |
| 718 | IPlugin1* plugin = m_changedPluginEditors[i]->Plugin; |
| 719 | |
| 720 | if (langID == m_pluginEditor[j].LanguageID && |
| 721 | editorID == m_pluginEditor[j].ID && |
| 722 | plugin == m_pluginEditor[j].Plugin) |
| 723 | { |
| 724 | size_t contentLength = 0; |
| 725 | const char* tempText = plugin->ShaderEditor_GetContent(langID, editorID, &contentLength); |
| 726 | |
| 727 | if (m_items[j]->Type == PipelineItem::ItemType::ShaderPass) { |
| 728 | std::string vs = "", ps = "", gs = "", tcs = "", tes = ""; |
| 729 | if (m_shaderStage[j] == ShaderStage::Vertex) |
| 730 | vs = std::string(tempText, contentLength); |
| 731 | else if (m_shaderStage[j] == ShaderStage::Pixel) |
| 732 | ps = std::string(tempText, contentLength); |
| 733 | else if (m_shaderStage[j] == ShaderStage::Geometry) |
| 734 | gs = std::string(tempText, contentLength); |
| 735 | else if (m_shaderStage[j] == ShaderStage::TessellationControl) |
| 736 | tcs = std::string(tempText, contentLength); |
| 737 | else if (m_shaderStage[j] == ShaderStage::TessellationEvaluation) |
| 738 | tes = std::string(tempText, contentLength); |
no test coverage detected