private void startConvo() { ps.initMetric.reset(); ps.totalMetric.reset(); ps.totalMetric.begin(); ps.initMetric.begin(); int convSize = uiConvoSize; int cubeSize = 1 << (int)uiCubeSize; int outExponentCount = 0; if (outDIM.cube) { outExponentCount++; } if (outSIM.cube) { if (uiMipChain) { outExponentCount += (int)uiCubeSize; } else { outExponentCount++; } } outMipSizes = new int[outExponentCount]; outExponents = new int[outExponentCount]; if (outDIM.cube) { outMipSizes[outExponentCount - 1] = cubeSize; outExponents[outExponentCount - 1] = 1; } if (outSIM.cube) { if (uiMipChain) { int maxExp = 256; int maxSize = cubeSize; //SIM exponents for (int i = 0; i < outExponentCount - 1; ++i) { outExponents[i] = maxExp >> i; outMipSizes[i] = maxSize >> i; } } else { outMipSizes[0] = cubeSize; outExponents[0] = uiExponent; } } ps.reset(); ps.exponentCount = (ulong)outExponentCount; ps.gammaCompress = uiGammaCompress; if (inSKY.input) { this.uiShowPreview = false; if (outSIM.cube) { ps.buildMipChain = uiMipChain; ps.reflectionInSIM = uiReflectionInSIM && uiMipChain; } else { ps.buildMipChain = false; ps.reflectionInSIM = false; } //NOTE: ps.IN is now a direct reference to the input sky. This is ok because we lock the CubemapGUIs //ps.IN.filterMode = CubeBuffer.FilterMode.BILINEAR; ps.IN = inSKY.buffers[0]; ps.IN.applyExposure(uiExposure); ps.CONVO.resize(convSize); ps.IN.resampleToBuffer(ref ps.CONVO); ps.CONVO.filterMode = CubemapGUI.sFilterMode; gatherLights(ref ps.CONVO); ulong opcount = ps.lightCount * ps.lightCount * ps.exponentCount; ps.setOpCount(stepsPerFrame, opcount); inSKY.locked = outSKY.locked = outDIM.locked = outSIM.locked = true; ps.play(); } ps.initMetric.end(); }