Lines Matching refs:res
45 program_resource_location(struct gl_program_resource *res,
53 const type * RESOURCE_ ## name (gl_program_resource *res) { \
54 assert(res->Data); \
55 return (type *) res->Data; \
188 struct gl_program_resource *res =
193 if (!res) {
198 const gl_shader_variable *const var = RESOURCE_VAR(res);
205 _mesa_program_resource_prop(shProg, res, desired_index, GL_ARRAY_SIZE,
209 _mesa_program_resource_prop(shProg, res, desired_index, GL_TYPE,
239 struct gl_program_resource *res =
243 if (!res)
246 return program_resource_location(res, array_index);
257 struct gl_program_resource *res = shProg->data->ProgramResourceList;
260 j++, res++) {
261 if (res->Type == GL_PROGRAM_INPUT &&
262 res->StageReferences & (1 << MESA_SHADER_VERTEX))
277 struct gl_program_resource *res = shProg->data->ProgramResourceList;
280 j++, res++) {
281 if (res->Type == GL_PROGRAM_INPUT &&
282 res->StageReferences & (1 << MESA_SHADER_VERTEX)) {
291 const size_t length = RESOURCE_VAR(res)->name.length;
448 struct gl_program_resource *res =
452 if (!res)
455 return program_resource_location(res, array_index);
459 _mesa_program_resource_name(struct gl_program_resource *res)
461 switch (res->Type) {
464 return RESOURCE_UBO(res)->name.string;
466 return RESOURCE_XFV(res)->name.string;
469 return RESOURCE_VAR(res)->name.string;
472 return RESOURCE_UNI(res)->name.string;
479 return RESOURCE_UNI(res)->name.string + MESA_SUBROUTINE_PREFIX_LEN;
486 return RESOURCE_SUB(res)->name.string;
494 _mesa_program_resource_name_length(struct gl_program_resource *res)
496 switch (res->Type) {
499 return RESOURCE_UBO(res)->name.length;
501 return RESOURCE_XFV(res)->name.length;
504 return RESOURCE_VAR(res)->name.length;
507 return RESOURCE_UNI(res)->name.length;
514 return RESOURCE_UNI(res)->name.length - MESA_SUBROUTINE_PREFIX_LEN;
521 return RESOURCE_SUB(res)->name.length;
529 _mesa_program_get_resource_name(struct gl_program_resource *res,
532 switch (res->Type) {
535 *out = RESOURCE_UBO(res)->name;
538 *out = RESOURCE_XFV(res)->name;
542 *out = RESOURCE_VAR(res)->name;
546 *out = RESOURCE_UNI(res)->name;
554 *out = RESOURCE_UNI(res)->name;
565 *out = RESOURCE_SUB(res)->name;
573 _mesa_program_resource_array_size(struct gl_program_resource *res)
575 switch (res->Type) {
577 return RESOURCE_XFV(res)->Size > 1 ?
578 RESOURCE_XFV(res)->Size : 0;
581 return RESOURCE_VAR(res)->type->length;
589 return RESOURCE_UNI(res)->array_elements;
592 if (RESOURCE_UNI(res)->array_stride > 0 &&
593 RESOURCE_UNI(res)->array_elements == 0)
596 return RESOURCE_UNI(res)->array_elements;
683 struct gl_program_resource *res =
686 if (res)
687 return res;
689 res = shProg->data->ProgramResourceList;
690 for (unsigned i = 0; i < shProg->data->NumProgramResourceList; i++, res++) {
691 if (res->Type != programInterface)
697 if (!_mesa_program_get_resource_name(res, &rname))
747 return res;
766 return res;
772 return res;
775 return res;
815 struct gl_program_resource *res = shProg->data->ProgramResourceList;
822 for (unsigned i = 0; i < shProg->data->NumProgramResourceList; i++, res++) {
823 if (res->Type != blockInterface)
830 const struct gl_uniform_block *block = RESOURCE_UBO(res);
849 res = shProg->data->ProgramResourceList;
850 for (unsigned i = 0; i < shProg->data->NumProgramResourceList; i++, res++) {
851 if (res->Type != programInterface)
854 const struct gl_uniform_storage *uniform = RESOURCE_UNI(res);
857 return res;
879 struct gl_program_resource *res;
886 res = _mesa_program_resource_find_name(shProg, programInterface, uni.IndexName,
892 res = program_resource_find_binding_offset(shProg, programInterface,
896 return res;
901 struct gl_program_resource *res)
906 if (&shProg->data->ProgramResourceList[i] == res)
908 if (shProg->data->ProgramResourceList[i].Type == res->Type)
919 struct gl_program_resource *res)
921 if (!res)
924 switch (res->Type) {
926 return RESOURCE_ATC(res) - shProg->data->AtomicBuffers;
933 return RESOURCE_SUB(res)->index;
939 return calc_resource_index(shProg, res);
949 struct gl_program_resource *res = shProg->data->ProgramResourceList;
951 i++, res++) {
952 if (res->Data == data)
953 return res;
964 struct gl_program_resource *res = shProg->data->ProgramResourceList;
968 i++, res++) {
969 if (res->Type != programInterface)
972 switch (res->Type) {
977 if (_mesa_program_resource_index(shProg, res) == index)
978 return res;
998 return res;
1025 add_index_to_name(struct gl_program_resource *res)
1030 return res->Type != GL_TRANSFORM_FEEDBACK_VARYING;
1037 _mesa_program_resource_name_length_array(struct gl_program_resource *res)
1039 int length = _mesa_program_resource_name_length(res);
1047 if (_mesa_program_resource_array_size(res) && add_index_to_name(res))
1064 struct gl_program_resource *res =
1071 if (!res) {
1088 _mesa_copy_string(name, bufSize, length, _mesa_program_resource_name(res));
1094 _mesa_program_resource_array_size(res) && add_index_to_name(res)) {
1110 program_resource_location(struct gl_program_resource *res, unsigned array_index)
1112 switch (res->Type) {
1114 const gl_shader_variable *var = RESOURCE_VAR(res);
1128 if (RESOURCE_VAR(res)->location == -1)
1133 && array_index >= RESOURCE_VAR(res)->type->length) {
1136 return RESOURCE_VAR(res)->location + array_index;
1139 if (RESOURCE_UNI(res)->builtin)
1147 if (RESOURCE_UNI(res)->type->without_array()->is_struct())
1157 if (RESOURCE_UNI(res)->block_index != -1 ||
1158 RESOURCE_UNI(res)->atomic_buffer_index != -1)
1170 && array_index >= RESOURCE_UNI(res)->array_elements) {
1175 return RESOURCE_UNI(res)->remap_location + array_index;
1190 struct gl_program_resource *res =
1195 if (!res)
1198 return program_resource_location(res, array_index);
1202 _get_resource_location_index(struct gl_program_resource *res)
1205 if (!res || !(res->StageReferences & (1 << MESA_SHADER_FRAGMENT)))
1213 if (RESOURCE_VAR(res)->location == -1)
1215 return RESOURCE_VAR(res)->index;
1226 struct gl_program_resource *res =
1229 return _get_resource_location_index(res);
1260 struct gl_program_resource *res,
1267 if (res->Type == GL_ATOMIC_COUNTER_BUFFER)
1268 return RESOURCE_ATC(res)->StageReferences[stage];
1270 if (res->Type == GL_UNIFORM_BLOCK)
1273 if (res->Type == GL_SHADER_STORAGE_BLOCK)
1276 return res->StageReferences & (1 << stage);
1281 struct gl_program_resource *res, const GLenum prop,
1285 if (res->Type != GL_UNIFORM_BLOCK &&
1286 res->Type != GL_ATOMIC_COUNTER_BUFFER &&
1287 res->Type != GL_SHADER_STORAGE_BLOCK &&
1288 res->Type != GL_TRANSFORM_FEEDBACK_BUFFER)
1291 if (res->Type == GL_UNIFORM_BLOCK) {
1294 *val = RESOURCE_UBO(res)->Binding;
1297 *val = RESOURCE_UBO(res)->UniformBufferSize;
1301 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1306 RESOURCE_UBO(res),
1316 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1321 RESOURCE_UBO(res),
1333 } else if (res->Type == GL_SHADER_STORAGE_BLOCK) {
1336 *val = RESOURCE_UBO(res)->Binding;
1339 *val = RESOURCE_UBO(res)->UniformBufferSize;
1343 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1348 RESOURCE_UBO(res),
1358 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1363 RESOURCE_UBO(res),
1375 } else if (res->Type == GL_ATOMIC_COUNTER_BUFFER) {
1378 *val = RESOURCE_ATC(res)->Binding;
1381 *val = RESOURCE_ATC(res)->MinimumSize;
1384 *val = RESOURCE_ATC(res)->NumUniforms;
1387 for (unsigned i = 0; i < RESOURCE_ATC(res)->NumUniforms; i++) {
1392 unsigned idx = RESOURCE_ATC(res)->Uniforms[i];
1399 return RESOURCE_ATC(res)->NumUniforms;
1401 } else if (res->Type == GL_TRANSFORM_FEEDBACK_BUFFER) {
1404 *val = RESOURCE_XFB(res)->Binding;
1407 *val = RESOURCE_XFB(res)->NumVaryings;
1419 if (res == buf_res) {
1423 return RESOURCE_XFB(res)->NumVaryings;
1431 _mesa_enum_to_string(res->Type),
1439 struct gl_program_resource *res, GLuint index,
1446 if (res->Type != type)\
1450 if (res->Type != type1 && res->Type != type2)\
1455 switch (res->Type) {
1461 *val = _mesa_program_resource_name_length_array(res) + 1;
1465 switch (res->Type) {
1468 *val = RESOURCE_UNI(res)->type->gl_type;
1473 *val = RESOURCE_VAR(res)->type->gl_type;
1477 *val = RESOURCE_XFV(res)->Type;
1484 switch (res->Type) {
1497 if (RESOURCE_UNI(res)->is_shader_storage &&
1498 RESOURCE_UNI(res)->array_stride > 0)
1499 *val = RESOURCE_UNI(res)->array_elements;
1501 *val = MAX2(RESOURCE_UNI(res)->array_elements, 1);
1505 *val = MAX2(_mesa_program_resource_array_size(res), 1);
1508 *val = RESOURCE_XFV(res)->Size;
1514 switch (res->Type) {
1517 *val = RESOURCE_UNI(res)->offset;
1520 *val = RESOURCE_XFV(res)->Offset;
1527 *val = RESOURCE_UNI(res)->block_index;
1531 *val = RESOURCE_UNI(res)->array_stride;
1535 *val = RESOURCE_UNI(res)->matrix_stride;
1539 *val = RESOURCE_UNI(res)->row_major;
1543 *val = RESOURCE_UNI(res)->atomic_buffer_index;
1549 return get_buffer_property(shProg, res, prop, val, glthread, caller);
1559 switch (res->Type) {
1567 *val = is_resource_referenced(shProg, res, index,
1574 switch (res->Type) {
1584 *val = program_resource_location(res, 0);
1590 switch (res->Type) {
1593 *val = RESOURCE_VAR(res)->component;
1600 if (res->Type != GL_PROGRAM_OUTPUT)
1602 tmp = program_resource_location(res, 0);
1606 *val = _get_resource_location_index(res);
1610 if (res->Type != GL_VERTEX_SUBROUTINE_UNIFORM &&
1611 res->Type != GL_FRAGMENT_SUBROUTINE_UNIFORM &&
1612 res->Type != GL_GEOMETRY_SUBROUTINE_UNIFORM &&
1613 res->Type != GL_COMPUTE_SUBROUTINE_UNIFORM &&
1614 res->Type != GL_TESS_CONTROL_SUBROUTINE_UNIFORM &&
1615 res->Type != GL_TESS_EVALUATION_SUBROUTINE_UNIFORM)
1617 *val = RESOURCE_UNI(res)->num_compatible_subroutines;
1625 if (res->Type != GL_VERTEX_SUBROUTINE_UNIFORM &&
1626 res->Type != GL_FRAGMENT_SUBROUTINE_UNIFORM &&
1627 res->Type != GL_GEOMETRY_SUBROUTINE_UNIFORM &&
1628 res->Type != GL_COMPUTE_SUBROUTINE_UNIFORM &&
1629 res->Type != GL_TESS_CONTROL_SUBROUTINE_UNIFORM &&
1630 res->Type != GL_TESS_EVALUATION_SUBROUTINE_UNIFORM)
1632 uni = RESOURCE_UNI(res);
1634 p = shProg->_LinkedShaders[_mesa_shader_stage_from_subroutine_uniform(res->Type)]->Program;
1650 *val = RESOURCE_UNI(res)->top_level_array_size;
1655 *val = RESOURCE_UNI(res)->top_level_array_stride;
1660 switch (res->Type) {
1663 *val = RESOURCE_VAR(res)->patch;
1671 *val = RESOURCE_XFV(res)->BufferIndex;
1675 *val = RESOURCE_XFB(res)->Stride * 4;
1688 _mesa_enum_to_string(res->Type),
1695 _mesa_enum_to_string(res->Type),
1711 struct gl_program_resource *res =
1715 if (!res || bufSize < 0) {
1725 _mesa_program_resource_prop(shProg, res, index, *prop, val,
1911 struct gl_program_resource *res =
1914 if (res->Type != GL_PROGRAM_OUTPUT)
1917 gl_shader_variable const *const var = RESOURCE_VAR(res);
1932 struct gl_program_resource *res =
1935 if (res->Type != GL_PROGRAM_INPUT)
1938 gl_shader_variable const *const consumer_var = RESOURCE_VAR(res);
2154 struct gl_program_resource *res = shProg->data->ProgramResourceList;
2155 for (unsigned i = 0; i < shProg->data->NumProgramResourceList; i++, res++) {
2157 if (_mesa_program_get_resource_name(res, &name)) {
2158 unsigned type = GET_PROGRAM_RESOURCE_TYPE_FROM_GLENUM(res->Type);
2168 name.string, res);