| 2408 | } |
| 2409 | |
| 2410 | void DebugInformation::PrepareDebugger() |
| 2411 | { |
| 2412 | spvm_word fnMain = GetEntryPoint(m_stage); |
| 2413 | if (fnMain == 0) { |
| 2414 | fnMain = spvm_state_get_result_location(m_vm, "main"); |
| 2415 | if (fnMain == 0) |
| 2416 | return; |
| 2417 | } |
| 2418 | |
| 2419 | m_funcStackLines.clear(); |
| 2420 | m_funcStackLines.push_back(-1); |
| 2421 | |
| 2422 | spvm_state_prepare(m_vm, fnMain); |
| 2423 | |
| 2424 | if (m_stage == ShaderStage::Pixel && m_pixel != nullptr) |
| 2425 | spvm_state_set_frag_coord(m_vm, m_pixel->Coordinate.x + 0.5f, m_pixel->Coordinate.y + 0.5f, 1.0f, 1.0f); // TODO: z and w components |
| 2426 | |
| 2427 | // move to cursor to first line in the function |
| 2428 | spvm_state_step_into(m_vm); |
| 2429 | if (m_vm->owner->language == SpvSourceLanguageHLSL) { |
| 2430 | // since actual main is encapsulated into another main function |
| 2431 | while (m_vm->code_current && m_vm->function_stack_current == 0) |
| 2432 | spvm_state_step_into(m_vm); |
| 2433 | } |
| 2434 | |
| 2435 | m_funcStackLines[0] = m_vm->current_line; |
| 2436 | |
| 2437 | // prepare immediate mode compiler |
| 2438 | m_compiler.SetSPIRV(m_spv); |
| 2439 | } |
| 2440 | |
| 2441 | void DebugInformation::ClearWatchList() |
| 2442 | { |