Class OwnerTextureDispatcher
Manages GPU compute shaders for owner texture population. Full-map shader (PopulateOwnerTexture) used at load time. Indexed shader (UpdateOwnerByIndex) used at runtime — dispatches only over pixels belonging to changed provinces instead of scanning all 97.5M pixels.
public class OwnerTextureDispatcher : MonoBehaviour
- Inheritance
-
objectOwnerTextureDispatcher
Methods
Initialize()
public void Initialize()
PopulateOwnerTexture(ProvinceQueries)
Full populate: builds entire owner buffer from simulation data. Used at load time only.
[ContextMenu("Populate Owner Texture")]
public void PopulateOwnerTexture(ProvinceQueries provinceQueries)
Parameters
provinceQueriesProvinceQueries
SetPixelIndex(uint[], uint[], uint[])
Set the per-province pixel index built at load time. Enables targeted runtime updates via UpdateOwnerByIndex compute shader.
public void SetPixelIndex(uint[] pixelCoords, uint[] offsets, uint[] counts)
Parameters
pixelCoordsuint[]offsetsuint[]countsuint[]
SetTextureManager(MapTextureManager)
public void SetTextureManager(MapTextureManager manager)
Parameters
managerMapTextureManager
UpdateOwnerTexture(ProvinceQueries, ushort[], CommandBuffer)
Incremental update: queues compute shader dispatch into a CommandBuffer for only pixels of changed provinces. Non-blocking — no GPU sync stall. Falls back to full-map dispatch if pixel index not available.
public void UpdateOwnerTexture(ProvinceQueries provinceQueries, ushort[] changedProvinces, CommandBuffer cmd)
Parameters
provinceQueriesProvinceQuerieschangedProvincesushort[]cmdCommandBuffer