pixieNoSimd
This commit is contained in:
parent
db0ee90fb2
commit
aec3d91109
2 changed files with 10 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
|||
## Blending modes.
|
||||
import chroma, math
|
||||
|
||||
when defined(amd64):
|
||||
when defined(amd64) and not defined(pixieNoSimd):
|
||||
import nimsimd/sse2
|
||||
|
||||
# See https://www.w3.org/TR/compositing-1/
|
||||
|
@ -264,7 +264,7 @@ proc blendExcludeMaskFloats*(backdrop, source: Color): Color {.inline.} =
|
|||
proc blendOverwriteFloats*(backdrop, source: Color): Color {.inline.} =
|
||||
source
|
||||
|
||||
when defined(amd64):
|
||||
when defined(amd64) and not defined(pixieNoSimd):
|
||||
proc alphaFix(backdrop, source: ColorRGBA, vb, vs, vm: M128): ColorRGBA =
|
||||
let
|
||||
sa = source.a.float32
|
||||
|
@ -417,7 +417,7 @@ proc blendSoftLight(backdrop, source: ColorRGBA): ColorRGBA =
|
|||
# (2 * source * backdrop) div 255
|
||||
# ).uint8
|
||||
|
||||
when defined(amd64):
|
||||
when defined(amd64) and not defined(pixieNoSimd):
|
||||
let
|
||||
vb = mm_setr_ps(backdrop.r.float32, backdrop.g.float32, backdrop.b.float32, 0)
|
||||
vs = mm_setr_ps(source.r.float32, source.g.float32, source.b.float32, 0)
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import chroma, blends, bumpy, vmath, common, nimsimd/sse2, system/memory
|
||||
import chroma, blends, bumpy, vmath, common, system/memory
|
||||
|
||||
when defined(amd64) and not defined(pixieNoSimd):
|
||||
import nimsimd/sse2
|
||||
|
||||
const h = 0.5.float32
|
||||
|
||||
|
@ -71,7 +74,7 @@ proc fillUnsafe(data: var seq[ColorRGBA], rgba: ColorRGBA, start, len: int) =
|
|||
nimSetMem(data[start].addr, rgba.r.cint, len * 4)
|
||||
else:
|
||||
var i = start
|
||||
when defined(amd64):
|
||||
when defined(amd64) and not defined(pixieNoSimd):
|
||||
# When supported, SIMD fill until we run out of room
|
||||
let m = mm_set1_epi32(cast[int32](rgba))
|
||||
for j in countup(i, start + len - 8, 8):
|
||||
|
@ -178,7 +181,7 @@ proc draw*(a, b: Image, pos = vec2(0, 0), blendMode = bmNormal) {.inline.}
|
|||
proc invert*(image: Image) =
|
||||
## Inverts all of the colors and alpha.
|
||||
var i: int
|
||||
when defined(amd64):
|
||||
when defined(amd64) and not defined(pixieNoSimd):
|
||||
let vec255 = mm_set1_epi8(255)
|
||||
while i < image.data.len - 4:
|
||||
var m = mm_loadu_si128(image.data[i].addr)
|
||||
|
@ -196,7 +199,7 @@ proc invert*(image: Image) =
|
|||
proc toAlphy*(image: Image) =
|
||||
## Converts an image to premultiplied alpha from straight.
|
||||
var i: int
|
||||
when defined(amd64):
|
||||
when defined(amd64) and not defined(pixieNoSimd):
|
||||
# When supported, SIMD convert as much as possible
|
||||
let
|
||||
alphaMask = mm_set1_epi32(cast[int32](0xff000000))
|
||||
|
|
Loading…
Reference in a new issue