diff --git a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index fe0999927..da3abf696 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -164,8 +164,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox, if (m_completed) return; if (chunk->level->dimension->id != m_dimension) return; - PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition"); - if (m_schematic == nullptr) + if (m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); if (!m_locationBox.has_value()) updateLocationBox(); @@ -177,16 +176,14 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox, app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n", m_schematicName.c_str(), chunk->x, chunk->z); #endif - PIXBeginNamedEvent(0, "Applying blocks and data"); - m_totalBlocksChanged += m_schematic->applyBlocksAndData( + m_totalBlocksChanged += m_schematic->applyBlocksAndData( chunk, chunkBox, &*m_locationBox, m_rotation); - PIXEndNamedEvent(); + // Add the tileEntities - PIXBeginNamedEvent(0, "Applying tile entities"); - m_schematic->applyTileEntities(chunk, chunkBox, &*m_locationBox, + m_schematic->applyTileEntities(chunk, chunkBox, &*m_locationBox, m_rotation); - PIXEndNamedEvent(); + // TODO This does not take into account things that go outside the // bounds of the world @@ -200,7 +197,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB* chunkBox, // m_schematic = nullptr; } } - PIXEndNamedEvent(); + } void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox, @@ -208,8 +205,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox, if (m_completed) return; if (chunk->level->dimension->id != m_dimension) return; - PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)"); - if (m_schematic == nullptr) + if (m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); if (!m_locationBox.has_value()) updateLocationBox(); @@ -221,10 +217,9 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox, app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n", m_schematicName.c_str(), chunk->x, chunk->z); #endif - PIXBeginNamedEvent(0, "Patching lighting"); - m_totalBlocksChangedLighting += m_schematic->applyLighting( + m_totalBlocksChangedLighting += m_schematic->applyLighting( chunk, chunkBox, &*m_locationBox, m_rotation); - PIXEndNamedEvent(); + // TODO This does not take into account things that go outside the // bounds of the world @@ -238,7 +233,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB* chunkBox, // m_schematic = nullptr; } } - PIXEndNamedEvent(); + } bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0, diff --git a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ConsoleSchematicFile.cpp b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ConsoleSchematicFile.cpp index 959bac893..8a959cac3 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ConsoleSchematicFile.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ConsoleSchematicFile.cpp @@ -227,13 +227,11 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk, int totalBlockCount = getXSize() * rowBlockCount; std::vector blockData = std::vector(Level::CHUNK_TILE_COUNT); - PIXBeginNamedEvent(0, "Getting block data"); - chunk->getBlockData(blockData); - PIXEndNamedEvent(); + chunk->getBlockData(blockData); + std::vector dataData = std::vector(Level::HALF_CHUNK_TILE_COUNT); - PIXBeginNamedEvent(0, "Getting Data data"); - chunk->getDataData(dataData); - PIXEndNamedEvent(); + chunk->getDataData(dataData); + // Ignore light data int blockLightP = -1; @@ -305,13 +303,11 @@ int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk* chunk, // } //} - PIXBeginNamedEvent(0, "Setting Block data"); - chunk->setBlockData(blockData); - PIXEndNamedEvent(); + chunk->setBlockData(blockData); + chunk->recalcHeightmapOnly(); - PIXBeginNamedEvent(0, "Setting Data data"); - chunk->setDataData(dataData); - PIXEndNamedEvent(); + chunk->setDataData(dataData); + // A basic pass through to roughly do the lighting. At this point of // post-processing, we don't have all the neighbouring chunks loaded in, so @@ -966,8 +962,7 @@ void ConsoleSchematicFile::setBlocksAndData( upperY1 = y1 - Level::COMPRESSED_CHUNK_SECTION_HEIGHT; bHasUpper = true; } - PIXBeginNamedEvent(0, "Applying block data"); - for (int x = x0; x < x1; x++) + for (int x = x0; x < x1; x++) for (int z = z0; z < z1; z++) { if (bHasLower) { int slot = x << Level::genDepthBitsPlusFour | @@ -985,10 +980,9 @@ void ConsoleSchematicFile::setBlocksAndData( blocksP += len; } } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Applying Data data"); - for (int x = x0; x < x1; x++) + for (int x = x0; x < x1; x++) for (int z = z0; z < z1; z++) { if (bHasLower) { int slot = (x << Level::genDepthBitsPlusFour | @@ -1008,7 +1002,7 @@ void ConsoleSchematicFile::setBlocksAndData( dataP += len; } } - PIXEndNamedEvent(); + // 4J Stu - Allow ignoring light data if (blockLightP > -1) { std::vector blockLightData = std::vector(Level::HALF_CHUNK_TILE_COUNT); diff --git a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/LevelGenerationOptions.cpp b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/LevelGenerationOptions.cpp index edc15fc66..5f3a2d9d5 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/LevelGenerationOptions.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/LevelGenerationOptions.cpp @@ -253,8 +253,6 @@ void LevelGenerationOptions::addAttribute(const std::wstring& attributeName, } void LevelGenerationOptions::processSchematics(LevelChunk* chunk) { - PIXBeginNamedEvent(0, "Processing schematics for chunk (%d,%d)", chunk->x, - chunk->z); AABB chunkBox(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16, Level::maxBuildHeight, chunk->z * 16 + 16); for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); @@ -277,12 +275,10 @@ void LevelGenerationOptions::processSchematics(LevelChunk* chunk) { delete bb; } } - PIXEndNamedEvent(); + } void LevelGenerationOptions::processSchematicsLighting(LevelChunk* chunk) { - PIXBeginNamedEvent(0, "Processing schematics (lighting) for chunk (%d,%d)", - chunk->x, chunk->z); AABB chunkBox(chunk->x * 16, 0, chunk->z * 16, chunk->x * 16 + 16, Level::maxBuildHeight, chunk->z * 16 + 16); for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); @@ -290,13 +286,12 @@ void LevelGenerationOptions::processSchematicsLighting(LevelChunk* chunk) { ApplySchematicRuleDefinition* rule = *it; rule->processSchematicLighting(&chunkBox, chunk); } - PIXEndNamedEvent(); + } bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1) { - PIXBeginNamedEvent(0, "Check Intersects"); - + // As an optimisation, we can quickly discard things below a certain y which // makes most ore checks faster due to a) ores generally being below // ground/sea level and b) tutorial world additions generally being above @@ -340,7 +335,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, if (intersects) break; } } - PIXEndNamedEvent(); + return intersects; } diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp index aa1074002..ed06002c8 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp @@ -303,9 +303,8 @@ void UIScene_MainMenu::RunAction(int iPad) { void UIScene_MainMenu::customDraw(IggyCustomDrawCallbackRegion* region) { if (std::char_traits::compare(region->name, u"Splash", 6) == 0) { - PIXBeginNamedEvent(0, "Custom draw splash"); - customDrawSplash(region); - PIXEndNamedEvent(); + customDrawSplash(region); + } } diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.cpp index 8b9e792bc..e766b6467 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.cpp @@ -795,23 +795,20 @@ UIController::ExternalFunctionCallback(void* user_callback_data, Iggy* player, // RENDERING void UIController::renderScenes() { - PIXBeginNamedEvent(0, "Rendering Iggy scenes"); - // Only render player scenes if the game is started + // Only render player scenes if the game is started if (app.GetGameStarted() && !m_groups[eUIGroup_Fullscreen]->hidesLowerScenes()) { for (int i = eUIGroup_Player1; i < eUIGroup_COUNT; ++i) { - PIXBeginNamedEvent(0, "Rendering layer %d scenes", i); - m_groups[i]->render(); - PIXEndNamedEvent(); + m_groups[i]->render(); + } } // Always render the fullscreen group - PIXBeginNamedEvent(0, "Rendering fullscreen scenes"); - m_groups[eUIGroup_Fullscreen]->render(); - PIXEndNamedEvent(); + m_groups[eUIGroup_Fullscreen]->render(); + - PIXEndNamedEvent(); + #if defined(ENABLE_IGGY_PERFMON) if (m_iggyPerfmonEnabled) { @@ -942,9 +939,8 @@ void UIController::setupCustomDrawGameState() { m_customRenderingClearRect.bottom = LONG_MIN; #if defined(_WINDOWS64) - PIXBeginNamedEvent(0, "StartFrame"); - RenderManager.StartFrame(); - PIXEndNamedEvent(); + RenderManager.StartFrame(); + gdraw_D3D11_setViewport_4J(); #elif defined(__linux__) RenderManager.StartFrame(); @@ -957,8 +953,7 @@ void UIController::setupCustomDrawGameState() { // RenderManager.Clear(GL_DEPTH_BUFFER_BIT, &m_customRenderingClearRect); // glClear(GL_DEPTH_BUFFER_BIT); - PIXBeginNamedEvent(0, "Final setup"); - glMatrixMode(GL_PROJECTION); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); @@ -967,7 +962,7 @@ void UIController::setupCustomDrawGameState() { glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glDepthMask(true); - PIXEndNamedEvent(); + } void UIController::setupCustomDrawMatrices(UIScene* scene, diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/UILayer.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/UILayer.cpp index 45fb04144..62bb270dd 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/UILayer.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/UILayer.cpp @@ -142,10 +142,8 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport) { auto itRef = m_componentRefCount.find((*it)->getSceneType()); if (itRef != m_componentRefCount.end() && itRef->second.second) { if ((*it)->isVisible()) { - PIXBeginNamedEvent(0, "Rendering component %d", - (*it)->getSceneType()); (*it)->render(width, height, viewport); - PIXEndNamedEvent(); + } } } @@ -161,11 +159,8 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport) { (!ui.IsExpectingOrReloadingSkin() || m_sceneStack[lowestRenderable]->getSceneType() == eUIScene_Timer)) { - PIXBeginNamedEvent( - 0, "Rendering scene %d", - m_sceneStack[lowestRenderable]->getSceneType()); m_sceneStack[lowestRenderable]->render(width, height, viewport); - PIXEndNamedEvent(); + } } } diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/UIScene.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/UIScene.cpp index fd40fd24b..81a9e499b 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/UIScene.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/UIScene.cpp @@ -545,8 +545,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region, // Setup GDraw, normal game render states and matrices // CustomDrawData *customDrawRegion = // ui.setupCustomDraw(this,region); - PIXBeginNamedEvent(0, "Starting Iggy custom draw\n"); - CustomDrawData* customDrawRegion = + CustomDrawData* customDrawRegion = ui.calculateCustomDraw(region); ui.beginIggyCustomDraw4J(region, customDrawRegion); ui.setupCustomDrawGameState(); @@ -557,16 +556,14 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region, if (!useCommandBuffers || m_needsCacheRendered) { if (useCommandBuffers) RenderManager.CBuffStart(list, true); - PIXBeginNamedEvent(0, "Draw uncached"); - ui.setupCustomDrawMatrices(this, customDrawRegion); + ui.setupCustomDrawMatrices(this, customDrawRegion); _customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, useCommandBuffers); delete customDrawRegion; - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Draw all cache"); - // Draw all the cached slots + // Draw all the cached slots for (auto it = m_cachedSlotDraw.begin(); it != m_cachedSlotDraw.end(); ++it) { CachedSlotDrawData* drawData = *it; @@ -579,7 +576,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region, delete drawData->customDrawRegion; delete drawData; } - PIXEndNamedEvent(); + if (useCommandBuffers) RenderManager.CBuffEnd(); } m_cachedSlotDraw.clear(); @@ -591,8 +588,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region, pMinecraft->player = oldPlayer; } else { - PIXBeginNamedEvent(0, "Caching region"); - CachedSlotDrawData* drawData = new CachedSlotDrawData(); + CachedSlotDrawData* drawData = new CachedSlotDrawData(); drawData->item = item; drawData->fAlpha = fAlpha; drawData->isFoil = isFoil; @@ -600,7 +596,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region, drawData->customDrawRegion = ui.calculateCustomDraw(region); m_cachedSlotDraw.push_back(drawData); - PIXEndNamedEvent(); + } } else { // Setup GDraw, normal game render states and matrices @@ -678,12 +674,11 @@ void UIScene::_customDrawSlotControl(CustomDrawData* region, int iPad, glTranslatef((float)-(sx + sxoffs), (float)-(sy + syoffs), 0); } - PIXBeginNamedEvent(0, "Render and decorate"); - if (m_pItemRenderer == nullptr) m_pItemRenderer = new ItemRenderer(); + if (m_pItemRenderer == nullptr) m_pItemRenderer = new ItemRenderer(); m_pItemRenderer->renderAndDecorateItem( pMinecraft->font, pMinecraft->textures, item, x, y, scaleX, scaleY, fAlpha, isFoil, false, !usingCommandBuffer); - PIXEndNamedEvent(); + if (pop > 0) { glPopMatrix(); diff --git a/minecraft/Minecraft.Client/Linux/Linux_Minecraft.cpp b/minecraft/Minecraft.Client/Linux/Linux_Minecraft.cpp index 97ad9f2e7..613f760a9 100644 --- a/minecraft/Minecraft.Client/Linux/Linux_Minecraft.cpp +++ b/minecraft/Minecraft.Client/Linux/Linux_Minecraft.cpp @@ -763,32 +763,25 @@ int main(int argc, const char* argv[]) { ui.setScreenSize(fbw, fbh); } app.UpdateTime(); - PIXBeginNamedEvent(0, "Input manager tick"); - InputManager.Tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Profile manager tick"); - ProfileManager.Tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Storage manager tick"); - StorageManager.Tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Render manager tick"); - RenderManager.Tick(); - PIXEndNamedEvent(); + InputManager.Tick(); + + ProfileManager.Tick(); + + StorageManager.Tick(); + + RenderManager.Tick(); + // Tick the social networking manager. - PIXBeginNamedEvent(0, "Social network manager tick"); - // CSocialManager::Instance()->Tick(); - PIXEndNamedEvent(); + // CSocialManager::Instance()->Tick(); + // Tick sentient. - PIXBeginNamedEvent(0, "Sentient tick"); - // SentientManager.Tick(); - PIXEndNamedEvent(); + // SentientManager.Tick(); + - PIXBeginNamedEvent(0, "Network manager do work #1"); - g_NetworkManager.DoWork(); - PIXEndNamedEvent(); + g_NetworkManager.DoWork(); + // Render game graphics. #if defined(ENABLE_JAVA_GUIS) pMinecraft->run_middle(); @@ -831,8 +824,7 @@ int main(int argc, const char* argv[]) { RenderManager.Present(); ui.CheckMenuDisplayed(); - PIXBeginNamedEvent(0, "Profile load check"); - // has the game defined profile data been changed (by a profile load) + // has the game defined profile data been changed (by a profile load) if (app.uiGameDefinedDataChangedBitmask != 0) { void* pData; for (int i = 0; i < XUSER_MAX_COUNT; i++) { @@ -863,11 +855,10 @@ int main(int argc, const char* argv[]) { // clear the flag app.uiGameDefinedDataChangedBitmask = 0; } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Network manager do work #2"); - g_NetworkManager.DoWork(); - PIXEndNamedEvent(); + g_NetworkManager.DoWork(); + // Any threading type things to deal with from the xui side? app.HandleXuiActions(); diff --git a/minecraft/Minecraft.Client/Linux/linux_game_stubs.cpp b/minecraft/Minecraft.Client/Linux/linux_game_stubs.cpp index 887703696..ce47dd0b0 100644 --- a/minecraft/Minecraft.Client/Linux/linux_game_stubs.cpp +++ b/minecraft/Minecraft.Client/Linux/linux_game_stubs.cpp @@ -9,6 +9,4 @@ int CMinecraftApp::GetTPConfigVal(wchar_t* pwchDataFile) { return 0; } #include "Minecraft.World/x64headers/extraX64.h" -void PIXSetMarkerDeprecated(int a, const char* b, ...) {} - #endif diff --git a/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp b/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp index 98864d86e..5d9110d85 100644 --- a/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp +++ b/minecraft/Minecraft.Client/Source Files/Extrax64Stubs.cpp @@ -44,51 +44,6 @@ uint32_t XContentGetThumbnail(uint32_t dwUserIndex, return 0; } -void PIXAddNamedCounter(int a, const char* b, ...) {} -// #define PS3_USE_PIX_EVENTS -// #define PS4_USE_PIX_EVENTS -void PIXBeginNamedEvent(int a, const char* b, ...) { -#if defined(PS4_USE_PIX_EVENTS) - char buf[512]; - va_list args; - va_start(args, b); - vsprintf(buf, b, args); - sceRazorCpuPushMarker(buf, 0xffffffff, SCE_RAZOR_MARKER_ENABLE_HUD); - -#endif -#if defined(PS3_USE_PIX_EVENTS) - char buf[256]; - wchar_t wbuf[256]; - va_list args; - va_start(args, b); - vsprintf(buf, b, args); - snPushMarker(buf); - - // mbstowcs(wbuf,buf,256); - // RenderManager.BeginEvent(wbuf); - va_end(args); -#endif -} - -void PIXEndNamedEvent() { -#if defined(PS4_USE_PIX_EVENTS) - sceRazorCpuPopMarker(); -#endif -#if defined(PS3_USE_PIX_EVENTS) - snPopMarker(); -// RenderManager.EndEvent(); -#endif -} -void PIXSetMarkerDeprecated(int a, char* b, ...) {} - -// void *D3DXBUFFER::GetBufferPointer() { return nullptr; } -// int D3DXBUFFER::GetBufferSize() { return 0; } -// void D3DXBUFFER::Release() {} - -// #if 0 -// void GetLocalTime(SYSTEMTIME *time) {} -// #endif - bool IsEqualXUID(PlayerUID a, PlayerUID b) { return false; } void XMemCpy(void* a, const void* b, size_t s) { memcpy(a, b, s); } diff --git a/minecraft/Minecraft.Client/Windows64/Source Files/Windows64_Minecraft.cpp b/minecraft/Minecraft.Client/Windows64/Source Files/Windows64_Minecraft.cpp index e2a5390ad..da6e67cb6 100644 --- a/minecraft/Minecraft.Client/Windows64/Source Files/Windows64_Minecraft.cpp +++ b/minecraft/Minecraft.Client/Windows64/Source Files/Windows64_Minecraft.cpp @@ -789,32 +789,25 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // } app.UpdateTime(); - PIXBeginNamedEvent(0, "Input manager tick"); - InputManager.Tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Profile manager tick"); - // ProfileManager.Tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Storage manager tick"); - StorageManager.Tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Render manager tick"); - RenderManager.Tick(); - PIXEndNamedEvent(); + InputManager.Tick(); + + // ProfileManager.Tick(); + + StorageManager.Tick(); + + RenderManager.Tick(); + // Tick the social networking manager. - PIXBeginNamedEvent(0, "Social network manager tick"); - // CSocialManager::Instance()->Tick(); - PIXEndNamedEvent(); + // CSocialManager::Instance()->Tick(); + // Tick sentient. - PIXBeginNamedEvent(0, "Sentient tick"); - // SentientManager.Tick(); - PIXEndNamedEvent(); + // SentientManager.Tick(); + - PIXBeginNamedEvent(0, "Network manager do work #1"); - // g_NetworkManager.DoWork(); - PIXEndNamedEvent(); + // g_NetworkManager.DoWork(); + // LeaderboardManager::Instance()->Tick(); // Render game graphics. diff --git a/minecraft/Minecraft.Client/Windows64/Windows64_UIController.cpp b/minecraft/Minecraft.Client/Windows64/Windows64_UIController.cpp index 124a7957c..84a06bded 100644 --- a/minecraft/Minecraft.Client/Windows64/Windows64_UIController.cpp +++ b/minecraft/Minecraft.Client/Windows64/Windows64_UIController.cpp @@ -97,13 +97,11 @@ void ConsoleUIController::render() { void ConsoleUIController::beginIggyCustomDraw4J( IggyCustomDrawCallbackRegion* region, CustomDrawData* customDrawRegion) { - PIXBeginNamedEvent(0, "Starting Iggy custom draw\n"); - - PIXBeginNamedEvent(0, "Gdraw setup"); - // get the correct object-to-world matrix from GDraw, and set the render + + // get the correct object-to-world matrix from GDraw, and set the render // state to a normal state gdraw_D3D11_BeginCustomDraw_4J(region, customDrawRegion->mat); - PIXEndNamedEvent(); + } CustomDrawData* ConsoleUIController::setupCustomDraw( @@ -114,8 +112,7 @@ CustomDrawData* ConsoleUIController::setupCustomDraw( customDrawRegion->y0 = region->y0; customDrawRegion->y1 = region->y1; - PIXBeginNamedEvent(0, "Starting Iggy custom draw\n"); - // get the correct object-to-world matrix from GDraw, and set the render + // get the correct object-to-world matrix from GDraw, and set the render // state to a normal state gdraw_D3D11_BeginCustomDraw_4J(region, customDrawRegion->mat); @@ -141,7 +138,7 @@ void ConsoleUIController::endCustomDraw(IggyCustomDrawCallbackRegion* region) { endCustomDrawGameStateAndMatrices(); gdraw_D3D11_EndCustomDraw(region); - PIXEndNamedEvent(); + } void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos) { diff --git a/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.cpp b/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.cpp index a1ed1cb92..2e6220dc7 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.cpp @@ -1577,17 +1577,15 @@ void Minecraft::run_middle() { // if (pause) timer.a = 1; - PIXBeginNamedEvent(0, "Sound engine update"); - soundEngine->tick((std::shared_ptr*)localplayers, + soundEngine->tick((std::shared_ptr*)localplayers, timer->a); - PIXEndNamedEvent(); - - PIXBeginNamedEvent(0, "Light update"); + + // if (level != nullptr) level->updateLights(); glEnable(GL_TEXTURE_2D); - PIXEndNamedEvent(); + // if (!Keyboard::isKeyDown(Keyboard.KEY_F7)) // Display.update(); // 4J - removed @@ -1603,14 +1601,12 @@ void Minecraft::run_middle() { int iPrimaryPad = InputManager.GetPrimaryPad(); for (int i = 0; i < XUSER_MAX_COUNT; i++) { if (setLocalPlayerIdx(i)) { - PIXBeginNamedEvent(0, "Game render player idx %d", - i); RenderManager.StateSetViewport( (C4JRender::eViewportType) player->m_iScreenSection); gameRenderer->render(timer->a, bFirst); bFirst = false; - PIXEndNamedEvent(); + if (i == iPrimaryPad) { // check to see if we need to capture a @@ -1698,19 +1694,17 @@ void Minecraft::run_middle() { achievementPopup->render(); - PIXBeginNamedEvent(0, "Sleeping"); - std::this_thread::yield(); // 4jcraft added now that we have + std::this_thread::yield(); // 4jcraft added now that we have // portable thread yield. // std::this_thread::sleep_for( // std::chrono::milliseconds(0)); // 4J - was // Thread.yield()) - PIXEndNamedEvent(); + // if (Keyboard::isKeyDown(Keyboard::KEY_F7)) // Display.update(); // 4J - removed condition - PIXBeginNamedEvent(0, "Display update"); - Display::update(); - PIXEndNamedEvent(); + Display::update(); + // checkScreenshot(); // 4J - removed @@ -1986,9 +1980,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { glBindTexture(GL_TEXTURE_2D, textures->loadTexture(TN_TERRAIN)); // L"/terrain.png")); if (bFirst) { - PIXBeginNamedEvent(0, "Texture tick"); - if (!pause) textures->tick(bUpdateTextures); - PIXEndNamedEvent(); + if (!pause) textures->tick(bUpdateTextures); + } /* @@ -3528,9 +3521,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { level->difficulty = options->difficulty; } - PIXBeginNamedEvent(0, "Game renderer tick"); - if (!pause) gameRenderer->tick(bFirst); - PIXEndNamedEvent(); + if (!pause) gameRenderer->tick(bFirst); + // 4J - we want to tick each level once only per frame, and do it when a // player that is actually in that level happens to be active. This is @@ -3543,9 +3535,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { levelsTickedFlags = 0; #if !defined(DISABLE_LEVELTICK_THREAD) - PIXBeginNamedEvent(0, "levelTickEventQueue waitForFinish"); - levelTickEventQueue->waitForFinish(); - PIXEndNamedEvent(); + levelTickEventQueue->waitForFinish(); + #endif SparseLightStorage::tick(); // 4J added CompressedTileStorage::tick(); // 4J added @@ -3571,9 +3562,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // level this frame levelsTickedFlags |= (1 << i); - PIXBeginNamedEvent(0, "Level renderer tick"); - if (!pause) levelRenderer->tick(); - PIXEndNamedEvent(); + if (!pause) levelRenderer->tick(); + // if (!pause && player!=null) { // if (player != null && !level.entities.contains(player)) { // level.addEntity(player); @@ -3582,9 +3572,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { if (levels[i] != nullptr) { if (!pause) { if (levels[i]->skyFlashTime > 0) levels[i]->skyFlashTime--; - PIXBeginNamedEvent(0, "Level entity tick"); - levels[i]->tickEntities(); - PIXEndNamedEvent(); + levels[i]->tickEntities(); + } // optimisation to set the culling off early, in parallel with @@ -3596,21 +3585,19 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // app.DebugPrintf("Minecraft::tick spawn settings - // Difficulty = %d",options->difficulty); levels[i]->setSpawnSettings(level->difficulty > 0, true); - PIXBeginNamedEvent(0, "Level tick"); -#if defined(DISABLE_LEVELTICK_THREAD) + #if defined(DISABLE_LEVELTICK_THREAD) levels[i]->tick(); #else levelTickEventQueue->sendEvent(levels[i]); #endif - PIXEndNamedEvent(); + } } } if (bFirst) { - PIXBeginNamedEvent(0, "Particle tick"); - if (!pause) particleEngine->tick(); - PIXEndNamedEvent(); + if (!pause) particleEngine->tick(); + } // 4J Stu - Keep ticking the connections if paused so that they don't diff --git a/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/ClientConnection.cpp b/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/ClientConnection.cpp index 15742c070..45d996f5a 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/ClientConnection.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/ClientConnection.cpp @@ -990,8 +990,7 @@ void ClientConnection::handleChunkTilesUpdate( MultiPlayerLevel* dimensionLevel = (MultiPlayerLevel*)minecraft->levels[packet->levelIdx]; if (dimensionLevel) { - PIXBeginNamedEvent(0, "Handle chunk tiles update"); - LevelChunk* lc = dimensionLevel->getChunk(packet->xc, packet->zc); + LevelChunk* lc = dimensionLevel->getChunk(packet->xc, packet->zc); int xo = packet->xc * 16; int zo = packet->zc * 16; // 4J Stu - Unshare before we make any changes incase the server is @@ -1012,9 +1011,8 @@ void ClientConnection::handleChunkTilesUpdate( // If this is going to actually change a tile, we'll need to unshare int prevTile = lc->getTile(x, y, z); if ((tile != prevTile && !forcedUnshare)) { - PIXBeginNamedEvent(0, "Chunk data unsharing\n"); - dimensionLevel->unshareChunkAt(xo, zo); - PIXEndNamedEvent(); + dimensionLevel->unshareChunkAt(xo, zo); + forcedUnshare = true; } @@ -1058,13 +1056,12 @@ void ClientConnection::handleChunkTilesUpdate( dimensionLevel->removeUnusedTileEntitiesInRegion( xo + x, y, zo + z, xo + x + 1, y + 1, zo + z + 1); } - PIXBeginNamedEvent(0, "Chunk data sharing\n"); - dimensionLevel->shareChunkAt(xo, + dimensionLevel->shareChunkAt(xo, zo); // 4J - added - only shares if chunks // are same on server & client - PIXEndNamedEvent(); + - PIXEndNamedEvent(); + } } @@ -1074,37 +1071,32 @@ void ClientConnection::handleBlockRegionUpdate( MultiPlayerLevel* dimensionLevel = (MultiPlayerLevel*)minecraft->levels[packet->levelIdx]; if (dimensionLevel) { - PIXBeginNamedEvent(0, "Handle block region update"); - + int y1 = packet->y + packet->ys; if (packet->bIsFullChunk) { y1 = Level::maxBuildHeight; if (packet->buffer.size() > 0) { - PIXBeginNamedEvent(0, "Reordering to XZY"); - LevelChunk::reorderBlocksAndDataToXZY(packet->y, packet->xs, + LevelChunk::reorderBlocksAndDataToXZY(packet->y, packet->xs, packet->ys, packet->zs, &packet->buffer); - PIXEndNamedEvent(); + } } - PIXBeginNamedEvent(0, "Clear rest region"); - dimensionLevel->clearResetRegion(packet->x, packet->y, packet->z, + dimensionLevel->clearResetRegion(packet->x, packet->y, packet->z, packet->x + packet->xs - 1, y1 - 1, packet->z + packet->zs - 1); - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "setBlocksAndData"); - // Only full chunks send lighting information now - added flag to end of + // Only full chunks send lighting information now - added flag to end of // this call dimensionLevel->setBlocksAndData(packet->x, packet->y, packet->z, packet->xs, packet->ys, packet->zs, packet->buffer, packet->bIsFullChunk); - PIXEndNamedEvent(); + // OutputDebugString("END BRU\n"); - PIXBeginNamedEvent(0, "removeUnusedTileEntitiesInRegion"); - // 4J - remove any tite entities in this region which are associated + // 4J - remove any tite entities in this region which are associated // with a tile that is now no longer a tile entity. Without doing this // we end up with stray tile entities kicking round, which leads to a // bug where chests can't be properly placed again in a location after @@ -1112,19 +1104,18 @@ void ClientConnection::handleBlockRegionUpdate( dimensionLevel->removeUnusedTileEntitiesInRegion( packet->x, packet->y, packet->z, packet->x + packet->xs, y1, packet->z + packet->zs); - PIXEndNamedEvent(); + // If this is a full packet for a chunk, make sure that the cache now // considers that it has data for this chunk - this is used to determine // whether to bother rendering mobs or not, so we don't have them in // crazy positions before the data is there if (packet->bIsFullChunk) { - PIXBeginNamedEvent(0, "dateReceivedForChunk"); - dimensionLevel->dataReceivedForChunk(packet->x >> 4, + dimensionLevel->dataReceivedForChunk(packet->x >> 4, packet->z >> 4); - PIXEndNamedEvent(); + } - PIXEndNamedEvent(); + } } @@ -1144,8 +1135,7 @@ void ClientConnection::handleTileUpdate( MultiPlayerLevel* dimensionLevel = (MultiPlayerLevel*)minecraft->levels[packet->levelIdx]; if (dimensionLevel) { - PIXBeginNamedEvent(0, "Handle tile update"); - + if (g_NetworkManager.IsHost()) { // 4J Stu - Unshare before we make any changes incase the server is // already another step ahead of us Fix for #7904 - Gameplay: @@ -1157,9 +1147,8 @@ void ClientConnection::handleTileUpdate( int prevData = dimensionLevel->getData(packet->x, packet->y, packet->z); if (packet->block != prevTile || packet->data != prevData) { - PIXBeginNamedEvent(0, "Chunk data unsharing\n"); - dimensionLevel->unshareChunkAt(packet->x, packet->z); - PIXEndNamedEvent(); + dimensionLevel->unshareChunkAt(packet->x, packet->z); + } } @@ -1172,11 +1161,10 @@ void ClientConnection::handleTileUpdate( dimensionLevel, packet->x, packet->y, packet->z); } - PIXBeginNamedEvent(0, "Setting data\n"); - bool tileWasSet = dimensionLevel->doSetTileAndData( + bool tileWasSet = dimensionLevel->doSetTileAndData( packet->x, packet->y, packet->z, packet->block, packet->data); - PIXEndNamedEvent(); + // 4J - remove any tite entities in this region which are associated // with a tile that is now no longer a tile entity. Without doing this @@ -1187,13 +1175,12 @@ void ClientConnection::handleTileUpdate( packet->x, packet->y, packet->z, packet->x + 1, packet->y + 1, packet->z + 1); - PIXBeginNamedEvent(0, "Sharing data\n"); - dimensionLevel->shareChunkAt( + dimensionLevel->shareChunkAt( packet->x, packet->z); // 4J - added - only shares if chunks are // same on server & client - PIXEndNamedEvent(); + - PIXEndNamedEvent(); + } } @@ -2451,11 +2438,9 @@ void ClientConnection::handleRespawn(std::shared_ptr packet) { void ClientConnection::handleExplosion(std::shared_ptr packet) { if (!packet->m_bKnockbackOnly) { // app.DebugPrintf("Received ExplodePacket with explosion data\n"); - PIXBeginNamedEvent(0, "Handling explosion"); - Explosion* e = new Explosion(minecraft->level, nullptr, packet->x, + Explosion* e = new Explosion(minecraft->level, nullptr, packet->x, packet->y, packet->z, packet->r); - PIXBeginNamedEvent(0, "Finalizing"); - + // Fix for #81758 - TCR 006 BAS Non-Interactive Pause: TU9: Performance: // Gameplay: After detonating bunch of TNT, game enters unresponsive // state for couple of seconds. The changes we are making here have been @@ -2468,8 +2453,8 @@ void ClientConnection::handleExplosion(std::shared_ptr packet) { // rather than copying around e->finalizeExplosion(true, &packet->toBlow); mpLevel->enableResetChanges(true); - PIXEndNamedEvent(); - PIXEndNamedEvent(); + + delete e; } else { // app.DebugPrintf("Received ExplodePacket with knockback only data\n"); @@ -2848,10 +2833,9 @@ void ClientConnection::handleContainerClose( void ClientConnection::handleTileEvent( std::shared_ptr packet) { - PIXBeginNamedEvent(0, "Handle tile event\n"); - minecraft->level->tileEvent(packet->x, packet->y, packet->z, packet->tile, + minecraft->level->tileEvent(packet->x, packet->y, packet->z, packet->tile, packet->b0, packet->b1); - PIXEndNamedEvent(); + } void ClientConnection::handleTileDestruction( diff --git a/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLevel.cpp b/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLevel.cpp index 44e7ad138..1cd143b0e 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLevel.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLevel.cpp @@ -114,8 +114,7 @@ void MultiPlayerLevel::shareChunkAt(int x, int z) { } void MultiPlayerLevel::tick() { - PIXBeginNamedEvent(0, "Sky color changing"); - setGameTime(getGameTime() + 1); + setGameTime(getGameTime() + 1); if (getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)) { // 4J: Debug setting added to keep it at day time #if !defined(_FINAL_BUILD) @@ -139,10 +138,9 @@ void MultiPlayerLevel::tick() { listeners[i]->skyColorChanged(); } }*/ - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Entity re-entry"); - { + { std::lock_guard lock(m_entitiesCS); for (int i = 0; i < 10 && !reEntries.empty(); i++) { std::shared_ptr e = *(reEntries.begin()); @@ -151,20 +149,18 @@ void MultiPlayerLevel::tick() { addEntity(e); } } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Connection ticking"); - // 4J HEG - Copy the connections vector to prevent crash when moving to + // 4J HEG - Copy the connections vector to prevent crash when moving to // Nether std::vector connectionsTemp = connections; for (auto connection = connectionsTemp.begin(); connection < connectionsTemp.end(); ++connection) { (*connection)->tick(); } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Updating resets"); - unsigned int lastIndexToRemove = 0; + unsigned int lastIndexToRemove = 0; bool eraseElements = false; for (unsigned int i = 0; i < updatesToReset.size(); i++) { ResetInfo& r = updatesToReset[i]; @@ -187,7 +183,7 @@ void MultiPlayerLevel::tick() { updatesToReset.erase(updatesToReset.begin(), updatesToReset.begin() + lastIndexToRemove); } - PIXEndNamedEvent(); + chunkCache->tick(); tickTiles(); @@ -411,13 +407,10 @@ void MultiPlayerLevel::tickTiles() { // resets in buildAndPrepareChunksToPoll rather than // the calling functions - PIXBeginNamedEvent(0, "Ticking tiles (multiplayer)"); - PIXBeginNamedEvent(0, "buildAndPrepareChunksToPoll"); - Level::tickTiles(); - PIXEndNamedEvent(); + Level::tickTiles(); + - PIXBeginNamedEvent(0, "Ticking client side tiles"); - auto itEndCtp = chunksToPoll.end(); + auto itEndCtp = chunksToPoll.end(); for (auto it = chunksToPoll.begin(); it != itEndCtp; it++) { ChunkPos cp = *it; int xo = cp.x * 16; @@ -427,8 +420,8 @@ void MultiPlayerLevel::tickTiles() { tickClientSideTiles(xo, zo, lc); } - PIXEndNamedEvent(); - PIXEndNamedEvent(); + + } void MultiPlayerLevel::setChunkVisible(int x, int z, bool visible) { @@ -917,11 +910,10 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection* c, } void MultiPlayerLevel::tickAllConnections() { - PIXBeginNamedEvent(0, "Connection ticking"); - for (auto it = connections.begin(); it < connections.end(); ++it) { + for (auto it = connections.begin(); it < connections.end(); ++it) { (*it)->tick(); } - PIXEndNamedEvent(); + } void MultiPlayerLevel::dataReceivedForChunk(int x, int z) { diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/Chunk.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/Chunk.cpp index b59e635a9..6e06a4113 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/Chunk.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/Chunk.cpp @@ -187,7 +187,6 @@ void Chunk::setPos(int x, int y, int z) { // itself have been made dirty. levelRenderer->setGlobalChunkFlag(x, y, z, level, LevelRenderer::CHUNK_FLAG_DIRTY); - PIXSetMarkerDeprecated(0, "Non-stack event pushed"); } } } @@ -221,11 +220,9 @@ void Chunk::makeCopyForRebuild(Chunk* source) { } void Chunk::rebuild() { - PIXBeginNamedEvent(0, "Rebuilding chunk %d, %d, %d", x, y, z); - + // if (!dirty) return; - PIXBeginNamedEvent(0, "Rebuild section A"); - + #if defined(_LARGE_WORLDS) Tesselator* t = Tesselator::getInstance(); #else @@ -258,10 +255,9 @@ void Chunk::rebuild() { 2; lists += levelRenderer->chunkLists; - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Rebuild section B"); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 4J - optimisation begins. // Get the data for the level chunk that this render chunk is it (level @@ -406,7 +402,7 @@ void Chunk::rebuild() { } } } - PIXEndNamedEvent(); + // Nothing at all to do for this chunk? if (empty) { // 4J - added - clear any renderer data associated with this @@ -430,8 +426,7 @@ void Chunk::rebuild() { // 4J - optimisation ends //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - PIXBeginNamedEvent(0, "Rebuild section C"); - Tesselator::Bounds bounds; // 4J MGH - added + Tesselator::Bounds bounds; // 4J MGH - added { // this was the old default clip bounds for the chunk, set in // Chunk::setPos. @@ -549,9 +544,8 @@ void Chunk::rebuild() { delete tileRenderer; delete region; - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Rebuild section D"); - + + // 4J - have rewritten the way that tile entities are stored globally to // make it work more easily with split screen. Chunks are now stored // globally in the levelrenderer, in a hashmap with a special key made up @@ -561,7 +555,7 @@ void Chunk::rebuild() { std::lock_guard lock(*globalRenderableTileEntities_cs); reconcileRenderableTileEntities(renderableTileEntities); } - PIXEndNamedEvent(); + // 4J - These removed items are now also removed from // globalRenderableTileEntities @@ -575,7 +569,7 @@ void Chunk::rebuild() { } levelRenderer->setGlobalChunkFlag(x, y, z, level, LevelRenderer::CHUNK_FLAG_COMPILED); - PIXEndNamedEvent(); + return; } diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/GameRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/GameRenderer.cpp index a88a47af2..363782d7b 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/GameRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/GameRenderer.cpp @@ -252,9 +252,8 @@ void GameRenderer::tick(bool first) // 4J - add bFirst itemInHandRenderer->tick(); - PIXBeginNamedEvent(0, "Rain tick"); - tickRain(); - PIXEndNamedEvent(); + tickRain(); + darkenWorldAmountO = darkenWorldAmount; if (BossMobGuiInfo::darkenWorld) { @@ -767,9 +766,8 @@ void GameRenderer::renderItemInHand(float a, int eye) { !mc->cameraTargetPlayer->isSleeping()) { if (!mc->options->hideGui && !mc->gameMode->isCutScene()) { turnOnLightLayer(a, true); - PIXBeginNamedEvent(0, "Item in hand render"); - itemInHandRenderer->render(a); - PIXEndNamedEvent(); + itemInHandRenderer->render(a); + turnOffLightLayer(a); } } @@ -1119,9 +1117,6 @@ int GameRenderer::runUpdate(void* lpParam) { m_updateEvents->set(eUpdateCanRun); - // PIXBeginNamedEvent(0,"Updating dirty chunks - //%d",(count++)&7); - // Update chunks atomically until there aren't any very near ones left - // they will be deferred for rendering until the call to // CBuffDeferredModeEnd if we have anything near to render here Now @@ -1168,7 +1163,7 @@ int GameRenderer::runUpdate(void* lpParam) { m_deleteStackSparseDataStorage.clear(); } - // PIXEndNamedEvent(); + // m_updateEvents->set(eUpdateEventIsFinished); } @@ -1281,8 +1276,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { GL11::glShadeModel(GL11::GL_SMOOTH); } - PIXBeginNamedEvent(0, "Culling"); - // Culler *frustum = new FrustumCuller(); + // Culler *frustum = new FrustumCuller(); FrustumCuller frustObj; Culler* frustum = &frustObj; frustum->prepare(xOff, yOff, zOff); @@ -1291,19 +1285,16 @@ void GameRenderer::renderLevel(float a, int64_t until) { FRAME_PROFILE_SCOPE(ChunkCull); mc->levelRenderer->cull(frustum, a); } - PIXEndNamedEvent(); + #if !defined(MULTITHREAD_ENABLE) if ((i == 0) && updateChunks) // 4J - added updateChunks condition { int PIXPass = 0; - PIXBeginNamedEvent(0, "Updating dirty chunks"); - do { - PIXBeginNamedEvent(0, "Updating dirty chunks pass %d", - PIXPass++); + do { bool retval = mc->levelRenderer->updateDirtyChunks(cameraEntity, false); - PIXEndNamedEvent(); + if (retval) break; if (until == 0) break; @@ -1312,7 +1303,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { if (diff < 0) break; if (diff > 1000000000) break; } while (true); - PIXEndNamedEvent(); + } #endif @@ -1330,16 +1321,14 @@ void GameRenderer::renderLevel(float a, int64_t until) { mc->textures->bindTexture( &TextureAtlas::LOCATION_BLOCKS); // 4J was L"/terrain.png" Lighting::turnOff(); - PIXBeginNamedEvent(0, "Level render"); - levelRenderer->render(cameraEntity, 0, a, updateChunks); - PIXEndNamedEvent(); + levelRenderer->render(cameraEntity, 0, a, updateChunks); + GL11::glShadeModel(GL11::GL_FLAT); if (cameraFlip == 0) { Lighting::turnOn(); - PIXBeginNamedEvent(0, "Entity render"); - // 4J - for entities, don't include the "a" factor that interpolates + // 4J - for entities, don't include the "a" factor that interpolates // from the old to new position, as the AABBs for the entities are // already fully at the new position This fixes flickering // minecarts, and pigs that you are riding on @@ -1358,9 +1347,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { FRAME_PROFILE_SCOPE(Entity); levelRenderer->renderEntities(&cameraPos, frustum, a); } - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Particle render"); - turnOnLightLayer(a); // 4J - brought forward from 1.8.2 + + turnOnLightLayer(a); // 4J - brought forward from 1.8.2 { FRAME_PROFILE_SCOPE(Particle); particleEngine->renderLit(cameraEntity, a, @@ -1373,7 +1361,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { particleEngine->render(cameraEntity, a, ParticleEngine::OPAQUE_LIST); } - PIXEndNamedEvent(); + turnOffLightLayer(a); // 4J - brought forward from 1.8.2 if ((mc->hitResult != nullptr) && @@ -1411,33 +1399,29 @@ void GameRenderer::renderLevel(float a, int64_t until) { } glBlendFunc(GL_ZERO, GL_ONE); - PIXBeginNamedEvent(0, "Fancy second pass - writing z"); - int visibleWaterChunks = + int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a, updateChunks); - PIXEndNamedEvent(); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if (visibleWaterChunks > 0) { - PIXBeginNamedEvent(0, "Fancy second pass - actual rendering"); - levelRenderer->render( + levelRenderer->render( cameraEntity, 1, a, updateChunks); // 4J - chanaged, used to be // renderSameAsLast but we don't support // that anymore - PIXEndNamedEvent(); + } GL11::glShadeModel(GL11::GL_FLAT); } else { - PIXBeginNamedEvent(0, "Second pass level render"); - levelRenderer->render(cameraEntity, 1, a, updateChunks); - PIXEndNamedEvent(); + levelRenderer->render(cameraEntity, 1, a, updateChunks); + } // 4J - added - have split out translucent particle rendering so that it // happens after the water is rendered, primarily for fireworks - PIXBeginNamedEvent(0, "Particle render (translucent)"); - Lighting::turnOn(); + Lighting::turnOn(); turnOnLightLayer(a); // 4J - brought forward from 1.8.2 { FRAME_PROFILE_SCOPE(Particle); @@ -1451,7 +1435,7 @@ void GameRenderer::renderLevel(float a, int64_t until) { particleEngine->render(cameraEntity, a, ParticleEngine::TRANSLUCENT_LIST); } - PIXEndNamedEvent(); + turnOffLightLayer(a); // 4J - brought forward from 1.8.2 ////////////////////////// End of 4J added section @@ -1473,9 +1457,8 @@ void GameRenderer::renderLevel(float a, int64_t until) { } /* 4J - moved rain rendering to after clouds so that it alpha blends - onto them properly PIXBeginNamedEvent(0,"Rendering snow and rain"); - renderSnowAndRain(a); - PIXEndNamedEvent(); + onto them properly renderSnowAndRain(a); + glDisable(GL_FOG); */ @@ -1498,12 +1481,11 @@ void GameRenderer::renderLevel(float a, int64_t until) { // blend properly onto them setupFog(0, a); glEnable(GL_FOG); - PIXBeginNamedEvent(0, "Rendering snow and rain"); - { + { FRAME_PROFILE_SCOPE(WeatherSky); renderSnowAndRain(a); } - PIXEndNamedEvent(); + glDisable(GL_FOG); if (zoom == 1) { @@ -1524,9 +1506,8 @@ void GameRenderer::prepareAndRenderClouds(LevelRenderer* levelRenderer, glPushMatrix(); setupFog(0, a); glEnable(GL_FOG); - PIXBeginNamedEvent(0, "Rendering clouds"); - levelRenderer->renderClouds(a); - PIXEndNamedEvent(); + levelRenderer->renderClouds(a); + glDisable(GL_FOG); setupFog(1, a); glPopMatrix(); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/ItemInHandRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/ItemInHandRenderer.cpp index f366e9eec..53b6e693e 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -595,11 +595,10 @@ void ItemInHandRenderer::render(float a) { std::shared_ptr data = Item::map->getSavedData(item, minecraft->level); - PIXBeginNamedEvent(0, "Minimap render"); - if (data != nullptr) + if (data != nullptr) minimap->render(minecraft->player, minecraft->textures, data, minecraft->player->entityId); - PIXEndNamedEvent(); + glPopMatrix(); } else if (item != nullptr) { diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/LevelRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/LevelRenderer.cpp index af22fe7f4..1b59c0a35 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/LevelRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/LevelRenderer.cpp @@ -1749,8 +1749,6 @@ bool LevelRenderer::updateDirtyChunks() { } throttle++; */ - PIXAddNamedCounter(((float)memAlloc) / (1024.0f * 1024.0f), - "Command buffer allocations"); bool onlyRebuild = (memAlloc >= MAX_COMMANDBUFFER_ALLOCATIONS); // Move any dirty chunks stored in the lock free stack into global flags @@ -1800,8 +1798,7 @@ bool LevelRenderer::updateDirtyChunks() { // chunk(s) if (dirtyChunkPresent) { lastDirtyChunkFound = System::currentTimeMillis(); - PIXBeginNamedEvent(0, "Finding nearest chunk\n"); - + // Find nearest chunk that is dirty for (int p = 0; p < XUSER_MAX_COUNT; p++) { // It's possible that the localplayers member can be set to @@ -1937,7 +1934,7 @@ bool LevelRenderer::updateDirtyChunks() { } // app.DebugPrintf("[%d,%d,%d]\n",nearestClipChunks.empty(),considered,wouldBeNearButEmpty); } - PIXEndNamedEvent(); + } } @@ -2019,7 +2016,7 @@ bool LevelRenderer::updateDirtyChunks() { // totalTime += (endTime - startTime); // countTime++; // printf("%d : %f\n", countTime, (float)totalTime - /// (float)countTime); PIXEndNamedEvent(); + /// (float)countTime); } // 4J Stu - Ignore this path when in constrained mode on Xbox One else { @@ -2038,8 +2035,6 @@ bool LevelRenderer::updateDirtyChunks() { #else if (nearChunk) { chunk = nearChunk->chunk; - PIXBeginNamedEvent(0, "Rebuilding near chunk %d %d %d", chunk->x, - chunk->y, chunk->z); static Chunk permaChunk; { FRAME_PROFILE_SCOPE(ChunkRebuildSchedule); @@ -2078,7 +2073,7 @@ bool LevelRenderer::updateDirtyChunks() { // countTime++; // printf("%d : %f\n", countTime, (float)totalTime / //(float)countTime); - PIXEndNamedEvent(); + } #endif else { @@ -2397,8 +2392,6 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, (int*)(intptr_t)(uintptr_t)(index + 2)); #endif - PIXSetMarkerDeprecated(0, "Setting chunk %d %d %d dirty", - x * 16, y * 16, z * 16); } // setGlobalChunkFlag(x * 16, y * // 16, z * 16, level, CHUNK_FLAG_DIRTY); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemRenderer.cpp index d0092b98d..221b804eb 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemRenderer.cpp @@ -362,8 +362,7 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures, if (item->getIconType() == Icon::TYPE_TERRAIN && TileRenderer::canRender(Tile::tiles[itemId]->getRenderShape())) { - PIXBeginNamedEvent(0, "3D gui item render %d\n", itemId); - textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS); + textures->bindTexture(&TextureAtlas::LOCATION_BLOCKS); Tile* tile = Tile::tiles[itemId]; glPushMatrix(); @@ -385,10 +384,9 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures, tileRenderer->renderTile(tile, itemAuxValue, 1, fAlpha, useCompiled); glPopMatrix(); - PIXEndNamedEvent(); + } else if (Item::items[itemId]->hasMultipleSpriteLayers()) { - PIXBeginNamedEvent(0, "Potion gui item render %d\n", itemIcon); - // special double-layered + // special double-layered glDisable(GL_LIGHTING); ResourceLocation* location = getTextureLocation(item->getIconType()); @@ -412,10 +410,9 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures, } } glEnable(GL_LIGHTING); - PIXEndNamedEvent(); + } else { - PIXBeginNamedEvent(0, "2D gui item render %d\n", itemIcon); - glDisable(GL_LIGHTING); + glDisable(GL_LIGHTING); if (item->getIconType() == Icon::TYPE_TERRAIN) { textures->bindTexture( &TextureAtlas::LOCATION_BLOCKS); // L"/terrain.png")); @@ -442,7 +439,7 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures, blit((int)x, (int)y, itemIcon, 16, 16); } glEnable(GL_LIGHTING); - PIXEndNamedEvent(); + } glEnable(GL_CULL_FACE); } diff --git a/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.cpp b/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.cpp index 881ad2d73..c851a9a4b 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.cpp @@ -255,10 +255,9 @@ int MinecraftServer::runPostUpdate(void* lpParam) { server->m_postProcessRequests.pop_back(); lock.unlock(); static int count = 0; - PIXBeginNamedEvent(0, "Post processing %d ", (count++) % 8); - request.chunkSource->postProcess(request.chunkSource, request.x, + request.chunkSource->postProcess(request.chunkSource, request.x, request.z); - PIXEndNamedEvent(); + } } std::this_thread::sleep_for(std::chrono::milliseconds(1)); @@ -583,12 +582,11 @@ bool MinecraftServer::loadLevel(LevelStorageSource* storageSource, // lastTime = now; } static int count = 0; - PIXBeginNamedEvent(0, "Creating %d ", (count++) % 8); - level->cache->create((spawnPos->x + x) >> 4, + level->cache->create((spawnPos->x + x) >> 4, (spawnPos->z + z) >> 4, true); // 4J - added parameter to // disable postprocessing here - PIXEndNamedEvent(); + // while (level->updateLights() && // running) // ; @@ -831,8 +829,7 @@ void MinecraftServer::saveGameRules() { } void MinecraftServer::Suspend() { - PIXBeginNamedEvent(0, "Suspending server"); - m_suspending = true; + m_suspending = true; // Get the frequency of the timer float fElapsedTime = 0.0f; // Save the start time @@ -862,7 +859,7 @@ void MinecraftServer::Suspend() { m_suspending = false; app.DebugPrintf("Suspend server: Elapsed time %f\n", fElapsedTime); - PIXEndNamedEvent(); + } bool MinecraftServer::IsSuspending() { return m_suspending; } @@ -1444,16 +1441,13 @@ void MinecraftServer::tick() { // #ifndef 0 static int64_t stc = 0; int64_t st0 = System::currentTimeMillis(); - PIXBeginNamedEvent(0, "Level tick %d", i); - ((Level*)level)->tick(); + ((Level*)level)->tick(); int64_t st1 = System::currentTimeMillis(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Update lights %d", i); - + + int64_t st2 = System::currentTimeMillis(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Entity tick %d", i); - // 4J added to stop ticking entities in levels when players are not + + // 4J added to stop ticking entities in levels when players are not // in those levels. Note: now changed so that we also tick if there // are entities to be removed, as this also happens as a result of // calling tickEntities. If we don't do this, then the entities get @@ -1466,11 +1460,10 @@ void MinecraftServer::tick() { (level->hasEntitiesToRemove())) { level->tickEntities(); } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Entity tracker tick"); - level->getTracker()->tick(); - PIXEndNamedEvent(); + level->getTracker()->tick(); + int64_t st3 = System::currentTimeMillis(); // printf(">>>>>>>>>>>>>>>>>>>>>> Tick %d %d %d : @@ -1481,12 +1474,10 @@ void MinecraftServer::tick() { } Entity::tickExtraWandering(); // 4J added - PIXBeginNamedEvent(0, "Connection tick"); - connection->tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Players tick"); - players->tick(); - PIXEndNamedEvent(); + connection->tick(); + + players->tick(); + // 4J - removed diff --git a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp index 87fa572ff..4fd9614a5 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerChunkCache.cpp @@ -544,8 +544,7 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) { if ((lc->terrainPopulated & LevelChunk::sTerrainPopulatedAllAffecting) == LevelChunk::sTerrainPopulatedAllAffecting) { // Do the compression of data & lighting at this point - PIXBeginNamedEvent(0, "Compressing lighting/blocks"); - + // Check, using lower blocks as a reference, if we've already compressed // - no point doing this multiple times, which otherwise we will do as // we aren't checking for the flags transitioning in the if statement @@ -554,7 +553,7 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) { if (!lc->isLowerBlockLightStorageCompressed()) lc->compressLighting(); if (!lc->isLowerDataStorageCompressed()) lc->compressData(); - PIXEndNamedEvent(); + } // Are all neighbouring chunks And this one now post-processed? @@ -564,16 +563,14 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) { // This would be a good time to fix up any lighting for this chunk since // all the geometry that could affect it should now be in place - PIXBeginNamedEvent(0, "Recheck gaps"); - if (lc->level->dimension->id != 1) { + if (lc->level->dimension->id != 1) { lc->recheckGaps(true); } - PIXEndNamedEvent(); + // Do a checkLight on any tiles which are lava. - PIXBeginNamedEvent(0, "Light lava (this)"); - lc->lightLava(); - PIXEndNamedEvent(); + lc->lightLava(); + // Flag as now having this post-post-processing stage completed lc->terrainPopulated |= LevelChunk::sTerrainPostPostProcessed; @@ -585,9 +582,8 @@ void ServerChunkCache::postProcess(ChunkSource* parent, int x, int z) { if ((chunk->terrainPopulated & LevelChunk::sTerrainPopulatedFromHere) == 0) { if (source != nullptr) { - PIXBeginNamedEvent(0, "Main post processing"); - source->postProcess(parent, x, z); - PIXEndNamedEvent(); + source->postProcess(parent, x, z); + chunk->markUnsaved(); } @@ -650,23 +646,20 @@ void ServerChunkCache::postProcess(ChunkSource* parent, int x, int z) { // 4J Added for suspend bool ServerChunkCache::saveAllEntities() { - PIXBeginNamedEvent(0, "Save all entities"); - - PIXBeginNamedEvent(0, "saving to NBT"); - { + + { std::lock_guard lock(m_csLoadCreate); for (auto it = m_loadedChunkList.begin(); it != m_loadedChunkList.end(); ++it) { storage->saveEntities(level, *it); } } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Flushing"); - storage->flush(); - PIXEndNamedEvent(); + storage->flush(); + - PIXEndNamedEvent(); + return true; } @@ -871,19 +864,16 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) { // app.DebugPrintf("Save thread has started\n"); while (params->chunkToSave != nullptr) { - PIXBeginNamedEvent(0, "Saving entities"); - // app.DebugPrintf("Save thread has started processing a chunk\n"); + // app.DebugPrintf("Save thread has started processing a chunk\n"); if (params->saveEntities) params->cache->saveEntities(params->chunkToSave); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Saving chunk"); - + + params->cache->save(params->chunkToSave); params->chunkToSave->setUnsaved(false); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Notifying and waiting for next chunk"); - + + // Inform the producer thread that we are done with this chunk params->notificationEvent ->set(); // SetEvent(params->notificationEvent); @@ -895,7 +885,7 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) { params->wakeEvent->waitForSignal( C4JThread:: kInfiniteTimeout); // WaitForSingleObject(params->wakeEvent,INFINITE); - PIXEndNamedEvent(); + } // app.DebugPrintf("Thread is exiting as it has no chunk to process\n"); diff --git a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.cpp b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.cpp index 4e28032ea..d5dd127ad 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.cpp @@ -238,8 +238,7 @@ void ServerLevel::tick() { awakenAllPlayers(); } - PIXBeginNamedEvent(0, "Mob spawner tick"); - // for Minecraft 1.8, spawn friendlies really rarely - 4J - altered + // for Minecraft 1.8, spawn friendlies really rarely - 4J - altered // from once every 400 ticks to 40 ticks as we depend on this a more than // the original since we don't have chunk post-process spawning if (getGameRules()->getBoolean(GameRules::RULE_DOMOBSPAWNING)) { @@ -262,10 +261,9 @@ void ServerLevel::tick() { mobSpawner->tick(this, finalSpawnEnemies, finalSpawnFriendlies, finalSpawnPersistent); } - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Chunk source tick"); - chunkSource->tick(); - PIXEndNamedEvent(); + + chunkSource->tick(); + int newDark = getOldSkyDarken(1); if (newDark != skyDarken) { skyDarken = newDark; @@ -293,9 +291,8 @@ void ServerLevel::tick() { #endif { // app.DebugPrintf("Incremental save\n"); - PIXBeginNamedEvent(0, "Incremental save"); - save(false, nullptr); - PIXEndNamedEvent(); + save(false, nullptr); + } // 4J : WESTY : Changed so that time update goes through stats tracking @@ -316,30 +313,25 @@ void ServerLevel::tick() { } } - PIXBeginNamedEvent(0, "Tick pending ticks"); - // if (tickCount % 5 == 0) { + // if (tickCount % 5 == 0) { tickPendingTicks(false); - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Tick tiles"); - tickTiles(); - PIXEndNamedEvent(); + tickTiles(); + chunkMap->tick(); - PIXBeginNamedEvent(0, "Tick villages"); - villages->tick(); + villages->tick(); villageSiege->tick(); - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Tick portal forcer"); - portalForcer->tick(getGameTime()); - PIXEndNamedEvent(); + portalForcer->tick(getGameTime()); + // repeat after tile ticks - PIXBeginNamedEvent(0, "runTileEvents"); - runTileEvents(); - PIXEndNamedEvent(); + runTileEvents(); + // 4J Added runQueuedSendTileUpdates(); @@ -936,9 +928,8 @@ void ServerLevel::save(bool force, ProgressListener* progressListener, progressListener->progressStartNoAbort(IDS_PROGRESS_SAVING_LEVEL); } } - PIXBeginNamedEvent(0, "Saving level data"); - saveLevelData(); - PIXEndNamedEvent(); + saveLevelData(); + if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS); @@ -1425,8 +1416,7 @@ int ServerLevel::runUpdate(void* lpParam) { if (!ShutdownManager::ShouldRun(ShutdownManager::eRunUpdateThread)) break; - PIXBeginNamedEvent(0, "Updating tiles to be ticked"); - // 4J Stu - Grass and Lava ticks currently take up the majority of all + // 4J Stu - Grass and Lava ticks currently take up the majority of all // tile updates, so I am limiting them int grassTicks = 0; int lavaTicks = 0; @@ -1522,7 +1512,7 @@ int ServerLevel::runUpdate(void* lpParam) { } } } - PIXEndNamedEvent(); + } ShutdownManager::HasFinished(ShutdownManager::eRunUpdateThread); diff --git a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.cpp b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.cpp index 78710bb81..346722b27 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.cpp @@ -437,8 +437,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { connection->getNetworkPlayer(), flagIndex)) { // app.DebugPrintf("Creating // BRUP for %d %d\n",nearest.x, nearest.z); - PIXBeginNamedEvent(0, "Creation BRUP for sending\n"); - int64_t before = System::currentTimeMillis(); + int64_t before = System::currentTimeMillis(); std::shared_ptr packet = std::shared_ptr( new BlockRegionUpdatePacket( @@ -447,7 +446,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { int64_t after = System::currentTimeMillis(); // app.DebugPrintf(">>><<< //%d ms\n",after-before); - PIXEndNamedEvent(); + if (dontDelayChunks) packet->shouldDelay = false; if (packet->shouldDelay == true) { diff --git a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index ddc2eb2cf..69918be42 100644 --- a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -597,8 +597,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { compLength = 0; // Pre-calculate the buffer size required for the compressed data - PIXBeginNamedEvent(0, "Pre-calc save compression"); - // Save the start time + // Save the start time const auto startTime = std::chrono::steady_clock::now(); Compression::getCompression()->Compress(nullptr, &compLength, pvSaveMem, fileSize); @@ -607,7 +606,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { .count(); app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime); - PIXEndNamedEvent(); + // We add 4 bytes to the start so that we can signal compressed data // And another 4 bytes to store the decompressed data size @@ -619,8 +618,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { if (compData != nullptr) { // Re-compress all save data before we save it to disk - PIXBeginNamedEvent(0, "Actual save compression"); - // Save the start time + // Save the start time const auto startTime = std::chrono::steady_clock::now(); Compression::getCompression()->Compress(compData + 8, &compLength, pvSaveMem, fileSize); @@ -629,7 +627,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail) { .count(); app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime); - PIXEndNamedEvent(); + std::fill_n(compData, 8, std::uint8_t{0}); int saveVer = 0; diff --git a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 332c8bf1c..e6f703651 100644 --- a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -688,9 +688,8 @@ void ConsoleSaveFileSplit::PrepareForWrite(FileEntry* file, // bytesToGrowBy = 1024; // Move all the data beyond us - PIXBeginNamedEvent(0, "Growing file by %d bytes", bytesToGrowBy); - MoveDataBeyond(file, bytesToGrowBy); - PIXEndNamedEvent(); + MoveDataBeyond(file, bytesToGrowBy); + // Update our length if (file->data.length < 0) file->data.length = 0; @@ -1313,8 +1312,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { compLength = 0; // Pre-calculate the buffer size required for the compressed data - PIXBeginNamedEvent(0, "Pre-calc save compression"); - // Save the start time + // Save the start time qwTime = PlatformTime::QueryPerformanceCounter(); Compression::getCompression()->Compress(nullptr, &compLength, pvSaveMem, fileSize); @@ -1323,7 +1321,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { fElapsedTime = static_cast(PlatformTime::ElapsedSeconds(qwTime, qwNewTime)); app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime); - PIXEndNamedEvent(); + // We add 4 bytes to the start so that we can signal compressed data // And another 4 bytes to store the decompressed data size @@ -1335,8 +1333,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { if (compData != nullptr) { // Re-compress all save data before we save it to disk - PIXBeginNamedEvent(0, "Actual save compression"); - // Save the start time + // Save the start time qwTime = PlatformTime::QueryPerformanceCounter(); Compression::getCompression()->Compress(compData + 8, &compLength, pvSaveMem, fileSize); @@ -1345,7 +1342,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) { fElapsedTime = static_cast(PlatformTime::ElapsedSeconds(qwTime, qwNewTime)); app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime); - PIXEndNamedEvent(); + memset(compData, 0, 8); int saveVer = 0; diff --git a/minecraft/Minecraft.World/Source Files/compression.cpp b/minecraft/Minecraft.World/Source Files/compression.cpp index 5e3377848..78d8be895 100644 --- a/minecraft/Minecraft.World/Source Files/compression.cpp +++ b/minecraft/Minecraft.World/Source Files/compression.cpp @@ -62,8 +62,7 @@ int32_t Compression::CompressLZXRLE(void* pDestination, unsigned int* pDestSize, // 0 - 254 - encodes a single byte // 255 followed by 0, 1, 2 - encodes a 1, 2, or 3 255s // 255 followed by 3-255, followed by a byte - encodes a run of n + 1 bytes - PIXBeginNamedEvent(0, "RLE compression"); - do { + do { unsigned char thisOne = *pucIn++; unsigned int count = 1; @@ -88,11 +87,10 @@ int32_t Compression::CompressLZXRLE(void* pDestination, unsigned int* pDestSize, } } while (pucIn != pucEnd); unsigned int rleSize = (unsigned int)(pucOut - rleCompressBuf); - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Secondary compression"); - Compress(pDestination, pDestSize, rleCompressBuf, rleSize); - PIXEndNamedEvent(); + Compress(pDestination, pDestSize, rleCompressBuf, rleSize); + // printf("Compressed from %d to %d to %d\n",SrcSize,rleSize,*pDestSize); return 0; @@ -114,8 +112,7 @@ int32_t Compression::CompressRLE(void* pDestination, unsigned int* pDestSize, // 255 followed by 0, 1, 2 - encodes a 1, 2, or 3 255s // 255 followed by 3-255, followed by a byte - encodes a run of n + 1 // bytes - PIXBeginNamedEvent(0, "RLE compression"); - do { + do { unsigned char thisOne = *pucIn++; unsigned int count = 1; @@ -140,7 +137,7 @@ int32_t Compression::CompressRLE(void* pDestination, unsigned int* pDestSize, } } while (pucIn != pucEnd); rleSize = (unsigned int)(pucOut - rleCompressBuf); - PIXEndNamedEvent(); + } // Return diff --git a/minecraft/Minecraft.World/net/minecraft/network/Connection.cpp b/minecraft/Minecraft.World/net/minecraft/network/Connection.cpp index e1ddcecf7..64e61b390 100644 --- a/minecraft/Minecraft.World/net/minecraft/network/Connection.cpp +++ b/minecraft/Minecraft.World/net/minecraft/network/Connection.cpp @@ -483,10 +483,8 @@ void Connection::tick() { // MGH - moved the packet handling outside of the incoming_cs block, as it // was locking up sometimes when disconnecting for (int i = 0; i < packetsToHandle.size(); i++) { - PIXBeginNamedEvent(0, "Handling packet %d\n", - packetsToHandle[i]->getId()); packetsToHandle[i]->handle(packetListener); - PIXEndNamedEvent(); + } flush(); diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/Entity.cpp b/minecraft/Minecraft.World/net/minecraft/world/entity/Entity.cpp index ac0316098..8eccd44fc 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/Entity.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/Entity.cpp @@ -145,8 +145,6 @@ void Entity::countFlagsForPIX() { } puiUsedFlags++; } - PIXAddNamedCounter(freecount, "Small Ids free"); - PIXAddNamedCounter(2048 - freecount, "Small Ids used"); } void Entity::resetSmallId() { diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/Mob.cpp b/minecraft/Minecraft.World/net/minecraft/world/entity/Mob.cpp index bac1b81e4..fd3a7362e 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/Mob.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/Mob.cpp @@ -422,43 +422,32 @@ void Mob::checkDespawn() { } void Mob::newServerAiStep() { - PIXBeginNamedEvent(0, "Tick target selector for %d", GetType()); - noActionTime++; - PIXBeginNamedEvent(0, "Check despawn"); - checkDespawn(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Tick sensing"); - sensing->tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Tick target selector"); - targetSelector.tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Tick goal selectors"); - goalSelector.tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Tick navigation"); - navigation->tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Tick server ai mob step"); - serverAiMobStep(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Tick move"); - moveControl->tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Tick look"); - lookControl->tick(); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Tick jump"); - jumpControl->tick(); - PIXEndNamedEvent(); + noActionTime++; + checkDespawn(); + + sensing->tick(); + + targetSelector.tick(); + + goalSelector.tick(); + + navigation->tick(); + + serverAiMobStep(); + + moveControl->tick(); + + lookControl->tick(); + + jumpControl->tick(); + // Consider this for extra strolling if it is protected against despawning. // We aren't interested in ones that aren't protected as the whole point of // this extra wandering is to potentially transition from protected to not // protected. - PIXBeginNamedEvent(0, "Consider extra wandering"); - considerForExtraWandering(isDespawnProtected()); - PIXEndNamedEvent(); - PIXEndNamedEvent(); + considerForExtraWandering(isDespawnProtected()); + + } void Mob::serverAiStep() { diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/Explosion.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/Explosion.cpp index c39045b5a..8716b0e3b 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/Explosion.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/Explosion.cpp @@ -202,8 +202,7 @@ void Explosion::finalizeExplosion( if (destroyBlocks) { // toBlowArray.addAll(toBlow); // TODO 4J Stu - Reverse iterator - PIXBeginNamedEvent(0, "Finalizing explosion size %d", toBlow.size()); - app.DebugPrintf("Finalizing explosion size %d\n", toBlow.size()); + app.DebugPrintf("Finalizing explosion size %d\n", toBlow.size()); static const int MAX_EXPLODE_PARTICLES = 50; // 4J - try and make at most MAX_EXPLODE_PARTICLES pairs of particles int fraction = (int)toBlowArray->size() / MAX_EXPLODE_PARTICLES; @@ -282,7 +281,7 @@ void Explosion::finalizeExplosion( } } - PIXEndNamedEvent(); + if (toBlowDirect == nullptr) delete toBlowArray; } diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp index b2d501216..41913b1b6 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp @@ -847,14 +847,9 @@ bool Level::setTileAndData(int x, int y, int z, int tile, int data, #endif result = c->setTileAndData(x & 15, y, z & 15, tile, data); if (updateFlags != Tile::UPDATE_INVISIBLE_NO_LIGHT) { -#if !defined(_CONTENT_PACKAGE) - PIXBeginNamedEvent(0, "Checking light %d %d %d", x, y, z); - PIXBeginNamedEvent(0, "was %d, %d now %d, %d", old, olddata, tile, - data); -#endif checkLight(x, y, z); - PIXEndNamedEvent(); - PIXEndNamedEvent(); + + } if (result) { if ((updateFlags & Tile::UPDATE_CLIENTS) != 0 && @@ -987,26 +982,22 @@ void Level::tileUpdated(int x, int y, int z, int tile) { } void Level::lightColumnChanged(int x, int z, int y0, int y1) { - PIXBeginNamedEvent(0, "LightColumnChanged (%d,%d) %d to %d", x, z, y0, y1); - if (y0 > y1) { + if (y0 > y1) { int tmp = y1; y1 = y0; y0 = tmp; } if (!dimension->hasCeiling) { - PIXBeginNamedEvent(0, "Checking lights"); - for (int y = y0; y <= y1; y++) { - PIXBeginNamedEvent(0, "Checking light %d", y); - checkLight(LightLayer::Sky, x, y, z); - PIXEndNamedEvent(); + for (int y = y0; y <= y1; y++) { + checkLight(LightLayer::Sky, x, y, z); + } - PIXEndNamedEvent(); + } - PIXBeginNamedEvent(0, "Setting tiles dirty"); - setTilesDirty(x, y0, z, x, y1, z); - PIXEndNamedEvent(); - PIXEndNamedEvent(); + setTilesDirty(x, y0, z, x, y1, z); + + } void Level::setTileDirty(int x, int y, int z) { @@ -2806,9 +2797,8 @@ void Level::setSpawnSettings(bool spawnEnemies, bool spawnFriendlies) { } void Level::tick() { - PIXBeginNamedEvent(0, "Weather tick"); - tickWeather(); - PIXEndNamedEvent(); + tickWeather(); + } void Level::prepareWeather() { @@ -3848,9 +3838,8 @@ void Level::setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, } if (forceUnshare) { int size = (x1 - x0) * (y1 - y0) * (z1 - z0); - PIXBeginNamedEvent(0, "Chunk data unsharing %d\n", size); - lc->stopSharingTilesAndData(); - PIXEndNamedEvent(); + lc->stopSharingTilesAndData(); + } if (p < data.size()) p = lc->setBlocksAndData(data, x0, y0, z0, x1, y1, z1, p, @@ -3858,11 +3847,10 @@ void Level::setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, setTilesDirty(xc * 16 + x0, y0, zc * 16 + z0, xc * 16 + x1, y1, zc * 16 + z1); - PIXBeginNamedEvent(0, "Chunk data sharing\n"); - if (g_NetworkManager.IsHost() && isClientSide) { + if (g_NetworkManager.IsHost() && isClientSide) { lc->startSharingTilesAndData(); } - PIXEndNamedEvent(); + } } } diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/biome/BiomeDecorator.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/biome/BiomeDecorator.cpp index 510450851..0270c5278 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/biome/BiomeDecorator.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/biome/BiomeDecorator.cpp @@ -88,12 +88,10 @@ void BiomeDecorator::_init() { } void BiomeDecorator::decorate() { - PIXBeginNamedEvent(0, "Decorate ores"); - decorateOres(); - PIXEndNamedEvent(); + decorateOres(); + - PIXBeginNamedEvent(0, "Decorate sand/clay/gravel"); - for (int i = 0; i < sandCount; i++) { + for (int i = 0; i < sandCount; i++) { int x = xo + random->nextInt(16) + 8; int z = zo + random->nextInt(16) + 8; sandFeature->place(level, random, x, level->getTopSolidBlock(x, z), z); @@ -110,10 +108,9 @@ void BiomeDecorator::decorate() { int z = zo + random->nextInt(16) + 8; sandFeature->place(level, random, x, level->getTopSolidBlock(x, z), z); } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Decorate forests"); - int forests = treeCount; + int forests = treeCount; if (random->nextInt(10) == 0) forests += 1; for (int i = 0; i < forests; i++) { @@ -124,10 +121,9 @@ void BiomeDecorator::decorate() { tree->place(level, random, x, level->getHeightmap(x, z), z); delete tree; } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Decorate mushrooms/flowers/grass"); - for (int i = 0; i < hugeMushrooms; i++) { + for (int i = 0; i < hugeMushrooms; i++) { int x = xo + random->nextInt(16) + 8; int z = zo + random->nextInt(16) + 8; hugeMushroomFeature->place(level, random, x, level->getHeightmap(x, z), @@ -158,10 +154,7 @@ void BiomeDecorator::decorate() { grassFeature->place(level, random, x, y, z); delete grassFeature; } - PIXEndNamedEvent(); - PIXBeginNamedEvent( - 0, "Decorate bush/waterlily/mushroom/reeds/pumpkins/cactuses"); - + // 4J Stu - For some reason this was created each time round in the loop // I assume there is a case where deadBushCount could be 0 DeadBushFeature* deadBushFeature = nullptr; @@ -245,9 +238,8 @@ void BiomeDecorator::decorate() { cactusFeature->place(level, random, x, y, z); } - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Decorate liquids"); - + + if (liquids) { // 4J Stu - For some reason this was created each time round in the loop SpringFeature* waterSpringFeature = new SpringFeature(Tile::water_Id); @@ -270,7 +262,7 @@ void BiomeDecorator::decorate() { } delete lavaSpringFeature; } - PIXEndNamedEvent(); + } void BiomeDecorator::decorate(int count, Feature* feature) { diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/biome/JungleBiome.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/biome/JungleBiome.cpp index 61c5be15d..0be15cecd 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/biome/JungleBiome.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/biome/JungleBiome.cpp @@ -58,8 +58,7 @@ Feature* JungleBiome::getGrassFeature(Random* random) { void JungleBiome::decorate(Level* level, Random* random, int xo, int zo) { Biome::decorate(level, random, xo, zo); - PIXBeginNamedEvent(0, "Adding vines"); - VinesFeature* vines = new VinesFeature(); + VinesFeature* vines = new VinesFeature(); for (int i = 0; i < 50; i++) { int x = xo + random->nextInt(16) + 8; @@ -67,5 +66,5 @@ void JungleBiome::decorate(Level* level, Random* random, int xo, int zo) { int z = zo + random->nextInt(16) + 8; vines->place(level, random, x, y, z); } - PIXEndNamedEvent(); + } \ No newline at end of file diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.cpp index 9871d36eb..49f9c4731 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/LevelChunk.cpp @@ -830,13 +830,12 @@ void LevelChunk::recalcHeight(int x, int yStart, int z) { } if (height < lowestHeightmap) lowestHeightmap = height; if (!level->dimension->hasCeiling) { - PIXBeginNamedEvent(0, "Light gaps"); - lightGap(xOffs - 1, zOffs, y1, y2); + lightGap(xOffs - 1, zOffs, y1, y2); lightGap(xOffs + 1, zOffs, y1, y2); lightGap(xOffs, zOffs - 1, y1, y2); lightGap(xOffs, zOffs + 1, y1, y2); lightGap(xOffs, zOffs, y1, y2); - PIXEndNamedEvent(); + } this->setUnsaved(true); @@ -895,9 +894,8 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) { if (old != 0 && !level->isClientSide) { Tile::tiles[old]->onRemoving(level, xOffs, y, zOffs, oldData); } - PIXBeginNamedEvent(0, "Chunk setting tile"); - blocks->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, tile); - PIXEndNamedEvent(); + blocks->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, tile); + if (old != 0) { if (!level->isClientSide) { Tile::tiles[old]->onRemove(level, xOffs, y, zOffs, old, oldData); @@ -905,9 +903,8 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) { level->removeTileEntity(xOffs, y, zOffs); } } - PIXBeginNamedEvent(0, "Chunk setting data"); - data->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, _data); - PIXEndNamedEvent(); + data->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, _data); + // 4J added - flag if something emissive is being added. This is used during // level creation to determine what chunks need extra lighting processing @@ -915,34 +912,30 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) { emissiveAdded = true; } - PIXBeginNamedEvent(0, "Updating lighting"); - // 4J - There isn't any point in recalculating heights or updating sky + // 4J - There isn't any point in recalculating heights or updating sky // lighting if this tile has the same light-blocking capabilities as the one // it is replacing if (Tile::lightBlock[tile & 0xff] != Tile::lightBlock[old & 0xff]) { if (!level->dimension->hasCeiling) { if (Tile::lightBlock[tile & 0xff] != 0) { if (y >= oldHeight) { - PIXBeginNamedEvent(0, "Recalc height 1"); - recalcHeight(x, y + 1, z); - PIXEndNamedEvent(); + recalcHeight(x, y + 1, z); + } } else { if (y == oldHeight - 1) { - PIXBeginNamedEvent(0, "Recalc height 2"); - recalcHeight(x, y, z); - PIXEndNamedEvent(); + recalcHeight(x, y, z); + } } } // level.updateLight(LightLayer.Carried, xOffs, y, zOffs, xOffs, y, // zOffs); - PIXBeginNamedEvent(0, "Lighting gaps"); - lightGaps(x, z); - PIXEndNamedEvent(); + lightGaps(x, z); + } - PIXEndNamedEvent(); + data->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, _data); if (_tile != 0) { if (!level->isClientSide) { @@ -1455,8 +1448,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter // 4J Stu - Save out entities to a cached format that won't // interfere with other systems m_unloadedEntitiesTag = new CompoundTag(); - PIXBeginNamedEvent(0, "Saving entities"); - ListTag* entityTags = new ListTag(); + ListTag* entityTags = new ListTag(); { std::lock_guard lock(m_csEntities); @@ -1478,10 +1470,9 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter } m_unloadedEntitiesTag->put(L"Entities", entityTags); - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Saving tile entities"); - ListTag* tileEntityTags = new ListTag(); + ListTag* tileEntityTags = new ListTag(); auto itEnd = tileEntities.end(); for (std::unordered_map, @@ -1497,7 +1488,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter tileEntities.clear(); m_unloadedEntitiesTag->put(L"TileEntities", tileEntityTags); - PIXEndNamedEvent(); + } } #endif diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 73e41eafe..702658d07 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -200,52 +200,45 @@ void McRegionChunkStorage::save(Level* level, LevelChunk* levelChunk) { // running saves on multiple threads these sections have a lot of // contention. Better to let each thread have its turn at a higher level of // granularity. - PIXBeginNamedEvent(0, "Getting output stream\n"); - DataOutputStream* output = RegionFileCache::getChunkDataOutputStream( + DataOutputStream* output = RegionFileCache::getChunkDataOutputStream( m_saveFile, m_prefix, levelChunk->x, levelChunk->z); - PIXEndNamedEvent(); + if (m_saveFile->getOriginalSaveVersion() >= SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) { - PIXBeginNamedEvent(0, "Writing chunk data"); - OldChunkStorage::save(levelChunk, level, output); - PIXEndNamedEvent(); + OldChunkStorage::save(levelChunk, level, output); + - PIXBeginNamedEvent(0, "Updating chunk queue"); - { + { std::lock_guard lock(cs_memory); s_chunkDataQueue.push_back(output); } - PIXEndNamedEvent(); + } else { CompoundTag* tag; { std::lock_guard lock(cs_memory); - PIXBeginNamedEvent(0, "Creating tags\n"); - tag = new CompoundTag(); + tag = new CompoundTag(); CompoundTag* levelData = new CompoundTag(); tag->put(L"Level", levelData); OldChunkStorage::save(levelChunk, level, levelData); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "NbtIo writing\n"); - NbtIo::write(tag, output); - PIXEndNamedEvent(); + + NbtIo::write(tag, output); + } - PIXBeginNamedEvent(0, "Output closing\n"); - output->close(); - PIXEndNamedEvent(); + output->close(); + // 4J Stu - getChunkDataOutputStream makes a new DataOutputStream that // points to a new ChunkBuffer( ByteArrayOutputStream ) We should clean // these up when we are done { std::lock_guard lock(cs_memory); - PIXBeginNamedEvent(0, "Cleaning up\n"); - output->deleteChildStream(); + output->deleteChildStream(); delete output; delete tag; } - PIXEndNamedEvent(); + } LevelData* levelInfo = level->getLevelData(); @@ -263,8 +256,7 @@ void McRegionChunkStorage::save(Level* level, LevelChunk* levelChunk) { void McRegionChunkStorage::saveEntities(Level* level, LevelChunk* levelChunk) { #if defined(SPLIT_SAVES) - PIXBeginNamedEvent(0, "Saving entities"); - // 4j added cast to unsigned and changed index to u + // 4j added cast to unsigned and changed index to u uint64_t index = ((uint64_t)(uint32_t)(levelChunk->x) << 32) | (((uint64_t)(uint32_t)(levelChunk->z))); @@ -289,7 +281,7 @@ void McRegionChunkStorage::saveEntities(Level* level, LevelChunk* levelChunk) { } } delete newTag; - PIXEndNamedEvent(); + #endif } @@ -314,24 +306,22 @@ void McRegionChunkStorage::tick() { m_saveFile->tick(); } void McRegionChunkStorage::flush() { #if defined(SPLIT_SAVES) - PIXBeginNamedEvent(0, "Flushing entity data"); - ConsoleSavePath currentFile = + ConsoleSavePath currentFile = ConsoleSavePath(m_prefix + std::wstring(L"entities.dat")); ConsoleSaveFileOutputStream fos = ConsoleSaveFileOutputStream(m_saveFile, currentFile); BufferedOutputStream bos(&fos, 1024 * 1024); DataOutputStream dos(&bos); - PIXBeginNamedEvent(0, "Writing to stream"); - dos.writeInt(m_entityData.size()); + dos.writeInt(m_entityData.size()); for (auto it = m_entityData.begin(); it != m_entityData.end(); ++it) { dos.writeLong(it->first); dos.write(it->second, 0, it->second.size()); } bos.flush(); - PIXEndNamedEvent(); - PIXEndNamedEvent(); + + #endif } @@ -381,12 +371,11 @@ int McRegionChunkStorage::runSaveThreadProc(void* lpParam) { lock.unlock(); if (dos) { - PIXBeginNamedEvent(0, "Saving chunk"); - // app.DebugPrintf("Compressing chunk data (%d left)\n", + // app.DebugPrintf("Compressing chunk data (%d left)\n", // lastQueueSize - 1); dos->close(); dos->deleteChildStream(); - PIXEndNamedEvent(); + } delete dos; dos = nullptr; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 66a1275ba..5695d09ea 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -244,31 +244,26 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, dos->writeLong(level->getGameTime()); dos->writeLong(lc->inhabitedTime); - PIXBeginNamedEvent(0, "Getting block data"); - lc->writeCompressedBlockData(dos); - PIXEndNamedEvent(); + lc->writeCompressedBlockData(dos); + - PIXBeginNamedEvent(0, "Getting data data"); - lc->writeCompressedDataData(dos); - PIXEndNamedEvent(); + lc->writeCompressedDataData(dos); + - PIXBeginNamedEvent(0, "Getting sky and block light data"); - lc->writeCompressedSkyLightData(dos); + lc->writeCompressedSkyLightData(dos); lc->writeCompressedBlockLightData(dos); - PIXEndNamedEvent(); + dos->write(lc->heightmap); dos->writeShort(lc->terrainPopulated); dos->write(lc->getBiomes()); - PIXBeginNamedEvent(0, "Saving entities"); - CompoundTag* tag = new CompoundTag(); + CompoundTag* tag = new CompoundTag(); #if !defined(SPLIT_SAVES) saveEntities(lc, level, tag); #endif - PIXBeginNamedEvent(0, "Saving tile entities"); - ListTag* tileEntityTags = new ListTag(); + ListTag* tileEntityTags = new ListTag(); auto itEnd = lc->tileEntities.end(); for (std::unordered_map, @@ -281,10 +276,9 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, tileEntityTags->add(teTag); } tag->put(L"TileEntities", tileEntityTags); - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Saving tile tick data"); - std::vector* ticksInChunk = + std::vector* ticksInChunk = level->fetchTicksInChunk(lc, false); if (ticksInChunk != nullptr) { int64_t levelTime = level->getGameTime(); @@ -304,11 +298,11 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, tag->put(L"TileTicks", tickTags); } delete ticksInChunk; - PIXEndNamedEvent(); + NbtIo::write(tag, dos); delete tag; - PIXEndNamedEvent(); + } void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) { @@ -331,26 +325,23 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) { // moved to TLS ThreadStorage* tls = m_tlsStorage; - PIXBeginNamedEvent(0, "Getting block data"); - // static std::vector blockData = std::vector(32768); + // static std::vector blockData = std::vector(32768); lc->getBlockData(tls->blockData); tag->putByteArray(L"Blocks", tls->blockData); - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Getting data data"); - // static std::vector dataData = std::vector(16384); + // static std::vector dataData = std::vector(16384); lc->getDataData(tls->dataData); tag->putByteArray(L"Data", tls->dataData); - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Getting sky and block light data"); - // static std::vector skyLightData = std::vector(16384); + // static std::vector skyLightData = std::vector(16384); // static std::vector blockLightData = std::vector(16384); lc->getSkyLightData(tls->skyLightData); lc->getBlockLightData(tls->blockLightData); tag->putByteArray(L"SkyLight", tls->skyLightData); tag->putByteArray(L"BlockLight", tls->blockLightData); - PIXEndNamedEvent(); + tag->putByteArray(L"HeightMap", lc->heightmap); tag->putShort( @@ -361,13 +352,11 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) { std::vector biomeData = lc->getBiomes(); tag->putByteArray(L"Biomes", biomeData); - PIXBeginNamedEvent(0, "Saving entities"); -#if !defined(SPLIT_SAVES) + #if !defined(SPLIT_SAVES) saveEntities(lc, level, tag); #endif - PIXBeginNamedEvent(0, "Saving tile entities"); - ListTag* tileEntityTags = new ListTag(); + ListTag* tileEntityTags = new ListTag(); auto itEnd = lc->tileEntities.end(); for (std::unordered_map, @@ -380,10 +369,9 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) { tileEntityTags->add(teTag); } tag->put(L"TileEntities", tileEntityTags); - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Saving tile tick data"); - std::vector* ticksInChunk = + std::vector* ticksInChunk = level->fetchTicksInChunk(lc, false); if (ticksInChunk != nullptr) { int64_t levelTime = level->getGameTime(); @@ -404,8 +392,8 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) { tag->put(L"TileTicks", tickTags); } delete ticksInChunk; - PIXEndNamedEvent(); - PIXEndNamedEvent(); + + } void OldChunkStorage::loadEntities(LevelChunk* lc, Level* level, @@ -437,8 +425,7 @@ void OldChunkStorage::loadEntities(LevelChunk* lc, Level* level, } LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) { - PIXBeginNamedEvent(0, "Loading chunk"); - short version = dis->readShort(); + short version = dis->readShort(); int x = dis->readInt(); int z = dis->readInt(); int time = dis->readLong(); @@ -486,8 +473,7 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) { loadEntities(levelChunk, level, tag); if (tag->contains(L"TileTicks")) { - PIXBeginNamedEvent(0, "Loading TileTicks"); - ListTag* tileTicks = + ListTag* tileTicks = (ListTag*)tag->getList(L"TileTicks"); if (tileTicks != nullptr) { @@ -500,12 +486,12 @@ LevelChunk* OldChunkStorage::load(Level* level, DataInputStream* dis) { teTag->getInt(L"t"), teTag->getInt(L"p")); } } - PIXEndNamedEvent(); + } delete tag; - PIXEndNamedEvent(); + return levelChunk; } diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFile.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFile.cpp index de3e47394..4f2c0857a 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFile.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFile.cpp @@ -335,8 +335,7 @@ void RegionFile::write(int x, int z, std::uint8_t* data, // better compressed until it is reused zero(sectorNumber, SECTOR_BYTES * sectorsAllocated); - PIXBeginNamedEvent(0, "Scanning for free space\n"); - /* scan for a free space large enough to store this chunk */ + /* scan for a free space large enough to store this chunk */ int runStart = (int)(find(sectorFree->begin(), sectorFree->end(), true) - sectorFree @@ -358,7 +357,7 @@ void RegionFile::write(int x, int z, std::uint8_t* data, } } } - PIXEndNamedEvent(); + if (runLength >= sectorsNeeded) { /* we found a free space large enough */ @@ -370,8 +369,6 @@ void RegionFile::write(int x, int z, std::uint8_t* data, } write(sectorNumber, compData, length, compLength); } else { - PIXBeginNamedEvent(0, "Expanding storage for %d sectors\n", - sectorsNeeded); /* * no free space large enough found -- we need to grow the * file @@ -393,7 +390,7 @@ void RegionFile::write(int x, int z, std::uint8_t* data, write(sectorNumber, compData, length, compLength); setOffset(x, z, (sectorNumber << 8) | sectorsNeeded); - PIXEndNamedEvent(); + } } setTimestamp(x, z, (int)(System::currentTimeMillis() / 1000L)); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/CustomLevelSource.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/CustomLevelSource.cpp index a777cdf13..7b4d351ee 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/CustomLevelSource.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/CustomLevelSource.cpp @@ -510,17 +510,15 @@ void CustomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { bool hasVillage = false; - PIXBeginNamedEvent(0, "Structure postprocessing"); - if (generateStructures) { + if (generateStructures) { mineShaftFeature->postProcess(level, pprandom, xt, zt); hasVillage = villageFeature->postProcess(level, pprandom, xt, zt); strongholdFeature->postProcess(level, pprandom, xt, zt); scatteredFeature->postProcess(level, random, xt, zt); } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Monster rooms"); - for (int i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { int x = xo + pprandom->nextInt(16) + 8; int y = pprandom->nextInt(Level::maxBuildHeight); int z = zo + pprandom->nextInt(16) + 8; @@ -529,11 +527,10 @@ void CustomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { } delete mrf; } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Biome decorate"); - biome->decorate(level, pprandom, xo, zo); - PIXEndNamedEvent(); + biome->decorate(level, pprandom, xo, zo); + app.processSchematics(parent->getChunk(xt, zt)); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/RandomLevelSource.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/RandomLevelSource.cpp index ad4ed2072..6b79b74ca 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/RandomLevelSource.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/RandomLevelSource.cpp @@ -756,17 +756,15 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { bool hasVillage = false; - PIXBeginNamedEvent(0, "Structure postprocessing"); - if (generateStructures) { + if (generateStructures) { mineShaftFeature->postProcess(level, pprandom, xt, zt); hasVillage = villageFeature->postProcess(level, pprandom, xt, zt); strongholdFeature->postProcess(level, pprandom, xt, zt); scatteredFeature->postProcess(level, random, xt, zt); } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Lakes"); - if (biome != Biome::desert && biome != Biome::desertHills) { + if (biome != Biome::desert && biome != Biome::desertHills) { if (!hasVillage && pprandom->nextInt(4) == 0) { int x = xo + pprandom->nextInt(16) + 8; int y = pprandom->nextInt(Level::genDepth); @@ -776,10 +774,9 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { calmWater.place(level, pprandom, x, y, z); } } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Lava"); - if (!hasVillage && pprandom->nextInt(8) == 0) { + if (!hasVillage && pprandom->nextInt(8) == 0) { int x = xo + pprandom->nextInt(16) + 8; int y = pprandom->nextInt(pprandom->nextInt(Level::genDepth - 8) + 8); int z = zo + pprandom->nextInt(16) + 8; @@ -788,33 +785,28 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { calmLava.place(level, pprandom, x, y, z); } } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Monster rooms"); - for (int i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { int x = xo + pprandom->nextInt(16) + 8; int y = pprandom->nextInt(Level::genDepth); int z = zo + pprandom->nextInt(16) + 8; MonsterRoomFeature mrf; mrf.place(level, pprandom, x, y, z); } - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Biome decorate"); - biome->decorate(level, pprandom, xo, zo); - PIXEndNamedEvent(); + biome->decorate(level, pprandom, xo, zo); + - PIXBeginNamedEvent(0, "Process Schematics"); - app.processSchematics(parent->getChunk(xt, zt)); - PIXEndNamedEvent(); + app.processSchematics(parent->getChunk(xt, zt)); + - PIXBeginNamedEvent(0, "Post process mobs"); - MobSpawner::postProcessSpawnMobs(level, biome, xo + 8, zo + 8, 16, 16, + MobSpawner::postProcessSpawnMobs(level, biome, xo + 8, zo + 8, 16, 16, pprandom); - PIXEndNamedEvent(); + - PIXBeginNamedEvent(0, "Update ice and snow"); - // 4J - brought forward from 1.2.3 to get snow back in taiga biomes + // 4J - brought forward from 1.2.3 to get snow back in taiga biomes xo += 8; zo += 8; for (int x = 0; x < 16; x++) { @@ -831,7 +823,7 @@ void RandomLevelSource::postProcess(ChunkSource* parent, int xt, int zt) { } } } - PIXEndNamedEvent(); + HeavyTile::instaFall = false; } diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp index 3262191c7..f916e66fc 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/BasicTreeFeature.cpp @@ -139,8 +139,7 @@ void BasicTree::prepare() { void BasicTree::crossection(int x, int y, int z, float radius, uint8_t direction, int material) { - PIXBeginNamedEvent(0, "BasicTree crossection"); - // Create a circular cross section. + // Create a circular cross section. // // Used to nearly everything in the foliage, branches, and trunk. // This is a good target for performance optimization. @@ -170,24 +169,22 @@ void BasicTree::crossection(int x, int y, int z, float radius, continue; } position[secidx2] = center[secidx2] + offset2; - PIXBeginNamedEvent(0, "BasicTree getting tile"); - thismat = thisLevel->getTile(position[0], position[1], position[2]); - PIXEndNamedEvent(); + thismat = thisLevel->getTile(position[0], position[1], position[2]); + if (!((thismat == 0) || (thismat == Tile::leaves_Id))) { // If the material of the checked block is anything other than // air or foliage, skip this tile. offset2++; continue; } - PIXBeginNamedEvent(0, "BasicTree placing block"); - placeBlock(thisLevel, position[0], position[1], position[2], + placeBlock(thisLevel, position[0], position[1], position[2], material, 0); - PIXEndNamedEvent(); + offset2++; } offset1++; } - PIXEndNamedEvent(); + } float BasicTree::treeShape(int y) { @@ -228,8 +225,7 @@ float BasicTree::foliageShape(int y) { } void BasicTree::foliageCluster(int x, int y, int z) { - PIXBeginNamedEvent(0, "BasicTree foliageCluster"); - // Generate a cluster of foliage, with the base at x, y, z. + // Generate a cluster of foliage, with the base at x, y, z. // The shape of the cluster is derived from foliageShape // crossection is called to make each level. int topy = y + foliageHeight; @@ -242,7 +238,7 @@ void BasicTree::foliageCluster(int x, int y, int z) { crossection(x, cury, z, radius, (uint8_t)1, Tile::leaves_Id); cury--; } - PIXEndNamedEvent(); + } void BasicTree::limb(int* start, int* end, int material) { @@ -532,26 +528,21 @@ bool BasicTree::place(Level* level, Random* random, int x, int y, int z) { // System.out.println("Tree location failed"); return false; } - PIXBeginNamedEvent(0, "Placing BasicTree"); - // System.out.println("The height is"); + // System.out.println("The height is"); // System.out.println(height); // System.out.println("Trunk Height check done"); - PIXBeginNamedEvent(0, "Preparing tree"); - prepare(); - PIXEndNamedEvent(); + prepare(); + // System.out.println("Prepare done"); - PIXBeginNamedEvent(0, "Making foliage"); - makeFoliage(); - PIXEndNamedEvent(); + makeFoliage(); + // System.out.println("Foliage done"); - PIXBeginNamedEvent(0, "Making trunk"); - makeTrunk(); - PIXEndNamedEvent(); + makeTrunk(); + // System.out.println("Trunk done"); - PIXBeginNamedEvent(0, "Making branches"); - makeBranches(); - PIXEndNamedEvent(); + makeBranches(); + // System.out.println("Branches done"); - PIXEndNamedEvent(); + return true; } \ No newline at end of file diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/GroundBushFeature.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/GroundBushFeature.cpp index 3b52384b3..511fe36d0 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/GroundBushFeature.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/GroundBushFeature.cpp @@ -13,8 +13,7 @@ GroundBushFeature::GroundBushFeature(int trunkType, int leafType) { bool GroundBushFeature::place(Level* level, Random* random, int x, int y, int z) { - PIXBeginNamedEvent(0, "Placing GroundBushFeature"); - int t = 0; + int t = 0; while (((t = level->getTile(x, y, z)) == 0 || t == Tile::leaves_Id) && y > 0) y--; @@ -41,6 +40,6 @@ bool GroundBushFeature::place(Level* level, Random* random, int x, int y, } } } - PIXEndNamedEvent(); + return true; } \ No newline at end of file diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp index 10876a902..25b79f67a 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/MegaTreeFeature.cpp @@ -27,12 +27,11 @@ bool MegaTreeFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation if (app.getLevelGenerationOptions() != nullptr) { - PIXBeginNamedEvent(0, "MegaTreeFeature Checking intersects"); LevelGenerationOptions* levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - 2, y - 1, z - 2, x + 2, y + treeHeight, z + 2); - PIXEndNamedEvent(); + if (intersects) { // app.DebugPrintf("Skipping reeds feature generation as it overlaps // a game rule structure\n"); @@ -74,12 +73,8 @@ bool MegaTreeFeature::place(Level* level, Random* random, int x, int y, int z) { level->setTileAndData(x + 1, y - 1, z + 1, Tile::dirt_Id, 0, Tile::UPDATE_CLIENTS); - PIXBeginNamedEvent(0, "MegaTree placing leaves, %d, %d, %d", x, z, - y + treeHeight); placeLeaves(level, x, z, y + treeHeight, 2, random); - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "MegaTree placing branches"); int branchHeight = y + treeHeight - 2 - random->nextInt(4); while (branchHeight > y + treeHeight / 2) { float angle = random->nextFloat() * std::numbers::pi * 2.0f; @@ -96,9 +91,7 @@ bool MegaTreeFeature::place(Level* level, Random* random, int x, int y, int z) { branchHeight -= 2 + random->nextInt(4); } - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "MegaTree placing vines"); for (int hh = 0; hh < treeHeight; hh++) { int t = level->getTile(x, y + hh, z); if (t == 0 || t == Tile::leaves_Id) { @@ -170,7 +163,6 @@ bool MegaTreeFeature::place(Level* level, Random* random, int x, int y, int z) { } } } - PIXEndNamedEvent(); return true; } @@ -199,13 +191,10 @@ void MegaTreeFeature::placeLeaves(Level* level, int x, int z, int topPosition, (xo * xo + zo * zo) > ((radius - 1) * (radius - 1))) { continue; } - PIXBeginNamedEvent(0, "Getting tile"); int t = level->getTile(xx, yy, zz); - PIXEndNamedEvent(); + if (t == 0 || t == Tile::leaves_Id) { - PIXBeginNamedEvent(0, "Placing block"); placeBlock(level, xx, yy, zz, Tile::leaves_Id, leafType); - PIXEndNamedEvent(); } } } diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/OreFeature.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/OreFeature.cpp index 1f40f062a..70113069e 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/OreFeature.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/OreFeature.cpp @@ -24,8 +24,7 @@ OreFeature::OreFeature(int tile, int count, int targetTile) { } bool OreFeature::place(Level* level, Random* random, int x, int y, int z) { - PIXBeginNamedEvent(0, "Place Ore Feature"); - float dir = random->nextFloat() * std::numbers::pi; + float dir = random->nextFloat() * std::numbers::pi; double x0 = x + 8 + Mth::sin(dir) * count / 8; double x1 = x + 8 - Mth::sin(dir) * count / 8; @@ -146,6 +145,6 @@ bool OreFeature::place(Level* level, Random* random, int x, int y, int z) { } } - PIXEndNamedEvent(); + return true; } \ No newline at end of file diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.cpp index 7659ffe22..3c1ad54de 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/feature/TreeFeature.cpp @@ -35,12 +35,11 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by // game rule generation if (app.getLevelGenerationOptions() != nullptr) { - PIXBeginNamedEvent(0, "TreeFeature checking intersects"); - LevelGenerationOptions* levelGenOptions = + LevelGenerationOptions* levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects( x - 2, y - 1, z - 2, x + 2, y + treeHeight, z + 2); - PIXEndNamedEvent(); + if (intersects) { // app.DebugPrintf("Skipping reeds feature generation as it overlaps // a game rule structure\n"); @@ -76,8 +75,7 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) { placeBlock(level, x, y - 1, z, Tile::dirt_Id, 0); - PIXBeginNamedEvent(0, "Placing TreeFeature leaves"); - int grassHeight = 3; + int grassHeight = 3; int extraWidth = 0; // 4J Stu - Generate leaves from the top down to stop having to recalc // heightmaps @@ -97,9 +95,8 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) { } } } - PIXEndNamedEvent(); - PIXBeginNamedEvent(0, "Placing TreeFeature trunks"); - for (int hh = 0; hh < treeHeight; hh++) { + + for (int hh = 0; hh < treeHeight; hh++) { int t = level->getTile(x, y + hh, z); if (t == 0 || t == Tile::leaves_Id) { placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, trunkType); @@ -127,10 +124,9 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) { } } } - PIXEndNamedEvent(); + if (addJungleFeatures) { - PIXBeginNamedEvent(0, "TreeFeature adding vines"); - for (int yy = y - 3 + treeHeight; yy <= y + treeHeight; yy++) { + for (int yy = y - 3 + treeHeight; yy <= y + treeHeight; yy++) { int yo = yy - (y + treeHeight); int offs = 2 - yo / 2; for (int xx = x - offs; xx <= x + offs; xx++) { @@ -158,11 +154,10 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) { } } } - PIXEndNamedEvent(); + // also chance for cocoa plants around stem if (random->nextInt(5) == 0 && treeHeight > 5) { - PIXBeginNamedEvent(0, "TreeFeature adding cocoa"); - for (int rows = 0; rows < 2; rows++) { + for (int rows = 0; rows < 2; rows++) { for (int dir = 0; dir < 4; dir++) { if (random->nextInt(4 - rows) == 0) { int age = random->nextInt(3); @@ -176,7 +171,7 @@ bool TreeFeature::place(Level* level, Random* random, int x, int y, int z) { } } } - PIXEndNamedEvent(); + } } diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/piston/PistonBaseTile.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/tile/piston/PistonBaseTile.cpp index ec038fb88..d3ee69a47 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/piston/PistonBaseTile.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/piston/PistonBaseTile.cpp @@ -224,8 +224,7 @@ bool PistonBaseTile::triggerEvent(Level* level, int x, int y, int z, int param1, } if (param1 == TRIGGER_EXTEND) { - PIXBeginNamedEvent(0, "Create push\n"); - if (createPush(level, x, y, z, facing)) { + if (createPush(level, x, y, z, facing)) { // 4J - it is (currently) critical that this setData sends data to // the client, so have added a bool to the method so that it sends // data even if the data was already set to the same value as @@ -256,10 +255,9 @@ bool PistonBaseTile::triggerEvent(Level* level, int x, int y, int z, int param1, } else { return false; } - PIXEndNamedEvent(); + } else if (param1 == TRIGGER_CONTRACT) { - PIXBeginNamedEvent(0, "Contract phase A\n"); - std::shared_ptr prevTileEntity = level->getTileEntity( + std::shared_ptr prevTileEntity = level->getTileEntity( x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], z + Facing::STEP_Z[facing]); if (prevTileEntity != nullptr && @@ -276,23 +274,21 @@ bool PistonBaseTile::triggerEvent(Level* level, int x, int y, int z, int param1, PistonMovingPiece::newMovingPieceEntity( id, facing, facing, false, true)); - PIXEndNamedEvent(); + // sticky movement if (isSticky) { - PIXBeginNamedEvent(0, "Contract sticky phase A\n"); - int twoX = x + Facing::STEP_X[facing] * 2; + int twoX = x + Facing::STEP_X[facing] * 2; int twoY = y + Facing::STEP_Y[facing] * 2; int twoZ = z + Facing::STEP_Z[facing] * 2; int block = level->getTile(twoX, twoY, twoZ); int blockData = level->getData(twoX, twoY, twoZ); bool pistonPiece = false; - PIXEndNamedEvent(); + if (block == Tile::pistonMovingPiece_Id) { - PIXBeginNamedEvent(0, "Contract sticky phase B\n"); - // the block two steps away is a moving piston block piece, so + // the block two steps away is a moving piston block piece, so // replace it with the real data, since it's probably this // piston which is changing too fast std::shared_ptr tileEntity = @@ -312,11 +308,10 @@ bool PistonBaseTile::triggerEvent(Level* level, int x, int y, int z, int param1, pistonPiece = true; } } - PIXEndNamedEvent(); + } - PIXBeginNamedEvent(0, "Contract sticky phase C\n"); - if (!pistonPiece && block > 0 && + if (!pistonPiece && block > 0 && (isPushable(block, level, twoX, twoY, twoZ, false)) && (Tile::tiles[block]->getPistonPushReaction() == Material::PUSH_NORMAL || @@ -348,7 +343,7 @@ bool PistonBaseTile::triggerEvent(Level* level, int x, int y, int z, int param1, z + Facing::STEP_Z[facing]); ignoreUpdate(true); } - PIXEndNamedEvent(); + } else { stopSharingIfServer(level, x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], diff --git a/minecraft/Minecraft.World/x64headers/extraX64.h b/minecraft/Minecraft.World/x64headers/extraX64.h index 289f5858e..b53d0c786 100644 --- a/minecraft/Minecraft.World/x64headers/extraX64.h +++ b/minecraft/Minecraft.World/x64headers/extraX64.h @@ -216,11 +216,6 @@ public: static IQNetPlayer m_player[4]; }; -void PIXAddNamedCounter(int a, const char* b, ...); -void PIXBeginNamedEvent(int a, const char* b, ...); -void PIXEndNamedEvent(); -void PIXSetMarkerDeprecated(int a, const char* b, ...); - void XSetThreadProcessor(void* a, int b); const int QNET_SENDDATA_LOW_PRIORITY = 0;