mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-21 07:49:18 +00:00
rollback to java 21, move native math to other branch
This commit is contained in:
@@ -1,105 +0,0 @@
|
||||
package org.bxteam.divinemc.math;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.lang.foreign.MemorySegment;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
public class Bindings {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Bindings.class);
|
||||
|
||||
private static final MethodHandle MH_c2me_natives_noise_perlin_double = bind(BindingsTemplate.c2me_natives_noise_perlin_double, "c2me_natives_noise_perlin_double");
|
||||
private static final MethodHandle MH_c2me_natives_noise_perlin_double_ptr = bind(BindingsTemplate.c2me_natives_noise_perlin_double_ptr, "c2me_natives_noise_perlin_double");
|
||||
private static final MethodHandle MH_c2me_natives_noise_perlin_double_batch = bind(BindingsTemplate.c2me_natives_noise_perlin_double_batch, "c2me_natives_noise_perlin_double_batch");
|
||||
private static final MethodHandle MH_c2me_natives_noise_perlin_double_batch_partial_ptr = bind(BindingsTemplate.c2me_natives_noise_perlin_double_batch_ptr, "c2me_natives_noise_perlin_double_batch");
|
||||
private static final MethodHandle MH_c2me_natives_noise_interpolated = bind(BindingsTemplate.c2me_natives_noise_interpolated, "c2me_natives_noise_interpolated");
|
||||
private static final MethodHandle MH_c2me_natives_noise_interpolated_ptr = bind(BindingsTemplate.c2me_natives_noise_interpolated_ptr, "c2me_natives_noise_interpolated");
|
||||
private static final MethodHandle MH_c2me_natives_end_islands_sample = bind(BindingsTemplate.c2me_natives_end_islands_sample, "c2me_natives_end_islands_sample");
|
||||
private static final MethodHandle MH_c2me_natives_end_islands_sample_ptr = bind(BindingsTemplate.c2me_natives_end_islands_sample_ptr, "c2me_natives_end_islands_sample");
|
||||
private static final MethodHandle MH_c2me_natives_biome_access_sample = bind(BindingsTemplate.c2me_natives_biome_access_sample, "c2me_natives_biome_access_sample");
|
||||
|
||||
private static @Nullable MethodHandle bind(@NotNull MethodHandle template, String prefix) {
|
||||
if (NativeLoader.currentMachineTarget == null) {
|
||||
LOGGER.warn("Call to bindings was found! Please disable native acceleration in config, as your system may be incompatible");
|
||||
return null;
|
||||
}
|
||||
return template.bindTo(NativeLoader.lookup.find(prefix + NativeLoader.currentMachineTarget.getSuffix()).get());
|
||||
}
|
||||
|
||||
public static double c2me_natives_noise_perlin_double(MemorySegment data, double x, double y, double z) {
|
||||
try {
|
||||
return (double) MH_c2me_natives_noise_perlin_double.invokeExact(data, x, y, z);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static double c2me_natives_noise_perlin_double(long data_ptr, double x, double y, double z) {
|
||||
try {
|
||||
return (double) MH_c2me_natives_noise_perlin_double_ptr.invokeExact(data_ptr, x, y, z);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void c2me_natives_noise_perlin_double_batch(MemorySegment data, MemorySegment res, MemorySegment x, MemorySegment y, MemorySegment z, int length) {
|
||||
try {
|
||||
MH_c2me_natives_noise_perlin_double_batch.invokeExact(data, res, x, y, z, length);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void c2me_natives_noise_perlin_double_batch(long data_ptr, MemorySegment res, MemorySegment x, MemorySegment y, MemorySegment z, int length) {
|
||||
try {
|
||||
MH_c2me_natives_noise_perlin_double_batch_partial_ptr.invokeExact(data_ptr, res, x, y, z, length);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static double c2me_natives_noise_interpolated(MemorySegment data, double x, double y, double z) {
|
||||
try {
|
||||
return (double) MH_c2me_natives_noise_interpolated.invokeExact(data, x, y, z);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static double c2me_natives_noise_interpolated(long data_ptr, double x, double y, double z) {
|
||||
try {
|
||||
return (double) MH_c2me_natives_noise_interpolated_ptr.invokeExact(data_ptr, x, y, z);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static float c2me_natives_end_islands_sample(MemorySegment data, int x, int z) {
|
||||
try {
|
||||
return (float) MH_c2me_natives_end_islands_sample.invokeExact(data, x, z);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static float c2me_natives_end_islands_sample(long data_ptr, int x, int z) {
|
||||
if ((x * x + z * z) < 0) { // workaround some compiler bugs
|
||||
return Float.NaN;
|
||||
}
|
||||
try {
|
||||
return (float) MH_c2me_natives_end_islands_sample_ptr.invokeExact(data_ptr, x, z);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static int c2me_natives_biome_access_sample(long seed, int x, int y, int z) {
|
||||
try {
|
||||
return (int) MH_c2me_natives_biome_access_sample.invokeExact(seed, x, y, z);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,401 +0,0 @@
|
||||
package org.bxteam.divinemc.math;
|
||||
|
||||
import net.minecraft.world.level.levelgen.synth.BlendedNoise;
|
||||
import net.minecraft.world.level.levelgen.synth.ImprovedNoise;
|
||||
import net.minecraft.world.level.levelgen.synth.PerlinNoise;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bxteam.divinemc.util.MemoryUtil;
|
||||
|
||||
import java.lang.foreign.*;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.VarHandle;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class BindingsTemplate {
|
||||
// double c2me_natives_noise_perlin_sample (const uint8_t *permutations, double originX, double originY, double originZ, double x, double y, double z, double yScale, double yMax)
|
||||
public static final MethodHandle c2me_natives_noise_perlin_sample = NativeLoader.linker.downcallHandle(
|
||||
FunctionDescriptor.of(
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE
|
||||
),
|
||||
Linker.Option.critical(true)
|
||||
);
|
||||
|
||||
// c2me_natives_noise_perlin_double, double, (const double_octave_sampler_data_t *data, double x, double y, double z)
|
||||
public static final MethodHandle c2me_natives_noise_perlin_double = NativeLoader.linker.downcallHandle(
|
||||
FunctionDescriptor.of(
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE
|
||||
),
|
||||
Linker.Option.critical(false)
|
||||
);
|
||||
public static final MethodHandle c2me_natives_noise_perlin_double_ptr = NativeLoader.linker.downcallHandle(
|
||||
FunctionDescriptor.of(
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_LONG,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE
|
||||
),
|
||||
Linker.Option.critical(false)
|
||||
);
|
||||
|
||||
// c2me_natives_noise_perlin_double_batch, void, (const double_octave_sampler_data_t *const data,
|
||||
// double *const res, const double *const x,
|
||||
// const double *const y, const double *const z,
|
||||
// const uint32_t length)
|
||||
public static final MethodHandle c2me_natives_noise_perlin_double_batch = NativeLoader.linker.downcallHandle(
|
||||
FunctionDescriptor.ofVoid(
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.JAVA_INT
|
||||
),
|
||||
Linker.Option.critical(true)
|
||||
);
|
||||
public static final MethodHandle c2me_natives_noise_perlin_double_batch_ptr = NativeLoader.linker.downcallHandle(
|
||||
FunctionDescriptor.ofVoid(
|
||||
ValueLayout.JAVA_LONG,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.JAVA_INT
|
||||
),
|
||||
Linker.Option.critical(true)
|
||||
);
|
||||
|
||||
|
||||
public static final StructLayout double_octave_sampler_data = MemoryLayout.structLayout(
|
||||
ValueLayout.JAVA_LONG.withName("length"),
|
||||
ValueLayout.JAVA_DOUBLE.withName("amplitude"),
|
||||
ValueLayout.ADDRESS.withName("need_shift"),
|
||||
ValueLayout.ADDRESS.withName("lacunarity_powd"),
|
||||
ValueLayout.ADDRESS.withName("persistence_powd"),
|
||||
ValueLayout.ADDRESS.withName("sampler_permutations"),
|
||||
ValueLayout.ADDRESS.withName("sampler_originX"),
|
||||
ValueLayout.ADDRESS.withName("sampler_originY"),
|
||||
ValueLayout.ADDRESS.withName("sampler_originZ"),
|
||||
ValueLayout.ADDRESS.withName("amplitudes")
|
||||
).withByteAlignment(32).withName("double_double_octave_sampler_data");
|
||||
public static final VarHandle double_octave_sampler_data$length = double_octave_sampler_data.varHandle(MemoryLayout.PathElement.groupElement("length"));
|
||||
public static final VarHandle double_octave_sampler_data$amplitude = double_octave_sampler_data.varHandle(MemoryLayout.PathElement.groupElement("amplitude"));
|
||||
public static final VarHandle double_octave_sampler_data$need_shift = double_octave_sampler_data.varHandle(MemoryLayout.PathElement.groupElement("need_shift"));
|
||||
public static final VarHandle double_octave_sampler_data$lacunarity_powd = double_octave_sampler_data.varHandle(MemoryLayout.PathElement.groupElement("lacunarity_powd"));
|
||||
public static final VarHandle double_octave_sampler_data$persistence_powd = double_octave_sampler_data.varHandle(MemoryLayout.PathElement.groupElement("persistence_powd"));
|
||||
public static final VarHandle double_octave_sampler_data$sampler_permutations = double_octave_sampler_data.varHandle(MemoryLayout.PathElement.groupElement("sampler_permutations"));
|
||||
public static final VarHandle double_octave_sampler_data$sampler_originX = double_octave_sampler_data.varHandle(MemoryLayout.PathElement.groupElement("sampler_originX"));
|
||||
public static final VarHandle double_octave_sampler_data$sampler_originY = double_octave_sampler_data.varHandle(MemoryLayout.PathElement.groupElement("sampler_originY"));
|
||||
public static final VarHandle double_octave_sampler_data$sampler_originZ = double_octave_sampler_data.varHandle(MemoryLayout.PathElement.groupElement("sampler_originZ"));
|
||||
public static final VarHandle double_octave_sampler_data$amplitudes = double_octave_sampler_data.varHandle(MemoryLayout.PathElement.groupElement("amplitudes"));
|
||||
// c2me_natives_noise_interpolated, double, (const interpolated_noise_sampler_t *const data, const double x, const double y, const double z)
|
||||
public static final MethodHandle c2me_natives_noise_interpolated = NativeLoader.linker.downcallHandle(
|
||||
FunctionDescriptor.of(
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE
|
||||
),
|
||||
Linker.Option.critical(false)
|
||||
);
|
||||
public static final MethodHandle c2me_natives_noise_interpolated_ptr = NativeLoader.linker.downcallHandle(
|
||||
FunctionDescriptor.of(
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_LONG,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE,
|
||||
ValueLayout.JAVA_DOUBLE
|
||||
),
|
||||
Linker.Option.critical(false)
|
||||
);
|
||||
// typedef const struct interpolated_noise_sub_sampler {
|
||||
// const aligned_uint8_ptr sampler_permutations;
|
||||
// const aligned_double_ptr sampler_originX;
|
||||
// const aligned_double_ptr sampler_originY;
|
||||
// const aligned_double_ptr sampler_originZ;
|
||||
// const aligned_double_ptr sampler_mulFactor;
|
||||
// const uint32_t length;
|
||||
// } interpolated_noise_sub_sampler_t;
|
||||
public static final StructLayout interpolated_noise_sub_sampler = MemoryLayout.structLayout(
|
||||
ValueLayout.ADDRESS.withName("sampler_permutations"),
|
||||
ValueLayout.ADDRESS.withName("sampler_originX"),
|
||||
ValueLayout.ADDRESS.withName("sampler_originY"),
|
||||
ValueLayout.ADDRESS.withName("sampler_originZ"),
|
||||
ValueLayout.ADDRESS.withName("sampler_mulFactor"),
|
||||
ValueLayout.JAVA_INT.withName("length"),
|
||||
MemoryLayout.paddingLayout(4)
|
||||
).withName("interpolated_noise_sub_sampler_t");
|
||||
// typedef const struct interpolated_noise_sampler {
|
||||
// const double scaledXzScale;
|
||||
// const double scaledYScale;
|
||||
// const double xzFactor;
|
||||
// const double yFactor;
|
||||
// const double smearScaleMultiplier;
|
||||
// const double xzScale;
|
||||
// const double yScale;
|
||||
//
|
||||
// const interpolated_noise_sub_sampler_t lower;
|
||||
// const interpolated_noise_sub_sampler_t upper;
|
||||
// const interpolated_noise_sub_sampler_t normal;
|
||||
// } interpolated_noise_sampler_t;
|
||||
public static final StructLayout interpolated_noise_sampler = MemoryLayout.structLayout(
|
||||
ValueLayout.JAVA_DOUBLE.withName("scaledXzScale"),
|
||||
ValueLayout.JAVA_DOUBLE.withName("scaledYScale"),
|
||||
ValueLayout.JAVA_DOUBLE.withName("xzFactor"),
|
||||
ValueLayout.JAVA_DOUBLE.withName("yFactor"),
|
||||
ValueLayout.JAVA_DOUBLE.withName("smearScaleMultiplier"),
|
||||
ValueLayout.JAVA_DOUBLE.withName("xzScale"),
|
||||
ValueLayout.JAVA_DOUBLE.withName("yScale"),
|
||||
|
||||
interpolated_noise_sub_sampler.withName("lower"),
|
||||
interpolated_noise_sub_sampler.withName("upper"),
|
||||
interpolated_noise_sub_sampler.withName("normal")
|
||||
).withByteAlignment(32).withName("interpolated_noise_sampler_t");
|
||||
public static final VarHandle interpolated_noise_sampler$scaledXzScale = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("scaledXzScale"));
|
||||
public static final VarHandle interpolated_noise_sampler$scaledYScale = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("scaledYScale"));
|
||||
public static final VarHandle interpolated_noise_sampler$xzFactor = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("xzFactor"));
|
||||
public static final VarHandle interpolated_noise_sampler$yFactor = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("yFactor"));
|
||||
public static final VarHandle interpolated_noise_sampler$smearScaleMultiplier = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("smearScaleMultiplier"));
|
||||
public static final VarHandle interpolated_noise_sampler$xzScale = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("xzScale"));
|
||||
public static final VarHandle interpolated_noise_sampler$yScale = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("yScale"));
|
||||
public static final VarHandle interpolated_noise_sampler$lower$sampler_permutations = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("lower"), MemoryLayout.PathElement.groupElement("sampler_permutations"));
|
||||
public static final VarHandle interpolated_noise_sampler$lower$sampler_originX = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("lower"), MemoryLayout.PathElement.groupElement("sampler_originX"));
|
||||
public static final VarHandle interpolated_noise_sampler$lower$sampler_originY = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("lower"), MemoryLayout.PathElement.groupElement("sampler_originY"));
|
||||
public static final VarHandle interpolated_noise_sampler$lower$sampler_originZ = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("lower"), MemoryLayout.PathElement.groupElement("sampler_originZ"));
|
||||
public static final VarHandle interpolated_noise_sampler$lower$sampler_mulFactor = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("lower"), MemoryLayout.PathElement.groupElement("sampler_mulFactor"));
|
||||
public static final VarHandle interpolated_noise_sampler$lower$length = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("lower"), MemoryLayout.PathElement.groupElement("length"));
|
||||
public static final VarHandle interpolated_noise_sampler$upper$sampler_permutations = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("upper"), MemoryLayout.PathElement.groupElement("sampler_permutations"));
|
||||
public static final VarHandle interpolated_noise_sampler$upper$sampler_originX = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("upper"), MemoryLayout.PathElement.groupElement("sampler_originX"));
|
||||
public static final VarHandle interpolated_noise_sampler$upper$sampler_originY = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("upper"), MemoryLayout.PathElement.groupElement("sampler_originY"));
|
||||
public static final VarHandle interpolated_noise_sampler$upper$sampler_originZ = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("upper"), MemoryLayout.PathElement.groupElement("sampler_originZ"));
|
||||
public static final VarHandle interpolated_noise_sampler$upper$sampler_mulFactor = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("upper"), MemoryLayout.PathElement.groupElement("sampler_mulFactor"));
|
||||
public static final VarHandle interpolated_noise_sampler$upper$length = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("upper"), MemoryLayout.PathElement.groupElement("length"));
|
||||
public static final VarHandle interpolated_noise_sampler$normal$sampler_permutations = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("normal"), MemoryLayout.PathElement.groupElement("sampler_permutations"));
|
||||
public static final VarHandle interpolated_noise_sampler$normal$sampler_originX = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("normal"), MemoryLayout.PathElement.groupElement("sampler_originX"));
|
||||
public static final VarHandle interpolated_noise_sampler$normal$sampler_originY = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("normal"), MemoryLayout.PathElement.groupElement("sampler_originY"));
|
||||
public static final VarHandle interpolated_noise_sampler$normal$sampler_originZ = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("normal"), MemoryLayout.PathElement.groupElement("sampler_originZ"));
|
||||
public static final VarHandle interpolated_noise_sampler$normal$sampler_mulFactor = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("normal"), MemoryLayout.PathElement.groupElement("sampler_mulFactor"));
|
||||
public static final VarHandle interpolated_noise_sampler$normal$length = interpolated_noise_sampler.varHandle(MemoryLayout.PathElement.groupElement("normal"), MemoryLayout.PathElement.groupElement("length"));
|
||||
// c2me_natives_end_islands_sample, float, (const int32_t *const simplex_permutations, const int32_t x, const int32_t z)
|
||||
public static final MethodHandle c2me_natives_end_islands_sample = NativeLoader.linker.downcallHandle(
|
||||
FunctionDescriptor.of(
|
||||
ValueLayout.JAVA_FLOAT,
|
||||
ValueLayout.ADDRESS,
|
||||
ValueLayout.JAVA_INT,
|
||||
ValueLayout.JAVA_INT
|
||||
),
|
||||
Linker.Option.critical(true)
|
||||
);
|
||||
public static final MethodHandle c2me_natives_end_islands_sample_ptr = NativeLoader.linker.downcallHandle(
|
||||
FunctionDescriptor.of(
|
||||
ValueLayout.JAVA_FLOAT,
|
||||
ValueLayout.JAVA_LONG,
|
||||
ValueLayout.JAVA_INT,
|
||||
ValueLayout.JAVA_INT
|
||||
),
|
||||
Linker.Option.critical(false)
|
||||
);
|
||||
// c2me_natives_biome_access_sample, uint32_t, (const int64_t theSeed, const int32_t x, const int32_t y, const int32_t z)
|
||||
public static final MethodHandle c2me_natives_biome_access_sample = NativeLoader.linker.downcallHandle(
|
||||
FunctionDescriptor.of(
|
||||
ValueLayout.JAVA_INT,
|
||||
ValueLayout.JAVA_LONG,
|
||||
ValueLayout.JAVA_INT,
|
||||
ValueLayout.JAVA_INT,
|
||||
ValueLayout.JAVA_INT
|
||||
),
|
||||
Linker.Option.critical(false)
|
||||
);
|
||||
|
||||
public static MemorySegment double_octave_sampler_data$create(Arena arena, @NotNull PerlinNoise firstSampler, PerlinNoise secondSampler, double amplitude) {
|
||||
long nonNullSamplerCount = 0;
|
||||
for (ImprovedNoise sampler : (firstSampler.noiseLevels)) {
|
||||
if (sampler != null) {
|
||||
nonNullSamplerCount++;
|
||||
}
|
||||
}
|
||||
for (ImprovedNoise sampler : (secondSampler.noiseLevels)) {
|
||||
if (sampler != null) {
|
||||
nonNullSamplerCount++;
|
||||
}
|
||||
}
|
||||
final MemorySegment data = arena.allocate(double_octave_sampler_data.byteSize(), 64);
|
||||
final MemorySegment need_shift = arena.allocate(nonNullSamplerCount, 64);
|
||||
final MemorySegment lacunarity_powd = arena.allocate(nonNullSamplerCount * 8, 64);
|
||||
final MemorySegment persistence_powd = arena.allocate(nonNullSamplerCount * 8, 64);
|
||||
final MemorySegment sampler_permutations = arena.allocate(nonNullSamplerCount * 256 * 4, 64);
|
||||
final MemorySegment sampler_originX = arena.allocate(nonNullSamplerCount * 8, 64);
|
||||
final MemorySegment sampler_originY = arena.allocate(nonNullSamplerCount * 8, 64);
|
||||
final MemorySegment sampler_originZ = arena.allocate(nonNullSamplerCount * 8, 64);
|
||||
final MemorySegment amplitudes = arena.allocate(nonNullSamplerCount * 8, 64);
|
||||
double_octave_sampler_data$length.set(data, 0L, nonNullSamplerCount);
|
||||
double_octave_sampler_data$amplitude.set(data, 0L, amplitude);
|
||||
double_octave_sampler_data$need_shift.set(data, 0L, need_shift);
|
||||
double_octave_sampler_data$lacunarity_powd.set(data, 0L, lacunarity_powd);
|
||||
double_octave_sampler_data$persistence_powd.set(data, 0L, persistence_powd);
|
||||
double_octave_sampler_data$sampler_permutations.set(data, 0L, sampler_permutations);
|
||||
double_octave_sampler_data$sampler_originX.set(data, 0L, sampler_originX);
|
||||
double_octave_sampler_data$sampler_originY.set(data, 0L, sampler_originY);
|
||||
double_octave_sampler_data$sampler_originZ.set(data, 0L, sampler_originZ);
|
||||
double_octave_sampler_data$amplitudes.set(data, 0L, amplitudes);
|
||||
long index = 0;
|
||||
{
|
||||
ImprovedNoise[] octaveSamplers = (firstSampler.noiseLevels);
|
||||
for (int i = 0, octaveSamplersLength = octaveSamplers.length; i < octaveSamplersLength; i++) {
|
||||
ImprovedNoise sampler = octaveSamplers[i];
|
||||
if (sampler != null) {
|
||||
need_shift.set(ValueLayout.JAVA_BOOLEAN, index, false);
|
||||
lacunarity_powd.set(ValueLayout.JAVA_DOUBLE, index * 8, (firstSampler.lowestFreqInputFactor) * Math.pow(2.0, i));
|
||||
persistence_powd.set(ValueLayout.JAVA_DOUBLE, index * 8, (firstSampler.lowestFreqValueFactor) * Math.pow(2.0, -i));
|
||||
MemorySegment.copy(MemorySegment.ofArray(MemoryUtil.byte2int(sampler.p)), 0, sampler_permutations, index * 256L * 4L, 256 * 4);
|
||||
sampler_originX.set(ValueLayout.JAVA_DOUBLE, index * 8, sampler.xo);
|
||||
sampler_originY.set(ValueLayout.JAVA_DOUBLE, index * 8, sampler.yo);
|
||||
sampler_originZ.set(ValueLayout.JAVA_DOUBLE, index * 8, sampler.zo);
|
||||
amplitudes.set(ValueLayout.JAVA_DOUBLE, index * 8, (firstSampler.amplitudes).getDouble(i));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
ImprovedNoise[] octaveSamplers = (secondSampler.noiseLevels);
|
||||
for (int i = 0, octaveSamplersLength = octaveSamplers.length; i < octaveSamplersLength; i++) {
|
||||
ImprovedNoise sampler = octaveSamplers[i];
|
||||
if (sampler != null) {
|
||||
need_shift.set(ValueLayout.JAVA_BOOLEAN, index, true);
|
||||
lacunarity_powd.set(ValueLayout.JAVA_DOUBLE, index * 8, (secondSampler.lowestFreqInputFactor) * Math.pow(2.0, i));
|
||||
persistence_powd.set(ValueLayout.JAVA_DOUBLE, index * 8, (secondSampler.lowestFreqValueFactor) * Math.pow(2.0, -i));
|
||||
MemorySegment.copy(MemorySegment.ofArray(MemoryUtil.byte2int(sampler.p)), 0, sampler_permutations, index * 256L * 4L, 256 * 4);
|
||||
sampler_originX.set(ValueLayout.JAVA_DOUBLE, index * 8, sampler.xo);
|
||||
sampler_originY.set(ValueLayout.JAVA_DOUBLE, index * 8, sampler.yo);
|
||||
sampler_originZ.set(ValueLayout.JAVA_DOUBLE, index * 8, sampler.zo);
|
||||
amplitudes.set(ValueLayout.JAVA_DOUBLE, index * 8, (secondSampler.amplitudes).getDouble(i));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VarHandle.fullFence();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public static boolean interpolated_noise_sampler$isSpecializedBase3dNoiseFunction(BlendedNoise interpolated) {
|
||||
return IntStream.range(0, 16).mapToObj((interpolated).minLimitNoise::getOctaveNoise).filter(Objects::nonNull).count() == 16 &&
|
||||
IntStream.range(0, 16).mapToObj((interpolated).maxLimitNoise::getOctaveNoise).filter(Objects::nonNull).count() == 16 &&
|
||||
IntStream.range(0, 8).mapToObj((interpolated).mainNoise::getOctaveNoise).filter(Objects::nonNull).count() == 8;
|
||||
}
|
||||
|
||||
public static MemorySegment interpolated_noise_sampler$create(@NotNull Arena arena, BlendedNoise interpolated) {
|
||||
final MemorySegment data = arena.allocate(interpolated_noise_sampler.byteSize(), 64);
|
||||
interpolated_noise_sampler$scaledXzScale.set(data, 0L, (interpolated).xzMultiplier);
|
||||
interpolated_noise_sampler$scaledYScale.set(data, 0L, (interpolated).yMultiplier);
|
||||
interpolated_noise_sampler$xzFactor.set(data, 0L, (interpolated).xzFactor);
|
||||
interpolated_noise_sampler$yFactor.set(data, 0L, (interpolated).yFactor);
|
||||
interpolated_noise_sampler$smearScaleMultiplier.set(data, 0L, (interpolated).smearScaleMultiplier);
|
||||
interpolated_noise_sampler$xzScale.set(data, 0L, (interpolated).xzScale);
|
||||
interpolated_noise_sampler$yScale.set(data, 0L, (interpolated).yScale);
|
||||
|
||||
// if (true) {
|
||||
// System.out.println(String.format("Interpolated total: %d", countNonNull));
|
||||
// System.out.println(String.format("lower: %d", IntStream.range(0, 16).mapToObj(((IInterpolatedNoiseSampler) interpolated).getLowerInterpolatedNoise()::getOctave).filter(Objects::nonNull).count()));
|
||||
// System.out.println(String.format("upper: %d", IntStream.range(0, 16).mapToObj(((IInterpolatedNoiseSampler) interpolated).getUpperInterpolatedNoise()::getOctave).filter(Objects::nonNull).count()));
|
||||
// System.out.println(String.format("normal: %d", IntStream.range(0, 8).mapToObj(((IInterpolatedNoiseSampler) interpolated).getInterpolationNoise()::getOctave).filter(Objects::nonNull).count()));
|
||||
// }
|
||||
|
||||
final MemorySegment sampler_permutations = arena.allocate(40 * 256L * 4L, 64);
|
||||
final MemorySegment sampler_originX = arena.allocate(40 * 8L, 64);
|
||||
final MemorySegment sampler_originY = arena.allocate(40 * 8L, 64);
|
||||
final MemorySegment sampler_originZ = arena.allocate(40 * 8L, 64);
|
||||
final MemorySegment sampler_mulFactor = arena.allocate(40 * 8L, 64);
|
||||
|
||||
int index = 0;
|
||||
|
||||
{
|
||||
int startIndex = index;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
ImprovedNoise sampler = (interpolated.mainNoise).getOctaveNoise(i);
|
||||
if (sampler != null) {
|
||||
MemorySegment.copy(MemorySegment.ofArray(MemoryUtil.byte2int(sampler.p)), 0, sampler_permutations, index * 256L * 4L, 256 * 4);
|
||||
sampler_originX.set(ValueLayout.JAVA_DOUBLE, index * 8L, sampler.xo);
|
||||
sampler_originY.set(ValueLayout.JAVA_DOUBLE, index * 8L, sampler.yo);
|
||||
sampler_originZ.set(ValueLayout.JAVA_DOUBLE, index * 8L, sampler.zo);
|
||||
sampler_mulFactor.set(ValueLayout.JAVA_DOUBLE, index * 8L, Math.pow(2, -i));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
BindingsTemplate.interpolated_noise_sampler$normal$sampler_permutations.set(data, 0L, sampler_permutations.asSlice(startIndex * 256L * 4L));
|
||||
BindingsTemplate.interpolated_noise_sampler$normal$sampler_originX.set(data, 0L, sampler_originX.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$normal$sampler_originY.set(data, 0L, sampler_originY.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$normal$sampler_originZ.set(data, 0L, sampler_originZ.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$normal$sampler_mulFactor.set(data, 0L, sampler_mulFactor.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$normal$length.set(data, 0L, index - startIndex);
|
||||
}
|
||||
|
||||
{
|
||||
int startIndex = index = 8;
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
ImprovedNoise sampler = (interpolated.minLimitNoise).getOctaveNoise(i);
|
||||
if (sampler != null) {
|
||||
MemorySegment.copy(MemorySegment.ofArray(MemoryUtil.byte2int(sampler.p)), 0, sampler_permutations, index * 256L * 4L, 256 * 4);
|
||||
sampler_originX.set(ValueLayout.JAVA_DOUBLE, index * 8L, sampler.xo);
|
||||
sampler_originY.set(ValueLayout.JAVA_DOUBLE, index * 8L, sampler.yo);
|
||||
sampler_originZ.set(ValueLayout.JAVA_DOUBLE, index * 8L, sampler.zo);
|
||||
sampler_mulFactor.set(ValueLayout.JAVA_DOUBLE, index * 8L, Math.pow(2, -i));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
BindingsTemplate.interpolated_noise_sampler$lower$sampler_permutations.set(data, 0L, sampler_permutations.asSlice(startIndex * 256L * 4L));
|
||||
BindingsTemplate.interpolated_noise_sampler$lower$sampler_originX.set(data, 0L, sampler_originX.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$lower$sampler_originY.set(data, 0L, sampler_originY.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$lower$sampler_originZ.set(data, 0L, sampler_originZ.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$lower$sampler_mulFactor.set(data, 0L, sampler_mulFactor.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$lower$length.set(data, 0L, index - startIndex);
|
||||
}
|
||||
|
||||
{
|
||||
int startIndex = index = 8 + 16;
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
ImprovedNoise sampler = (interpolated.maxLimitNoise).getOctaveNoise(i);
|
||||
if (sampler != null) {
|
||||
MemorySegment.copy(MemorySegment.ofArray(MemoryUtil.byte2int(sampler.p)), 0, sampler_permutations, index * 256L * 4L, 256 * 4);
|
||||
sampler_originX.set(ValueLayout.JAVA_DOUBLE, index * 8L, sampler.xo);
|
||||
sampler_originY.set(ValueLayout.JAVA_DOUBLE, index * 8L, sampler.yo);
|
||||
sampler_originZ.set(ValueLayout.JAVA_DOUBLE, index * 8L, sampler.zo);
|
||||
sampler_mulFactor.set(ValueLayout.JAVA_DOUBLE, index * 8L, Math.pow(2, -i));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
BindingsTemplate.interpolated_noise_sampler$upper$sampler_permutations.set(data, 0L, sampler_permutations.asSlice(startIndex * 256L * 4L));
|
||||
BindingsTemplate.interpolated_noise_sampler$upper$sampler_originX.set(data, 0L, sampler_originX.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$upper$sampler_originY.set(data, 0L, sampler_originY.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$upper$sampler_originZ.set(data, 0L, sampler_originZ.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$upper$sampler_mulFactor.set(data, 0L, sampler_mulFactor.asSlice(startIndex * 8L));
|
||||
BindingsTemplate.interpolated_noise_sampler$upper$length.set(data, 0L, index - startIndex);
|
||||
}
|
||||
|
||||
VarHandle.fullFence();
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package org.bxteam.divinemc.math;
|
||||
|
||||
import org.bxteam.divinemc.math.isa.ISA_aarch64;
|
||||
import org.bxteam.divinemc.math.isa.ISA_x86_64;
|
||||
|
||||
public interface ISATarget {
|
||||
int ordinal();
|
||||
|
||||
String getSuffix();
|
||||
|
||||
boolean isNativelySupported();
|
||||
|
||||
static Class<? extends Enum<? extends ISATarget>> getInstance() {
|
||||
return switch (NativeLoader.NORMALIZED_ARCH) {
|
||||
case "x86_64" -> ISA_x86_64.class;
|
||||
case "aarch_64" -> ISA_aarch64.class;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
package org.bxteam.divinemc.math;
|
||||
|
||||
import io.netty.util.internal.SystemPropertyUtil;
|
||||
import org.bxteam.divinemc.DivineConfig;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.foreign.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Locale;
|
||||
|
||||
public class NativeLoader {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(NativeLoader.class);
|
||||
|
||||
public static final String NORMALIZED_ARCH = normalizeArch(SystemPropertyUtil.get("os.arch", ""));
|
||||
public static final String NORMALIZED_OS = normalizeOs(SystemPropertyUtil.get("os.name", ""));
|
||||
|
||||
private static final Arena arena = Arena.ofAuto();
|
||||
public static final SymbolLookup lookup;
|
||||
public static final Linker linker = Linker.nativeLinker();
|
||||
public static final ISATarget currentMachineTarget;
|
||||
|
||||
static {
|
||||
String libName = String.format("%s-%s-%s", NORMALIZED_OS, NORMALIZED_ARCH, System.mapLibraryName("c2me-opts-natives-math"));
|
||||
lookup = load0(libName);
|
||||
if (lookup == null) {
|
||||
currentMachineTarget = null;
|
||||
DivineConfig.nativeAccelerationEnabled = false;
|
||||
LOGGER.warn("Disabling native math optimization due to unsupported platform.");
|
||||
} else {
|
||||
try {
|
||||
LOGGER.info("Attempting to call native library. If your game crashes right after this point, native acceleration may not be available for your system.");
|
||||
int level = (int) linker.downcallHandle(
|
||||
lookup.find("c2me_natives_get_system_isa").get(),
|
||||
FunctionDescriptor.of(
|
||||
ValueLayout.JAVA_INT,
|
||||
ValueLayout.JAVA_BOOLEAN
|
||||
)
|
||||
).invokeExact(DivineConfig.allowAVX512);
|
||||
ISATarget target;
|
||||
if (DivineConfig.isaTargetLevelOverride != -1) {
|
||||
target = (ISATarget) ISATarget.getInstance().getEnumConstants()[DivineConfig.isaTargetLevelOverride];
|
||||
} else {
|
||||
target = (ISATarget) ISATarget.getInstance().getEnumConstants()[level];
|
||||
while (!target.isNativelySupported()) target = (ISATarget) ISATarget.getInstance().getEnumConstants()[target.ordinal() - 1];
|
||||
}
|
||||
currentMachineTarget = target;
|
||||
LOGGER.info("Detected maximum supported ISA target: {}", currentMachineTarget);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Contract(pure = true)
|
||||
public static @NotNull String getAvailabilityString() {
|
||||
if (lookup != null) {
|
||||
return String.format("Available, with ISA target %s", currentMachineTarget);
|
||||
} else {
|
||||
return "Unavailable";
|
||||
}
|
||||
}
|
||||
|
||||
private static @Nullable SymbolLookup load0(String libName) {
|
||||
// load from resources
|
||||
try (final InputStream in = NativeLoader.class.getClassLoader().getResourceAsStream(libName)) {
|
||||
if (in == null) {
|
||||
LOGGER.warn("Cannot find native library {}, possibly unsupported platform for native acceleration", libName);
|
||||
return null;
|
||||
}
|
||||
final Path tempFile;
|
||||
if (Boolean.getBoolean("vectorizedgen.preserveNative")) {
|
||||
tempFile = Path.of(".", libName);
|
||||
} else {
|
||||
tempFile = Files.createTempFile(null, libName);
|
||||
tempFile.toFile().deleteOnExit();
|
||||
}
|
||||
Files.copy(in, tempFile, StandardCopyOption.REPLACE_EXISTING);
|
||||
return SymbolLookup.libraryLookup(tempFile, arena);
|
||||
} catch (Throwable e) {
|
||||
LOGGER.warn("Failed to load native library", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static @NotNull String normalize(@NotNull String value) {
|
||||
return value.toLowerCase(Locale.US).replaceAll("[^a-z0-9]+", "");
|
||||
}
|
||||
|
||||
private static @NotNull String normalizeArch(String value) {
|
||||
value = normalize(value);
|
||||
if (value.matches("^(x8664|amd64|ia32e|em64t|x64)$")) {
|
||||
return "x86_64";
|
||||
}
|
||||
if (value.matches("^(x8632|x86|i[3-6]86|ia32|x32)$")) {
|
||||
return "x86_32";
|
||||
}
|
||||
if (value.matches("^(ia64|itanium64)$")) {
|
||||
return "itanium_64";
|
||||
}
|
||||
if (value.matches("^(sparc|sparc32)$")) {
|
||||
return "sparc_32";
|
||||
}
|
||||
if (value.matches("^(sparcv9|sparc64)$")) {
|
||||
return "sparc_64";
|
||||
}
|
||||
if (value.matches("^(arm|arm32)$")) {
|
||||
return "arm_32";
|
||||
}
|
||||
if ("aarch64".equals(value)) {
|
||||
return "aarch_64";
|
||||
}
|
||||
if (value.matches("^(ppc|ppc32)$")) {
|
||||
return "ppc_32";
|
||||
}
|
||||
if ("ppc64".equals(value)) {
|
||||
return "ppc_64";
|
||||
}
|
||||
if ("ppc64le".equals(value)) {
|
||||
return "ppcle_64";
|
||||
}
|
||||
if ("s390".equals(value)) {
|
||||
return "s390_32";
|
||||
}
|
||||
if ("s390x".equals(value)) {
|
||||
return "s390_64";
|
||||
}
|
||||
if ("loongarch64".equals(value)) {
|
||||
return "loongarch_64";
|
||||
}
|
||||
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
private static @NotNull String normalizeOs(String value) {
|
||||
value = normalize(value);
|
||||
if (value.startsWith("aix")) {
|
||||
return "aix";
|
||||
}
|
||||
if (value.startsWith("hpux")) {
|
||||
return "hpux";
|
||||
}
|
||||
if (value.startsWith("os400")) {
|
||||
// Avoid the names such as os4000
|
||||
if (value.length() <= 5 || !Character.isDigit(value.charAt(5))) {
|
||||
return "os400";
|
||||
}
|
||||
}
|
||||
if (value.startsWith("linux")) {
|
||||
return "linux";
|
||||
}
|
||||
if (value.startsWith("macosx") || value.startsWith("osx") || value.startsWith("darwin")) {
|
||||
return "osx";
|
||||
}
|
||||
if (value.startsWith("freebsd")) {
|
||||
return "freebsd";
|
||||
}
|
||||
if (value.startsWith("openbsd")) {
|
||||
return "openbsd";
|
||||
}
|
||||
if (value.startsWith("netbsd")) {
|
||||
return "netbsd";
|
||||
}
|
||||
if (value.startsWith("solaris") || value.startsWith("sunos")) {
|
||||
return "sunos";
|
||||
}
|
||||
if (value.startsWith("windows")) {
|
||||
return "windows";
|
||||
}
|
||||
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package org.bxteam.divinemc.math.isa;
|
||||
|
||||
import org.bxteam.divinemc.math.ISATarget;
|
||||
|
||||
public enum ISA_aarch64 implements ISATarget {
|
||||
GENERIC("_generic", true);
|
||||
|
||||
private final String suffix;
|
||||
private final boolean nativelySupported;
|
||||
|
||||
ISA_aarch64(String suffix, boolean nativelySupported) {
|
||||
this.suffix = suffix;
|
||||
this.nativelySupported = nativelySupported;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix() {
|
||||
return this.suffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNativelySupported() {
|
||||
return this.nativelySupported;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package org.bxteam.divinemc.math.isa;
|
||||
|
||||
import org.bxteam.divinemc.math.ISATarget;
|
||||
|
||||
public enum ISA_x86_64 implements ISATarget {
|
||||
SSE2("_sse2", true), // 0
|
||||
SSE4_1("_sse2", false), // 1, not implemented
|
||||
SSE4_2("_sse4_2", true), // 2
|
||||
AVX("_avx", true), // 3
|
||||
AVX2("_avx2", true), // 4
|
||||
AVX2ADL("_avx2adl", true), // 5
|
||||
AVX512KNL("_avx2", false), // 6, not implemented
|
||||
AVX512SKX("_avx512skx", true), // 7
|
||||
AVX512ICL("_avx512icl", true), // 8
|
||||
AVX512SPR("_avx512spr", true); // 9
|
||||
|
||||
private final String suffix;
|
||||
private final boolean nativelySupported;
|
||||
|
||||
ISA_x86_64(String suffix, boolean nativelySupported) {
|
||||
this.suffix = suffix;
|
||||
this.nativelySupported = nativelySupported;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix() {
|
||||
return this.suffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNativelySupported() {
|
||||
return this.nativelySupported;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user