[orx-fx] Fix problems with content scales in ApproximateGaussianBlur

This commit is contained in:
Edwin Jakobs
2020-07-20 17:52:34 +02:00
parent f0013b96a7
commit b4908b3cd8

View File

@@ -57,23 +57,21 @@ open class MipBloom<T:Filter>(val blur:T) : Filter(filterShaderFromUrl(filterFra
val combine = BloomCombine() val combine = BloomCombine()
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) { override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
sourceCopy?.let { sourceCopy?.let {
if (it.width != source[0].width || it.height != source[0].height) { if (!it.isEquivalentTo(source[0], ignoreType = true)) {
it.destroy() it.destroy()
sourceCopy = null sourceCopy = null
} }
} }
if (sourceCopy == null) { if (sourceCopy == null) {
sourceCopy = colorBuffer(source[0].width, source[0].height, type = ColorType.FLOAT16) sourceCopy = source[0].createEquivalent(type = ColorType.FLOAT16)
} }
source[0].copyTo(sourceCopy!!) source[0].copyTo(sourceCopy!!)
upscale.shape = shape upscale.shape = shape
if (intermediates.size != passes if (intermediates.size != passes
|| (intermediates.isNotEmpty() && (intermediates[0].width!=target[0].width || intermediates[0].height != target[0].height) )) { || (intermediates.isNotEmpty() && (!intermediates[0].isEquivalentTo(target[0], ignoreType = true, ignoreFormat = true)))) {
intermediates.forEach { intermediates.forEach {
it.destroy() it.destroy()
} }