public void UL(ComputePO pObject, int slot) { lock (computePObjectLists[slot]) { computePObjectLists[slot].Add(pObject); } }
public async Task <bool> Reload(IStorageItem storageItem, RPAssetsManager RPAssetsManager, ProcessingList processingList) { Mark(GraphicsObjectStatus.loading); if (!(storageItem is StorageFile file)) { Mark(GraphicsObjectStatus.error); return(false); } Windows.Storage.Streams.IBuffer datas; try { datas = await FileIO.ReadBufferAsync(file); } catch { Mark(GraphicsObjectStatus.error); return(false); } VertexShader vs0 = VS; GeometryShader gs0 = GS; VertexShader vs1 = VS1; GeometryShader gs1 = GS1; PixelShader ps1 = PS1; VertexShader vs2 = VSParticle; GeometryShader gs2 = GSParticle; PixelShader ps2 = PSParticle; ComputePO cs1 = CSParticle; bool haveVS = vs0.CompileInitialize1(datas, "VS", macroEntryVS); bool haveGS = gs0.CompileInitialize1(datas, "GS", macroEntryGS); bool haveVS1 = vs1.CompileInitialize1(datas, "VS1", macroEntryVS); bool haveGS1 = gs1.CompileInitialize1(datas, "GS1", macroEntryGS); bool havePS1 = ps1.CompileInitialize1(datas, "PS1", macroEntryPS); bool haveVSParticle = vs2.CompileInitialize1(datas, "VSParticle", macroEntryVS); bool haveGSParticle = gs2.CompileInitialize1(datas, "GSParticle", macroEntryGS); bool havePSParticle = ps2.CompileInitialize1(datas, "PSParticle", macroEntryPS); bool haveCS1 = cs1.CompileInitialize1(datas, "CSParticle", macroEntryCS1); if (haveVS || haveGS) { processingList.UL(new ShaderWarp1() { pipelineState = POSkinning, vs = haveVS ? vs0 : RPAssetsManager.VSAssets["VSMMDSkinning2.cso"], gs = haveGS ? gs0 : null, ps = null }); } else { POSkinning.Status = GraphicsObjectStatus.unload; } if (haveVS1 || haveGS1 || havePS1) { processingList.UL(new ShaderWarp1() { pipelineState = PODraw, vs = haveVS1 ? vs1 : RPAssetsManager.VSMMDTransform, gs = haveGS1 ? gs1 : null, ps = havePS1 ? ps1 : RPAssetsManager.PSMMD }); } else { PODraw.Status = GraphicsObjectStatus.unload; } if (haveVSParticle || haveGSParticle || havePSParticle) { processingList.UL(new ShaderWarp1() { pipelineState = POParticleDraw, vs = haveVSParticle ? vs2 : RPAssetsManager.VSMMDTransform, gs = haveGSParticle ? gs2 : null, ps = havePSParticle ? ps2 : RPAssetsManager.PSMMD }); } else { POParticleDraw.Status = GraphicsObjectStatus.unload; } if (haveCS1) { processingList.UL(CSParticle, 0); } else { CSParticle.Status = GraphicsObjectStatus.unload; } Status = GraphicsObjectStatus.loaded; return(true); }
protected async Task ReloadComputeShader(ComputePO computeShader, string uri) { computeShader.Reload(await ReadFile(uri)); }
public async Task <bool> Reload(IStorageItem storageItem, RPAssetsManager RPAssetsManager, ProcessingList processingList) { Mark(GraphicsObjectStatus.loading); if (!(storageItem is StorageFile file)) { Mark(GraphicsObjectStatus.error); return(false); } Windows.Storage.Streams.IBuffer datas; try { datas = await FileIO.ReadBufferAsync(file); } catch { Mark(GraphicsObjectStatus.error); return(false); } VertexShader vs0 = VS; GeometryShader gs0 = GS; VertexShader vs1 = VS1; GeometryShader gs1 = GS1; PixelShader ps1 = PS1; VertexShader vs2 = VSParticle; GeometryShader gs2 = GSParticle; PixelShader ps2 = PSParticle; ComputePO cs1 = CSParticle; bool haveVS = vs0.CompileReload1(datas, "VS", ShaderMacro.DEFINE_COO_SURFACE); bool haveGS = gs0.CompileReload1(datas, "GS", ShaderMacro.DEFINE_COO_SURFACE); bool haveVS1 = vs1.CompileReload1(datas, "VS1", ShaderMacro.DEFINE_COO_SURFACE); bool haveGS1 = gs1.CompileReload1(datas, "GS1", ShaderMacro.DEFINE_COO_SURFACE); bool havePS1 = ps1.CompileReload1(datas, "PS1", ShaderMacro.DEFINE_COO_SURFACE); bool haveVSParticle = vs2.CompileReload1(datas, "VSParticle", ShaderMacro.DEFINE_COO_SURFACE); bool haveGSParticle = gs2.CompileReload1(datas, "GSParticle", ShaderMacro.DEFINE_COO_SURFACE); bool havePSParticle = ps2.CompileReload1(datas, "PSParticle", ShaderMacro.DEFINE_COO_SURFACE); bool haveCS1 = cs1.CompileReload1(datas, "CSParticle", ShaderMacro.DEFINE_COO_PARTICLE); if (haveVS || haveGS) { POSkinning.ReloadSkinning( haveVS ? vs0 : RPAssetsManager.VSMMDSkinning2, haveGS ? gs0 : null); processingList.UL(POSkinning, 1); } else { POSkinning.Status = GraphicsObjectStatus.unload; } if (haveVS1 || haveGS1 || havePS1) { PODraw.ReloadDrawing(BlendState.alpha, haveVS1 ? vs1 : RPAssetsManager.VSMMDTransform, haveGS1 ? gs1 : null, havePS1 ? ps1 : RPAssetsManager.PSMMD, RPAssetsManager.outputFormat, RPAssetsManager.depthFormat); processingList.UL(PODraw, 0); } else { PODraw.Status = GraphicsObjectStatus.unload; } if (haveVSParticle || haveGSParticle || havePSParticle) { POParticleDraw.ReloadDrawing(BlendState.alpha, haveVSParticle ? vs2 : RPAssetsManager.VSMMDTransform, haveGSParticle ? gs2 : null, havePSParticle ? ps2 : RPAssetsManager.PSMMD, RPAssetsManager.outputFormat, RPAssetsManager.depthFormat); processingList.UL(POParticleDraw, 0); } else { POParticleDraw.Status = GraphicsObjectStatus.unload; } if (haveCS1) { processingList.UL(CSParticle, 0); } else { CSParticle.Status = GraphicsObjectStatus.unload; } Status = GraphicsObjectStatus.loaded; return(true); }