meson: use a feature option for shader_cache

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20409>
This commit is contained in:
Dylan Baker 2022-12-20 15:09:41 -08:00 committed by Marge Bot
parent b200d547dc
commit 98bd7cdb8c
2 changed files with 9 additions and 25 deletions

View File

@ -971,30 +971,16 @@ if get_option('buildtype') == 'debug'
pre_args += '-DDEBUG'
endif
with_shader_cache = false
_shader_cache = get_option('shader-cache')
if _shader_cache == 'true'
_shader_cache = 'enabled'
warning('shader_cache option "true" deprecated, please use "enabled" instead.')
elif _shader_cache == 'false'
_shader_cache = 'disabled'
warning('shader_cache option "false" deprecated, please use "disabled" instead.')
endif
if _shader_cache != 'disabled'
if host_machine.system() == 'windows'
if _shader_cache == 'enabled'
error('Shader Cache does not currently work on Windows')
endif
else
pre_args += '-DENABLE_SHADER_CACHE'
if not get_option('shader-cache-default')
pre_args += '-DSHADER_CACHE_DISABLE_BY_DEFAULT'
endif
with_shader_cache = true
endif
endif
with_shader_cache = get_option('shader-cache') \
.require(host_machine.system() != 'windows', error_message : 'Shader Cache does not currently work on Windows') \
.allowed()
if with_shader_cache
pre_args += '-DENABLE_SHADER_CACHE'
if not get_option('shader-cache-default')
pre_args += '-DSHADER_CACHE_DISABLE_BY_DEFAULT'
endif
shader_cache_max_size = get_option('shader-cache-max-size')
if shader_cache_max_size != ''
pre_args += '-DMESA_SHADER_CACHE_MAX_SIZE="@0@"'.format(shader_cache_max_size)

View File

@ -200,9 +200,7 @@ option(
)
option(
'shader-cache',
type : 'combo',
value : 'auto',
choices : ['auto', 'true', 'false', 'enabled', 'disabled'],
type : 'feature',
description : 'Build with on-disk shader cache support.',
)
option(