void VertexManager::PrepareForAdditionalData(int primitive, u32 count, u32 stride) { u32 const needed_vertex_bytes = count * stride; // We can't merge different kinds of primitives, so we have to flush here if (current_primitive_type != primitive_from_gx[primitive]) Flush(); current_primitive_type = primitive_from_gx[primitive]; // Check for size in buffer, if the buffer gets full, call Flush() if ( !IsFlushed && ( count > IndexGenerator::GetRemainingIndices() || count > GetRemainingIndices(primitive) || needed_vertex_bytes > GetRemainingSize() ) ) { Flush(); if (count > IndexGenerator::GetRemainingIndices()) ERROR_LOG(VIDEO, "Too little remaining index values. Use 32-bit or reset them on flush."); if (count > GetRemainingIndices(primitive)) ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all indices! " "Increase MAXIBUFFERSIZE or we need primitive breaking after all."); if (needed_vertex_bytes > GetRemainingSize()) ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all vertices! " "Increase MAXVBUFFERSIZE or we need primitive breaking after all."); } // need to alloc new buffer if (IsFlushed) { g_vertex_manager->ResetBuffer(stride); IsFlushed = false; } }
void CChunkRenderNSF::StoreSampleBankswitched(const CDSample *pDSample) { unsigned int SampleSize = pDSample->GetSize(); if (m_iSampleAddr + SampleSize >= (unsigned)CCompiler::DPCM_SWITCH_ADDRESS) { // Allocate new bank if (GetRemainingSize() != 0x1000) // Skip if already on beginning of new bank AllocateNewBank(); m_iSampleAddr = CCompiler::PAGE_SAMPLES; } int Adjust = CCompiler::AdjustSampleAddress(m_iSampleAddr + SampleSize); Store(pDSample->GetData(), SampleSize); Fill(Adjust); m_iSampleAddr += SampleSize + Adjust; }
void CChunkRenderNSF::AllocateNewBank() { // Get new NSF bank int Remaining = GetRemainingSize(); Fill(Remaining); }