Add ResourceBuffer to the resolver. Update the resolver to support the ResourceBuffer type. Bug: 439626491 Change-Id: I058956590372e4f0bce74cddae98544ddc28599e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/259235 Commit-Queue: dan sinclair <dsinclair@chromium.org> Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/cmd/bench/enums_core_bench.cc b/src/tint/cmd/bench/enums_core_bench.cc index ca7ce5f..c0532be 100644 --- a/src/tint/cmd/bench/enums_core_bench.cc +++ b/src/tint/cmd/bench/enums_core_bench.cc
@@ -719,286 +719,293 @@ "p", "ptMM", "ptC", - "samQQPPer", - "suDDmplxxr", - "YYlqamdpler", + "resourceQQPPinding", + "resoDDrxxe_bin8uing", + "reddYYurcmllbiqqding", + "resource_binding", + "_esource_bindiFFg", + "rerroGGrce_bidinNN", + "Mesource_bilding", + "aler", + "slmpqex", + "samper", "sampler", - "amFFle__", - "rrGGNNler", - "samMler", - "samlr_cmparison", - "sampler_comparqxon", - "sampler_comprison", + "samp44r", + "WWGmpler", + "sjjmplr", + "sampler_compajjison", + "sampjercomparis1n", + "sapler_comparison", "sampler_comparison", - "sapler_comparis44n", - "sampler_WWomparGson", - "sampler_compajjson", - "sjjbgroup_matrix_left", - "subgrojp_matrix_l1t", - "subgrop_matrix_left", + "sampler_comparis99n", + "samVVler_comparison", + "ZZampler_cmparxson", + "subvvroup_ma33ri_left", + "subgroup_matrsx_lef9", + "subgroup_matFix_lef", "subgroup_matrix_left", - "subg99oup_matrix_left", - "subgroup_mayrix_lVVft", - "subgroup_matiZZ_lext", - "sugr33uvv_matrix_result", - "ssbgroup_9atrix_result", - "suFgroup_matrixresult", + "suegroup_muutrix_lft", + "subgroup_mtIixlefKK", + "subgroJ_matrix_left", + "subgrXXupSSmatriCC_result", + "subgrWWupZZmatrix_66esult", + "subroup_mari5_resumdt", "subgroup_matrix_result", - "ubgroup_matrix_eesuuut", - "sKKbgrou_mItrx_result", - "subgroup_aJrix_result", - "subgroupCCmatrixXXrighSS", - "subZZr66uWW_maJrix_right", - "summgropmadrix_5ight", + "BBubgroupmaBBriU_result", + "subgr0up_mJJtri11_result", + "subfroup_matrix_rettult", + "subroup_maXrix_ightt", + "subgroup_matrix_riwhL", + "subgr1up_matrix_right", "subgroup_matrix_right", - "subUoup_matrBBx_riBBht", - "subgJJoup_mat110x_right", - "subgroup_matrix_rfgttt", - "texelbufftt", - "texel_buLwer", - "texel_bu1fer", + "subgroup_matrix_righww", + "subgou_atrix_righee", + "subgroup_matrx_right", + "texel_NNuffer", + "tRUUx__l_blffer", + "tHxel_buffer", "texel_buffer", - "tewwel_buffer", - "teelbuffer", - "texel_bffer", - "textNNre_1d", - "tex__uleRUU1d", - "texHure_1d", - "texture_1d", - "teCCturr_1d", + "teCCelrbuffer", + "exel_buffer", + "texppl_bdfIr", "textre_1d", - "textupd_1d", - "textre_2d", "textLN_d", "tet_d", - "texture_2d", + "texture_1d", "teqqtuxRR_GGd", "texturS_GGd", - "88tucce_2d", - "texture_2d_arra", - "texture_2dpparty", - "te55tureFF02d_aqqray", + "88tucce_1d", + "texture_2", + "textte_ppd", + "qqFF0xture552d", + "texture_2d", + "txture_2d", + "textur2d", + "texOre_2d", + "textuHHe_2d_rray", + "text66re_2d_OrraSS", + "texture_2d_ddYraTT", "texture_2d_array", - "texure_2d_array", - "texture_2d_ary", - "texure_2dOarray", - "textuHHe_3", - "66extureSS3O", - "tTTturddY_3d", + "textsrgg_2d_rray", + "texGGure_2d_array", + "teQQtOreI2ll_array", + "textue_3d", + "texrrure_3d", + "txtur7_yyd", "texture_3d", - "textursg3d", - "texture_3GG", - "tIxtllOQQ_3d", - "txture_cube", - "texture_crrbe", - "teyytue_cub7", + "textu22Be_Yd", + "textyyVe_3d", + "x4ure_3", + "texture_cudde", + "texVVuze_cu2", + "texturyy_cube", "texture_cube", - "tBBxWur22_cube", - "yyexture_cubV", - "texturec4", - "texture_cudde_array", - "textu2e_cVVbz_rray", - "texture_cubeyyarray", + "textu__A_cube", + "texture_chhbe", + "ttvvre_cube", + "texture_ub_array", + "tNNgtsre_cubeooarray", + "mmZZxtre_cube_aray", "texture_cube_array", - "texture_cAb___array", - "texture_cube_arhhay", - "teture_cube_arvvy", - "txture_dept_2d", - "texNNure_gesth_ood", - "emmtre_ZZepth_2d", + "textuk_cue_array", + "texAur_ffube_aRray", + "Wxturrr_cube_zzrry", + "texture_depR_2d", + "textuSSe_88epth_Md", + "texture_debbPR_2d", "texture_depth_2d", - "texture_dkt_2d", - "teRtue_ffepth_2d", - "terrztuWdepth_2d", - "texture_dept_2d_Rrray", - "texture_dS88ptM_2d_array", - "bbexurR_depth_2d_PPrray", + "WWeture_depthxx2d", + "texture_dptAAv_2d", + "tj44xXure_depth_2d", + "texturefdepth_2d_array", + "texture_dAAUthOOd_array", + "tuxtue_ssept_2d_array", "texture_depth_2d_array", - "texturexxWWeth_2d_array", - "texture_dAAvth_2d_array", - "textujje_de44th_2d_Xrray", - "textufe_depth_cube", - "textureAAUepth_cOOe", - "tuxtre_ssepth_cue", + "tsxtuFFe_deptbb_2d_array", + "texture_depth_2d_annraYY", + "teture_depth_2d_arrass", + "textre_qezzth_cube", + "textre_NepQh_cube", + "tppxtukke_deph_cbe", "texture_depth_cube", - "bbexture_sFFpth_cube", - "texture_nnepth_cubYY", - "teture_depth_cubss", - "textre_dzzpthqcube_array", - "texuQedepth_cube_aNNray", - "textukke_eptpp_cubearray", + "textssre_JepthLcube", + "77exJure_depthff5TTbe", + "texure_d00pth_cubx", + "texture1depth_cube_arrA", + "texture_depth_cube_rray", + "texture_depth_QQbe_array", "texture_depth_cube_array", - "texturL_depth_cusse_arraJ", - "texture5ffepth_cubeJa77TTay", - "textur00_dpxh_cube_array", - "exture_depth_Aulti1ampled_2d", - "texturedepth_multisampled_2d", - "textQQre_depth_multisamled_2d", + "exture_depth_cubeiiaway", + "texture_depth_cube_arwway", + "texJJure_dephYh_cube_array", + "teEkure_depth_multi7ampld_2RR", + "texture_deptuu_multisampked_2d", + "texture_dethtRultisampled_2d", "texture_depth_multisampled_2d", - "iiexture_depthwultiampled_2d", - "texture_depth_mwwltisampled_2d", - "teYYturh_deptJJ_multisampled_2d", - "texture_RRxkEnal", - "texture_exteknauu", - "textrRtexternal", + "txture_dIIpth_multisNmpled_2d", + "texture_deptII_multisampled_d", + "texture_depthmultisamiiledE2d", + "txture_ssxternal", + "XeCC5tue_external", + "text9re_external", "texture_external", - "IIeNtre_external", - "texture_exIernal", - "Eiixture_externl", - "texture_multsssample_2d", - "txture_mCCltXsa55pled_2d", - "9exture_multisampled_2d", + "tXxture_extrnl", + "txture_eteIInal", + "texturz_external", + "texturezzmultisaAApled222", + "texture_multiampled_2d", + "textbbre_mulisampld_2F", "texture_multisampled_2d", - "exture_mltisampled_Xd", - "tetIIre_mltisampled_2d", - "texzure_multisampled_2d", - "tAAxtur22_zztorae_1d", - "texture_storag_1d", - "texturbb_strageFd", + "textuVe_multisMMmpled_2d", + "texturA_mwcmmisamplzzd_2d", + "texture_muOOtisampeQQ2d", + "texbure_storage_1d", + "nne5kture_torage_1C", + "textue_KKtorarreyy1d", "texture_storage_1d", - "teVture_stMMrage_1d", - "textuwe_storacmzz_1d", - "textuQQOO_storag1d", - "texbure_storage_2d", - "nne5kture_torage_2C", - "textue_KKtorarreyy2d", - "texture_storage_2d", - "tTxtue_ttorageAA2d", - "QQexture_sorage_2d", + "tTxtue_ttorageAA1d", + "QQexture_sorage_1d", "texture_t8rage_d", - "texture_storag_2d_aaray", - "exteccre_storage_bd_array", - "txture_storage_dLLaPPray", + "teture_stoaage_2d", + "eeextbr_stccrage_2d", + "texLLure_Porage_2d", + "texture_storage_2d", + "tetuWW_sUorage_2d", + "texture_stzzrage_2", + "text__re_soNa_2d", + "texaure_storage_2d_array", + "texture_storage2dBaray", + "texure_storagezz2darray", "texture_storage_2d_array", - "texWWUr_storag_2d_array", - "texzzure_stoage_2d_array", - "textNre_stoage_2__rray", - "texture_storagea3d", - "texre_stoBage_3d", - "zzexture_torge_3d", + "teaatUre_stHHrage_2dbarray", + "texturesOo4ag_2d_array", + "textume_sGGrage_2d_array", + "teture_storage_3d", + "texturezzstG8rageN3d", + "texture_storag_3d", "texture_storage_3d", - "textureUaatorbge_HHd", - "te4ture_sOorg_3d", - "texGGme_storage_3d", - "u3", - "8Gzz2", - "u3", + "textuxe_storaAAe_3d", + "tbbxture_suuorage_3d", + "tejjture_storage_3d", + "xccJ3", + "g", + "Av", "u32", - "uAAx", - "ubb32", - "u3jj", - "cqJx", - "", - "A", + "u3cc", + "BUU", + "uAAB", + "ux", + "8", + "BUC8", "u8", - "cc8", - "BU", - "BAA", - "vxc2", - "Ue8", - "vUICB8", + "u__", + "UU", + "u", + "vuuc7r", + "vkk2", + "lec2", "vec2", - "vec__", - "ecUU", - "vec", - "vrruc27", - "ve2kk", - "vel2f", - "vec2f", - "vecf", - "YYc3f", - "44ec2f", - "Rc2h", - "88ePPr2h", + "vc2", + "vwY3", + "vec44", + "Rc2f", + "88ePPr2f", "ec2J", - "vec2h", + "vec2f", "cVt", - "vech", + "vecf", "ec2", - "331i", - "uuci", - "4e02i", - "vec2i", - "v3ri", + "331h", + "uuch", + "4e02h", + "vec2h", + "v3rh", "veYY2g", - "ve2i", - "rCCcu", - "lecu", + "ve2h", + "rCCci", + "leci", "vec2ZZ", - "vec2u", - "tqm9MMu", - "veUu", + "vec2i", + "tqm9MMi", + "veUi", "vgc77n", - "dddd", - "aaecE", - "vIIc3", + "vdddu", + "vEcaau", + "vecIIu", + "vec2u", + "RReZ2ll", + "vecNNkrr", + "vec", + "vcw", + "vec", + "HH", "vec3", - "ZllRR3", - "kNNecrr", - "e3", - "vc3f", - "veca", - "HHec3G", + "cc3", + "vulB223", + "5ec3", + "eR3f", + "gec3f", + "ve3f", "vec3f", - "cc3f", - "vB22nllf", - "vec35", - "eR3h", - "gec3h", - "ve3h", - "vec3h", - "vecph", - "vecK99h", - "22Rch", + "vecpf", + "vecK99f", + "22Rcf", "vecnn", - "veeENi", - "fHHec3i", - "vec3i", - "ss226i", - "em0i", + "veeENh", + "fHHec3h", + "vec3h", + "ss226h", + "em0h", "vecNp", "ve63", - "oZWWV3u", - "vHHu", + "oZWWV3i", + "vHHi", + "vec3i", + "vAci", + "vTi", + "2ec3i", + "ve443W", + "8Z77", + "FeR3", "vec3u", - "vAcu", - "vTu", - "2ec3u", - "vec4W", - "8eZ", - "FRc", + "vebb3", + "ggce", + "UeSh", + "vqcN", + "vc", + "vccMM", "vec4", - "bbc4", - "gce", - "ech", - "vZqNN", - "v9f", - "ccHMMf", + "xT", + "vqZ", + "e", + "vef", + "vecgg4f", + "rfe4f", "vec4f", - "v4x", - "veXX", - "4f", - "veh", - "vecgg4h", - "rfe4h", - "vec4h", - "ve4h", + "ve4f", "vggc4D", "v994Q", - "eeei", - "veci", + "eeeh", + "vech", "vc4II", - "vec4i", - "veqi", - "Ooc77i", + "vec4h", + "veqh", + "Ooc77h", "vrrDD", - "vecju", - "11ciiFu", - "jBcRRu", - "vec4u", - "vdAc_7u", + "vecji", + "11ciiFi", + "jBcRRi", + "vec4i", + "vdAc_7i", "4jj", "xxkeo", + "veW4u", + "IQQN1u", + "veIu", + "vec4u", + "vjc4", + "e722", + "vEElc4g", }; for (auto _ : state) { for (auto* str : kStrings) { @@ -1011,132 +1018,132 @@ BENCHMARK(BuiltinTypeParser); void BuiltinValueParser(::benchmark::State& state) { const char* kStrings[] = { - "barycentriW_coord", - "bary1IQQtric_coord", - "baryceItric_cood", + "barcentric_coord", + "baryce5tri_oord", + "ba66yc88ntrc_oord", "barycentric_coord", - "barcentric_coojd", - "ar7cntric_coor22", - "bEErccentrKg_collrd", - "clip_distance", - "5p_distances", - "c66_di88tances", + "barcetric_coard", + "bErycentrc_coord", + "Qaryentri_coord", + "clp_distanc_s", + "clip_rNtanc", + "clip_ditances", "clip_distances", - "alip_itanceE", - "clip_dEstnces", - "cliQ_dqsthes", - "frag_dpth", - "frag_th", - "frag_dept", + "clTTeeB_distances", + "nnipgdis11ancs", + "clin_distqnces", + "mmBcag_deptX", + "fttag_dep7h", + "fag_dph", "frag_depth", - "frag_depeeBTh", - "fag_1nnpth", - "frag_nepth", - "frBmcct_fXcing", - "fron7tt_fcGng", - "frontcing", + "frag_epKh", + "jjran_deFFt", + "g8depEEh", + "frLnt_fciDDg", + "frhhnt55fScing", + "ronZ_facinuu", "front_facing", - "fronK_fcing", - "jjrontfaniFFg", - "8rEEn_fcig", - "global_invocatvon_DD", - "goobal_inhhcation_i55S", - "global_invocatiun_Zd", + "7ront5PPfacing", + "font_facSnkk", + "fronEEFfa_ing", + "globyyl_nvocatbbo_id", + "globalJJinvocRinid", + "global_Tnvcation_1d", "global_invocation_id", - "glPPbal_invoc755ion_id", - "global_invocSion_kkd", - "gFobEEl_iSvocatio__id", - "nstayye_indebb", - "nRtanc_index", - "iTstan1e_indx", + "Xlobal_vocatioT_id", + "global_invocat00o_id", + "globalPinvocat77on_id", + "inspaceZindex", + "PPstanbe_indew", + "instssbbH8e_injjex", "instance_index", - "XsTancX_inex", - "instance_in00x", - "insPance77index", - "locap_invcZtion_id", - "lbcl_iPwvocation_id", - "lHHcabb_i8vocsjjtion_id", + "instance_indhx", + "insancexxine", + "inrQaBce_ineex", + "local_invocation_iJJ", + "ocaluinvocwtio_id", + "lttcalZinvocatio_xxd", "local_invocation_id", - "local_invocatihn_id", - "lcal_invocxxtion_", - "rroclQinvocatieB_id", - "locaJJ_invocation_index", - "loal_ivvocaiow_undex", - "locatt_Znvocatio_indexx", + "local_invocation_99d", + "localiocaion_id", + "local_invocatinffn_id", + "5ocal_invocation_index", + "IoUal_invocation_Jndex", + "locl_invocation_index", "local_invocation_index", - "local_iv99ocation_index", - "lcal_ivocatin_indx", - "locnffl_invocation_index", - "num_workgrou5s", - "nuIJworkUrouus", - "num_worgroups", + "ltcal_invocation_index", + "local_in1ocation_index", + "localAAinvocation_inDDex", + "Om_woP2grups", + "num_workgoups", + "num_workgro77ps", "num_workgroups", - "ntm_workgroFps", - "num_workgr1ups", - "nAAm_woDDkgroups", - "OostoP", - "positon", - "posit77on", + "n1m_UUorkAAroups", + "Xum_workgrfupAA", + "VVum_wrkgrouvs", + "posippion", + "posTTtion", + "kosjj0tion", "position", - "AAUUs1timm", - "XosAftion", - "posVVvvn", - "pprimitive_index", - "primitive_TTndex", - "prkmitivjj_inde00", + "posiion", + "posiyyon", + "poYizzion", + "priWitiiie_index", + "6rimitv7_indUUx", + "prUUitive_inpe", "primitive_index", - "primitie_index", - "rimitive_inyyex", - "pzzimitive_ideYY", - "siWmple_Wndex", - "6a70UU_index", - "sale_indUUx", + "hrimitiveiTTex", + "primitie_inde5", + "primtveind1x", + "sam44mme_iIdex", + "saYDpRe_indYY", + "sampjje_index", "sample_index", - "samlTTinhex", - "smple_i5dex", - "saple_i1e", - "sammmleI44ask", - "saRpleYYDDsk", - "sample_jjask", + "sample_idex", + "smple_iQQdex", + "55amHle_idex", + "saxFple_mask", + "sapD_mrsk", + "sNmple__KKsk", "sample_mask", - "sample_ask", - "sampe_QQask", - "samplH_ms55", - "suxFgroup_ik", - "sugDuprid", - "sNbgrou_KKid", + "saxalT_mask", + "sample_vvask", + "sjjmple_mak", + "subgrnnOOp_i", + "sggOOgroOpid", + "suwwQgoup_id", "subgroup_id", - "suxarTup_id", - "subgrouvv_id", - "sjjbgroup_d", - "subgrnnOOp_invocatin_id", - "subgroup_invggOOtOon_id", - "suQQgrup_invocatioww_id", + "subgrup_iJ", + "subgroup_iD", + "OOubgroupid", + "subgroup_nvocation_id", + "subro00p_invocation_i", + "subgroup_vqcation_ld", "subgroup_invocation_id", - "subgrup_iJvocation_id", - "subgroup_iDvocation_id", - "subgroOOp_invocationid", - "subgrou_size", - "00ubgroup_ze", - "sulgroup_ze", + "subgroup_invocation_iu", + "subgroup_invo33ation_id", + "subgrouNNinvocation_id", + "subrMup_sze", + "ubgr22up_sRzbb", + "subgiiup_size", "subgroup_size", - "subgrEup_size", - "subgroupiisie", - "subgsoup_siz", - "vertettins2ex", - "versii_index", - "vetex_index", - "vertex_index", - "veteuindeoo", - "verHHx_JUdx", + "subgrup_size", + "soobgop_sCue", + "subgrHHu_izJ", "vrtyg_ihdggx", - "wrgroWWp_iBB", - "workgroupECEcc", - "woGkgrouee_yy", - "workgroup_id", - "wo44kgUup_id", - "workgroup_i", + "vrex_WWndeBB", + "vertex_inECEcc", + "vertex_index", + "veGtex_ieedyy", + "ve44teUindex", + "vertex_inde", "workgNoup_id", + "MMorkgrssup_id", + "workgrDup_Cd", + "workgroup_id", + "ggTYkgroup_id", + "workjjroup_id", + "wrkDDroup_i", }; for (auto _ : state) { for (auto* str : kStrings) { @@ -1149,41 +1156,41 @@ BENCHMARK(BuiltinValueParser); void InterpolationSamplingParser(::benchmark::State& state) { const char* kStrings[] = { - "MMentess", - "DentCr", - "gTeYter", - "center", - "centjjr", - "cDDte", "cEEMM9er", - "entrNid", - "55entroid", - "centQoid", - "centroid", - "cntroinn", - "FFenrWWd", + "cNter", + "55enter", + "center", + "Qenter", + "nnnter", + "cenWFr", "centro66w", - "evFher", - "itWWr", - "ethr", - "either", - "5hK", - "eit4er", + "cvntroFd", + "cWWntrd", + "centroid", + "entrod", + "5Ktri", + "c4ntroid", "gtnnPr", - "Sist", - "ir22V", - "fprst", - "first", - "f9VV9s2", - "nt", + "eSShe", + "2itVer", + "either", + "epther", + "eiXV9992", + "nte", "Bs", - "8BBml", - "AyACCple", - "sipBv", - "sample", - "A4QQmle", - "ZZmplT4", + "fiBB", + "yCCAAAt", + "first", + "ivit", + "A4rsQQ", + "T4Zist", "Xamlle", + "ddamle", + "sadd", + "sample", + "si1le", + "vmpGG", + "jjmpl", }; for (auto _ : state) { for (auto* str : kStrings) { @@ -1196,27 +1203,27 @@ BENCHMARK(InterpolationSamplingParser); void InterpolationTypeParser(::benchmark::State& state) { const char* kStrings[] = { - "fadd", - "dd", - "fi1", - "flat", - "vGG", - "jja", "fwat", - "Xinnar", - "ji9ear", - "lier", - "linear", - "lin2WWr", - "linar", + "flXn", + "fljt", + "flat", + "fz", + "flWW2", + "fat", "lneVr", - "lers4ectzzve", - "ersecti__Y", - "perspMctkHve", - "perspective", - "peIzzpecDive", - "ersdeqtive", + "lnz4ear", + "li__Y", + "linear", + "linHkaM", + "lInzzaD", + "qnedr", "persehtive", + "perlMMNctiFe", + "perspetiv", + "perspective", + "xersA9tiv", + "VVnrspetive", + "perspecKv", }; for (auto _ : state) { for (auto* str : kStrings) { @@ -1229,286 +1236,286 @@ BENCHMARK(InterpolationTypeParser); void TexelFormatParser(::benchmark::State& state) { const char* kStrings[] = { - "bNra8uMMFlm", - "gra8norm", - "g9x8unrA", - "bgra8unorm", - "bgraVVnnrm", - "bKra8urm", "bgra8nCBBm", - "16floot", - "EE1f88occww", - "r6fbboat", - "r16float", - "r166loat", - "K1ggoa", + "bgrauoorm", + "bgra8ccnE88rw", + "bgra8unorm", + "bgr8bbnorm", + "b6ra8unorm", + "gKaggnrm", "r16fE1at", - "r16sit", - "rpH6int", - "raa6sinqq", - "r16sint", - "r16sn", - "rxxxxXsi_", + "r16floa", + "rHpfloat", + "r16float", + "qqaa6flGat", + "r6loat", + "xxxx6_loat", "r16SSzznt", - "r16sorm", - "1o4orm", - "r16snr", - "r16snorm", - "rKsnrm", - "rzz6sncm", + "r16int", + "16ont", + "r16sint", + "r16nt", + "rK6st", + "rczsint", "r88an5ggm", - "r1jjsint", - "riA6uin1", - "rlVVu66nt", - "r16uint", - "6uic", - "r16GGnht", + "r16snsjrm", + "116snoriA", + "r16snorm", + "rVV6sl66rm", + "6norm", + "tt1Ghmnom", "iiyy6int", - "rv_QQunttm", - "r6uoLLm", - "r16Wno7m", + "QQt1_vuin", + "rLuint", + "r16uint", + "r1uWcct", + "r16uFt", + "rzz6yyin", + "runorm", + "I16Rco_m", + "r16uddrm", "r16unorm", - "6uvvoFr", - "ryyunzzrm", - "runorm", - "I32Rco_t", - "r32fddat", - "M3l22oa", - "r32float", - "O32float", - "KK6TTflmat", + "M1l22or", + "O16unorm", + "KK6TTunmrm", "rRR2lo", - "r3s04", - "rnsiqq", - "r3BBsint", - "r32sint", - "rWB22aint", - "rjj2sint", + "4flo00", + "r32nqoa", + "r32float", + "r32floaBB", + "r32f2WBaat", + "r32fjjoat", "66tinHH", - "r3JJut", - "rttoouiSt", + "r3JJst", + "rttoosiSt", + "r32sint", "2r_SSnt", - "r32uint", - "rWW2uint", - "r32uink", + "rWW2sint", + "r32sink", "r3bbitt", - "_1sin", - "r8sft", - "ii8ink", - "r8sint", - "rwsiUt", - "I8nnt", + "r32u1n", + "rf2uiN", + "r32uint", + "rii2iVt", + "r32winU", + "r3Funt", "448s8LLnt", - "r8snoZZm", - "MM8snorm", - "r8norm", - "r8snorm", - "rSSMMn6Am", - "GGgxnorTT", + "r8sinZZ", + "rMMsint", + "r8sint", + "8sint", + "SSAM6int", + "GGxTTint", "r8snorI", - "l8uint", - "r8OOn", - "r8u5n", - "r8uint", - "r8zRint", - "r8uiPLL", + "r8slorm", + "rOOsnm", + "r8snorm", + "8aKo5m", + "Rf__zzrm", + "r8LLnorP", "ruihht", - "runorm", - "8unjm", - "r8BB0", - "r8unorm", - "xxL8nrm", - "rIIunorMM", + "ruint", + "ruit", + "r8uint", + "08BB", + "xxL8un", + "r8uiMMIt", "r8XnFFm", - "r1ssb10uflpazz", - "rZZ11b1Frufloat", - "rrr001b1jfloat", - "rg11b10ufloat", - "rgp1b1rrfloaww", - "QQZ1b10ufloa", + "r8unsszz", + "r8rrnZZFm", + "r8unorm", + "rrrjor00", + "p8wrrorm", + "QZuorm", "rg__hb1nfloat", - "rw16loat", - "rg16floa3", - "rg1ifoXXt", - "rg16float", - "rg16l3", - "c8O6fvvoat", + "rg11w10ufloa", + "rg11b103float", + "rg11b10ufloat", + "rg11b0XXfloai", + "rg31b10loa", + "rg11c10u8vvoOO", "rg16vlPaj", - "Nguspni", - "r21sint", - "qJg1siDt", - "rg16sint", - "rg6miQt", - "rJ16int", + "ugi6plot", + "g16f2oat", + "rg16float", + "rgD6fJqat", + "rg1Qfmoa", + "rg16fJat", "rg1sWWnt", - "wQg16ggnwrm", - "rg1zsnorm", - "rWW6snzzrm", - "rg16snorm", - "rg6sno", - "rKUU6snr99q", + "rQQ1wswgnt", + "rg16sinz", + "rg16sint", + "rgWWsinzz", + "rg1it", + "rK996qqUUn", "EEg16sRRom", - "r1uint", - "rg16uttt", - "rg1MMin", - "rg16uint", - "raaKKTBBint", - "l5516uIIn", + "rg16nor", + "rg1tsnorm", + "rg16snorm", + "rgqnoMMm", + "rgT6aanBBrKK", + "rl16sII5rm", "rg16wBBoo", - "PPg1__unorm", - "rg16RRnorm", - "rghSom", - "rg16unorm", - "Q1urm", - "r6un8HHrm", + "rg1__PPint", + "rRR16uint", + "rg16uint", + "rgSut", + "riQt", + "g6uHH8nt", "rD16unYYrm", - "rg32floOt", - "r8II2ZJoat", - "rgoYfloat", - "rg32float", - "rg2floa0X", - "rcKn2floSt", + "rg16unoOm", + "r8II6ZJorm", + "rg16unorm", + "rgoYunorm", + "rg6unor0X", + "rcKn6unoSm", "GGg3233la88", - "XXg3233qint", - "gzzs4nt", - "rgtW2siWhh", - "rg32sint", - "xg2srnt", - "rz3eeQnt", + "rXX333floqqt", + "rz32lo4t", + "rg32float", + "rWttWKlhhat", + "rg3rxoat", + "rg32CQeat", "rg32sYr", - "xxgm2uinS", - "rg3ruit", - "rgyy2uit", - "rg32uint", + "xxgm2sinS", + "rg3rsit", + "rg32sint", + "rgyy2sit", "r82i8t", - "rge2uint", + "rge2sint", "hkkg3uint", - "rgBBsOOt", - "rg89it", - "gg8Dint", - "rg8sint", - "ag8inn1", - "qgSiIt", + "rg2uOOBnt", + "g32ui9t", + "rg32uint", + "rgg2uDnt", + "rgna2in1", + "6gIuinS", "rgsinYY", - "rYYsnLVVm", - "m62s8snorI", - "r8snorjj", - "rg8snorm", - "ppgsn7", - "Ng8sno6m", + "Lg8YVVin", + "rg8ms2I66", + "rg8sint", + "jjg8snt", + "pp7nt", + "rgN6int", "rg8snorsgg", - "g8uint", - "JgOOuqnt", - "rg00uinMM", - "rg8uint", - "rMM8ummnt", - "rH8uqqt", + "rgsnorm", + "rg8sJoOOm", + "rg8snorm", + "MMg8snor00", + "rg8snmmMMm", + "r8snqHrm", "gGuin88", - "gRRuwworm", - "rgqunorm", - "gUuom", - "rg8unorm", - "g8uBo5MQ", - "33g8unorm", + "wwgRRuit", + "rg8uinq", + "rg8uint", + "8uiU", + "BQ85nMM", + "rg8u33nt", "Og8uno33m", - "gb0awuint", - "rb_1Aa2uMnkk", - "rgb102uint", - "rgb10a2uint", - "db1auint", - "rXXb10a25iww55", + "rg8uom", + "kkgAunb_M", + "rg8unorm", + "rg8unom", + "rduom", + "rg55wXXnorm", "rb10a2uint", - "rgb12unorm", - "dgb1JJ2norm", - "rgb1a2un1r_", - "rgb10a2unorm", - "rgb0a2Lnor", - "99b10a2unrGG", + "rgb10a2ut", + "rgb1Jadint", + "rgb10a2uint", + "rb_1a2uint", + "rgLL0aint", + "rg10G2uin99", "xxgb102UUnom", - "9gba16flot", - "rvba16float", - "LLgba1622loat", - "rgba16float", - "rgabf1loat", - "rgbaAA6floa", + "rgb90a2unom", + "rgb10a2uvorm", + "rgb10a2unorm", + "rgb10LL22unorm", + "rgb11a2ufom", + "rgb0aAAungrm", "CUa16flo", - "zzgba16swnt", - "nwwba16siMMVV", - "Xgba16NNit", - "rgba16sint", - "rgba1W77eent", - "vvgba16RP33nt", + "rgbw1zzflont", + "rgna16flowVVMM", + "rgba16float", + "rgNNaX6flat", + "rgbee77flWWat", + "rgb3316PPloavv", "22gba16sjjnt", - "rgbaAA6snom", - "kkba1NsRRorm", - "rQQba16snorm", - "rgba16snorm", - "rgb16suuorm", - "uuba16snrm", + "cgAA16sint", + "Ngbakk6RRin", + "rgba16sint", + "rgba16sinQQ", + "rgbuu6sint", + "rba6suunt", "rga1snorZ", - "rgHa16unt", - "rgdSSS16uint", - "rgba16uTTnt", - "rgba16uint", - "rmb16ctnt", - "rgba16uhhnt", + "rgba1sHorm", + "rgba1dsnoSSSm", + "rgba16snorm", + "rgba16snTTrm", + "rba16cmort", + "rgba16snohhm", "rgba16uiG", - "HHgbaww6unAArbb", - "rgba1BBunorm", - "rgbM2hunogm", - "rgba16unorm", - "rgba1unorWW", - "rgbqq16unorm", + "rHbbwAAa16uint", + "rgba16uBBnt", + "rgba16uint", + "hga226Mint", + "rgba16unWW", + "rqqba16uint", "rgbar6unUUm", - "rgba32Eoat", - "rgRa32floVVrr", - "rg33OGG3Hflot", - "rgba32float", - "55g32Dloat", - "rSSbB32floQt", + "rgba16Eorm", + "rgRa16unoVVrr", + "rgba16unorm", + "rg33OGG1Hunom", + "55g16Dnorm", + "rSSbB16unoQm", "zzgba32lat", - "rb662siAAt", - "wgba__2nt", - "rgba32sit", - "rgba32sint", - "rga32sirt", - "rgbRR3Gsint", + "rga32loAA66", + "rgbw2_loat", + "rgba32float", + "rgba2float", + "rgbr32loat", + "rgba32flRRaG", "KxUbLL31sint", "rgba32NNWWFt", - "gbfGUuint", + "gbfGUsint", + "rgba32sint", "rgba3FFE6nt", - "rgba32uint", "rgba39yyJTTnt", - "zgba32uit", + "zgba32sit", "rb32uinI", - "rapin", - "ttga8nnint", - "igbK8sint", - "rgba8sint", - "rgba8seent", - "rg_8si11gg", + "gb32pt", + "ttgnn32uint", + "rgba32uint", + "rgba3iuiKt", + "reeba32uint", + "rgbg_2ui11t", "rgba8snt", - "rgba8orm", - "rpbX8no", - "rgYY6sssnor", - "rgba8snorm", - "r77ba8YnIrm", - "rgbaSSeenonG", + "rgbaino", + "rpX8si", + "rgba8sint", + "g6ss8sYYnt", + "rIIba8s7Yt", + "ngbGSSeeint", "rgbQlnorm", - "gba8int", - "rgba__uint", - "rDDba8uin", - "rgba8uint", - "rga8int", - "551baluint", + "ba8snorm", + "rgba8sn__rm", + "rgba8snorm", + "rgba8soDDm", + "rgb8snrm", + "rgb5l55nor1", "rgbc4int", - "gba8unorm", - "rgOa811no6m", - "rgaunosm", - "rgba8unorm", - "rgba8unXrm", - "rg44w8unorm", + "gba8uint", + "gba6Ou11nt", + "rgba8uint", + "rsa8unt", + "rgbaXuint", + "rgbw844int", "rgba8YYnorm", + "gba8unorm", + "rTa8unyrm", + "rgba8unorm", + "bbba8unovv", + "rgba8unokm", + "Vb58unor9", }; for (auto _ : state) { for (auto* str : kStrings) {
diff --git a/src/tint/cmd/fuzz/wgsl/dictionary.txt b/src/tint/cmd/fuzz/wgsl/dictionary.txt index 7e896d3..0926ee1 100644 --- a/src/tint/cmd/fuzz/wgsl/dictionary.txt +++ b/src/tint/cmd/fuzz/wgsl/dictionary.txt
@@ -368,6 +368,7 @@ "refract" "refz" "requires" +"resource_binding" "result" "return" "reverseBits"
diff --git a/src/tint/lang/core/core.def b/src/tint/lang/core/core.def index 07e94ec..237999e 100644 --- a/src/tint/lang/core/core.def +++ b/src/tint/lang/core/core.def
@@ -179,6 +179,8 @@ subgroup_matrix_result // sized_binding_array binding_array + // type-less binding array + resource_binding // texel_buffers texel_buffer @@ -306,6 +308,7 @@ @display("array<{T}>") type runtime_array<T> type array<T, N: num> type binding_array<T, N: num> +type resource_binding type sampler type sampler_comparison type texture_1d<T>
diff --git a/src/tint/lang/core/enums.cc b/src/tint/lang/core/enums.cc index d9024d8..c352349 100644 --- a/src/tint/lang/core/enums.cc +++ b/src/tint/lang/core/enums.cc
@@ -628,6 +628,9 @@ if (str == "ptr") { return BuiltinType::kPtr; } + if (str == "resource_binding") { + return BuiltinType::kResourceBinding; + } if (str == "sampler") { return BuiltinType::kSampler; } @@ -880,6 +883,8 @@ return "mat4x4h"; case BuiltinType::kPtr: return "ptr"; + case BuiltinType::kResourceBinding: + return "resource_binding"; case BuiltinType::kSampler: return "sampler"; case BuiltinType::kSamplerComparison:
diff --git a/src/tint/lang/core/enums.h b/src/tint/lang/core/enums.h index 7e682b3..af9918d 100644 --- a/src/tint/lang/core/enums.h +++ b/src/tint/lang/core/enums.h
@@ -402,6 +402,7 @@ kMat4X4F, kMat4X4H, kPtr, + kResourceBinding, kSampler, kSamplerComparison, kSubgroupMatrixLeft, @@ -526,6 +527,7 @@ "mat4x4f", "mat4x4h", "ptr", + "resource_binding", "sampler", "sampler_comparison", "subgroup_matrix_left",
diff --git a/src/tint/lang/core/enums_test.cc b/src/tint/lang/core/enums_test.cc index fb5d869..03eb456 100644 --- a/src/tint/lang/core/enums_test.cc +++ b/src/tint/lang/core/enums_test.cc
@@ -558,6 +558,7 @@ {"mat4x4f", BuiltinType::kMat4X4F}, {"mat4x4h", BuiltinType::kMat4X4H}, {"ptr", BuiltinType::kPtr}, + {"resource_binding", BuiltinType::kResourceBinding}, {"sampler", BuiltinType::kSampler}, {"sampler_comparison", BuiltinType::kSamplerComparison}, {"subgroup_matrix_left", BuiltinType::kSubgroupMatrixLeft}, @@ -790,126 +791,129 @@ {"ptd", BuiltinType::kUndefined}, {"pCPtd", BuiltinType::kUndefined}, {"p", BuiltinType::kUndefined}, - {"s5mpler", BuiltinType::kUndefined}, - {"s9jmffler", BuiltinType::kUndefined}, - {"samRvlXXr", BuiltinType::kUndefined}, - {"samper_ompariscn", BuiltinType::kUndefined}, - {"sampler_copaXXi58n", BuiltinType::kUndefined}, - {"samplr_comprison", BuiltinType::kUndefined}, - {"subgrppp_matrix_lecct", BuiltinType::kUndefined}, - {"subgroup_matrvx_left", BuiltinType::kUndefined}, - {"sEEbgrupJmatSSix_left", BuiltinType::kUndefined}, - {"subgrup_marix_result", BuiltinType::kUndefined}, - {"sbgrup_m_trix_resut", BuiltinType::kUndefined}, - {"sbgroup_m_trix_rewwult", BuiltinType::kUndefined}, - {"subgroup_matrix_ri99ddt", BuiltinType::kUndefined}, - {"subgroPP_m99trix_righ", BuiltinType::kUndefined}, - {"sugroup_matrix_rKKght", BuiltinType::kUndefined}, - {"teel_buoofeDD", BuiltinType::kUndefined}, - {"exel_uBeii", BuiltinType::kUndefined}, - {"texl_buqer", BuiltinType::kUndefined}, - {"txt00rLL_d", BuiltinType::kUndefined}, - {"tnxture_16vv", BuiltinType::kUndefined}, - {"trrxtur_nd", BuiltinType::kUndefined}, + {"resour5e_binding", BuiltinType::kUndefined}, + {"rejource_bin99iffg", BuiltinType::kUndefined}, + {"rRsYYuXXce_bivding", BuiltinType::kUndefined}, + {"cmler", BuiltinType::kUndefined}, + {"XX8m5le", BuiltinType::kUndefined}, + {"mpler", BuiltinType::kUndefined}, + {"samcclr_cppmparison", BuiltinType::kUndefined}, + {"sampler_comparivon", BuiltinType::kUndefined}, + {"sampSSerJcomparEEon", BuiltinType::kUndefined}, + {"subgroup_atrix_let", BuiltinType::kUndefined}, + {"subgou_mat_x_left", BuiltinType::kUndefined}, + {"subgroup_mat_iw_left", BuiltinType::kUndefined}, + {"subgroudd_matrix_resu99t", BuiltinType::kUndefined}, + {"subgroup_mtrix_99eulPP", BuiltinType::kUndefined}, + {"suKKgroup_mtrix_result", BuiltinType::kUndefined}, + {"suDDgroup_maorix_righM", BuiltinType::kUndefined}, + {"subropBmatriixright", BuiltinType::kUndefined}, + {"sqgroup_atrix_right", BuiltinType::kUndefined}, + {"LLexe00bffer", BuiltinType::kUndefined}, + {"tnxel_bvvffe66", BuiltinType::kUndefined}, + {"nrxel_buffer", BuiltinType::kUndefined}, {"xxture_eed", BuiltinType::kUndefined}, - {"CCNOxture_2d", BuiltinType::kUndefined}, - {"txture_2d", BuiltinType::kUndefined}, - {"tex4ure_2d_array", BuiltinType::kUndefined}, - {"teNNture_2d_arNNy", BuiltinType::kUndefined}, - {"texture2d_array", BuiltinType::kUndefined}, - {"tuxtre3d", BuiltinType::kUndefined}, - {"textErYYS3A", BuiltinType::kUndefined}, - {"tex0ure_3d", BuiltinType::kUndefined}, - {"texaaure_cube", BuiltinType::kUndefined}, - {"extre_cubmmq", BuiltinType::kUndefined}, - {"texture_cbe", BuiltinType::kUndefined}, - {"tExtue_cube_araUU", BuiltinType::kUndefined}, - {"eturKK_cube_aDDray", BuiltinType::kUndefined}, - {"textut___cu0e_array", BuiltinType::kUndefined}, - {"tpturl_dpAh_2d", BuiltinType::kUndefined}, - {"txture_dMpth_2d", BuiltinType::kUndefined}, - {"BBexture_depth_2d", BuiltinType::kUndefined}, - {"text99e_depth2bb_arnnay", BuiltinType::kUndefined}, - {"EEe1tureAAdepth_2d_arra", BuiltinType::kUndefined}, - {"texturT_dep5h_2d_arra66", BuiltinType::kUndefined}, - {"textuHe_depth_cube", BuiltinType::kUndefined}, - {"texture_dxpthHHcbe", BuiltinType::kUndefined}, - {"zexture_deptyy0cubn", BuiltinType::kUndefined}, - {"texture_deth_cube_array", BuiltinType::kUndefined}, - {"texture_depth_cubeHkray", BuiltinType::kUndefined}, - {"texture_depth_cubearcay", BuiltinType::kUndefined}, - {"texture_depth_urrtiooapled_2d", BuiltinType::kUndefined}, - {"texue_depth_JJultisampled_2d", BuiltinType::kUndefined}, - {"texture_depth_multCCsampld_20", BuiltinType::kUndefined}, - {"99eAAure_exxernal", BuiltinType::kUndefined}, - {"textcre_external", BuiltinType::kUndefined}, - {"texture_Sxternal", BuiltinType::kUndefined}, - {"BBextre_multisaopleds2d", BuiltinType::kUndefined}, - {"texture_multisampld_2d", BuiltinType::kUndefined}, - {"texmmur_multieampled_2d", BuiltinType::kUndefined}, - {"tQQturPP_storage_1gg", BuiltinType::kUndefined}, - {"textr_stoBe_1d", BuiltinType::kUndefined}, - {"tlKKtur_storagN_1d", BuiltinType::kUndefined}, - {"trrture_storage2d", BuiltinType::kUndefined}, - {"texrure_tpprage_2d", BuiltinType::kUndefined}, + {"CCNOxture_1d", BuiltinType::kUndefined}, + {"txture_1d", BuiltinType::kUndefined}, + {"tex4uae_2d", BuiltinType::kUndefined}, + {"extuNNe_2NN", BuiltinType::kUndefined}, + {"texture2d", BuiltinType::kUndefined}, + {"txtureud_array", BuiltinType::kUndefined}, + {"teYYtuAe_2d_arESy", BuiltinType::kUndefined}, + {"texture_2d_0rray", BuiltinType::kUndefined}, + {"texaaure_3d", BuiltinType::kUndefined}, + {"tqqmmtur_d", BuiltinType::kUndefined}, + {"textue_3d", BuiltinType::kUndefined}, + {"tetuUUe_cEb", BuiltinType::kUndefined}, + {"textuK_DDube", BuiltinType::kUndefined}, + {"__ext0rt_cube", BuiltinType::kUndefined}, + {"tepAure_be_array", BuiltinType::kUndefined}, + {"texture_cube_arMa", BuiltinType::kUndefined}, + {"texture_BBube_array", BuiltinType::kUndefined}, + {"nnxtbbre_dpt99_2d", BuiltinType::kUndefined}, + {"texturEEdeptAA_2d", BuiltinType::kUndefined}, + {"texture5depth66Td", BuiltinType::kUndefined}, + {"texture_depth_2H_array", BuiltinType::kUndefined}, + {"textureHHdepthxxd_aray", BuiltinType::kUndefined}, + {"textyy0e_depthznd_array", BuiltinType::kUndefined}, + {"texture_depth_cue", BuiltinType::kUndefined}, + {"texurH_kepth_cube", BuiltinType::kUndefined}, + {"exture_cepth_cube", BuiltinType::kUndefined}, + {"ooexrrure_dpt_cube_array", BuiltinType::kUndefined}, + {"textre_depthJJube_array", BuiltinType::kUndefined}, + {"tCCxture_dep0h_ube_array", BuiltinType::kUndefined}, + {"texure_deAAtx_mult99sampled_2d", BuiltinType::kUndefined}, + {"texture_cepth_multisampled_2d", BuiltinType::kUndefined}, + {"texture_deSth_multisampled_2d", BuiltinType::kUndefined}, + {"textureoeterBBal", BuiltinType::kUndefined}, + {"texture_extenal", BuiltinType::kUndefined}, + {"textummeexternal", BuiltinType::kUndefined}, + {"texggure_multisomPPQle_2d", BuiltinType::kUndefined}, + {"teture_mltisamBed_2", BuiltinType::kUndefined}, + {"texture_mlllNKismpled2d", BuiltinType::kUndefined}, + {"trrture_storage1d", BuiltinType::kUndefined}, + {"texrure_tpprage_1d", BuiltinType::kUndefined}, {"teyture_storage_PPd", BuiltinType::kUndefined}, - {"texturcc_torageZ2d_array", BuiltinType::kUndefined}, - {"texturestorage_2d_aray", BuiltinType::kUndefined}, - {"texture_storage_2d_00rray", BuiltinType::kUndefined}, - {"texPPuBB_stJrage_ssd", BuiltinType::kUndefined}, - {"texJJre_sffowwagf_3d", BuiltinType::kUndefined}, - {"textIre_stoXXage_3", BuiltinType::kUndefined}, - {"a", BuiltinType::kUndefined}, - {"u3", BuiltinType::kUndefined}, - {"KK2", BuiltinType::kUndefined}, - {"m4", BuiltinType::kUndefined}, - {"o8", BuiltinType::kUndefined}, - {"jNHh", BuiltinType::kUndefined}, - {"vEw3Uc2", BuiltinType::kUndefined}, - {"vuc", BuiltinType::kUndefined}, - {"Krrdd", BuiltinType::kUndefined}, - {"2Pttcf", BuiltinType::kUndefined}, - {"vwwcsf", BuiltinType::kUndefined}, - {"11enncf", BuiltinType::kUndefined}, - {"ve2h", BuiltinType::kUndefined}, - {"vech", BuiltinType::kUndefined}, - {"ecaSSIh", BuiltinType::kUndefined}, - {"vED2i", BuiltinType::kUndefined}, + {"teture_stoZZcge_2d", BuiltinType::kUndefined}, + {"txtue_storage_2d", BuiltinType::kUndefined}, + {"texture00storage_2d", BuiltinType::kUndefined}, + {"teJturBss_storagePPd_array", BuiltinType::kUndefined}, + {"textureffsforage_2dwwaJJay", BuiltinType::kUndefined}, + {"XXexture_stoage_2I_array", BuiltinType::kUndefined}, + {"textur_oage_d", BuiltinType::kUndefined}, + {"textue_storage_3d", BuiltinType::kUndefined}, + {"tuxtreKKstorage_3d", BuiltinType::kUndefined}, + {"m43", BuiltinType::kUndefined}, + {"po2", BuiltinType::kUndefined}, + {"HhNj2", BuiltinType::kUndefined}, + {"uEw33", BuiltinType::kUndefined}, + {"u", BuiltinType::kUndefined}, + {"rdd", BuiltinType::kUndefined}, + {"Pttc2", BuiltinType::kUndefined}, + {"vwws2", BuiltinType::kUndefined}, + {"nncc11", BuiltinType::kUndefined}, + {"ve2f", BuiltinType::kUndefined}, + {"vecf", BuiltinType::kUndefined}, + {"ecaSSIf", BuiltinType::kUndefined}, + {"vED2h", BuiltinType::kUndefined}, {"veIccR", BuiltinType::kUndefined}, {"ec9", BuiltinType::kUndefined}, - {"aec2u", BuiltinType::kUndefined}, - {"LSc2u", BuiltinType::kUndefined}, + {"aec2i", BuiltinType::kUndefined}, + {"LSc2i", BuiltinType::kUndefined}, {"ecmm", BuiltinType::kUndefined}, - {"4eV", BuiltinType::kUndefined}, - {"ec_", BuiltinType::kUndefined}, - {"cQ", BuiltinType::kUndefined}, - {"veERdd", BuiltinType::kUndefined}, - {"vec9", BuiltinType::kUndefined}, - {"e03", BuiltinType::kUndefined}, - {"vzh", BuiltinType::kUndefined}, - {"veccch", BuiltinType::kUndefined}, - {"v_Qch", BuiltinType::kUndefined}, + {"4ecV", BuiltinType::kUndefined}, + {"vc__", BuiltinType::kUndefined}, + {"vQ2", BuiltinType::kUndefined}, + {"vddRE", BuiltinType::kUndefined}, + {"e93", BuiltinType::kUndefined}, + {"03", BuiltinType::kUndefined}, + {"vzf", BuiltinType::kUndefined}, + {"vecccf", BuiltinType::kUndefined}, + {"v_Qcf", BuiltinType::kUndefined}, {"vect", BuiltinType::kUndefined}, {"zz3ecECpp", BuiltinType::kUndefined}, - {"veddhhi", BuiltinType::kUndefined}, - {"e7766u", BuiltinType::kUndefined}, + {"veddhhh", BuiltinType::kUndefined}, + {"e7766i", BuiltinType::kUndefined}, {"vec3P", BuiltinType::kUndefined}, - {"vecwu", BuiltinType::kUndefined}, - {"vu", BuiltinType::kUndefined}, - {"6ecXX", BuiltinType::kUndefined}, - {"RR", BuiltinType::kUndefined}, - {"e1V", BuiltinType::kUndefined}, - {"vecHHGG", BuiltinType::kUndefined}, - {"MeFF4f", BuiltinType::kUndefined}, - {"ve4h", BuiltinType::kUndefined}, + {"vecwi", BuiltinType::kUndefined}, + {"ecu", BuiltinType::kUndefined}, + {"vXXc3u", BuiltinType::kUndefined}, + {"Rc3", BuiltinType::kUndefined}, + {"eV", BuiltinType::kUndefined}, + {"GGeHH4", BuiltinType::kUndefined}, + {"MFFc4", BuiltinType::kUndefined}, + {"ve4f", BuiltinType::kUndefined}, {"cTgg", BuiltinType::kUndefined}, {"KK1c_Q", BuiltinType::kUndefined}, {"vEc4", BuiltinType::kUndefined}, {"c4M", BuiltinType::kUndefined}, {"veS77G4", BuiltinType::kUndefined}, - {"vKFttu", BuiltinType::kUndefined}, - {"vZZUss4u", BuiltinType::kUndefined}, - {"vc4u", BuiltinType::kUndefined}, + {"vKFtti", BuiltinType::kUndefined}, + {"vZZUss4i", BuiltinType::kUndefined}, + {"vc4i", BuiltinType::kUndefined}, + {"lec4u", BuiltinType::kUndefined}, + {"veh4u", BuiltinType::kUndefined}, + {"vkcTT", BuiltinType::kUndefined}, }; using BuiltinTypeParseTest = testing::TestWithParam<BuiltinTypeCase>; @@ -968,60 +972,60 @@ }; static constexpr BuiltinValueCase kInvalidBuiltinValueCases[] = { - {"barycentric_coorl", BuiltinValue::kUndefined}, - {"barycehtric_coord", BuiltinValue::kUndefined}, - {"barycKnrik_TToord", BuiltinValue::kUndefined}, - {"clip_eistanwws", BuiltinValue::kUndefined}, - {"clip_vKsjjances", BuiltinValue::kUndefined}, - {"clip_ditaceYY", BuiltinValue::kUndefined}, - {"EEcag_deIt", BuiltinValue::kUndefined}, - {"fQQag_depth", BuiltinValue::kUndefined}, - {"fra_Pelt", BuiltinValue::kUndefined}, - {"frffHt_facing", BuiltinValue::kUndefined}, - {"frontnfacing", BuiltinValue::kUndefined}, - {"Frongfa66ing", BuiltinValue::kUndefined}, - {"hlobal_invoca8ioss_id", BuiltinValue::kUndefined}, - {"gloFFl_illvocation_id", BuiltinValue::kUndefined}, - {"gloal_injo00ation_2d", BuiltinValue::kUndefined}, - {"instance_igdex", BuiltinValue::kUndefined}, - {"instance_iede", BuiltinValue::kUndefined}, - {"insance_ffndex", BuiltinValue::kUndefined}, - {"oal_invocationid", BuiltinValue::kUndefined}, - {"ocal_invocation_id", BuiltinValue::kUndefined}, - {"local_invocaqion_id", BuiltinValue::kUndefined}, - {"local_invction_iAAex", BuiltinValue::kUndefined}, - {"localinvocation_indvx", BuiltinValue::kUndefined}, - {"local_invocatijj_index", BuiltinValue::kUndefined}, - {"ZZum_workgroups", BuiltinValue::kUndefined}, - {"nOPm_wor2gIIUups", BuiltinValue::kUndefined}, - {"num_workZZroups", BuiltinValue::kUndefined}, - {"pnnsition", BuiltinValue::kUndefined}, - {"HositkkZ22n", BuiltinValue::kUndefined}, - {"positio", BuiltinValue::kUndefined}, - {"pimitRve_idex", BuiltinValue::kUndefined}, - {"primiqqive_inde99", BuiltinValue::kUndefined}, - {"prim77tive_index", BuiltinValue::kUndefined}, - {"samp3_inde", BuiltinValue::kUndefined}, - {"ccamle_iuudex", BuiltinValue::kUndefined}, - {"ampRRe_inde1", BuiltinValue::kUndefined}, - {"samplllmaJJk", BuiltinValue::kUndefined}, - {"smplMMmak", BuiltinValue::kUndefined}, - {"samlT66maxk", BuiltinValue::kUndefined}, - {"sQQbgroJp_id", BuiltinValue::kUndefined}, - {"suubgop_id", BuiltinValue::kUndefined}, - {"subgrup_d", BuiltinValue::kUndefined}, - {"ugroup_qnvoyat33on_id", BuiltinValue::kUndefined}, - {"subgrouxx_invocation_id", BuiltinValue::kUndefined}, - {"subgrNup_ivrcation_d", BuiltinValue::kUndefined}, - {"sugroup_si99e", BuiltinValue::kUndefined}, - {"subgrop_size", BuiltinValue::kUndefined}, - {"suHgroul_ize", BuiltinValue::kUndefined}, - {"_erx_index", BuiltinValue::kUndefined}, - {"vrtex_index", BuiltinValue::kUndefined}, - {"vrtexjindex", BuiltinValue::kUndefined}, - {"EEottkmmroup_id", BuiltinValue::kUndefined}, - {"workgop_id", BuiltinValue::kUndefined}, - {"workgrourr_d", BuiltinValue::kUndefined}, + {"baycentric_coowwd", BuiltinValue::kUndefined}, + {"barycentrjK_vvoord", BuiltinValue::kUndefined}, + {"baryYYntric_cord", BuiltinValue::kUndefined}, + {"cipEEdistanceI", BuiltinValue::kUndefined}, + {"clip_diQQtances", BuiltinValue::kUndefined}, + {"clip_itaPcel", BuiltinValue::kUndefined}, + {"frg_defftHH", BuiltinValue::kUndefined}, + {"frag_deptn", BuiltinValue::kUndefined}, + {"frF6g_gpth", BuiltinValue::kUndefined}, + {"hront_fass8ng", BuiltinValue::kUndefined}, + {"frot_FFalling", BuiltinValue::kUndefined}, + {"f0ont_2acing", BuiltinValue::kUndefined}, + {"global_invgcation_id", BuiltinValue::kUndefined}, + {"global_invoceion_id", BuiltinValue::kUndefined}, + {"global_invoffaton_id", BuiltinValue::kUndefined}, + {"instace_ide", BuiltinValue::kUndefined}, + {"insance_index", BuiltinValue::kUndefined}, + {"intanceqqindex", BuiltinValue::kUndefined}, + {"oca_invoAAaion_id", BuiltinValue::kUndefined}, + {"local_invoation_iv", BuiltinValue::kUndefined}, + {"local_invocation_ij", BuiltinValue::kUndefined}, + {"locaZZ_invocation_index", BuiltinValue::kUndefined}, + {"local_2nvocationOinIIPUx", BuiltinValue::kUndefined}, + {"local_invocatiZZn_index", BuiltinValue::kUndefined}, + {"num_workgroupnn", BuiltinValue::kUndefined}, + {"nu22_ZZHrkgkkoups", BuiltinValue::kUndefined}, + {"num_workgrops", BuiltinValue::kUndefined}, + {"osiiRn", BuiltinValue::kUndefined}, + {"posqqt99on", BuiltinValue::kUndefined}, + {"posit77on", BuiltinValue::kUndefined}, + {"prmitive3inex", BuiltinValue::kUndefined}, + {"primitiveindeccu", BuiltinValue::kUndefined}, + {"priRRitive_i1ex", BuiltinValue::kUndefined}, + {"sllple_inJJex", BuiltinValue::kUndefined}, + {"sImplMM_ix", BuiltinValue::kUndefined}, + {"s66mpleinTex", BuiltinValue::kUndefined}, + {"sQQmpleJmask", BuiltinValue::kUndefined}, + {"suumpemask", BuiltinValue::kUndefined}, + {"sampl_mak", BuiltinValue::kUndefined}, + {"ygqoup_i33", BuiltinValue::kUndefined}, + {"subgrouxx_id", BuiltinValue::kUndefined}, + {"subgrrN_d", BuiltinValue::kUndefined}, + {"su99group_nvocation_id", BuiltinValue::kUndefined}, + {"subgoup_invocation_id", BuiltinValue::kUndefined}, + {"subgloup_inHocaton_id", BuiltinValue::kUndefined}, + {"sug_oup_sie", BuiltinValue::kUndefined}, + {"subgroup_sze", BuiltinValue::kUndefined}, + {"jbgroup_size", BuiltinValue::kUndefined}, + {"EEetttmmx_index", BuiltinValue::kUndefined}, + {"verte_ndex", BuiltinValue::kUndefined}, + {"vertex_irrdx", BuiltinValue::kUndefined}, + {"workgrxupid", BuiltinValue::kUndefined}, + {"zzorkgou_id", BuiltinValue::kUndefined}, + {"workgroup_ed", BuiltinValue::kUndefined}, }; using BuiltinValueParseTest = testing::TestWithParam<BuiltinValueCase>; @@ -1080,60 +1084,60 @@ }; static constexpr AttributeCase kInvalidAttributeCases[] = { - {"xign", Attribute::kUndefined}, - {"alzz", Attribute::kUndefined}, - {"alige", Attribute::kUndefined}, - {"iudpZng", Attribute::kUndefined}, - {"buuTTdi00", Attribute::kUndefined}, - {"bvviJJ", Attribute::kUndefined}, - {"blendQsrc", Attribute::kUndefined}, - {"lend3srR", Attribute::kUndefined}, - {"bnd_C", Attribute::kUndefined}, - {"bultPPpr", Attribute::kUndefined}, - {"buDDiltxxn", Attribute::kUndefined}, - {"YYlqumdltin", Attribute::kUndefined}, - {"cFFl__", Attribute::kUndefined}, - {"rrNNlor", Attribute::kUndefined}, - {"loMor", Attribute::kUndefined}, - {"oute", Attribute::kUndefined}, - {"clmpqtx", Attribute::kUndefined}, - {"compte", Attribute::kUndefined}, - {"diag4aostc", Attribute::kUndefined}, - {"diagWWostic", Attribute::kUndefined}, - {"diagjjosti", Attribute::kUndefined}, - {"fjjagment", Attribute::kUndefined}, - {"frjgm1t", Attribute::kUndefined}, - {"fragmet", Attribute::kUndefined}, - {"grou99", Attribute::kUndefined}, - {"gyVVup", Attribute::kUndefined}, - {"rouxZ", Attribute::kUndefined}, - {"3vv", Attribute::kUndefined}, - {"is", Attribute::kUndefined}, - {"F", Attribute::kUndefined}, - {"nput_attachmenteinduux", Attribute::kUndefined}, - {"iKKput_ataIhmnt_index", Attribute::kUndefined}, - {"input_attcJment_index", Attribute::kUndefined}, - {"intCXSSrpolate", Attribute::kUndefined}, - {"iWWterZZJolate", Attribute::kUndefined}, - {"itedp5lamm", Attribute::kUndefined}, - {"nvBBriBBUt", Attribute::kUndefined}, - {"iJJ11ariant", Attribute::kUndefined}, - {"ittfariant", Attribute::kUndefined}, - {"ltttion", Attribute::kUndefined}, - {"lwcaLion", Attribute::kUndefined}, - {"loca1ion", Attribute::kUndefined}, - {"muwwt_use", Attribute::kUndefined}, - {"mt_uee", Attribute::kUndefined}, - {"mus_use", Attribute::kUndefined}, - {"siNNe", Attribute::kUndefined}, - {"sRR__Ul", Attribute::kUndefined}, - {"sHze", Attribute::kUndefined}, - {"veCrtex", Attribute::kUndefined}, - {"ertex", Attribute::kUndefined}, - {"vedpIx", Attribute::kUndefined}, - {"wokgroup_size", Attribute::kUndefined}, - {"Lrkgroup_Nze", Attribute::kUndefined}, - {"wokg_size", Attribute::kUndefined}, + {"uigZp", Attribute::kUndefined}, + {"00ui7TT", Attribute::kUndefined}, + {"vvJJ", Attribute::kUndefined}, + {"biQding", Attribute::kUndefined}, + {"bCdRng", Attribute::kUndefined}, + {"iCi", Attribute::kUndefined}, + {"blnPPp_srr", Attribute::kUndefined}, + {"xx8DDuen_src", Attribute::kUndefined}, + {"lldqqendYYsrc", Attribute::kUndefined}, + {"uiFFti__", Attribute::kUndefined}, + {"rrGGNNtin", Attribute::kUndefined}, + {"buiMlin", Attribute::kUndefined}, + {"lo", Attribute::kUndefined}, + {"xllor", Attribute::kUndefined}, + {"olor", Attribute::kUndefined}, + {"camp44e", Attribute::kUndefined}, + {"WWGmpute", Attribute::kUndefined}, + {"cjjmpue", Attribute::kUndefined}, + {"djjagnostic", Attribute::kUndefined}, + {"diagnoj1c", Attribute::kUndefined}, + {"diagnotic", Attribute::kUndefined}, + {"99ragment", Attribute::kUndefined}, + {"fVVagmeny", Attribute::kUndefined}, + {"frxmeZZt", Attribute::kUndefined}, + {"g33vvp", Attribute::kUndefined}, + {"gros9", Attribute::kUndefined}, + {"grFu", Attribute::kUndefined}, + {"ue", Attribute::kUndefined}, + {"Z", Attribute::kUndefined}, + {"i", Attribute::kUndefined}, + {"inpMt_attFchmnt_index", Attribute::kUndefined}, + {"inputWWatZZachment66index", Attribute::kUndefined}, + {"inpt_attacme5t_indmdx", Attribute::kUndefined}, + {"BBnterpBlaUe", Attribute::kUndefined}, + {"inter0olatJ11", Attribute::kUndefined}, + {"intfrpottate", Attribute::kUndefined}, + {"inXaittn", Attribute::kUndefined}, + {"inLwriant", Attribute::kUndefined}, + {"in1ariant", Attribute::kUndefined}, + {"lowwation", Attribute::kUndefined}, + {"latien", Attribute::kUndefined}, + {"loction", Attribute::kUndefined}, + {"muNNt_use", Attribute::kUndefined}, + {"mustUlRRs__", Attribute::kUndefined}, + {"mHst_use", Attribute::kUndefined}, + {"srCCe", Attribute::kUndefined}, + {"ize", Attribute::kUndefined}, + {"dzIp", Attribute::kUndefined}, + {"vetex", Attribute::kUndefined}, + {"LNtx", Attribute::kUndefined}, + {"r", Attribute::kUndefined}, + {"wxxrkgqqoup_GizRR", Attribute::kUndefined}, + {"workSroup_siGGe", Attribute::kUndefined}, + {"oqkccr8up_size", Attribute::kUndefined}, }; using AttributeParseTest = testing::TestWithParam<AttributeCase>;
diff --git a/src/tint/lang/core/intrinsic/data.cc b/src/tint/lang/core/intrinsic/data.cc index 146747f..2099c14 100644 --- a/src/tint/lang/core/intrinsic/data.cc +++ b/src/tint/lang/core/intrinsic/data.cc
@@ -592,6 +592,20 @@ }; +/// TypeMatcher for 'type resource_binding' +constexpr TypeMatcher kResourceBindingMatcher { +/* match */ [](MatchState& state, const Type* ty) -> const Type* { + if (!MatchResourceBinding(state, ty)) { + return nullptr; + } + return BuildResourceBinding(state, ty); + }, +/* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { + out << style::Type("resource_binding"); + } +}; + + /// TypeMatcher for 'type sampler' constexpr TypeMatcher kSamplerMatcher { /* match */ [](MatchState& state, const Type* ty) -> const Type* { @@ -1742,48 +1756,49 @@ /* [29] */ kRuntimeArrayMatcher, /* [30] */ kArrayMatcher, /* [31] */ kBindingArrayMatcher, - /* [32] */ kSamplerMatcher, - /* [33] */ kSamplerComparisonMatcher, - /* [34] */ kTexture1DMatcher, - /* [35] */ kTexture2DMatcher, - /* [36] */ kTexture2DArrayMatcher, - /* [37] */ kTexture3DMatcher, - /* [38] */ kTextureCubeMatcher, - /* [39] */ kTextureCubeArrayMatcher, - /* [40] */ kTextureMultisampled2DMatcher, - /* [41] */ kTextureDepth2DMatcher, - /* [42] */ kTextureDepth2DArrayMatcher, - /* [43] */ kTextureDepthCubeMatcher, - /* [44] */ kTextureDepthCubeArrayMatcher, - /* [45] */ kTextureDepthMultisampled2DMatcher, - /* [46] */ kTextureStorage1DMatcher, - /* [47] */ kTextureStorage2DMatcher, - /* [48] */ kTextureStorage2DArrayMatcher, - /* [49] */ kTextureStorage3DMatcher, - /* [50] */ kTextureExternalMatcher, - /* [51] */ kTexelBufferMatcher, - /* [52] */ kInputAttachmentMatcher, - /* [53] */ kModfResultMatcher, - /* [54] */ kModfResultVecMatcher, - /* [55] */ kFrexpResultMatcher, - /* [56] */ kFrexpResultVecMatcher, - /* [57] */ kAtomicCompareExchangeResultMatcher, - /* [58] */ kSubgroupMatrixMatcher, - /* [59] */ kScalarMatcher, - /* [60] */ kScalarNoF32Matcher, - /* [61] */ kScalarNoF16Matcher, - /* [62] */ kScalarNoI32Matcher, - /* [63] */ kScalarNoU32Matcher, - /* [64] */ kScalarNoBoolMatcher, - /* [65] */ kFiu32F16Matcher, - /* [66] */ kFiu32Matcher, - /* [67] */ kFi32F16Matcher, - /* [68] */ kFi32Matcher, - /* [69] */ kF32F16Matcher, - /* [70] */ kIu32Matcher, - /* [71] */ kIu32Iu8Matcher, - /* [72] */ kIu8Matcher, - /* [73] */ kSubgroupMatrixElementsMatcher, + /* [32] */ kResourceBindingMatcher, + /* [33] */ kSamplerMatcher, + /* [34] */ kSamplerComparisonMatcher, + /* [35] */ kTexture1DMatcher, + /* [36] */ kTexture2DMatcher, + /* [37] */ kTexture2DArrayMatcher, + /* [38] */ kTexture3DMatcher, + /* [39] */ kTextureCubeMatcher, + /* [40] */ kTextureCubeArrayMatcher, + /* [41] */ kTextureMultisampled2DMatcher, + /* [42] */ kTextureDepth2DMatcher, + /* [43] */ kTextureDepth2DArrayMatcher, + /* [44] */ kTextureDepthCubeMatcher, + /* [45] */ kTextureDepthCubeArrayMatcher, + /* [46] */ kTextureDepthMultisampled2DMatcher, + /* [47] */ kTextureStorage1DMatcher, + /* [48] */ kTextureStorage2DMatcher, + /* [49] */ kTextureStorage2DArrayMatcher, + /* [50] */ kTextureStorage3DMatcher, + /* [51] */ kTextureExternalMatcher, + /* [52] */ kTexelBufferMatcher, + /* [53] */ kInputAttachmentMatcher, + /* [54] */ kModfResultMatcher, + /* [55] */ kModfResultVecMatcher, + /* [56] */ kFrexpResultMatcher, + /* [57] */ kFrexpResultVecMatcher, + /* [58] */ kAtomicCompareExchangeResultMatcher, + /* [59] */ kSubgroupMatrixMatcher, + /* [60] */ kScalarMatcher, + /* [61] */ kScalarNoF32Matcher, + /* [62] */ kScalarNoF16Matcher, + /* [63] */ kScalarNoI32Matcher, + /* [64] */ kScalarNoU32Matcher, + /* [65] */ kScalarNoBoolMatcher, + /* [66] */ kFiu32F16Matcher, + /* [67] */ kFiu32Matcher, + /* [68] */ kFi32F16Matcher, + /* [69] */ kFi32Matcher, + /* [70] */ kF32F16Matcher, + /* [71] */ kIu32Matcher, + /* [72] */ kIu32Iu8Matcher, + /* [73] */ kIu8Matcher, + /* [74] */ kSubgroupMatrixElementsMatcher, }; /// The template numbers, and number matchers @@ -1864,7 +1879,7 @@ /* [50] */ MatcherIndex(0), /* [51] */ MatcherIndex(13), /* [52] */ MatcherIndex(11), - /* [53] */ MatcherIndex(58), + /* [53] */ MatcherIndex(59), /* [54] */ MatcherIndex(1), /* [55] */ MatcherIndex(2), /* [56] */ MatcherIndex(3), @@ -1892,7 +1907,7 @@ /* [78] */ MatcherIndex(1), /* [79] */ MatcherIndex(15), /* [80] */ MatcherIndex(0), - /* [81] */ MatcherIndex(58), + /* [81] */ MatcherIndex(59), /* [82] */ MatcherIndex(0), /* [83] */ MatcherIndex(1), /* [84] */ MatcherIndex(2), @@ -1908,47 +1923,47 @@ /* [94] */ MatcherIndex(29), /* [95] */ MatcherIndex(10), /* [96] */ MatcherIndex(15), - /* [97] */ MatcherIndex(58), + /* [97] */ MatcherIndex(59), /* [98] */ MatcherIndex(8), /* [99] */ MatcherIndex(0), /* [100] */ MatcherIndex(2), /* [101] */ MatcherIndex(3), - /* [102] */ MatcherIndex(58), + /* [102] */ MatcherIndex(59), /* [103] */ MatcherIndex(6), /* [104] */ MatcherIndex(1), /* [105] */ MatcherIndex(4), /* [106] */ MatcherIndex(3), - /* [107] */ MatcherIndex(58), + /* [107] */ MatcherIndex(59), /* [108] */ MatcherIndex(7), /* [109] */ MatcherIndex(1), /* [110] */ MatcherIndex(2), /* [111] */ MatcherIndex(4), - /* [112] */ MatcherIndex(58), + /* [112] */ MatcherIndex(59), /* [113] */ MatcherIndex(8), /* [114] */ MatcherIndex(1), /* [115] */ MatcherIndex(2), /* [116] */ MatcherIndex(3), - /* [117] */ MatcherIndex(58), + /* [117] */ MatcherIndex(59), /* [118] */ MatcherIndex(6), /* [119] */ MatcherIndex(0), /* [120] */ MatcherIndex(4), /* [121] */ MatcherIndex(3), - /* [122] */ MatcherIndex(58), + /* [122] */ MatcherIndex(59), /* [123] */ MatcherIndex(7), /* [124] */ MatcherIndex(0), /* [125] */ MatcherIndex(2), /* [126] */ MatcherIndex(4), - /* [127] */ MatcherIndex(58), + /* [127] */ MatcherIndex(59), /* [128] */ MatcherIndex(6), /* [129] */ MatcherIndex(0), /* [130] */ MatcherIndex(1), /* [131] */ MatcherIndex(2), - /* [132] */ MatcherIndex(58), + /* [132] */ MatcherIndex(59), /* [133] */ MatcherIndex(7), /* [134] */ MatcherIndex(0), /* [135] */ MatcherIndex(1), /* [136] */ MatcherIndex(2), - /* [137] */ MatcherIndex(58), + /* [137] */ MatcherIndex(59), /* [138] */ MatcherIndex(8), /* [139] */ MatcherIndex(0), /* [140] */ MatcherIndex(1), @@ -1993,121 +2008,121 @@ /* [179] */ MatcherIndex(25), /* [180] */ MatcherIndex(0), /* [181] */ MatcherIndex(11), - /* [182] */ MatcherIndex(56), + /* [182] */ MatcherIndex(57), /* [183] */ MatcherIndex(0), /* [184] */ MatcherIndex(1), /* [185] */ MatcherIndex(25), /* [186] */ MatcherIndex(0), /* [187] */ MatcherIndex(2), - /* [188] */ MatcherIndex(54), + /* [188] */ MatcherIndex(55), /* [189] */ MatcherIndex(0), /* [190] */ MatcherIndex(1), - /* [191] */ MatcherIndex(46), + /* [191] */ MatcherIndex(47), /* [192] */ MatcherIndex(0), /* [193] */ MatcherIndex(1), - /* [194] */ MatcherIndex(47), + /* [194] */ MatcherIndex(48), /* [195] */ MatcherIndex(0), /* [196] */ MatcherIndex(1), - /* [197] */ MatcherIndex(48), + /* [197] */ MatcherIndex(49), /* [198] */ MatcherIndex(0), /* [199] */ MatcherIndex(1), - /* [200] */ MatcherIndex(49), + /* [200] */ MatcherIndex(50), /* [201] */ MatcherIndex(0), /* [202] */ MatcherIndex(1), - /* [203] */ MatcherIndex(51), + /* [203] */ MatcherIndex(52), /* [204] */ MatcherIndex(0), /* [205] */ MatcherIndex(1), - /* [206] */ MatcherIndex(46), + /* [206] */ MatcherIndex(47), /* [207] */ MatcherIndex(9), /* [208] */ MatcherIndex(15), - /* [209] */ MatcherIndex(47), + /* [209] */ MatcherIndex(48), /* [210] */ MatcherIndex(9), /* [211] */ MatcherIndex(15), - /* [212] */ MatcherIndex(48), + /* [212] */ MatcherIndex(49), /* [213] */ MatcherIndex(9), /* [214] */ MatcherIndex(15), - /* [215] */ MatcherIndex(49), + /* [215] */ MatcherIndex(50), /* [216] */ MatcherIndex(9), /* [217] */ MatcherIndex(15), - /* [218] */ MatcherIndex(51), + /* [218] */ MatcherIndex(52), /* [219] */ MatcherIndex(9), /* [220] */ MatcherIndex(13), /* [221] */ MatcherIndex(10), - /* [222] */ MatcherIndex(46), + /* [222] */ MatcherIndex(47), /* [223] */ MatcherIndex(10), /* [224] */ MatcherIndex(15), - /* [225] */ MatcherIndex(47), + /* [225] */ MatcherIndex(48), /* [226] */ MatcherIndex(10), /* [227] */ MatcherIndex(15), - /* [228] */ MatcherIndex(48), + /* [228] */ MatcherIndex(49), /* [229] */ MatcherIndex(10), /* [230] */ MatcherIndex(15), - /* [231] */ MatcherIndex(49), + /* [231] */ MatcherIndex(50), /* [232] */ MatcherIndex(10), /* [233] */ MatcherIndex(15), - /* [234] */ MatcherIndex(51), + /* [234] */ MatcherIndex(52), /* [235] */ MatcherIndex(10), /* [236] */ MatcherIndex(13), /* [237] */ MatcherIndex(9), - /* [238] */ MatcherIndex(46), + /* [238] */ MatcherIndex(47), /* [239] */ MatcherIndex(11), /* [240] */ MatcherIndex(15), - /* [241] */ MatcherIndex(47), + /* [241] */ MatcherIndex(48), /* [242] */ MatcherIndex(11), /* [243] */ MatcherIndex(15), - /* [244] */ MatcherIndex(48), + /* [244] */ MatcherIndex(49), /* [245] */ MatcherIndex(11), /* [246] */ MatcherIndex(15), - /* [247] */ MatcherIndex(49), + /* [247] */ MatcherIndex(50), /* [248] */ MatcherIndex(11), /* [249] */ MatcherIndex(15), - /* [250] */ MatcherIndex(51), + /* [250] */ MatcherIndex(52), /* [251] */ MatcherIndex(11), /* [252] */ MatcherIndex(13), /* [253] */ MatcherIndex(0), - /* [254] */ MatcherIndex(46), + /* [254] */ MatcherIndex(47), /* [255] */ MatcherIndex(9), /* [256] */ MatcherIndex(14), - /* [257] */ MatcherIndex(46), + /* [257] */ MatcherIndex(47), /* [258] */ MatcherIndex(10), /* [259] */ MatcherIndex(14), - /* [260] */ MatcherIndex(46), + /* [260] */ MatcherIndex(47), /* [261] */ MatcherIndex(11), /* [262] */ MatcherIndex(14), - /* [263] */ MatcherIndex(47), + /* [263] */ MatcherIndex(48), /* [264] */ MatcherIndex(9), /* [265] */ MatcherIndex(14), - /* [266] */ MatcherIndex(47), + /* [266] */ MatcherIndex(48), /* [267] */ MatcherIndex(10), /* [268] */ MatcherIndex(14), - /* [269] */ MatcherIndex(47), + /* [269] */ MatcherIndex(48), /* [270] */ MatcherIndex(11), /* [271] */ MatcherIndex(14), - /* [272] */ MatcherIndex(48), + /* [272] */ MatcherIndex(49), /* [273] */ MatcherIndex(9), /* [274] */ MatcherIndex(14), - /* [275] */ MatcherIndex(48), + /* [275] */ MatcherIndex(49), /* [276] */ MatcherIndex(10), /* [277] */ MatcherIndex(14), - /* [278] */ MatcherIndex(48), + /* [278] */ MatcherIndex(49), /* [279] */ MatcherIndex(11), /* [280] */ MatcherIndex(14), - /* [281] */ MatcherIndex(49), + /* [281] */ MatcherIndex(50), /* [282] */ MatcherIndex(9), /* [283] */ MatcherIndex(14), - /* [284] */ MatcherIndex(49), + /* [284] */ MatcherIndex(50), /* [285] */ MatcherIndex(10), /* [286] */ MatcherIndex(14), - /* [287] */ MatcherIndex(49), + /* [287] */ MatcherIndex(50), /* [288] */ MatcherIndex(11), /* [289] */ MatcherIndex(14), - /* [290] */ MatcherIndex(51), + /* [290] */ MatcherIndex(52), /* [291] */ MatcherIndex(9), /* [292] */ MatcherIndex(14), - /* [293] */ MatcherIndex(51), + /* [293] */ MatcherIndex(52), /* [294] */ MatcherIndex(10), /* [295] */ MatcherIndex(14), - /* [296] */ MatcherIndex(51), + /* [296] */ MatcherIndex(52), /* [297] */ MatcherIndex(11), /* [298] */ MatcherIndex(14), /* [299] */ MatcherIndex(25), @@ -2119,41 +2134,41 @@ /* [305] */ MatcherIndex(25), /* [306] */ MatcherIndex(1), /* [307] */ MatcherIndex(10), - /* [308] */ MatcherIndex(55), + /* [308] */ MatcherIndex(56), /* [309] */ MatcherIndex(0), - /* [310] */ MatcherIndex(53), + /* [310] */ MatcherIndex(54), /* [311] */ MatcherIndex(0), - /* [312] */ MatcherIndex(34), + /* [312] */ MatcherIndex(35), /* [313] */ MatcherIndex(0), - /* [314] */ MatcherIndex(35), + /* [314] */ MatcherIndex(36), /* [315] */ MatcherIndex(0), - /* [316] */ MatcherIndex(36), + /* [316] */ MatcherIndex(37), /* [317] */ MatcherIndex(0), - /* [318] */ MatcherIndex(37), + /* [318] */ MatcherIndex(38), /* [319] */ MatcherIndex(0), - /* [320] */ MatcherIndex(38), + /* [320] */ MatcherIndex(39), /* [321] */ MatcherIndex(0), - /* [322] */ MatcherIndex(39), + /* [322] */ MatcherIndex(40), /* [323] */ MatcherIndex(0), - /* [324] */ MatcherIndex(40), + /* [324] */ MatcherIndex(41), /* [325] */ MatcherIndex(0), - /* [326] */ MatcherIndex(34), + /* [326] */ MatcherIndex(35), /* [327] */ MatcherIndex(11), - /* [328] */ MatcherIndex(35), + /* [328] */ MatcherIndex(36), /* [329] */ MatcherIndex(11), - /* [330] */ MatcherIndex(36), + /* [330] */ MatcherIndex(37), /* [331] */ MatcherIndex(11), - /* [332] */ MatcherIndex(37), + /* [332] */ MatcherIndex(38), /* [333] */ MatcherIndex(11), - /* [334] */ MatcherIndex(38), + /* [334] */ MatcherIndex(39), /* [335] */ MatcherIndex(11), - /* [336] */ MatcherIndex(39), + /* [336] */ MatcherIndex(40), /* [337] */ MatcherIndex(11), /* [338] */ MatcherIndex(13), /* [339] */ MatcherIndex(1), - /* [340] */ MatcherIndex(52), + /* [340] */ MatcherIndex(53), /* [341] */ MatcherIndex(0), - /* [342] */ MatcherIndex(57), + /* [342] */ MatcherIndex(58), /* [343] */ MatcherIndex(0), /* [344] */ MatcherIndex(16), /* [345] */ MatcherIndex(0), @@ -2209,28 +2224,28 @@ /* [395] */ MatcherIndex(11), /* [396] */ MatcherIndex(24), /* [397] */ MatcherIndex(12), - /* [398] */ MatcherIndex(65), - /* [399] */ MatcherIndex(69), - /* [400] */ MatcherIndex(70), - /* [401] */ MatcherIndex(59), - /* [402] */ MatcherIndex(67), - /* [403] */ MatcherIndex(66), - /* [404] */ MatcherIndex(41), - /* [405] */ MatcherIndex(42), - /* [406] */ MatcherIndex(43), - /* [407] */ MatcherIndex(44), - /* [408] */ MatcherIndex(45), - /* [409] */ MatcherIndex(50), - /* [410] */ MatcherIndex(32), - /* [411] */ MatcherIndex(33), - /* [412] */ MatcherIndex(71), - /* [413] */ MatcherIndex(72), - /* [414] */ MatcherIndex(62), - /* [415] */ MatcherIndex(63), - /* [416] */ MatcherIndex(60), - /* [417] */ MatcherIndex(61), - /* [418] */ MatcherIndex(64), - /* [419] */ MatcherIndex(73), + /* [398] */ MatcherIndex(66), + /* [399] */ MatcherIndex(70), + /* [400] */ MatcherIndex(71), + /* [401] */ MatcherIndex(60), + /* [402] */ MatcherIndex(68), + /* [403] */ MatcherIndex(67), + /* [404] */ MatcherIndex(42), + /* [405] */ MatcherIndex(43), + /* [406] */ MatcherIndex(44), + /* [407] */ MatcherIndex(45), + /* [408] */ MatcherIndex(46), + /* [409] */ MatcherIndex(51), + /* [410] */ MatcherIndex(33), + /* [411] */ MatcherIndex(34), + /* [412] */ MatcherIndex(72), + /* [413] */ MatcherIndex(73), + /* [414] */ MatcherIndex(63), + /* [415] */ MatcherIndex(64), + /* [416] */ MatcherIndex(61), + /* [417] */ MatcherIndex(62), + /* [418] */ MatcherIndex(65), + /* [419] */ MatcherIndex(74), }; static_assert(MatcherIndicesIndex::CanIndex(kMatcherIndices),
diff --git a/src/tint/lang/core/intrinsic/type_matchers.h b/src/tint/lang/core/intrinsic/type_matchers.h index 4fc1b72..eacfb13 100644 --- a/src/tint/lang/core/intrinsic/type_matchers.h +++ b/src/tint/lang/core/intrinsic/type_matchers.h
@@ -51,6 +51,7 @@ #include "src/tint/lang/core/type/multisampled_texture.h" #include "src/tint/lang/core/type/pointer.h" #include "src/tint/lang/core/type/reference.h" +#include "src/tint/lang/core/type/resource_binding.h" #include "src/tint/lang/core/type/sampled_texture.h" #include "src/tint/lang/core/type/storage_texture.h" #include "src/tint/lang/core/type/string.h" @@ -358,6 +359,22 @@ return state.types.runtime_array(el); } +inline const type::ResourceBinding* BuildResourceBinding(intrinsic::MatchState& state, + const type::Type*) { + return state.types.resource_binding(); +} + +inline bool MatchResourceBinding(intrinsic::MatchState&, const type::Type* ty) { + if (ty->Is<intrinsic::Any>()) { + return true; + } + + if (ty->Is<type::ResourceBinding>()) { + return true; + } + return false; +} + inline const type::BindingArray* BuildBindingArray(intrinsic::MatchState& state, const type::Type*, const type::Type* el,
diff --git a/src/tint/lang/core/ir/validator_value_test.cc b/src/tint/lang/core/ir/validator_value_test.cc index 48f73b5..f431f2d 100644 --- a/src/tint/lang/core/ir/validator_value_test.cc +++ b/src/tint/lang/core/ir/validator_value_test.cc
@@ -746,6 +746,21 @@ )")) << res.Failure(); } +TEST_F(IR_ValidatorTest, Var_ResourceBinding_NonHandleAddressSpace) { + auto* v = b.Var(ty.ptr(AddressSpace::kPrivate, ty.resource_binding(), read)); + mod.root_block->Append(v); + + auto res = ir::Validate(mod); + ASSERT_NE(res, Success); + EXPECT_THAT( + res.Failure().reason, + testing::HasSubstr( + R"(:2:3 error: var: handle types can only be declared in the 'handle' address space + %1:ptr<private, resource_binding, read> = var undef + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +)")) << res.Failure(); +} + TEST_F(IR_ValidatorTest, Var_InputAttachementIndex_NonHandle) { auto* v = b.Var(ty.ptr(AddressSpace::kPrivate, ty.f32(), read_write)); v->SetInputAttachmentIndex(0);
diff --git a/src/tint/lang/core/type/type.cc b/src/tint/lang/core/type/type.cc index 4ae6135..839748a 100644 --- a/src/tint/lang/core/type/type.cc +++ b/src/tint/lang/core/type/type.cc
@@ -39,6 +39,7 @@ #include "src/tint/lang/core/type/matrix.h" #include "src/tint/lang/core/type/pointer.h" #include "src/tint/lang/core/type/reference.h" +#include "src/tint/lang/core/type/resource_binding.h" #include "src/tint/lang/core/type/sampler.h" #include "src/tint/lang/core/type/struct.h" #include "src/tint/lang/core/type/texture.h" @@ -166,7 +167,7 @@ } bool Type::IsHandle() const { - if (IsAnyOf<Sampler, Texture>()) { + if (IsAnyOf<Sampler, Texture, ResourceBinding>()) { return true; } if (auto* binding_array = As<BindingArray>()) {
diff --git a/src/tint/lang/wgsl/intrinsic/data.cc b/src/tint/lang/wgsl/intrinsic/data.cc index 7523873..ed9d1f2 100644 --- a/src/tint/lang/wgsl/intrinsic/data.cc +++ b/src/tint/lang/wgsl/intrinsic/data.cc
@@ -676,6 +676,20 @@ }; +/// TypeMatcher for 'type resource_binding' +constexpr TypeMatcher kResourceBindingMatcher { +/* match */ [](MatchState& state, const Type* ty) -> const Type* { + if (!MatchResourceBinding(state, ty)) { + return nullptr; + } + return BuildResourceBinding(state, ty); + }, +/* print */ []([[maybe_unused]] MatchState* state, StyledText& out) { + out << style::Type("resource_binding"); + } +}; + + /// TypeMatcher for 'type sampler' constexpr TypeMatcher kSamplerMatcher { /* match */ [](MatchState& state, const Type* ty) -> const Type* { @@ -2073,57 +2087,58 @@ /* [32] */ kRuntimeArrayMatcher, /* [33] */ kArrayMatcher, /* [34] */ kBindingArrayMatcher, - /* [35] */ kSamplerMatcher, - /* [36] */ kSamplerComparisonMatcher, - /* [37] */ kTexture1DMatcher, - /* [38] */ kTexture2DMatcher, - /* [39] */ kTexture2DArrayMatcher, - /* [40] */ kTexture3DMatcher, - /* [41] */ kTextureCubeMatcher, - /* [42] */ kTextureCubeArrayMatcher, - /* [43] */ kTextureMultisampled2DMatcher, - /* [44] */ kTextureDepth2DMatcher, - /* [45] */ kTextureDepth2DArrayMatcher, - /* [46] */ kTextureDepthCubeMatcher, - /* [47] */ kTextureDepthCubeArrayMatcher, - /* [48] */ kTextureDepthMultisampled2DMatcher, - /* [49] */ kTextureStorage1DMatcher, - /* [50] */ kTextureStorage2DMatcher, - /* [51] */ kTextureStorage2DArrayMatcher, - /* [52] */ kTextureStorage3DMatcher, - /* [53] */ kTextureExternalMatcher, - /* [54] */ kTexelBufferMatcher, - /* [55] */ kInputAttachmentMatcher, - /* [56] */ kModfResultMatcher, - /* [57] */ kModfResultVecMatcher, - /* [58] */ kFrexpResultMatcher, - /* [59] */ kFrexpResultVecMatcher, - /* [60] */ kAtomicCompareExchangeResultMatcher, - /* [61] */ kSubgroupMatrixMatcher, - /* [62] */ kConstructibleMatcher, - /* [63] */ kScalarMatcher, - /* [64] */ kConcreteScalarMatcher, - /* [65] */ kScalarNoF32Matcher, - /* [66] */ kScalarNoF16Matcher, - /* [67] */ kScalarNoI32Matcher, - /* [68] */ kScalarNoU32Matcher, - /* [69] */ kScalarNoBoolMatcher, - /* [70] */ kFiaFiu32F16Matcher, - /* [71] */ kFiaFi32F16Matcher, - /* [72] */ kFiaFiu32Matcher, - /* [73] */ kFaF32Matcher, - /* [74] */ kFaF32F16Matcher, - /* [75] */ kIaIu32Matcher, - /* [76] */ kIaI32Matcher, - /* [77] */ kFiu32F16Matcher, - /* [78] */ kFiu32Matcher, - /* [79] */ kFi32F16Matcher, - /* [80] */ kFi32Matcher, - /* [81] */ kF32F16Matcher, - /* [82] */ kIu32Matcher, - /* [83] */ kIu32Iu8Matcher, - /* [84] */ kIu8Matcher, - /* [85] */ kSubgroupMatrixElementsMatcher, + /* [35] */ kResourceBindingMatcher, + /* [36] */ kSamplerMatcher, + /* [37] */ kSamplerComparisonMatcher, + /* [38] */ kTexture1DMatcher, + /* [39] */ kTexture2DMatcher, + /* [40] */ kTexture2DArrayMatcher, + /* [41] */ kTexture3DMatcher, + /* [42] */ kTextureCubeMatcher, + /* [43] */ kTextureCubeArrayMatcher, + /* [44] */ kTextureMultisampled2DMatcher, + /* [45] */ kTextureDepth2DMatcher, + /* [46] */ kTextureDepth2DArrayMatcher, + /* [47] */ kTextureDepthCubeMatcher, + /* [48] */ kTextureDepthCubeArrayMatcher, + /* [49] */ kTextureDepthMultisampled2DMatcher, + /* [50] */ kTextureStorage1DMatcher, + /* [51] */ kTextureStorage2DMatcher, + /* [52] */ kTextureStorage2DArrayMatcher, + /* [53] */ kTextureStorage3DMatcher, + /* [54] */ kTextureExternalMatcher, + /* [55] */ kTexelBufferMatcher, + /* [56] */ kInputAttachmentMatcher, + /* [57] */ kModfResultMatcher, + /* [58] */ kModfResultVecMatcher, + /* [59] */ kFrexpResultMatcher, + /* [60] */ kFrexpResultVecMatcher, + /* [61] */ kAtomicCompareExchangeResultMatcher, + /* [62] */ kSubgroupMatrixMatcher, + /* [63] */ kConstructibleMatcher, + /* [64] */ kScalarMatcher, + /* [65] */ kConcreteScalarMatcher, + /* [66] */ kScalarNoF32Matcher, + /* [67] */ kScalarNoF16Matcher, + /* [68] */ kScalarNoI32Matcher, + /* [69] */ kScalarNoU32Matcher, + /* [70] */ kScalarNoBoolMatcher, + /* [71] */ kFiaFiu32F16Matcher, + /* [72] */ kFiaFi32F16Matcher, + /* [73] */ kFiaFiu32Matcher, + /* [74] */ kFaF32Matcher, + /* [75] */ kFaF32F16Matcher, + /* [76] */ kIaIu32Matcher, + /* [77] */ kIaI32Matcher, + /* [78] */ kFiu32F16Matcher, + /* [79] */ kFiu32Matcher, + /* [80] */ kFi32F16Matcher, + /* [81] */ kFi32Matcher, + /* [82] */ kF32F16Matcher, + /* [83] */ kIu32Matcher, + /* [84] */ kIu32Iu8Matcher, + /* [85] */ kIu8Matcher, + /* [86] */ kSubgroupMatrixElementsMatcher, }; /// The template numbers, and number matchers @@ -2165,7 +2180,7 @@ /* [10] */ MatcherIndex(11), /* [11] */ MatcherIndex(5), /* [12] */ MatcherIndex(15), - /* [13] */ MatcherIndex(78), + /* [13] */ MatcherIndex(79), /* [14] */ MatcherIndex(29), /* [15] */ MatcherIndex(18), /* [16] */ MatcherIndex(33), @@ -2209,7 +2224,7 @@ /* [54] */ MatcherIndex(31), /* [55] */ MatcherIndex(0), /* [56] */ MatcherIndex(14), - /* [57] */ MatcherIndex(61), + /* [57] */ MatcherIndex(62), /* [58] */ MatcherIndex(1), /* [59] */ MatcherIndex(2), /* [60] */ MatcherIndex(3), @@ -2238,7 +2253,7 @@ /* [83] */ MatcherIndex(1), /* [84] */ MatcherIndex(16), /* [85] */ MatcherIndex(11), - /* [86] */ MatcherIndex(61), + /* [86] */ MatcherIndex(62), /* [87] */ MatcherIndex(0), /* [88] */ MatcherIndex(1), /* [89] */ MatcherIndex(2), @@ -2255,32 +2270,32 @@ /* [100] */ MatcherIndex(12), /* [101] */ MatcherIndex(16), /* [102] */ MatcherIndex(9), - /* [103] */ MatcherIndex(61), + /* [103] */ MatcherIndex(62), /* [104] */ MatcherIndex(8), /* [105] */ MatcherIndex(0), /* [106] */ MatcherIndex(2), /* [107] */ MatcherIndex(3), - /* [108] */ MatcherIndex(61), + /* [108] */ MatcherIndex(62), /* [109] */ MatcherIndex(6), /* [110] */ MatcherIndex(1), /* [111] */ MatcherIndex(4), /* [112] */ MatcherIndex(3), - /* [113] */ MatcherIndex(61), + /* [113] */ MatcherIndex(62), /* [114] */ MatcherIndex(7), /* [115] */ MatcherIndex(1), /* [116] */ MatcherIndex(2), /* [117] */ MatcherIndex(4), - /* [118] */ MatcherIndex(61), + /* [118] */ MatcherIndex(62), /* [119] */ MatcherIndex(8), /* [120] */ MatcherIndex(1), /* [121] */ MatcherIndex(2), /* [122] */ MatcherIndex(3), - /* [123] */ MatcherIndex(61), + /* [123] */ MatcherIndex(62), /* [124] */ MatcherIndex(6), /* [125] */ MatcherIndex(0), /* [126] */ MatcherIndex(4), /* [127] */ MatcherIndex(3), - /* [128] */ MatcherIndex(61), + /* [128] */ MatcherIndex(62), /* [129] */ MatcherIndex(7), /* [130] */ MatcherIndex(0), /* [131] */ MatcherIndex(2), @@ -2336,7 +2351,7 @@ /* [181] */ MatcherIndex(0), /* [182] */ MatcherIndex(27), /* [183] */ MatcherIndex(1), - /* [184] */ MatcherIndex(78), + /* [184] */ MatcherIndex(79), /* [185] */ MatcherIndex(27), /* [186] */ MatcherIndex(1), /* [187] */ MatcherIndex(2), @@ -2352,43 +2367,43 @@ /* [197] */ MatcherIndex(27), /* [198] */ MatcherIndex(0), /* [199] */ MatcherIndex(13), - /* [200] */ MatcherIndex(59), + /* [200] */ MatcherIndex(60), /* [201] */ MatcherIndex(0), /* [202] */ MatcherIndex(1), /* [203] */ MatcherIndex(27), /* [204] */ MatcherIndex(0), /* [205] */ MatcherIndex(2), - /* [206] */ MatcherIndex(57), + /* [206] */ MatcherIndex(58), /* [207] */ MatcherIndex(0), /* [208] */ MatcherIndex(1), - /* [209] */ MatcherIndex(49), + /* [209] */ MatcherIndex(50), /* [210] */ MatcherIndex(0), /* [211] */ MatcherIndex(1), - /* [212] */ MatcherIndex(50), + /* [212] */ MatcherIndex(51), /* [213] */ MatcherIndex(0), /* [214] */ MatcherIndex(1), - /* [215] */ MatcherIndex(51), + /* [215] */ MatcherIndex(52), /* [216] */ MatcherIndex(0), /* [217] */ MatcherIndex(1), - /* [218] */ MatcherIndex(52), + /* [218] */ MatcherIndex(53), /* [219] */ MatcherIndex(0), /* [220] */ MatcherIndex(1), - /* [221] */ MatcherIndex(54), + /* [221] */ MatcherIndex(55), /* [222] */ MatcherIndex(0), /* [223] */ MatcherIndex(1), - /* [224] */ MatcherIndex(49), + /* [224] */ MatcherIndex(50), /* [225] */ MatcherIndex(1), /* [226] */ MatcherIndex(2), - /* [227] */ MatcherIndex(50), + /* [227] */ MatcherIndex(51), /* [228] */ MatcherIndex(1), /* [229] */ MatcherIndex(2), - /* [230] */ MatcherIndex(51), + /* [230] */ MatcherIndex(52), /* [231] */ MatcherIndex(1), /* [232] */ MatcherIndex(2), - /* [233] */ MatcherIndex(52), + /* [233] */ MatcherIndex(53), /* [234] */ MatcherIndex(1), /* [235] */ MatcherIndex(2), - /* [236] */ MatcherIndex(54), + /* [236] */ MatcherIndex(55), /* [237] */ MatcherIndex(1), /* [238] */ MatcherIndex(2), /* [239] */ MatcherIndex(27), @@ -2399,9 +2414,9 @@ /* [244] */ MatcherIndex(6), /* [245] */ MatcherIndex(17), /* [246] */ MatcherIndex(14), - /* [247] */ MatcherIndex(58), + /* [247] */ MatcherIndex(59), /* [248] */ MatcherIndex(0), - /* [249] */ MatcherIndex(56), + /* [249] */ MatcherIndex(57), /* [250] */ MatcherIndex(0), /* [251] */ MatcherIndex(17), /* [252] */ MatcherIndex(13), @@ -2409,39 +2424,39 @@ /* [254] */ MatcherIndex(11), /* [255] */ MatcherIndex(17), /* [256] */ MatcherIndex(12), - /* [257] */ MatcherIndex(37), + /* [257] */ MatcherIndex(38), /* [258] */ MatcherIndex(0), - /* [259] */ MatcherIndex(38), + /* [259] */ MatcherIndex(39), /* [260] */ MatcherIndex(0), - /* [261] */ MatcherIndex(39), + /* [261] */ MatcherIndex(40), /* [262] */ MatcherIndex(0), - /* [263] */ MatcherIndex(40), + /* [263] */ MatcherIndex(41), /* [264] */ MatcherIndex(0), - /* [265] */ MatcherIndex(41), + /* [265] */ MatcherIndex(42), /* [266] */ MatcherIndex(0), - /* [267] */ MatcherIndex(42), + /* [267] */ MatcherIndex(43), /* [268] */ MatcherIndex(0), - /* [269] */ MatcherIndex(43), + /* [269] */ MatcherIndex(44), /* [270] */ MatcherIndex(0), /* [271] */ MatcherIndex(17), /* [272] */ MatcherIndex(0), - /* [273] */ MatcherIndex(37), + /* [273] */ MatcherIndex(38), /* [274] */ MatcherIndex(13), - /* [275] */ MatcherIndex(38), + /* [275] */ MatcherIndex(39), /* [276] */ MatcherIndex(13), - /* [277] */ MatcherIndex(39), + /* [277] */ MatcherIndex(40), /* [278] */ MatcherIndex(13), - /* [279] */ MatcherIndex(40), + /* [279] */ MatcherIndex(41), /* [280] */ MatcherIndex(13), - /* [281] */ MatcherIndex(41), + /* [281] */ MatcherIndex(42), /* [282] */ MatcherIndex(13), - /* [283] */ MatcherIndex(42), + /* [283] */ MatcherIndex(43), /* [284] */ MatcherIndex(13), /* [285] */ MatcherIndex(15), /* [286] */ MatcherIndex(0), - /* [287] */ MatcherIndex(55), + /* [287] */ MatcherIndex(56), /* [288] */ MatcherIndex(0), - /* [289] */ MatcherIndex(60), + /* [289] */ MatcherIndex(61), /* [290] */ MatcherIndex(0), /* [291] */ MatcherIndex(15), /* [292] */ MatcherIndex(9), @@ -2501,33 +2516,33 @@ /* [346] */ MatcherIndex(13), /* [347] */ MatcherIndex(26), /* [348] */ MatcherIndex(14), - /* [349] */ MatcherIndex(70), - /* [350] */ MatcherIndex(74), - /* [351] */ MatcherIndex(82), - /* [352] */ MatcherIndex(76), - /* [353] */ MatcherIndex(63), - /* [354] */ MatcherIndex(71), - /* [355] */ MatcherIndex(62), - /* [356] */ MatcherIndex(44), - /* [357] */ MatcherIndex(45), - /* [358] */ MatcherIndex(46), - /* [359] */ MatcherIndex(47), - /* [360] */ MatcherIndex(48), - /* [361] */ MatcherIndex(53), - /* [362] */ MatcherIndex(35), - /* [363] */ MatcherIndex(36), + /* [349] */ MatcherIndex(71), + /* [350] */ MatcherIndex(75), + /* [351] */ MatcherIndex(83), + /* [352] */ MatcherIndex(77), + /* [353] */ MatcherIndex(64), + /* [354] */ MatcherIndex(72), + /* [355] */ MatcherIndex(63), + /* [356] */ MatcherIndex(45), + /* [357] */ MatcherIndex(46), + /* [358] */ MatcherIndex(47), + /* [359] */ MatcherIndex(48), + /* [360] */ MatcherIndex(49), + /* [361] */ MatcherIndex(54), + /* [362] */ MatcherIndex(36), + /* [363] */ MatcherIndex(37), /* [364] */ MatcherIndex(10), - /* [365] */ MatcherIndex(77), - /* [366] */ MatcherIndex(81), - /* [367] */ MatcherIndex(83), - /* [368] */ MatcherIndex(84), - /* [369] */ MatcherIndex(64), - /* [370] */ MatcherIndex(75), - /* [371] */ MatcherIndex(67), - /* [372] */ MatcherIndex(68), - /* [373] */ MatcherIndex(65), - /* [374] */ MatcherIndex(66), - /* [375] */ MatcherIndex(69), + /* [365] */ MatcherIndex(78), + /* [366] */ MatcherIndex(82), + /* [367] */ MatcherIndex(84), + /* [368] */ MatcherIndex(85), + /* [369] */ MatcherIndex(65), + /* [370] */ MatcherIndex(76), + /* [371] */ MatcherIndex(68), + /* [372] */ MatcherIndex(69), + /* [373] */ MatcherIndex(66), + /* [374] */ MatcherIndex(67), + /* [375] */ MatcherIndex(70), }; static_assert(MatcherIndicesIndex::CanIndex(kMatcherIndices),
diff --git a/src/tint/lang/wgsl/resolver/BUILD.bazel b/src/tint/lang/wgsl/resolver/BUILD.bazel index cb5763b..43c194e 100644 --- a/src/tint/lang/wgsl/resolver/BUILD.bazel +++ b/src/tint/lang/wgsl/resolver/BUILD.bazel
@@ -146,6 +146,7 @@ "resolver_helper_test.cc", "resolver_helper_test.h", "resolver_test.cc", + "resource_binding_test.cc", "root_identifier_test.cc", "side_effects_test.cc", "struct_address_space_use_test.cc",
diff --git a/src/tint/lang/wgsl/resolver/BUILD.cmake b/src/tint/lang/wgsl/resolver/BUILD.cmake index 8bb3e62..31f1134 100644 --- a/src/tint/lang/wgsl/resolver/BUILD.cmake +++ b/src/tint/lang/wgsl/resolver/BUILD.cmake
@@ -147,6 +147,7 @@ lang/wgsl/resolver/resolver_helper_test.cc lang/wgsl/resolver/resolver_helper_test.h lang/wgsl/resolver/resolver_test.cc + lang/wgsl/resolver/resource_binding_test.cc lang/wgsl/resolver/root_identifier_test.cc lang/wgsl/resolver/side_effects_test.cc lang/wgsl/resolver/struct_address_space_use_test.cc
diff --git a/src/tint/lang/wgsl/resolver/BUILD.gn b/src/tint/lang/wgsl/resolver/BUILD.gn index 760f86d..9e80715 100644 --- a/src/tint/lang/wgsl/resolver/BUILD.gn +++ b/src/tint/lang/wgsl/resolver/BUILD.gn
@@ -147,6 +147,7 @@ "resolver_helper_test.cc", "resolver_helper_test.h", "resolver_test.cc", + "resource_binding_test.cc", "root_identifier_test.cc", "side_effects_test.cc", "struct_address_space_use_test.cc",
diff --git a/src/tint/lang/wgsl/resolver/resolver.cc b/src/tint/lang/wgsl/resolver/resolver.cc index a40be82..aee5052 100644 --- a/src/tint/lang/wgsl/resolver/resolver.cc +++ b/src/tint/lang/wgsl/resolver/resolver.cc
@@ -50,6 +50,7 @@ #include "src/tint/lang/core/type/multisampled_texture.h" #include "src/tint/lang/core/type/pointer.h" #include "src/tint/lang/core/type/reference.h" +#include "src/tint/lang/core/type/resource_binding.h" #include "src/tint/lang/core/type/sampled_texture.h" #include "src/tint/lang/core/type/sampler.h" #include "src/tint/lang/core/type/storage_texture.h" @@ -2580,6 +2581,8 @@ return Array(ident); case core::BuiltinType::kBindingArray: return BindingArray(ident); + case core::BuiltinType::kResourceBinding: + return ResourceBinding(ident); case core::BuiltinType::kAtomic: return Atomic(ident); case core::BuiltinType::kPtr: @@ -2849,6 +2852,14 @@ return out; } +const core::type::ResourceBinding* Resolver::ResourceBinding(const ast::Identifier* ident) { + auto* out = b.create<core::type::ResourceBinding>(); + if (DAWN_UNLIKELY(!validator_.ResourceBinding(out, ident->source))) { + return nullptr; + } + return out; +} + const core::type::BindingArray* Resolver::BindingArray(const ast::Identifier* ident) { auto* tmpl_ident = TemplatedIdentifier(ident, 1, 2); if (DAWN_UNLIKELY(!tmpl_ident)) {
diff --git a/src/tint/lang/wgsl/resolver/resolver.h b/src/tint/lang/wgsl/resolver/resolver.h index 72784b0..81141af 100644 --- a/src/tint/lang/wgsl/resolver/resolver.h +++ b/src/tint/lang/wgsl/resolver/resolver.h
@@ -202,6 +202,10 @@ /// the identifier is not templated. const core::type::Type* Array(const ast::Identifier* ident); + /// @returns a resource_binding, if the `chromium_experimental_dynamic_binding` extension is + /// enabled, otherwise nullptr + const core::type::ResourceBinding* ResourceBinding(const ast::Identifier* ident); + /// @returns a binding_array resolved from the templated identifier @p ident. const core::type::BindingArray* BindingArray(const ast::Identifier* ident);
diff --git a/src/tint/lang/wgsl/resolver/resource_binding_test.cc b/src/tint/lang/wgsl/resolver/resource_binding_test.cc new file mode 100644 index 0000000..02dc5c9 --- /dev/null +++ b/src/tint/lang/wgsl/resolver/resource_binding_test.cc
@@ -0,0 +1,166 @@ +// Copyright 2025 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/lang/core/type/resource_binding.h" +#include "src/tint/lang/wgsl/resolver/resolver.h" +#include "src/tint/lang/wgsl/resolver/resolver_helper_test.h" + +#include "gmock/gmock.h" + +using namespace tint::core::fluent_types; // NOLINT +using namespace tint::core::number_suffixes; // NOLINT + +namespace tint::resolver { +namespace { + +using ResolverResourceBindingTest = ResolverTest; + +TEST_F(ResolverResourceBindingTest, ValidGlobalDecl) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + auto* var = GlobalVar("a", Binding(0_a), Group(0_a), ty("resource_binding")); + + EXPECT_TRUE(r()->Resolve()) << r()->error(); + + auto* m = TypeOf(var)->UnwrapRef()->As<core::type::ResourceBinding>(); + ASSERT_NE(m, nullptr); +} + +TEST_F(ResolverResourceBindingTest, InvalidNoFeature) { + GlobalVar("a", Binding(0_a), Group(0_a), ty("resource_binding")); + + Resolver resolver{this, wgsl::AllowedFeatures{}}; + EXPECT_FALSE(resolver.Resolve()); + EXPECT_EQ( + resolver.error(), + R"(error: use of a 'resource_binding' requires enabling extension 'chromium_experimental_dynamic_binding')"); +} + +TEST_F(ResolverResourceBindingTest, InvalidGlobalDeclNoGroup) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + GlobalVar("a", Binding(0_a), ty("resource_binding")); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(error: resource variables require '@group' and '@binding' attributes)"); +} + +TEST_F(ResolverResourceBindingTest, InvalidGlobalDeclNoBinding) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + GlobalVar("a", Group(0_a), ty("resource_binding")); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(error: resource variables require '@group' and '@binding' attributes)"); +} + +TEST_F(ResolverResourceBindingTest, InvalidGlobalDeclPrivate) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + GlobalVar("a", private_, ty("resource_binding")); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(error: variables of type 'resource_binding' must not specify an address space)"); +} + +TEST_F(ResolverResourceBindingTest, InvalidGlobalDeclWorkgroup) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + GlobalVar("a", workgroup, ty("resource_binding")); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(error: variables of type 'resource_binding' must not specify an address space)"); +} + +TEST_F(ResolverResourceBindingTest, InvalidGlobalDeclStorageWithHandleType) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + GlobalVar("a", storage, Binding(0_a), Group(0_a), ty("resource_binding")); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ( + r()->error(), + R"(error: type 'resource_binding' cannot be used in address space 'storage' as it is non-host-shareable +note: while instantiating 'var' a)"); +} + +TEST_F(ResolverResourceBindingTest, InvalidGlobalDeclUniformWithHandleType) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + GlobalVar("a", uniform, Binding(0_a), Group(0_a), ty("resource_binding")); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ( + r()->error(), + R"(error: type 'resource_binding' cannot be used in address space 'uniform' as it is non-host-shareable +note: while instantiating 'var' a)"); +} + +TEST_F(ResolverResourceBindingTest, InvalidGlobalDeclOverride) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + Override("a", ty("resource_binding")); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(error: resource_binding cannot be used as the type of a 'override')"); +} + +TEST_F(ResolverResourceBindingTest, InvalidFuncDecl) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + Func("foo", Empty, ty.void_(), + Vector{ + Decl(Var("a", ty("resource_binding"))), + }); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), R"(error: function-scope 'var' must have a constructible type)"); +} + +TEST_F(ResolverResourceBindingTest, InvalidStructMember) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + Structure("S", Vector{Member("a", ty("resource_binding"))}); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), + R"(error: resource_binding cannot be used as the type of a structure member)"); +} + +TEST_F(ResolverResourceBindingTest, InvalidAsFunctionParameter) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + Func("foo", Vector{Param("a", ty("resource_binding"))}, ty.void_(), Empty); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), R"(error: type of function parameter cannot be resource_binding)"); +} + +TEST_F(ResolverResourceBindingTest, InvalidFunctionPointerParameterWithHandleType) { + Enable(wgsl::Extension::kChromiumExperimentalDynamicBinding); + Func("foo", Vector{Param("a", ty.ptr<function>(ty("resource_binding")))}, ty.void_(), Empty); + + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), R"(error: pointer can not be formed to handle type resource_binding)"); +} + +} // namespace +} // namespace tint::resolver
diff --git a/src/tint/lang/wgsl/resolver/validator.cc b/src/tint/lang/wgsl/resolver/validator.cc index 001cf69..4758db9 100644 --- a/src/tint/lang/wgsl/resolver/validator.cc +++ b/src/tint/lang/wgsl/resolver/validator.cc
@@ -245,8 +245,8 @@ // https://gpuweb.github.io/gpuweb/wgsl.html#storable-types bool Validator::IsStorable(const core::type::Type* type) const { - return IsPlain(type) || - type->IsAnyOf<core::type::BindingArray, core::type::Texture, core::type::Sampler>(); + return IsPlain(type) || type->IsAnyOf<core::type::BindingArray, core::type::ResourceBinding, + core::type::Texture, core::type::Sampler>(); } const ast::Statement* Validator::ClosestContinuing(bool stop_at_loop, @@ -462,6 +462,18 @@ return true; } +bool Validator::ResourceBinding([[maybe_unused]] const core::type::ResourceBinding* t, + const Source& source) const { + if (!enabled_extensions_.Contains(wgsl::Extension::kChromiumExperimentalDynamicBinding)) { + AddError(source) << "use of a " << style::Attribute("resource_binding") + << " requires enabling extension " + << style::Code("chromium_experimental_dynamic_binding"); + return false; + } + + return true; +} + bool Validator::BindingArray(const core::type::BindingArray* t, const Source& source) const { if (allowed_features_.features.count(wgsl::LanguageFeature::kSizedBindingArray) == 0) { AddError(source) << "use of " << style::Type("binding_array") << " requires the " @@ -992,7 +1004,7 @@ AddError(decl->type->source) << "type of function parameter must be constructible"; return false; } - } else if (is_runtime_binding_array || + } else if (var->Type()->Is<core::type::ResourceBinding>() || is_runtime_binding_array || (!var->Type()->Is<core::type::Pointer>() && !var->Type()->IsHandle())) { AddError(decl->source) << "type of function parameter cannot be " << sem_.TypeNameOf(var->Type());
diff --git a/src/tint/lang/wgsl/resolver/validator.h b/src/tint/lang/wgsl/resolver/validator.h index 2cd8db43..de3b8b4 100644 --- a/src/tint/lang/wgsl/resolver/validator.h +++ b/src/tint/lang/wgsl/resolver/validator.h
@@ -454,6 +454,12 @@ const core::type::Type* type, const Source& source) const; + /// Validates a resource buffer type + /// @param t the resource buffer to validate + /// @param source the source of the resource buffer type + /// @returns true on success, false otherwise + bool ResourceBinding(const core::type::ResourceBinding* t, const Source& source) const; + /// Validates a binding array type /// @param t the binding array to validate /// @param source the source of the binding array type
diff --git a/src/tint/lang/wgsl/resolver/validator_is_storeable_test.cc b/src/tint/lang/wgsl/resolver/validator_is_storeable_test.cc index 355d1a9..d7141ef 100644 --- a/src/tint/lang/wgsl/resolver/validator_is_storeable_test.cc +++ b/src/tint/lang/wgsl/resolver/validator_is_storeable_test.cc
@@ -123,5 +123,10 @@ EXPECT_TRUE(v()->IsStorable(arr)); } +TEST_F(ValidatorIsStorableTest, ResourceBinding) { + auto* arr = create<core::type::ResourceBinding>(); + EXPECT_TRUE(v()->IsStorable(arr)); +} + } // namespace } // namespace tint::resolver
diff --git a/src/tint/lang/wgsl/wgsl.def b/src/tint/lang/wgsl/wgsl.def index 46bf2c2..0fcf9c6 100644 --- a/src/tint/lang/wgsl/wgsl.def +++ b/src/tint/lang/wgsl/wgsl.def
@@ -159,6 +159,7 @@ @display("array<{T}>") type runtime_array<T> type array<T, N: num> type binding_array<T, N: num> +type resource_binding type sampler type sampler_comparison type texture_1d<T>
diff --git a/tools/src/tint/intrinsic/gen/permutate.go b/tools/src/tint/intrinsic/gen/permutate.go index 2d5105d..88b5304 100644 --- a/tools/src/tint/intrinsic/gen/permutate.go +++ b/tools/src/tint/intrinsic/gen/permutate.go
@@ -398,6 +398,7 @@ strings.Contains(elTyName, "u8"), strings.Contains(elTyName, "sampler"), strings.Contains(elTyName, "texture"), + strings.Contains(elTyName, "resource_binding"), IsAbstract(DeepestElementType(elTy)): return false }