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; \
151 struct gl_program_resource *res =
156 if (!res) {
161 const gl_shader_variable *const var = RESOURCE_VAR(res);
168 _mesa_program_resource_prop(shProg, res, desired_index, GL_ARRAY_SIZE,
172 _mesa_program_resource_prop(shProg, res, desired_index, GL_TYPE,
202 struct gl_program_resource *res =
206 if (!res)
209 return program_resource_location(res, array_index);
220 struct gl_program_resource *res = shProg->data->ProgramResourceList;
223 j++, res++) {
224 if (res->Type == GL_PROGRAM_INPUT &&
225 res->StageReferences & (1 << MESA_SHADER_VERTEX))
240 struct gl_program_resource *res = shProg->data->ProgramResourceList;
243 j++, res++) {
244 if (res->Type == GL_PROGRAM_INPUT &&
245 res->StageReferences & (1 << MESA_SHADER_VERTEX)) {
247 const size_t length = strlen(RESOURCE_VAR(res)->name);
415 struct gl_program_resource *res =
419 if (!res)
422 return program_resource_location(res, array_index);
426 _mesa_program_resource_name(struct gl_program_resource *res)
428 switch (res->Type) {
431 return RESOURCE_UBO(res)->Name;
433 return RESOURCE_XFV(res)->Name;
436 return RESOURCE_VAR(res)->name;
439 return RESOURCE_UNI(res)->name;
446 return RESOURCE_UNI(res)->name + MESA_SUBROUTINE_PREFIX_LEN;
453 return RESOURCE_SUB(res)->name;
462 _mesa_program_resource_array_size(struct gl_program_resource *res)
464 switch (res->Type) {
466 return RESOURCE_XFV(res)->Size > 1 ?
467 RESOURCE_XFV(res)->Size : 0;
470 return RESOURCE_VAR(res)->type->length;
478 return RESOURCE_UNI(res)->array_elements;
481 if (RESOURCE_UNI(res)->array_stride > 0 &&
482 RESOURCE_UNI(res)->array_elements == 0)
485 return RESOURCE_UNI(res)->array_elements;
528 struct gl_program_resource *res = shProg->data->ProgramResourceList;
530 i++, res++) {
531 if (res->Type != programInterface)
535 const char *rname = _mesa_program_resource_name(res);
593 return res;
612 return res;
618 return res;
621 return res;
634 struct gl_program_resource *res)
639 if (&shProg->data->ProgramResourceList[i] == res)
641 if (shProg->data->ProgramResourceList[i].Type == res->Type)
652 struct gl_program_resource *res)
654 if (!res)
657 switch (res->Type) {
659 return RESOURCE_ATC(res) - shProg->data->AtomicBuffers;
666 return RESOURCE_SUB(res)->index;
672 return calc_resource_index(shProg, res);
682 struct gl_program_resource *res = shProg->data->ProgramResourceList;
684 i++, res++) {
685 if (res->Data == data)
686 return res;
697 struct gl_program_resource *res = shProg->data->ProgramResourceList;
701 i++, res++) {
702 if (res->Type != programInterface)
705 switch (res->Type) {
710 if (_mesa_program_resource_index(shProg, res) == index)
711 return res;
731 return res;
758 add_index_to_name(struct gl_program_resource *res)
763 return res->Type != GL_TRANSFORM_FEEDBACK_VARYING;
770 _mesa_program_resource_name_len(struct gl_program_resource *res)
772 unsigned length = strlen(_mesa_program_resource_name(res));
773 if (_mesa_program_resource_array_size(res) && add_index_to_name(res))
789 struct gl_program_resource *res =
796 if (!res) {
811 _mesa_copy_string(name, bufSize, length, _mesa_program_resource_name(res));
813 if (_mesa_program_resource_array_size(res) && add_index_to_name(res)) {
829 program_resource_location(struct gl_program_resource *res, unsigned array_index)
831 switch (res->Type) {
833 const gl_shader_variable *var = RESOURCE_VAR(res);
847 if (RESOURCE_VAR(res)->location == -1)
852 && array_index >= RESOURCE_VAR(res)->type->length) {
855 return RESOURCE_VAR(res)->location + array_index;
858 if (RESOURCE_UNI(res)->builtin)
866 if (RESOURCE_UNI(res)->type->without_array()->is_struct())
876 if (RESOURCE_UNI(res)->block_index != -1 ||
877 RESOURCE_UNI(res)->atomic_buffer_index != -1)
889 && array_index >= RESOURCE_UNI(res)->array_elements) {
894 return RESOURCE_UNI(res)->remap_location + array_index;
909 struct gl_program_resource *res =
914 if (!res)
917 return program_resource_location(res, array_index);
928 struct gl_program_resource *res =
932 if (!res || !(res->StageReferences & (1 << MESA_SHADER_FRAGMENT)))
940 if (RESOURCE_VAR(res)->location == -1)
942 return RESOURCE_VAR(res)->index;
973 struct gl_program_resource *res,
980 if (res->Type == GL_ATOMIC_COUNTER_BUFFER)
981 return RESOURCE_ATC(res)->StageReferences[stage];
983 if (res->Type == GL_UNIFORM_BLOCK)
986 if (res->Type == GL_SHADER_STORAGE_BLOCK)
989 return res->StageReferences & (1 << stage);
994 struct gl_program_resource *res, const GLenum prop,
998 if (res->Type != GL_UNIFORM_BLOCK &&
999 res->Type != GL_ATOMIC_COUNTER_BUFFER &&
1000 res->Type != GL_SHADER_STORAGE_BLOCK &&
1001 res->Type != GL_TRANSFORM_FEEDBACK_BUFFER)
1004 if (res->Type == GL_UNIFORM_BLOCK) {
1007 *val = RESOURCE_UBO(res)->Binding;
1010 *val = RESOURCE_UBO(res)->UniformBufferSize;
1014 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1015 const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
1026 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1027 const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
1040 } else if (res->Type == GL_SHADER_STORAGE_BLOCK) {
1043 *val = RESOURCE_UBO(res)->Binding;
1046 *val = RESOURCE_UBO(res)->UniformBufferSize;
1050 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1051 const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
1062 for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) {
1063 const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName;
1076 } else if (res->Type == GL_ATOMIC_COUNTER_BUFFER) {
1079 *val = RESOURCE_ATC(res)->Binding;
1082 *val = RESOURCE_ATC(res)->MinimumSize;
1085 *val = RESOURCE_ATC(res)->NumUniforms;
1088 for (unsigned i = 0; i < RESOURCE_ATC(res)->NumUniforms; i++) {
1093 unsigned idx = RESOURCE_ATC(res)->Uniforms[i];
1100 return RESOURCE_ATC(res)->NumUniforms;
1102 } else if (res->Type == GL_TRANSFORM_FEEDBACK_BUFFER) {
1105 *val = RESOURCE_XFB(res)->Binding;
1108 *val = RESOURCE_XFB(res)->NumVaryings;
1120 if (res == buf_res) {
1124 return RESOURCE_XFB(res)->NumVaryings;
1131 _mesa_enum_to_string(res->Type),
1139 struct gl_program_resource *res, GLuint index,
1145 if (res->Type != type)\
1149 if (res->Type != type1 && res->Type != type2)\
1154 switch (res->Type) {
1160 *val = _mesa_program_resource_name_len(res) + 1;
1164 switch (res->Type) {
1167 *val = RESOURCE_UNI(res)->type->gl_type;
1171 *val = RESOURCE_VAR(res)->type->gl_type;
1174 *val = RESOURCE_XFV(res)->Type;
1180 switch (res->Type) {
1193 if (RESOURCE_UNI(res)->is_shader_storage &&
1194 RESOURCE_UNI(res)->array_stride > 0)
1195 *val = RESOURCE_UNI(res)->array_elements;
1197 *val = MAX2(RESOURCE_UNI(res)->array_elements, 1);
1201 *val = MAX2(_mesa_program_resource_array_size(res), 1);
1204 *val = RESOURCE_XFV(res)->Size;
1210 switch (res->Type) {
1213 *val = RESOURCE_UNI(res)->offset;
1216 *val = RESOURCE_XFV(res)->Offset;
1223 *val = RESOURCE_UNI(res)->block_index;
1227 *val = RESOURCE_UNI(res)->array_stride;
1231 *val = RESOURCE_UNI(res)->matrix_stride;
1235 *val = RESOURCE_UNI(res)->row_major;
1239 *val = RESOURCE_UNI(res)->atomic_buffer_index;
1245 return get_buffer_property(shProg, res, prop, val, caller);
1255 switch (res->Type) {
1263 *val = is_resource_referenced(shProg, res, index,
1270 switch (res->Type) {
1280 *val = program_resource_location(res, 0);
1286 switch (res->Type) {
1289 *val = RESOURCE_VAR(res)->component;
1296 if (res->Type != GL_PROGRAM_OUTPUT)
1298 tmp = program_resource_location(res, 0);
1302 *val = _mesa_program_resource_location_index(shProg, res->Type,
1303 RESOURCE_VAR(res)->name);
1307 if (res->Type != GL_VERTEX_SUBROUTINE_UNIFORM &&
1308 res->Type != GL_FRAGMENT_SUBROUTINE_UNIFORM &&
1309 res->Type != GL_GEOMETRY_SUBROUTINE_UNIFORM &&
1310 res->Type != GL_COMPUTE_SUBROUTINE_UNIFORM &&
1311 res->Type != GL_TESS_CONTROL_SUBROUTINE_UNIFORM &&
1312 res->Type != GL_TESS_EVALUATION_SUBROUTINE_UNIFORM)
1314 *val = RESOURCE_UNI(res)->num_compatible_subroutines;
1322 if (res->Type != GL_VERTEX_SUBROUTINE_UNIFORM &&
1323 res->Type != GL_FRAGMENT_SUBROUTINE_UNIFORM &&
1324 res->Type != GL_GEOMETRY_SUBROUTINE_UNIFORM &&
1325 res->Type != GL_COMPUTE_SUBROUTINE_UNIFORM &&
1326 res->Type != GL_TESS_CONTROL_SUBROUTINE_UNIFORM &&
1327 res->Type != GL_TESS_EVALUATION_SUBROUTINE_UNIFORM)
1329 uni = RESOURCE_UNI(res);
1331 p = shProg->_LinkedShaders[_mesa_shader_stage_from_subroutine_uniform(res->Type)]->Program;
1347 *val = RESOURCE_UNI(res)->top_level_array_size;
1352 *val = RESOURCE_UNI(res)->top_level_array_stride;
1357 switch (res->Type) {
1360 *val = RESOURCE_VAR(res)->patch;
1368 *val = RESOURCE_XFV(res)->BufferIndex;
1372 *val = RESOURCE_XFB(res)->Stride * 4;
1384 _mesa_enum_to_string(res->Type),
1390 _mesa_enum_to_string(res->Type),
1406 struct gl_program_resource *res =
1410 if (!res || bufSize < 0) {
1420 _mesa_program_resource_prop(shProg, res, index, *prop, val,
1477 struct gl_program_resource *res =
1480 if (res->Type != GL_PROGRAM_OUTPUT)
1483 gl_shader_variable const *const var = RESOURCE_VAR(res);
1498 struct gl_program_resource *res =
1501 if (res->Type != GL_PROGRAM_INPUT)
1504 gl_shader_variable const *const consumer_var = RESOURCE_VAR(res);