Lines Matching refs:sprog

1378 static int bind_sampler_locs(struct vrend_linked_shader_program *sprog,  in bind_sampler_locs()  argument
1381 if (sprog->ss[id]->sel->sinfo.samplers_used_mask) { in bind_sampler_locs()
1382 uint32_t mask = sprog->ss[id]->sel->sinfo.samplers_used_mask; in bind_sampler_locs()
1383 int nsamp = util_bitcount(sprog->ss[id]->sel->sinfo.samplers_used_mask); in bind_sampler_locs()
1385 sprog->shadow_samp_mask[id] = sprog->ss[id]->sel->sinfo.shadow_samp_mask; in bind_sampler_locs()
1386 if (sprog->ss[id]->sel->sinfo.shadow_samp_mask) { in bind_sampler_locs()
1387 sprog->shadow_samp_mask_locs[id] = calloc(nsamp, sizeof(uint32_t)); in bind_sampler_locs()
1388 sprog->shadow_samp_add_locs[id] = calloc(nsamp, sizeof(uint32_t)); in bind_sampler_locs()
1390 sprog->shadow_samp_mask_locs[id] = sprog->shadow_samp_add_locs[id] = NULL; in bind_sampler_locs()
1397 if (sprog->ss[id]->sel->sinfo.num_sampler_arrays) { in bind_sampler_locs()
1398 int arr_idx = vrend_shader_lookup_sampler_array(&sprog->ss[id]->sel->sinfo, i); in bind_sampler_locs()
1403 glUniform1i(glGetUniformLocation(sprog->id, name), next_sampler_id++); in bind_sampler_locs()
1405 if (sprog->ss[id]->sel->sinfo.shadow_samp_mask & (1 << i)) { in bind_sampler_locs()
1407 sprog->shadow_samp_mask_locs[id][index] = glGetUniformLocation(sprog->id, name); in bind_sampler_locs()
1409 sprog->shadow_samp_add_locs[id][index] = glGetUniformLocation(sprog->id, name); in bind_sampler_locs()
1414 sprog->shadow_samp_mask_locs[id] = NULL; in bind_sampler_locs()
1415 sprog->shadow_samp_add_locs[id] = NULL; in bind_sampler_locs()
1416 sprog->shadow_samp_mask[id] = 0; in bind_sampler_locs()
1418 sprog->samplers_used_mask[id] = sprog->ss[id]->sel->sinfo.samplers_used_mask; in bind_sampler_locs()
1423 static void bind_const_locs(struct vrend_linked_shader_program *sprog, in bind_const_locs() argument
1426 if (sprog->ss[id]->sel->sinfo.num_consts) { in bind_const_locs()
1429 sprog->const_location[id] = glGetUniformLocation(sprog->id, name); in bind_const_locs()
1431 sprog->const_location[id] = -1; in bind_const_locs()
1434 static int bind_ubo_locs(struct vrend_linked_shader_program *sprog, in bind_ubo_locs() argument
1439 if (sprog->ss[id]->sel->sinfo.ubo_used_mask) { in bind_ubo_locs()
1442 unsigned mask = sprog->ss[id]->sel->sinfo.ubo_used_mask; in bind_ubo_locs()
1446 if (sprog->ss[id]->sel->sinfo.ubo_indirect) in bind_ubo_locs()
1451 GLuint loc = glGetUniformBlockIndex(sprog->id, name); in bind_ubo_locs()
1452 glUniformBlockBinding(sprog->id, loc, next_ubo_id++); in bind_ubo_locs()
1456 sprog->ubo_used_mask[id] = sprog->ss[id]->sel->sinfo.ubo_used_mask; in bind_ubo_locs()
1461 static void bind_ssbo_locs(struct vrend_linked_shader_program *sprog, in bind_ssbo_locs() argument
1468 if (sprog->ss[id]->sel->sinfo.ssbo_used_mask) { in bind_ssbo_locs()
1470 uint32_t mask = sprog->ss[id]->sel->sinfo.ssbo_used_mask; in bind_ssbo_locs()
1471 sprog->ssbo_locs[id] = calloc(util_last_bit(mask), sizeof(uint32_t)); in bind_ssbo_locs()
1476sprog->ssbo_locs[id][i] = glGetProgramResourceIndex(sprog->id, GL_SHADER_STORAGE_BLOCK, name); in bind_ssbo_locs()
1479 sprog->ssbo_locs[id] = NULL; in bind_ssbo_locs()
1480 sprog->ssbo_used_mask[id] = sprog->ss[id]->sel->sinfo.ssbo_used_mask; in bind_ssbo_locs()
1483 static void bind_image_locs(struct vrend_linked_shader_program *sprog, in bind_image_locs() argument
1490 uint32_t mask = sprog->ss[id]->sel->sinfo.images_used_mask; in bind_image_locs()
1491 if (!mask && ! sprog->ss[id]->sel->sinfo.num_image_arrays) in bind_image_locs()
1499 sprog->img_locs[id] = calloc(nsamp, sizeof(GLint)); in bind_image_locs()
1500 if (!sprog->img_locs[id]) in bind_image_locs()
1503 sprog->img_locs[id] = NULL; in bind_image_locs()
1505 if (sprog->ss[id]->sel->sinfo.num_image_arrays) { in bind_image_locs()
1506 for (i = 0; i < sprog->ss[id]->sel->sinfo.num_image_arrays; i++) { in bind_image_locs()
1507 struct vrend_array *img_array = &sprog->ss[id]->sel->sinfo.image_arrays[i]; in bind_image_locs()
1510 sprog->img_locs[id][img_array->first + j] = glGetUniformLocation(sprog->id, name); in bind_image_locs()
1511 if (sprog->img_locs[id][img_array->first + j] == -1) in bind_image_locs()
1519 sprog->img_locs[id][i] = glGetUniformLocation(sprog->id, name); in bind_image_locs()
1520 if (sprog->img_locs[id][i] == -1) in bind_image_locs()
1523 sprog->img_locs[id][i] = -1; in bind_image_locs()
1527 sprog->images_used_mask[id] = mask; in bind_image_locs()
1533 struct vrend_linked_shader_program *sprog = CALLOC_STRUCT(vrend_linked_shader_program); in add_cs_shader_program() local
1550 free(sprog); in add_cs_shader_program()
1553 sprog->ss[PIPE_SHADER_COMPUTE] = cs; in add_cs_shader_program()
1555 list_add(&sprog->sl[PIPE_SHADER_COMPUTE], &cs->programs); in add_cs_shader_program()
1556 sprog->id = prog_id; in add_cs_shader_program()
1557 list_addtail(&sprog->head, &ctx->sub->cs_programs); in add_cs_shader_program()
1561 bind_sampler_locs(sprog, PIPE_SHADER_COMPUTE, 0); in add_cs_shader_program()
1562 bind_ubo_locs(sprog, PIPE_SHADER_COMPUTE, 0); in add_cs_shader_program()
1563 bind_ssbo_locs(sprog, PIPE_SHADER_COMPUTE); in add_cs_shader_program()
1564 bind_const_locs(sprog, PIPE_SHADER_COMPUTE); in add_cs_shader_program()
1565 bind_image_locs(sprog, PIPE_SHADER_COMPUTE); in add_cs_shader_program()
1566 return sprog; in add_cs_shader_program()
1576 struct vrend_linked_shader_program *sprog = CALLOC_STRUCT(vrend_linked_shader_program); in add_shader_program() local
1583 if (!sprog) in add_shader_program()
1611 sprog->dual_src_linked = true; in add_shader_program()
1617 sprog->dual_src_linked = false; in add_shader_program()
1620 sprog->dual_src_linked = false; in add_shader_program()
1646 free(sprog); in add_shader_program()
1650 sprog->ss[PIPE_SHADER_VERTEX] = vs; in add_shader_program()
1651 sprog->ss[PIPE_SHADER_FRAGMENT] = fs; in add_shader_program()
1652 sprog->vs_fs_key = (((uint64_t)fs->id) << 32) | (vs->id & ~VREND_PROGRAM_NQUEUE_MASK) | in add_shader_program()
1653 (sprog->dual_src_linked ? 1 : 0); in add_shader_program()
1655 sprog->ss[PIPE_SHADER_GEOMETRY] = gs; in add_shader_program()
1656 sprog->ss[PIPE_SHADER_TESS_CTRL] = tcs; in add_shader_program()
1657 sprog->ss[PIPE_SHADER_TESS_EVAL] = tes; in add_shader_program()
1659 list_add(&sprog->sl[PIPE_SHADER_VERTEX], &vs->programs); in add_shader_program()
1660 list_add(&sprog->sl[PIPE_SHADER_FRAGMENT], &fs->programs); in add_shader_program()
1662 list_add(&sprog->sl[PIPE_SHADER_GEOMETRY], &gs->programs); in add_shader_program()
1664 list_add(&sprog->sl[PIPE_SHADER_TESS_CTRL], &tcs->programs); in add_shader_program()
1666 list_add(&sprog->sl[PIPE_SHADER_TESS_EVAL], &tes->programs); in add_shader_program()
1669 sprog->id = prog_id; in add_shader_program()
1671 list_addtail(&sprog->head, &sub_ctx->gl_programs[vs->id & VREND_PROGRAM_NQUEUE_MASK]); in add_shader_program()
1674 sprog->fs_stipple_loc = glGetUniformLocation(prog_id, "pstipple_sampler"); in add_shader_program()
1676 sprog->fs_stipple_loc = -1; in add_shader_program()
1678 sprog->fs_alpha_ref_val_loc = glGetUniformLocation(prog_id, "alpha_ref_val"); in add_shader_program()
1680 sprog->fs_alpha_ref_val_loc = -1; in add_shader_program()
1681 sprog->vs_ws_adjust_loc = glGetUniformLocation(prog_id, "winsys_adjust_y"); in add_shader_program()
1687 if (!sprog->ss[id]) in add_shader_program()
1690 next_sampler_id = bind_sampler_locs(sprog, id, next_sampler_id); in add_shader_program()
1691 bind_const_locs(sprog, id); in add_shader_program()
1692 next_ubo_id = bind_ubo_locs(sprog, id, next_ubo_id); in add_shader_program()
1693 bind_image_locs(sprog, id); in add_shader_program()
1694 bind_ssbo_locs(sprog, id); in add_shader_program()
1699 sprog->attrib_locs = calloc(vs->sel->sinfo.num_inputs, sizeof(uint32_t)); in add_shader_program()
1700 if (sprog->attrib_locs) { in add_shader_program()
1703 sprog->attrib_locs[i] = glGetAttribLocation(prog_id, name); in add_shader_program()
1707 sprog->attrib_locs = NULL; in add_shader_program()
1713 sprog->clip_locs[i] = glGetUniformLocation(prog_id, name); in add_shader_program()
1716 return sprog; in add_shader_program()