Lines Matching refs:res

43 program_resource_location(struct gl_program_resource *res,
51 const type * RESOURCE_ ## name (gl_program_resource *res) { \
52 assert(res->Data); \
53 return (type *) res->Data; \
186 struct gl_program_resource *res =
191 if (!res) {
196 const gl_shader_variable *const var = RESOURCE_VAR(res);
203 _mesa_program_resource_prop(shProg, res, desired_index, GL_ARRAY_SIZE,
207 _mesa_program_resource_prop(shProg, res, desired_index, GL_TYPE,
237 struct gl_program_resource *res =
241 if (!res)
244 return program_resource_location(res, array_index);
255 struct gl_program_resource *res = shProg->data->ProgramResourceList;
258 j++, res++) {
259 if (res->Type == GL_PROGRAM_INPUT &&
260 res->StageReferences & (1 << MESA_SHADER_VERTEX))
275 struct gl_program_resource *res = shProg->data->ProgramResourceList;
278 j++, res++) {
279 if (res->Type == GL_PROGRAM_INPUT &&
280 res->StageReferences & (1 << MESA_SHADER_VERTEX)) {
289 const size_t length = RESOURCE_VAR(res)->name != NULL ?
290 strlen(RESOURCE_VAR(res)->name) : 0;
447 struct gl_program_resource *res =
451 if (!res)
454 return program_resource_location(res, array_index);
458 _mesa_program_resource_name(struct gl_program_resource *res)
460 switch (res->Type) {
463 return RESOURCE_UBO(res)->Name;
465 return RESOURCE_XFV(res)->Name;
468 return RESOURCE_VAR(res)->name;
471 return RESOURCE_UNI(res)->name;
478 return RESOURCE_UNI(res)->name + MESA_SUBROUTINE_PREFIX_LEN;
485 return RESOURCE_SUB(res)->name;
494 _mesa_program_resource_array_size(struct gl_program_resource *res)
496 switch (res->Type) {
498 return RESOURCE_XFV(res)->Size > 1 ?
499 RESOURCE_XFV(res)->Size : 0;
502 return RESOURCE_VAR(res)->type->length;
510 return RESOURCE_UNI(res)->array_elements;
513 if (RESOURCE_UNI(res)->array_stride > 0 &&
514 RESOURCE_UNI(res)->array_elements == 0)
517 return RESOURCE_UNI(res)->array_elements;
580 struct gl_program_resource *res = (struct gl_program_resource *)
586 if (res && array_index)
589 return res;
599 struct gl_program_resource *res = NULL;
606 res = search_resource_hash(shProg, programInterface, name, array_index);
608 if (res)
609 return res;
611 res = shProg->data->ProgramResourceList;
612 for (unsigned i = 0; i < shProg->data->NumProgramResourceList; i++, res++) {
613 if (res->Type != programInterface)
617 const char *rname = _mesa_program_resource_name(res);
675 return res;
694 return res;
700 return res;
703 return res;
743 struct gl_program_resource *res = shProg->data->ProgramResourceList;
750 for (unsigned i = 0; i < shProg->data->NumProgramResourceList; i++, res++) {
751 if (res->Type != blockInterface)
758 const struct gl_uniform_block *block = RESOURCE_UBO(res);
777 res = shProg->data->ProgramResourceList;
778 for (unsigned i = 0; i < shProg->data->NumProgramResourceList; i++, res++) {
779 if (res->Type != programInterface)
782 const struct gl_uniform_storage *uniform = RESOURCE_UNI(res);
785 return res;
807 struct gl_program_resource *res;
814 res = _mesa_program_resource_find_name(shProg, programInterface, uni.IndexName,
820 res = program_resource_find_binding_offset(shProg, programInterface,
824 return res;
829 struct gl_program_resource *res)
834 if (&shProg->data->ProgramResourceList[i] == res)
836 if (shProg->data->ProgramResourceList[i].Type == res->Type)
847 struct gl_program_resource *res)
849 if (!res)
852 switch (res->Type) {
854 return RESOURCE_ATC(res) - shProg->data->AtomicBuffers;
861 return RESOURCE_SUB(res)->index;
867 return calc_resource_index(shProg, res);
877 struct gl_program_resource *res = shProg->data->ProgramResourceList;
879 i++, res++) {
880 if (res->Data == data)
881 return res;
892 struct gl_program_resource *res = shProg->data->ProgramResourceList;
896 i++, res++) {
897 if (res->Type != programInterface)
900 switch (res->Type) {
905 if (_mesa_program_resource_index(shProg, res) == index)
906 return res;
926 return res;
953 add_index_to_name(struct gl_program_resource *res)
958 return res->Type != GL_TRANSFORM_FEEDBACK_VARYING;
965 _mesa_program_resource_name_len(struct gl_program_resource *res)
967 const char* name = _mesa_program_resource_name(res);
976 if (_mesa_program_resource_array_size(res) && add_index_to_name(res))
993 struct gl_program_resource *res =
1000 if (!res) {
1017 _mesa_copy_string(name, bufSize, length, _mesa_program_resource_name(res));
1023 _mesa_program_resource_array_size(res) && add_index_to_name(res)) {
1039 program_resource_location(struct gl_program_resource *res, unsigned array_index)
1041 switch (res->Type) {
1043 const gl_shader_variable *var = RESOURCE_VAR(res);
1057 if (RESOURCE_VAR(res)->location == -1)
1062 && array_index >= RESOURCE_VAR(res)->type->length) {
1065 return RESOURCE_VAR(res)->location + array_index;
1068 if (RESOURCE_UNI(res)->builtin)
1076 if (RESOURCE_UNI(res)->type->without_array()->is_struct())
1086 if (RESOURCE_UNI(res)->block_index != -1 ||
1087 RESOURCE_UNI(res)->atomic_buffer_index != -1)
1099 && array_index >= RESOURCE_UNI(res)->array_elements) {
1104 return RESOURCE_UNI(res)->remap_location + array_index;
1119 struct gl_program_resource *res =
1124 if (!res)
1127 return program_resource_location(res, array_index);
1131 _get_resource_location_index(struct gl_program_resource *res)
1134 if (!res || !(res->StageReferences & (1 << MESA_SHADER_FRAGMENT)))
1142 if (RESOURCE_VAR(res)->location == -1)
1144 return RESOURCE_VAR(res)->index;
1155 struct gl_program_resource *res =
1158 return _get_resource_location_index(res);
1189 struct gl_program_resource *res,
1196 if (res->Type == GL_ATOMIC_COUNTER_BUFFER)
1197 return RESOURCE_ATC(res)->StageReferences[stage];
1199 if (res->Type == GL_UNIFORM_BLOCK)
1202 if (res->Type == GL_SHADER_STORAGE_BLOCK)
1205 return res->StageReferences & (1 << stage);
1210 struct gl_program_resource *res, const GLenum prop,
1214 if (res->Type != GL_UNIFORM_BLOCK &&
1215 res->Type != GL_ATOMIC_COUNTER_BUFFER &&
1216 res->Type != GL_SHADER_STORAGE_BLOCK &&
1217 res->Type != GL_TRANSFORM_FEEDBACK_BUFFER)
1220 if (res->Type == GL_UNIFORM_BLOCK) {
1223 *val = RESOURCE_UBO(res)->Binding;
1226 *val = RESOURCE_UBO(res)->UniformBufferSize;
1230 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1235 RESOURCE_UBO(res),
1245 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1250 RESOURCE_UBO(res),
1262 } else if (res->Type == GL_SHADER_STORAGE_BLOCK) {
1265 *val = RESOURCE_UBO(res)->Binding;
1268 *val = RESOURCE_UBO(res)->UniformBufferSize;
1272 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1277 RESOURCE_UBO(res),
1287 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1292 RESOURCE_UBO(res),
1304 } else if (res->Type == GL_ATOMIC_COUNTER_BUFFER) {
1307 *val = RESOURCE_ATC(res)->Binding;
1310 *val = RESOURCE_ATC(res)->MinimumSize;
1313 *val = RESOURCE_ATC(res)->NumUniforms;
1316 for (unsigned i = 0; i < RESOURCE_ATC(res)->NumUniforms; i++) {
1321 unsigned idx = RESOURCE_ATC(res)->Uniforms[i];
1328 return RESOURCE_ATC(res)->NumUniforms;
1330 } else if (res->Type == GL_TRANSFORM_FEEDBACK_BUFFER) {
1333 *val = RESOURCE_XFB(res)->Binding;
1336 *val = RESOURCE_XFB(res)->NumVaryings;
1348 if (res == buf_res) {
1352 return RESOURCE_XFB(res)->NumVaryings;
1360 _mesa_enum_to_string(res->Type),
1368 struct gl_program_resource *res, GLuint index,
1375 if (res->Type != type)\
1379 if (res->Type != type1 && res->Type != type2)\
1384 switch (res->Type) {
1390 *val = _mesa_program_resource_name_len(res) + 1;
1394 switch (res->Type) {
1397 *val = RESOURCE_UNI(res)->type->gl_type;
1402 *val = RESOURCE_VAR(res)->type->gl_type;
1406 *val = RESOURCE_XFV(res)->Type;
1413 switch (res->Type) {
1426 if (RESOURCE_UNI(res)->is_shader_storage &&
1427 RESOURCE_UNI(res)->array_stride > 0)
1428 *val = RESOURCE_UNI(res)->array_elements;
1430 *val = MAX2(RESOURCE_UNI(res)->array_elements, 1);
1434 *val = MAX2(_mesa_program_resource_array_size(res), 1);
1437 *val = RESOURCE_XFV(res)->Size;
1443 switch (res->Type) {
1446 *val = RESOURCE_UNI(res)->offset;
1449 *val = RESOURCE_XFV(res)->Offset;
1456 *val = RESOURCE_UNI(res)->block_index;
1460 *val = RESOURCE_UNI(res)->array_stride;
1464 *val = RESOURCE_UNI(res)->matrix_stride;
1468 *val = RESOURCE_UNI(res)->row_major;
1472 *val = RESOURCE_UNI(res)->atomic_buffer_index;
1478 return get_buffer_property(shProg, res, prop, val, glthread, caller);
1488 switch (res->Type) {
1496 *val = is_resource_referenced(shProg, res, index,
1503 switch (res->Type) {
1513 *val = program_resource_location(res, 0);
1519 switch (res->Type) {
1522 *val = RESOURCE_VAR(res)->component;
1529 if (res->Type != GL_PROGRAM_OUTPUT)
1531 tmp = program_resource_location(res, 0);
1535 *val = _get_resource_location_index(res);
1539 if (res->Type != GL_VERTEX_SUBROUTINE_UNIFORM &&
1540 res->Type != GL_FRAGMENT_SUBROUTINE_UNIFORM &&
1541 res->Type != GL_GEOMETRY_SUBROUTINE_UNIFORM &&
1542 res->Type != GL_COMPUTE_SUBROUTINE_UNIFORM &&
1543 res->Type != GL_TESS_CONTROL_SUBROUTINE_UNIFORM &&
1544 res->Type != GL_TESS_EVALUATION_SUBROUTINE_UNIFORM)
1546 *val = RESOURCE_UNI(res)->num_compatible_subroutines;
1554 if (res->Type != GL_VERTEX_SUBROUTINE_UNIFORM &&
1555 res->Type != GL_FRAGMENT_SUBROUTINE_UNIFORM &&
1556 res->Type != GL_GEOMETRY_SUBROUTINE_UNIFORM &&
1557 res->Type != GL_COMPUTE_SUBROUTINE_UNIFORM &&
1558 res->Type != GL_TESS_CONTROL_SUBROUTINE_UNIFORM &&
1559 res->Type != GL_TESS_EVALUATION_SUBROUTINE_UNIFORM)
1561 uni = RESOURCE_UNI(res);
1563 p = shProg->_LinkedShaders[_mesa_shader_stage_from_subroutine_uniform(res->Type)]->Program;
1579 *val = RESOURCE_UNI(res)->top_level_array_size;
1584 *val = RESOURCE_UNI(res)->top_level_array_stride;
1589 switch (res->Type) {
1592 *val = RESOURCE_VAR(res)->patch;
1600 *val = RESOURCE_XFV(res)->BufferIndex;
1604 *val = RESOURCE_XFB(res)->Stride * 4;
1617 _mesa_enum_to_string(res->Type),
1624 _mesa_enum_to_string(res->Type),
1640 struct gl_program_resource *res =
1644 if (!res || bufSize < 0) {
1654 _mesa_program_resource_prop(shProg, res, index, *prop, val,
1840 struct gl_program_resource *res =
1843 if (res->Type != GL_PROGRAM_OUTPUT)
1846 gl_shader_variable const *const var = RESOURCE_VAR(res);
1861 struct gl_program_resource *res =
1864 if (res->Type != GL_PROGRAM_INPUT)
1867 gl_shader_variable const *const consumer_var = RESOURCE_VAR(res);
2075 struct gl_program_resource *res = shProg->data->ProgramResourceList;
2076 for (unsigned i = 0; i < shProg->data->NumProgramResourceList; i++, res++) {
2077 const char *name = _mesa_program_resource_name(res);
2079 uint32_t key = compute_resource_key(res->Type, name, strlen(name));
2081 res);