Lines Matching refs:sprog
1045 static void bind_sampler_locs(struct vrend_linked_shader_program *sprog, in bind_sampler_locs() argument
1048 if (sprog->ss[id]->sel->sinfo.samplers_used_mask) { in bind_sampler_locs()
1049 uint32_t mask = sprog->ss[id]->sel->sinfo.samplers_used_mask; in bind_sampler_locs()
1050 int nsamp = util_bitcount(sprog->ss[id]->sel->sinfo.samplers_used_mask); in bind_sampler_locs()
1052 sprog->shadow_samp_mask[id] = sprog->ss[id]->sel->sinfo.shadow_samp_mask; in bind_sampler_locs()
1053 if (sprog->ss[id]->sel->sinfo.shadow_samp_mask) { in bind_sampler_locs()
1054 sprog->shadow_samp_mask_locs[id] = calloc(nsamp, sizeof(uint32_t)); in bind_sampler_locs()
1055 sprog->shadow_samp_add_locs[id] = calloc(nsamp, sizeof(uint32_t)); in bind_sampler_locs()
1057 sprog->shadow_samp_mask_locs[id] = sprog->shadow_samp_add_locs[id] = NULL; in bind_sampler_locs()
1059 sprog->samp_locs[id] = calloc(nsamp, sizeof(uint32_t)); in bind_sampler_locs()
1060 if (sprog->samp_locs[id]) { in bind_sampler_locs()
1066 if (sprog->ss[id]->sel->sinfo.num_sampler_arrays) { in bind_sampler_locs()
1067 int arr_idx = shader_lookup_sampler_array(&sprog->ss[id]->sel->sinfo, i); in bind_sampler_locs()
1071 sprog->samp_locs[id][index] = glGetUniformLocation(sprog->id, name); in bind_sampler_locs()
1072 if (sprog->ss[id]->sel->sinfo.shadow_samp_mask & (1 << i)) { in bind_sampler_locs()
1074 sprog->shadow_samp_mask_locs[id][index] = glGetUniformLocation(sprog->id, name); in bind_sampler_locs()
1076 sprog->shadow_samp_add_locs[id][index] = glGetUniformLocation(sprog->id, name); in bind_sampler_locs()
1082 sprog->samp_locs[id] = NULL; in bind_sampler_locs()
1083 sprog->shadow_samp_mask_locs[id] = NULL; in bind_sampler_locs()
1084 sprog->shadow_samp_add_locs[id] = NULL; in bind_sampler_locs()
1085 sprog->shadow_samp_mask[id] = 0; in bind_sampler_locs()
1087 sprog->samplers_used_mask[id] = sprog->ss[id]->sel->sinfo.samplers_used_mask; in bind_sampler_locs()
1090 static void bind_const_locs(struct vrend_linked_shader_program *sprog, in bind_const_locs() argument
1093 if (sprog->ss[id]->sel->sinfo.num_consts) { in bind_const_locs()
1094 sprog->const_locs[id] = calloc(sprog->ss[id]->sel->sinfo.num_consts, sizeof(uint32_t)); in bind_const_locs()
1095 if (sprog->const_locs[id]) { in bind_const_locs()
1097 for (int i = 0; i < sprog->ss[id]->sel->sinfo.num_consts; i++) { in bind_const_locs()
1100 sprog->const_locs[id][i] = glGetUniformLocation(sprog->id, name); in bind_const_locs()
1104 sprog->const_locs[id] = NULL; in bind_const_locs()
1107 static void bind_ubo_locs(struct vrend_linked_shader_program *sprog, in bind_ubo_locs() argument
1112 if (sprog->ss[id]->sel->sinfo.num_ubos) { in bind_ubo_locs()
1115 sprog->ubo_locs[id] = calloc(sprog->ss[id]->sel->sinfo.num_ubos, sizeof(uint32_t)); in bind_ubo_locs()
1116 for (int i = 0; i < sprog->ss[id]->sel->sinfo.num_ubos; i++) { in bind_ubo_locs()
1117 int ubo_idx = sprog->ss[id]->sel->sinfo.ubo_idx[i]; in bind_ubo_locs()
1119 if (sprog->ss[id]->sel->sinfo.ubo_indirect) in bind_ubo_locs()
1124 sprog->ubo_locs[id][i] = glGetUniformBlockIndex(sprog->id, name); in bind_ubo_locs()
1127 sprog->ubo_locs[id] = NULL; in bind_ubo_locs()
1130 static void bind_ssbo_locs(struct vrend_linked_shader_program *sprog, in bind_ssbo_locs() argument
1137 if (sprog->ss[id]->sel->sinfo.ssbo_used_mask) { in bind_ssbo_locs()
1139 uint32_t mask = sprog->ss[id]->sel->sinfo.ssbo_used_mask; in bind_ssbo_locs()
1140 sprog->ssbo_locs[id] = calloc(util_last_bit(mask), sizeof(uint32_t)); in bind_ssbo_locs()
1145 … sprog->ssbo_locs[id][i] = glGetProgramResourceIndex(sprog->id, GL_SHADER_STORAGE_BLOCK, name); in bind_ssbo_locs()
1148 sprog->ssbo_locs[id] = NULL; in bind_ssbo_locs()
1149 sprog->ssbo_used_mask[id] = sprog->ss[id]->sel->sinfo.ssbo_used_mask; in bind_ssbo_locs()
1152 static void bind_image_locs(struct vrend_linked_shader_program *sprog, in bind_image_locs() argument
1162 uint32_t mask = sprog->ss[id]->sel->sinfo.images_used_mask; in bind_image_locs()
1165 sprog->img_locs[id] = calloc(nsamp, sizeof(GLint)); in bind_image_locs()
1166 if (!sprog->img_locs[id]) in bind_image_locs()
1169 sprog->img_locs[id] = NULL; in bind_image_locs()
1171 if (sprog->ss[id]->sel->sinfo.num_image_arrays) { in bind_image_locs()
1172 for (i = 0; i < sprog->ss[id]->sel->sinfo.num_image_arrays; i++) { in bind_image_locs()
1173 struct vrend_array *img_array = &sprog->ss[id]->sel->sinfo.image_arrays[i]; in bind_image_locs()
1176 sprog->img_locs[id][img_array->first + j] = glGetUniformLocation(sprog->id, name); in bind_image_locs()
1177 if (sprog->img_locs[id][img_array->first + j] == -1) in bind_image_locs()
1185 sprog->img_locs[id][i] = glGetUniformLocation(sprog->id, name); in bind_image_locs()
1186 if (sprog->img_locs[id][i] == -1) in bind_image_locs()
1189 sprog->img_locs[id][i] = -1; in bind_image_locs()
1193 sprog->images_used_mask[id] = mask; in bind_image_locs()
1199 struct vrend_linked_shader_program *sprog = CALLOC_STRUCT(vrend_linked_shader_program); in add_cs_shader_program() local
1216 free(sprog); in add_cs_shader_program()
1219 sprog->ss[PIPE_SHADER_COMPUTE] = cs; in add_cs_shader_program()
1221 list_add(&sprog->sl[PIPE_SHADER_COMPUTE], &cs->programs); in add_cs_shader_program()
1222 sprog->id = prog_id; in add_cs_shader_program()
1223 list_addtail(&sprog->head, &ctx->sub->programs); in add_cs_shader_program()
1225 bind_sampler_locs(sprog, PIPE_SHADER_COMPUTE); in add_cs_shader_program()
1226 bind_ubo_locs(sprog, PIPE_SHADER_COMPUTE); in add_cs_shader_program()
1227 bind_ssbo_locs(sprog, PIPE_SHADER_COMPUTE); in add_cs_shader_program()
1228 bind_const_locs(sprog, PIPE_SHADER_COMPUTE); in add_cs_shader_program()
1229 bind_image_locs(sprog, PIPE_SHADER_COMPUTE); in add_cs_shader_program()
1230 return sprog; in add_cs_shader_program()
1240 struct vrend_linked_shader_program *sprog = CALLOC_STRUCT(vrend_linked_shader_program); in add_shader_program() local
1248 if (!sprog) in add_shader_program()
1277 free(sprog); in add_shader_program()
1309 sprog->dual_src_linked = true; in add_shader_program()
1313 sprog->dual_src_linked = false; in add_shader_program()
1316 sprog->dual_src_linked = false; in add_shader_program()
1342 free(sprog); in add_shader_program()
1346 sprog->ss[PIPE_SHADER_VERTEX] = vs; in add_shader_program()
1347 sprog->ss[PIPE_SHADER_FRAGMENT] = fs; in add_shader_program()
1348 sprog->ss[PIPE_SHADER_GEOMETRY] = gs; in add_shader_program()
1349 sprog->ss[PIPE_SHADER_TESS_CTRL] = tcs; in add_shader_program()
1350 sprog->ss[PIPE_SHADER_TESS_EVAL] = tes; in add_shader_program()
1352 list_add(&sprog->sl[PIPE_SHADER_VERTEX], &vs->programs); in add_shader_program()
1353 list_add(&sprog->sl[PIPE_SHADER_FRAGMENT], &fs->programs); in add_shader_program()
1355 list_add(&sprog->sl[PIPE_SHADER_GEOMETRY], &gs->programs); in add_shader_program()
1357 list_add(&sprog->sl[PIPE_SHADER_TESS_CTRL], &tcs->programs); in add_shader_program()
1359 list_add(&sprog->sl[PIPE_SHADER_TESS_EVAL], &tes->programs); in add_shader_program()
1362 sprog->id = prog_id; in add_shader_program()
1364 list_addtail(&sprog->head, &ctx->sub->programs); in add_shader_program()
1367 sprog->fs_stipple_loc = glGetUniformLocation(prog_id, "pstipple_sampler"); in add_shader_program()
1369 sprog->fs_stipple_loc = -1; in add_shader_program()
1370 sprog->vs_ws_adjust_loc = glGetUniformLocation(prog_id, "winsys_adjust_y"); in add_shader_program()
1372 if (!sprog->ss[id]) in add_shader_program()
1375 bind_sampler_locs(sprog, id); in add_shader_program()
1376 bind_const_locs(sprog, id); in add_shader_program()
1377 bind_ubo_locs(sprog, id); in add_shader_program()
1378 bind_image_locs(sprog, id); in add_shader_program()
1379 bind_ssbo_locs(sprog, id); in add_shader_program()
1384 sprog->attrib_locs = calloc(vs->sel->sinfo.num_inputs, sizeof(uint32_t)); in add_shader_program()
1385 if (sprog->attrib_locs) { in add_shader_program()
1388 sprog->attrib_locs[i] = glGetAttribLocation(prog_id, name); in add_shader_program()
1392 sprog->attrib_locs = NULL; in add_shader_program()
1398 sprog->clip_locs[i] = glGetUniformLocation(prog_id, name); in add_shader_program()
1401 return sprog; in add_shader_program()