Auburn / FastNoiseLite

Fast Portable Noise Library - C# C++ C Java HLSL GLSL JavaScript Rust Go

Home Page:http://auburn.github.io/FastNoiseLite/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

non-empty case statements must have break or return at kernel xxx at noise.compute(697) (on d3d11)

timczm opened this issue · comments

fnlDomainWarp3D can not work, But fnlDomainWarp2D can work.

error stacktrace:

non-empty case statements must have break or return at kernel xxx at noise.compute(697) (on d3d11)

here is the code:

[numthreads(8, 8, 1)]
void generate_city(uint3 id : SV_DispatchThreadID)
{
    fnl_state city_noise = fnlCreateState();
    city_noise.noise_type = FNL_NOISE_CELLULAR;
    city_noise.rotation_type_3d = FNL_ROTATION_NONE;
    city_noise.seed = Seed;
    city_noise.frequency = 0.025;
    city_noise.fractal_type = FNL_FRACTAL_NONE;
    city_noise.octaves = 5;
    city_noise.lacunarity = 2.0;
    city_noise.gain = 0.5;
    city_noise.weighted_strength = 0;
    city_noise.ping_pong_strength = 2.0;
    city_noise.cellular_distance_func = FNL_CELLULAR_DISTANCE_HYBRID;
    city_noise.cellular_return_type = FNL_CELLULAR_RETURN_TYPE_CELLVALUE;
    city_noise.cellular_jitter_mod = 1;
    
    fnl_state city_wrap_noise = fnlCreateState();
    city_wrap_noise.seed = Seed;
    city_wrap_noise.domain_warp_type = FNL_DOMAIN_WARP_OPENSIMPLEX2;
    city_wrap_noise.rotation_type_3d = FNL_ROTATION_NONE;
    city_wrap_noise.domain_warp_amp = 70;
    city_wrap_noise.frequency = 0.020;
    city_wrap_noise.fractal_type = FNL_FRACTAL_DOMAIN_WARP_INDEPENDENT;
    city_wrap_noise.octaves = 3;
    city_wrap_noise.lacunarity = 2.0;
    city_wrap_noise.gain = 0.5;
    
    // statement after this can not work
    float3 fl = int2_to_float3(id.xy);
    FNLfloat fx = fl.x, fy = fl.y, fz = fl.z;
    fnlDomainWarp3D(city_wrap_noise, fx, fy, fz); // ops! here is an error
    float value = fnlGetNoise3D(city_noise, fx, fy, fz);
    
    // statement after this can work
    // FNLfloat xf = id.x, yf = id.y;
    // fnlDomainWarp2D(city_wrap_noise, xf, yf);
    // float value = fnlGetNoise2D(city_noise, xf, yf);

    cities[id.x * SizeY + id.y] = (value + 1.0) / 2.0;
}

float3 int2_to_float3(int2 v)
{
    float3 result;
    result.x = v.x;
    float r = SizeY / 2.0 / PI;
    float radian = 2.0 * PI * v.y / SizeY;
    result.y = cos(radian) * r;
    result.z = sin(radian) * r;
    return result;
}

Can you test if adding break; after line 712 solves the issue

Great! It can works now.