diff options
| -rw-r--r-- | sokol_gfx.h | 18 | ||||
| -rw-r--r-- | tests/functional/sokol_gfx_test.c | 26 | ||||
| -rw-r--r-- | tests/functional/sokol_spine_test.c | 2 | ||||
| -rw-r--r-- | util/sokol_fontstash.h | 1 | ||||
| -rw-r--r-- | util/sokol_gfx_imgui.h | 1 | ||||
| -rw-r--r-- | util/sokol_imgui.h | 1 | ||||
| -rw-r--r-- | util/sokol_spine.h | 24 |
7 files changed, 21 insertions, 52 deletions
diff --git a/sokol_gfx.h b/sokol_gfx.h index 7e94f9d1..35c81e7d 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -2098,13 +2098,10 @@ typedef enum sg_primitive_type { used in the sg_sampler_desc.min_filter, sg_sampler_desc.mag_filter and sg_sampler_desc.mipmap_filter members when creating a sampler object. - For min_filter and mag_filter the default is SG_FILTER_NEAREST. - - For mipmap_filter the default is SG_FILTER_NONE. + For the default is SG_FILTER_NEAREST. */ typedef enum sg_filter { _SG_FILTER_DEFAULT, // value 0 reserved for default-init - SG_FILTER_NONE, // FIXME: deprecated SG_FILTER_NEAREST, SG_FILTER_LINEAR, _SG_FILTER_NUM, @@ -2893,7 +2890,7 @@ typedef struct sg_image_desc { .min_filter: SG_FILTER_NEAREST .mag_filter: SG_FILTER_NEAREST - .mipmap_filter SG_FILTER_NONE + .mipmap_filter SG_FILTER_NEAREST .wrap_u: SG_WRAP_REPEAT .wrap_v: SG_WRAP_REPEAT .wrap_w: SG_WRAP_REPEAT (only SG_IMAGETYPE_3D) @@ -3652,8 +3649,6 @@ typedef struct sg_frame_stats { _SG_LOGITEM_XMACRO(VALIDATE_IMAGEDESC_DYNAMIC_NO_DATA, "dynamic/stream images cannot be initialized with data") \ _SG_LOGITEM_XMACRO(VALIDATE_IMAGEDESC_COMPRESSED_IMMUTABLE, "compressed images must be immutable") \ _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_CANARY, "sg_sampler_desc not initialized") \ - _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_MINFILTER_NONE, "sg_sampler_desc.min_filter cannot be SG_FILTER_NONE") \ - _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_MAGFILTER_NONE, "sg_sampler_desc.mag_filter cannot be SG_FILTER_NONE") \ _SG_LOGITEM_XMACRO(VALIDATE_SAMPLERDESC_ANISTROPIC_REQUIRES_LINEAR_FILTERING, "sg_sampler_desc.max_anisotropy > 1 requires min/mag/mipmap_filter to be SG_FILTER_LINEAR") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_CANARY, "sg_shader_desc not initialized") \ _SG_LOGITEM_XMACRO(VALIDATE_SHADERDESC_SOURCE, "shader source code required") \ @@ -7161,14 +7156,12 @@ _SOKOL_PRIVATE GLenum _sg_gl_blend_op(sg_blend_op op) { _SOKOL_PRIVATE GLenum _sg_gl_min_filter(sg_filter min_f, sg_filter mipmap_f) { if (min_f == SG_FILTER_NEAREST) { switch (mipmap_f) { - case SG_FILTER_NONE: return GL_NEAREST; case SG_FILTER_NEAREST: return GL_NEAREST_MIPMAP_NEAREST; case SG_FILTER_LINEAR: return GL_NEAREST_MIPMAP_LINEAR; default: SOKOL_UNREACHABLE; return (GLenum)0; } } else if (min_f == SG_FILTER_LINEAR) { switch (mipmap_f) { - case SG_FILTER_NONE: return GL_LINEAR; case SG_FILTER_NEAREST: return GL_LINEAR_MIPMAP_NEAREST; case SG_FILTER_LINEAR: return GL_LINEAR_MIPMAP_LINEAR; default: SOKOL_UNREACHABLE; return (GLenum)0; @@ -11907,8 +11900,6 @@ _SOKOL_PRIVATE MTLSamplerMinMagFilter _sg_mtl_minmag_filter(sg_filter f) { _SOKOL_PRIVATE MTLSamplerMipFilter _sg_mtl_mipmap_filter(sg_filter f) { switch (f) { - case SG_FILTER_NONE: - return MTLSamplerMipFilterNotMipmapped; case SG_FILTER_NEAREST: return MTLSamplerMipFilterNearest; case SG_FILTER_LINEAR: @@ -13464,7 +13455,6 @@ _SOKOL_PRIVATE WGPUFilterMode _sg_wgpu_sampler_minmag_filter(sg_filter f) { _SOKOL_PRIVATE WGPUMipmapFilterMode _sg_wgpu_sampler_mipmap_filter(sg_filter f) { switch (f) { - case SG_FILTER_NONE: case SG_FILTER_NEAREST: return WGPUMipmapFilterMode_Nearest; case SG_FILTER_LINEAR: @@ -16325,8 +16315,6 @@ _SOKOL_PRIVATE bool _sg_validate_sampler_desc(const sg_sampler_desc* desc) { _sg_validate_begin(); _SG_VALIDATE(desc->_start_canary == 0, VALIDATE_SAMPLERDESC_CANARY); _SG_VALIDATE(desc->_end_canary == 0, VALIDATE_SAMPLERDESC_CANARY); - _SG_VALIDATE(desc->min_filter != SG_FILTER_NONE, VALIDATE_SAMPLERDESC_MINFILTER_NONE); - _SG_VALIDATE(desc->mag_filter != SG_FILTER_NONE, VALIDATE_SAMPLERDESC_MAGFILTER_NONE); // restriction from WebGPU: when anisotropy > 1, all filters must be linear if (desc->max_anisotropy > 1) { _SG_VALIDATE((desc->min_filter == SG_FILTER_LINEAR) @@ -17146,7 +17134,7 @@ _SOKOL_PRIVATE sg_sampler_desc _sg_sampler_desc_defaults(const sg_sampler_desc* sg_sampler_desc def = *desc; def.min_filter = _sg_def(def.min_filter, SG_FILTER_NEAREST); def.mag_filter = _sg_def(def.mag_filter, SG_FILTER_NEAREST); - def.mipmap_filter = _sg_def(def.mipmap_filter, SG_FILTER_NONE); + def.mipmap_filter = _sg_def(def.mipmap_filter, SG_FILTER_NEAREST); def.wrap_u = _sg_def(def.wrap_u, SG_WRAP_REPEAT); def.wrap_v = _sg_def(def.wrap_v, SG_WRAP_REPEAT); def.wrap_w = _sg_def(def.wrap_w, SG_WRAP_REPEAT); diff --git a/tests/functional/sokol_gfx_test.c b/tests/functional/sokol_gfx_test.c index 121b3d0f..910d0814 100644 --- a/tests/functional/sokol_gfx_test.c +++ b/tests/functional/sokol_gfx_test.c @@ -429,7 +429,7 @@ UTEST(sokol_gfx, make_destroy_samplers) { T(smpptr->slot.state == SG_RESOURCESTATE_VALID); T(smpptr->cmn.min_filter == SG_FILTER_NEAREST); T(smpptr->cmn.mag_filter == SG_FILTER_NEAREST); - T(smpptr->cmn.mipmap_filter == SG_FILTER_NONE); + T(smpptr->cmn.mipmap_filter == SG_FILTER_NEAREST); T(smpptr->cmn.wrap_u == SG_WRAP_REPEAT); T(smpptr->cmn.wrap_v == SG_WRAP_REPEAT); T(smpptr->cmn.wrap_w == SG_WRAP_REPEAT); @@ -635,7 +635,7 @@ UTEST(sokol_gfx, query_sampler_defaults) { const sg_sampler_desc desc = sg_query_sampler_defaults(&(sg_sampler_desc){0}); T(desc.min_filter == SG_FILTER_NEAREST); T(desc.mag_filter == SG_FILTER_NEAREST); - T(desc.mipmap_filter == SG_FILTER_NONE); + T(desc.mipmap_filter == SG_FILTER_NEAREST); T(desc.wrap_u == SG_WRAP_REPEAT); T(desc.wrap_v == SG_WRAP_REPEAT); T(desc.wrap_w == SG_WRAP_REPEAT); @@ -2151,26 +2151,6 @@ UTEST(sokol_gfx, make_sampler_validate_start_canary) { sg_shutdown(); } -UTEST(sokol_gfx, make_sampler_validate_minfilter_none) { - setup(&(sg_desc){0}); - sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){ - .min_filter = SG_FILTER_NONE, - }); - T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_FAILED); - T(log_items[0] == SG_LOGITEM_VALIDATE_SAMPLERDESC_MINFILTER_NONE); - sg_shutdown(); -} - -UTEST(sokol_gfx, make_sampler_validate_magfilter_none) { - setup(&(sg_desc){0}); - sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){ - .mag_filter = SG_FILTER_NONE, - }); - T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_FAILED); - T(log_items[0] == SG_LOGITEM_VALIDATE_SAMPLERDESC_MAGFILTER_NONE); - sg_shutdown(); -} - UTEST(sokol_gfx, make_sampler_validate_anistropic_requires_linear_filtering) { setup(&(sg_desc){0}); sg_sampler smp; @@ -2179,7 +2159,7 @@ UTEST(sokol_gfx, make_sampler_validate_anistropic_requires_linear_filtering) { .max_anisotropy = 2, .min_filter = SG_FILTER_LINEAR, .mag_filter = SG_FILTER_LINEAR, - .mipmap_filter = SG_FILTER_NONE, + .mipmap_filter = SG_FILTER_NEAREST, }); T(sg_query_sampler_state(smp) == SG_RESOURCESTATE_FAILED); T(log_items[0] == SG_LOGITEM_VALIDATE_SAMPLERDESC_ANISTROPIC_REQUIRES_LINEAR_FILTERING); diff --git a/tests/functional/sokol_spine_test.c b/tests/functional/sokol_spine_test.c index 435b32b2..1c69d350 100644 --- a/tests/functional/sokol_spine_test.c +++ b/tests/functional/sokol_spine_test.c @@ -655,7 +655,7 @@ UTEST(sokol_spine, atlas_get_atlas_page_info_with_overrides) { T(strcmp(info.image.filename.cstr, "spineboy.png") == 0); T(info.image.min_filter == SG_FILTER_LINEAR); T(info.image.mag_filter == SG_FILTER_LINEAR); - T(info.image.mipmap_filter == SG_FILTER_NONE); + T(info.image.mipmap_filter == SG_FILTER_NEAREST); T(info.image.wrap_u == SG_WRAP_CLAMP_TO_EDGE); T(info.image.wrap_v == SG_WRAP_CLAMP_TO_EDGE); T(info.image.width == 1024); diff --git a/util/sokol_fontstash.h b/util/sokol_fontstash.h index a6505857..861241e7 100644 --- a/util/sokol_fontstash.h +++ b/util/sokol_fontstash.h @@ -1661,7 +1661,6 @@ static int _sfons_render_create(void* user_ptr, int width, int height) { _sfons_clear(&smp_desc, sizeof(smp_desc)); smp_desc.min_filter = SG_FILTER_LINEAR; smp_desc.mag_filter = SG_FILTER_LINEAR; - smp_desc.mipmap_filter = SG_FILTER_NONE; sfons->smp = sg_make_sampler(&smp_desc); } diff --git a/util/sokol_gfx_imgui.h b/util/sokol_gfx_imgui.h index ba9d25fc..5aea7ec1 100644 --- a/util/sokol_gfx_imgui.h +++ b/util/sokol_gfx_imgui.h @@ -1287,7 +1287,6 @@ _SOKOL_PRIVATE const char* _sgimgui_pixelformat_string(sg_pixel_format fmt) { _SOKOL_PRIVATE const char* _sgimgui_filter_string(sg_filter f) { switch (f) { - case SG_FILTER_NONE: return "SG_FILTER_NONE"; case SG_FILTER_NEAREST: return "SG_FILTER_NEAREST"; case SG_FILTER_LINEAR: return "SG_FILTER_LINEAR"; default: return "???"; diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h index 0362a9a9..05426791 100644 --- a/util/sokol_imgui.h +++ b/util/sokol_imgui.h @@ -2400,7 +2400,6 @@ SOKOL_API_IMPL void simgui_create_fonts_texture(const simgui_font_tex_desc_t* de font_smp_desc.wrap_v = SG_WRAP_CLAMP_TO_EDGE; font_smp_desc.min_filter = desc->min_filter; font_smp_desc.mag_filter = desc->mag_filter; - font_smp_desc.mipmap_filter = SG_FILTER_NONE; font_smp_desc.label = "sokol-imgui-font-sampler"; _simgui.font_smp = sg_make_sampler(&font_smp_desc); diff --git a/util/sokol_spine.h b/util/sokol_spine.h index 4eb9b66a..7b677480 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -236,7 +236,7 @@ .overrides = { .min_filter = SG_FILTER_NEAREST, .mag_filter = SG_FILTER_NEAREST, - .mipmap_filter = SG_FILTER_NONE, + .mipmap_filter = SG_FILTER_NEAREST, .wrap_u = SG_WRAP_MIRROR, .wrap_v = SG_WRAP_MIRROR, .premul_alpha_enabled = ..., @@ -4573,15 +4573,19 @@ static sg_filter _sspine_as_sampler_filter(spAtlasFilter filter) { static sg_filter _sspine_as_sampler_mipmap_filter(spAtlasFilter filter) { switch (filter) { - case SP_ATLAS_UNKNOWN_FILTER: return _SG_FILTER_DEFAULT; - case SP_ATLAS_NEAREST: return SG_FILTER_NONE; - case SP_ATLAS_LINEAR: return SG_FILTER_NONE; - case SP_ATLAS_MIPMAP: return SG_FILTER_NEAREST; - case SP_ATLAS_MIPMAP_NEAREST_NEAREST: return SG_FILTER_NEAREST; - case SP_ATLAS_MIPMAP_LINEAR_NEAREST: return SG_FILTER_NEAREST; - case SP_ATLAS_MIPMAP_NEAREST_LINEAR: return SG_FILTER_LINEAR; - case SP_ATLAS_MIPMAP_LINEAR_LINEAR: return SG_FILTER_LINEAR; - default: return SG_FILTER_NEAREST; + case SP_ATLAS_UNKNOWN_FILTER: + return _SG_FILTER_DEFAULT; + case SP_ATLAS_NEAREST: + case SP_ATLAS_LINEAR: + case SP_ATLAS_MIPMAP: + case SP_ATLAS_MIPMAP_NEAREST_NEAREST: + case SP_ATLAS_MIPMAP_LINEAR_NEAREST: + return SG_FILTER_NEAREST; + case SP_ATLAS_MIPMAP_NEAREST_LINEAR: + case SP_ATLAS_MIPMAP_LINEAR_LINEAR: + return SG_FILTER_LINEAR; + default: + return SG_FILTER_NEAREST; } } |