| 279 | return done; |
| 280 | } |
| 281 | bv_variable ShaderDebugger::Immediate(const std::string& src) |
| 282 | { |
| 283 | m_immCompiler->ClearDefinitions(); |
| 284 | |
| 285 | // pass the function definitions |
| 286 | const std::vector<sd::Function>& funcs = m_compiler->GetFunctions(); |
| 287 | for (const auto& func : funcs) |
| 288 | if (func.Name != m_entry) |
| 289 | m_immCompiler->AddFunctionDefinition(func); |
| 290 | |
| 291 | // pass the structure definitions |
| 292 | const std::vector<sd::Structure>& structs = m_compiler->GetStructures(); |
| 293 | for (const auto& str : structs) |
| 294 | m_immCompiler->AddStructureDefinition(str); |
| 295 | |
| 296 | // pass the global definitions |
| 297 | const std::vector<sd::Variable>& globals = m_compiler->GetGlobals(); |
| 298 | for (const auto& glob : globals) { |
| 299 | m_immCompiler->AddGlobalDefinition(glob); |
| 300 | m_immCompiler->AddImmediateGlobalDefinition(glob); |
| 301 | } |
| 302 | |
| 303 | // pass macro definitions |
| 304 | pp::MacroMap macros = m_compiler->GetMacroList(); |
| 305 | for (const auto& m : macros) |
| 306 | m_immCompiler->AddMacro(m.first, m.second); |
| 307 | |
| 308 | // pass arguments |
| 309 | std::string curFunc = GetCurrentFunction(); |
| 310 | unsigned int locIndex = 0; |
| 311 | for (const auto& f : funcs) { |
| 312 | if (f.Name == curFunc) { |
| 313 | |
| 314 | for (const auto& arg : f.Arguments) { |
| 315 | sd::Variable locData = arg; |
| 316 | locData.ID = globals.size() + locIndex; |
| 317 | m_immCompiler->AddGlobalDefinition(locData); |
| 318 | m_immCompiler->AddImmediateGlobalDefinition(locData); |
| 319 | |
| 320 | locIndex++; |
| 321 | } |
| 322 | |
| 323 | break; |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | // pass on the local variables |
| 328 | const std::vector<std::string>& locals = m_compiler->GetLocals(GetCurrentFunction()); |
| 329 | for (const auto& loc : locals) { |
| 330 | sd::Variable locData; |
| 331 | locData.ID = globals.size() + locIndex; |
| 332 | locData.Name = loc; |
| 333 | locData.Type = m_compiler->GetLocalType(GetCurrentFunction(), loc); |
| 334 | m_immCompiler->AddGlobalDefinition(locData); |
| 335 | m_immCompiler->AddImmediateGlobalDefinition(locData); |
| 336 | |
| 337 | locIndex++; |
| 338 | } |
nothing calls this directly
no test coverage detected