• Home
  • Raw
  • Download

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