diff options
-rw-r--r-- | src/vrend_shader.c | 262 |
1 files changed, 126 insertions, 136 deletions
diff --git a/src/vrend_shader.c b/src/vrend_shader.c index ba3624d..5a94c63 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -765,8 +765,8 @@ iter_declaration(struct tgsi_iterate_context *iter, ctx->patch_input_range.used = true; } if (ctx->inputs[i].sid > ctx->patch_input_range.last) - ctx->patch_input_range.last = ctx->inputs[i].sid; - } + ctx->patch_input_range.last = ctx->inputs[i].sid; + } case TGSI_SEMANTIC_GENERIC: if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) { @@ -780,19 +780,19 @@ iter_declaration(struct tgsi_iterate_context *iter, break; } } - if (indirect && ctx->inputs[i].name == TGSI_SEMANTIC_GENERIC) { + if (indirect && ctx->inputs[i].name == TGSI_SEMANTIC_GENERIC) { ctx->inputs[i].glsl_predefined_no_emit = true; - if (ctx->inputs[i].sid < ctx->generic_input_range.first || ctx->generic_input_range.used == false) { - ctx->generic_input_range.first = ctx->inputs[i].sid; - ctx->generic_input_range.array_id = i; - ctx->generic_input_range.used = true; - } - if (ctx->inputs[i].sid > ctx->generic_input_range.last) - ctx->generic_input_range.last = ctx->inputs[i].sid; - } + if (ctx->inputs[i].sid < ctx->generic_input_range.first || ctx->generic_input_range.used == false) { + ctx->generic_input_range.first = ctx->inputs[i].sid; + ctx->generic_input_range.array_id = i; + ctx->generic_input_range.used = true; + } + if (ctx->inputs[i].sid > ctx->generic_input_range.last) + ctx->generic_input_range.last = ctx->inputs[i].sid; + } default: name_prefix = get_stage_input_name_prefix(ctx, iter->processor.Processor); - break; + break; } if (ctx->inputs[i].glsl_no_index) @@ -984,29 +984,29 @@ iter_declaration(struct tgsi_iterate_context *iter, if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC) color_offset = -1; - if (indirect && ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC) { + if (indirect && ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC) { ctx->outputs[i].glsl_predefined_no_emit = true; - ctx->glsl_ver_required = 150; - if (ctx->outputs[i].sid < ctx->generic_output_range.first || ctx->generic_output_range.used == false) { - ctx->generic_output_range.array_id = i; - ctx->generic_output_range.first = ctx->outputs[i].sid; - ctx->generic_output_range.used = true; - } - if (ctx->outputs[i].sid > ctx->generic_output_range.last) - ctx->generic_output_range.last = ctx->outputs[i].sid; - } + ctx->glsl_ver_required = 150; + if (ctx->outputs[i].sid < ctx->generic_output_range.first || ctx->generic_output_range.used == false) { + ctx->generic_output_range.array_id = i; + ctx->generic_output_range.first = ctx->outputs[i].sid; + ctx->generic_output_range.used = true; + } + if (ctx->outputs[i].sid > ctx->generic_output_range.last) + ctx->generic_output_range.last = ctx->outputs[i].sid; + } case TGSI_SEMANTIC_PATCH: - if (indirect && ctx->outputs[i].name == TGSI_SEMANTIC_PATCH) { + if (indirect && ctx->outputs[i].name == TGSI_SEMANTIC_PATCH) { ctx->outputs[i].glsl_predefined_no_emit = true; - ctx->glsl_ver_required = 150; - if (ctx->outputs[i].sid < ctx->patch_output_range.first || ctx->patch_output_range.used == false) { - ctx->patch_output_range.array_id = i; - ctx->patch_output_range.first = ctx->outputs[i].sid; - ctx->patch_output_range.used = true; - } - if (ctx->outputs[i].sid > ctx->patch_output_range.last) - ctx->patch_output_range.last = ctx->outputs[i].sid; - } + ctx->glsl_ver_required = 150; + if (ctx->outputs[i].sid < ctx->patch_output_range.first || ctx->patch_output_range.used == false) { + ctx->patch_output_range.array_id = i; + ctx->patch_output_range.first = ctx->outputs[i].sid; + ctx->patch_output_range.used = true; + } + if (ctx->outputs[i].sid > ctx->patch_output_range.last) + ctx->patch_output_range.last = ctx->outputs[i].sid; + } default: name_prefix = get_stage_output_name_prefix(iter->processor.Processor); break; @@ -2056,8 +2056,8 @@ static void create_swizzled_clipdist(struct dump_ctx *ctx, char *result, const struct tgsi_full_src_register *src, - int sid, - int direction, + int sid, + int direction, const char *stypeprefix, const char *prefix, const char *arrayname) @@ -2095,7 +2095,7 @@ create_swizzled_clipdist(struct dump_ctx *ctx, if (direction == -1) snprintf(clipdistvec[cc], 64, "%sgl_in%s.%s[%d]", prefix, arrayname, cc_name, idx); else if (direction == 1) - snprintf(clipdistvec[cc], 64, "%sgl_out%s.%s[%d]", prefix, arrayname, cc_name, idx); + snprintf(clipdistvec[cc], 64, "%sgl_out%s.%s[%d]", prefix, arrayname, cc_name, idx); else snprintf(clipdistvec[cc], 64, "%s%s%s[%d]", prefix, arrayname, cc_name, idx); } @@ -2220,30 +2220,29 @@ get_destination_info(struct dump_ctx *ctx, ctx->outputs[j].glsl_name, ctx->outputs[j].override_no_wm ? "" : writemask); } else if (ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL && ctx->outputs[j].name != TGSI_SEMANTIC_PATCH) { - if (ctx_indirect_outputs(ctx)) { - if (dst->Register.Indirect) - snprintf(dsts[i], 255, "oblk[gl_InvocationID].%s%d[addr%d + %d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, dst->Indirect.Index, dst->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); - else - snprintf(dsts[i], 255, "oblk[gl_InvocationID].%s%d[%d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, dst->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); - - } else - snprintf(dsts[i], 255, "%s[gl_InvocationID]%s", ctx->outputs[j].glsl_name, ctx->outputs[j].override_no_wm ? "" : writemask); - } else if (ctx_indirect_outputs(ctx) && ctx->outputs[j].name == TGSI_SEMANTIC_GENERIC) { - if (dst->Register.Indirect) - snprintf(dsts[i], 255, "oblk.%s%d[addr%d + %d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, dst->Indirect.Index, dst->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); - else - snprintf(dsts[i], 255, "oblk.%s%d[%d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, dst->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); - dst_override_no_wm[i] = ctx->outputs[j].override_no_wm; - } else if (ctx_indirect_outputs(ctx) && ctx->outputs[j].name == TGSI_SEMANTIC_PATCH) { - if (dst->Register.Indirect) - snprintf(dsts[i], 255, "%sp%d[addr%d + %d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->patch_output_range.first, dst->Indirect.Index, dst->Register.Index - ctx->patch_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); - else - snprintf(dsts[i], 255, "%sp%d[%d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->patch_output_range.first, dst->Register.Index - ctx->patch_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); - dst_override_no_wm[i] = ctx->outputs[j].override_no_wm; - - } else { + if (ctx_indirect_outputs(ctx)) { + if (dst_reg->Register.Indirect) + snprintf(dsts[i], 255, "oblk[gl_InvocationID].%s%d[addr%d + %d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, dst_reg->Indirect.Index, dst_reg->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); + else + snprintf(dsts[i], 255, "oblk[gl_InvocationID].%s%d[%d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, dst_reg->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); + + } else + snprintf(dsts[i], 255, "%s[gl_InvocationID]%s", ctx->outputs[j].glsl_name, ctx->outputs[j].override_no_wm ? "" : writemask); + } else if (ctx_indirect_outputs(ctx) && ctx->outputs[j].name == TGSI_SEMANTIC_GENERIC) { + if (dst_reg->Register.Indirect) + snprintf(dsts[i], 255, "oblk.%s%d[addr%d + %d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, dst_reg->Indirect.Index, dst_reg->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); + else + snprintf(dsts[i], 255, "oblk.%s%d[%d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, dst_reg->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); + dinfo->dst_override_no_wm[i] = ctx->outputs[j].override_no_wm; + } else if (ctx_indirect_outputs(ctx) && ctx->outputs[j].name == TGSI_SEMANTIC_PATCH) { + if (dst_reg->Register.Indirect) + snprintf(dsts[i], 255, "%sp%d[addr%d + %d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->patch_output_range.first, dst_reg->Indirect.Index, dst_reg->Register.Index - ctx->patch_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); + else + snprintf(dsts[i], 255, "%sp%d[%d]%s", get_shader_output_var_prefix(ctx->prog_type), ctx->patch_output_range.first, dst_reg->Register.Index - ctx->patch_output_range.array_id, ctx->outputs[j].override_no_wm ? "" : writemask); + dinfo->dst_override_no_wm[i] = ctx->outputs[j].override_no_wm; + } else { snprintf(dsts[i], 255, "%s%s", ctx->outputs[j].glsl_name, ctx->outputs[j].override_no_wm ? "" : writemask); - dinfo.dst_override_no_wm[i] = ctx->outputs[j].override_no_wm; + dinfo->dst_override_no_wm[i] = ctx->outputs[j].override_no_wm; } if (ctx->outputs[j].is_int) { if (dinfo->dtypeprefix == TYPE_CONVERSION_NONE) @@ -2366,12 +2365,10 @@ get_source_info(struct dump_ctx *ctx, if (ctx->inputs[j].first == src->Register.Index) { if (ctx->key->color_two_side && ctx->inputs[j].name == TGSI_SEMANTIC_COLOR) snprintf(srcs[i], 255, "%s(%s%s%d%s%s)", get_string(stypeprefix), prefix, "realcolor", ctx->inputs[j].sid, arrayname, swizzle); - else if (ctx->inputs[j].glsl_gl_in) { - snprintf(srcs[i], 255, "%s(%s%s%d%s%s)", get_string(stypeprefix), prefix, "realcolor", ctx->inputs[j].sid, arrayname, swizzle); else if (ctx->inputs[j].glsl_gl_block) { /* GS input clipdist requires a conversion */ if (ctx->inputs[j].name == TGSI_SEMANTIC_CLIPDIST) { - create_swizzled_clipdist(ctx, srcs[i], src, ctx->inputs[j].sid, -1, stypeprefix, prefix, arrayname); + create_swizzled_clipdist(ctx, srcs[i], src, ctx->inputs[j].sid, -1, get_string(stypeprefix), prefix, arrayname); } else { snprintf(srcs[i], 255, "%s(vec4(%sgl_in%s.%s)%s)", get_string(stypeprefix), prefix, arrayname, ctx->inputs[j].glsl_name, swizzle); } @@ -2381,7 +2378,7 @@ get_source_info(struct dump_ctx *ctx, else if (ctx->inputs[j].name == TGSI_SEMANTIC_FACE) snprintf(srcs[i], 255, "%s(%s ? 1.0 : -1.0)", get_string(stypeprefix), ctx->inputs[j].glsl_name); else if (ctx->inputs[j].name == TGSI_SEMANTIC_CLIPDIST) { - create_swizzled_clipdist(ctx, srcs[i], src, j, 0, stypeprefix, prefix, arrayname); + create_swizzled_clipdist(ctx, srcs[i], src, j, 0, get_string(stypeprefix), prefix, arrayname); } else { enum vrend_type_qualifier srcstypeprefix = stypeprefix; if (stype == TGSI_TYPE_UNSIGNED && @@ -2390,22 +2387,20 @@ get_source_info(struct dump_ctx *ctx, if (inst->Instruction.Opcode == TGSI_OPCODE_INTERP_SAMPLE && i == 1) { snprintf(srcs[i], 255, "floatBitsToInt(%s%s%s%s)", prefix, ctx->inputs[j].glsl_name, arrayname, swizzle); - } else - snprintf(srcs[i], 255, "%s(%s%s%s%s)", get_string(srcstypeprefix), prefix, ctx->inputs[j].glsl_name, arrayname, ctx->inputs[j].is_int ? "" : swizzle); } else if (ctx->inputs[j].name == TGSI_SEMANTIC_GENERIC && - ctx_indirect_inputs(ctx)) { - const char *blkarray = ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL ? "[gl_InvocationID]" : "[0]"; - if (src->Register.Indirect) - snprintf(srcs[i], 255, "%s(%sblk%s.%s%d[addr%d + %d]%s)", get_string(srcstypeprefix), prefix, blkarray, get_shader_input_var_prefix(ctx->key, ctx->prog_type), ctx->generic_input_range.first, src->Indirect.Index, src->Register.Index - ctx->generic_input_range.array_id, ctx->inputs[j].is_int ? "" : swizzle); - else - snprintf(srcs[i], 255, "%s(%sblk%s.%s%d[%d]%s)", get_string(srcstypeprefix), prefix, blkarray, get_shader_input_var_prefix(ctx->key, ctx->prog_type), ctx->generic_input_range.first, src->Register.Index - ctx->generic_input_range.array_id, ctx->inputs[j].is_int ? "" : swizzle); - } else if (ctx->inputs[j].name == TGSI_SEMANTIC_PATCH && - ctx_indirect_inputs(ctx)) { - if (src->Register.Indirect) - snprintf(srcs[i], 255, "%s(%s%sp%d[addr%d + %d]%s)", get_string(srcstypeprefix), prefix, get_shader_input_var_prefix(ctx->key, ctx->prog_type), ctx->patch_input_range.first, src->Indirect.Index, src->Register.Index - ctx->patch_input_range.array_id, ctx->inputs[j].is_int ? "" : swizzle); - else - snprintf(srcs[i], 255, "%s(%s%sp%d[%d]%s)", get_string(srcstypeprefix), prefix, get_shader_input_var_prefix(ctx->key, ctx->prog_type), ctx->patch_input_range.first, src->Register.Index - ctx->patch_input_range.array_id, ctx->inputs[j].is_int ? "" : swizzle); - } else + ctx_indirect_inputs(ctx)) { + const char *blkarray = ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL ? "[gl_InvocationID]" : "[0]"; + if (src->Register.Indirect) + snprintf(srcs[i], 255, "%s(%sblk%s.%s%d[addr%d + %d]%s)", get_string(srcstypeprefix), prefix, blkarray, get_shader_input_var_prefix(ctx->key, ctx->prog_type), ctx->generic_input_range.first, src->Indirect.Index, src->Register.Index - ctx->generic_input_range.array_id, ctx->inputs[j].is_int ? "" : swizzle); + else + snprintf(srcs[i], 255, "%s(%sblk%s.%s%d[%d]%s)", get_string(srcstypeprefix), prefix, blkarray, get_shader_input_var_prefix(ctx->key, ctx->prog_type), ctx->generic_input_range.first, src->Register.Index - ctx->generic_input_range.array_id, ctx->inputs[j].is_int ? "" : swizzle); + } else if (ctx->inputs[j].name == TGSI_SEMANTIC_PATCH && + ctx_indirect_inputs(ctx)) { + if (src->Register.Indirect) + snprintf(srcs[i], 255, "%s(%s%sp%d[addr%d + %d]%s)", get_string(srcstypeprefix), prefix, get_shader_input_var_prefix(ctx->key, ctx->prog_type), ctx->patch_input_range.first, src->Indirect.Index, src->Register.Index - ctx->patch_input_range.array_id, ctx->inputs[j].is_int ? "" : swizzle); + else + snprintf(srcs[i], 255, "%s(%s%sp%d[%d]%s)", get_string(srcstypeprefix), prefix, get_shader_input_var_prefix(ctx->key, ctx->prog_type), ctx->patch_input_range.first, src->Register.Index - ctx->patch_input_range.array_id, ctx->inputs[j].is_int ? "" : swizzle); + } else snprintf(srcs[i], 255, "%s(%s%s%s%s)", get_string(srcstypeprefix), prefix, ctx->inputs[j].glsl_name, arrayname, ctx->inputs[j].is_int ? "" : swizzle); } if ((inst->Instruction.Opcode == TGSI_OPCODE_INTERP_SAMPLE || @@ -2416,37 +2411,36 @@ get_source_info(struct dump_ctx *ctx, snprintf(src_swizzle0, 10, "%s", swizzle); } sinfo->override_no_wm[i] = ctx->inputs[j].override_no_wm; - break; } } else if (src->Register.File == TGSI_FILE_OUTPUT) { - for (j = 0; j < ctx->num_outputs; j++) - if (ctx->outputs[j].first == src->Register.Index) { - const char *srcstypeprefix = stypeprefix; - if (stype == TGSI_TYPE_UNSIGNED && - ctx->outputs[j].is_int) - srcstypeprefix = ""; - if (ctx->outputs[j].glsl_gl_block) { - /* GS input clipdist requires a conversion */ - if (ctx->outputs[j].name == TGSI_SEMANTIC_CLIPDIST) { - create_swizzled_clipdist(ctx, srcs[i], src, ctx->outputs[j].sid, 1, stypeprefix, prefix, arrayname); - } - } else if (ctx->outputs[j].name == TGSI_SEMANTIC_GENERIC && - ctx_indirect_outputs(ctx)) { - const char *blkarray = ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL ? "[gl_InvocationID]" : "[0]"; - if (src->Register.Indirect) - snprintf(srcs[i], 255, "%s(%soblk%s.%s%d[addr%d + %d]%s)", srcstypeprefix, prefix, blkarray, get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, src->Indirect.Index, src->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].is_int ? "" : swizzle); - else - snprintf(srcs[i], 255, "%s(%sblk%s.%s%d[%d]%s)", srcstypeprefix, prefix, blkarray, get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, src->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].is_int ? "" : swizzle); - } else if (ctx->outputs[j].name == TGSI_SEMANTIC_PATCH && - ctx_indirect_outputs(ctx)) { - if (src->Register.Indirect) - snprintf(srcs[i], 255, "%s(%s%sp%d[addr%d + %d]%s)", srcstypeprefix, prefix, get_shader_output_var_prefix(ctx->prog_type), ctx->patch_output_range.first, src->Indirect.Index, src->Register.Index - ctx->patch_output_range.array_id, ctx->outputs[j].is_int ? "" : swizzle); - else - snprintf(srcs[i], 255, "%s(%s%sp%d[%d]%s)", srcstypeprefix, prefix, get_shader_output_var_prefix(ctx->prog_type), ctx->patch_output_range.first, src->Register.Index - ctx->patch_output_range.array_id, ctx->outputs[j].is_int ? "" : swizzle); - } else { - snprintf(srcs[i], 255, "%s(%s%s%s%s)", srcstypeprefix, prefix, ctx->outputs[j].glsl_name, arrayname, ctx->outputs[j].is_int ? "" : swizzle); - } - } + for (uint32_t j = 0; j < ctx->num_outputs; j++) + if (ctx->outputs[j].first == src->Register.Index) { + enum vrend_type_qualifier srcstypeprefix = stypeprefix; + if (stype == TGSI_TYPE_UNSIGNED && + ctx->outputs[j].is_int) + srcstypeprefix = TYPE_CONVERSION_NONE; + if (ctx->outputs[j].glsl_gl_block) { + /* GS input clipdist requires a conversion */ + if (ctx->outputs[j].name == TGSI_SEMANTIC_CLIPDIST) { + create_swizzled_clipdist(ctx, srcs[i], src, ctx->outputs[j].sid, 1, get_string(stypeprefix), prefix, arrayname); + } + } else if (ctx->outputs[j].name == TGSI_SEMANTIC_GENERIC && + ctx_indirect_outputs(ctx)) { + const char *blkarray = ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL ? "[gl_InvocationID]" : "[0]"; + if (src->Register.Indirect) + snprintf(srcs[i], 255, "%s(%soblk%s.%s%d[addr%d + %d]%s)", get_string(srcstypeprefix), prefix, blkarray, get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, src->Indirect.Index, src->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].is_int ? "" : swizzle); + else + snprintf(srcs[i], 255, "%s(%sblk%s.%s%d[%d]%s)", get_string(srcstypeprefix), prefix, blkarray, get_shader_output_var_prefix(ctx->prog_type), ctx->generic_output_range.first, src->Register.Index - ctx->generic_output_range.array_id, ctx->outputs[j].is_int ? "" : swizzle); + } else if (ctx->outputs[j].name == TGSI_SEMANTIC_PATCH && + ctx_indirect_outputs(ctx)) { + if (src->Register.Indirect) + snprintf(srcs[i], 255, "%s(%s%sp%d[addr%d + %d]%s)", get_string(srcstypeprefix), prefix, get_shader_output_var_prefix(ctx->prog_type), ctx->patch_output_range.first, src->Indirect.Index, src->Register.Index - ctx->patch_output_range.array_id, ctx->outputs[j].is_int ? "" : swizzle); + else + snprintf(srcs[i], 255, "%s(%s%sp%d[%d]%s)", get_string(srcstypeprefix), prefix, get_shader_output_var_prefix(ctx->prog_type), ctx->patch_output_range.first, src->Register.Index - ctx->patch_output_range.array_id, ctx->outputs[j].is_int ? "" : swizzle); + } else { + snprintf(srcs[i], 255, "%s(%s%s%s%s)", get_string(srcstypeprefix), prefix, ctx->outputs[j].glsl_name, arrayname, ctx->outputs[j].is_int ? "" : swizzle); + } + } } else if (src->Register.File == TGSI_FILE_TEMPORARY) { struct vrend_temp_range *range = find_temp_range(ctx, src->Register.Index); if (!range) @@ -2612,16 +2606,12 @@ get_source_info(struct dump_ctx *ctx, ctx->system_values[j].name == TGSI_SEMANTIC_INVOCATIONID || ctx->system_values[j].name == TGSI_SEMANTIC_SAMPLEID) snprintf(srcs[i], 255, "%s(vec4(intBitsToFloat(%s)))", get_string(stypeprefix), ctx->system_values[j].glsl_name); - else if (ctx->system_values[j].name == TGSI_SEMANTIC_SAMPLEPOS) { - snprintf(srcs[i], 255, "%s(vec4(intBitsToFloat(%s)))", get_string(stypeprefix), ctx->system_values[j].glsl_name); - else if (ctx->system_values[j].name == TGSI_SEMANTIC_TESSCOORD || - snprintf(srcs[i], 255, "%s(vec4(intBitsToFloat(%s)))", get_string(stypeprefix), ctx->system_values[j].glsl_name); else if (/*ctx->system_values[j].name == TGSI_SEMANTIC_TESSCOORD ||*/ ctx->system_values[j].name == TGSI_SEMANTIC_TESSINNER || ctx->system_values[j].name == TGSI_SEMANTIC_TESSOUTER) { snprintf(srcs[i], 255, "%s%s[%d]", prefix, ctx->system_values[j].glsl_name, src->Register.SwizzleX); } else if (ctx->system_values[j].name == TGSI_SEMANTIC_SAMPLEPOS || - ctx->system_values[j].name == TGSI_SEMANTIC_TESSCOORD) { + ctx->system_values[j].name == TGSI_SEMANTIC_TESSCOORD) { snprintf(srcs[i], 255, "vec4(%s.%c, %s.%c, %s.%c, %s.%c)", ctx->system_values[j].glsl_name, get_swiz_char(src->Register.SwizzleX), ctx->system_values[j].glsl_name, get_swiz_char(src->Register.SwizzleY), @@ -3281,7 +3271,7 @@ static char *emit_header(struct dump_ctx *ctx, char *glsl_hdr) if (ctx->prog_type == TGSI_PROCESSOR_GEOMETRY || ctx->prog_type == TGSI_PROCESSOR_TESS_EVAL || ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL || - ctx->glsl_ver_required == 150) + ctx->glsl_ver_required == 150) STRCAT_WITH_RET(glsl_hdr, "#version 150\n"); else if (ctx->glsl_ver_required == 140) STRCAT_WITH_RET(glsl_hdr, "#version 140\n"); @@ -3450,24 +3440,24 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr) if (ctx_indirect_inputs(ctx)) { const char *name_prefix = get_shader_input_var_prefix(ctx->key, ctx->prog_type); if (ctx->prog_type == TGSI_PROCESSOR_TESS_EVAL) { - if (ctx->patch_input_range.used) { - int size = ctx->patch_input_range.last - ctx->patch_input_range.first + 1; + if (ctx->patch_input_range.used) { + int size = ctx->patch_input_range.last - ctx->patch_input_range.first + 1; if (size < ctx->key->num_indirect_patch_inputs) size = ctx->key->num_indirect_patch_inputs; - snprintf(buf, 255, "patch in vec4 %sp%d[%d];\n", name_prefix, ctx->patch_input_range.first, size); - STRCAT_WITH_RET(glsl_hdr, buf); - } + snprintf(buf, 255, "patch in vec4 %sp%d[%d];\n", name_prefix, ctx->patch_input_range.first, size); + STRCAT_WITH_RET(glsl_hdr, buf); + } } if (ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL || - ctx->prog_type == TGSI_PROCESSOR_TESS_EVAL) { - if (ctx->generic_input_range.used) { + ctx->prog_type == TGSI_PROCESSOR_TESS_EVAL) { + if (ctx->generic_input_range.used) { int size = ctx->generic_input_range.last - ctx->generic_input_range.first + 1; if (size < ctx->key->num_indirect_generic_inputs) size = ctx->key->num_indirect_generic_inputs; - snprintf(buf, 255, "in block { vec4 %s%d[%d]; } blk[];\n", name_prefix, ctx->generic_input_range.first, size); - STRCAT_WITH_RET(glsl_hdr, buf); - } + snprintf(buf, 255, "in block { vec4 %s%d[%d]; } blk[];\n", name_prefix, ctx->generic_input_range.first, size); + STRCAT_WITH_RET(glsl_hdr, buf); + } } } for (i = 0; i < ctx->num_inputs; i++) { @@ -3515,20 +3505,20 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr) if (ctx_indirect_outputs(ctx)) { const char *name_prefix = get_shader_output_var_prefix(ctx->prog_type); if (ctx->prog_type == TGSI_PROCESSOR_VERTEX) { - if (ctx->generic_output_range.used) { - snprintf(buf, 255, "out block { vec4 %s%d[%d]; } oblk;\n", name_prefix, ctx->generic_output_range.first, ctx->generic_output_range.last - ctx->generic_output_range.first + 1); - STRCAT_WITH_RET(glsl_hdr, buf); - } + if (ctx->generic_output_range.used) { + snprintf(buf, 255, "out block { vec4 %s%d[%d]; } oblk;\n", name_prefix, ctx->generic_output_range.first, ctx->generic_output_range.last - ctx->generic_output_range.first + 1); + STRCAT_WITH_RET(glsl_hdr, buf); + } } if (ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL) { - if (ctx->generic_output_range.used) { - snprintf(buf, 255, "out block { vec4 %s%d[%d]; } oblk[];\n", name_prefix, ctx->generic_output_range.first, ctx->generic_output_range.last - ctx->generic_output_range.first + 1); - STRCAT_WITH_RET(glsl_hdr, buf); - } - if (ctx->patch_output_range.used) { - snprintf(buf, 255, "patch out vec4 %sp%d[%d];\n", name_prefix, ctx->patch_output_range.first, ctx->patch_output_range.last - ctx->patch_output_range.first + 1); - STRCAT_WITH_RET(glsl_hdr, buf); - } + if (ctx->generic_output_range.used) { + snprintf(buf, 255, "out block { vec4 %s%d[%d]; } oblk[];\n", name_prefix, ctx->generic_output_range.first, ctx->generic_output_range.last - ctx->generic_output_range.first + 1); + STRCAT_WITH_RET(glsl_hdr, buf); + } + if (ctx->patch_output_range.used) { + snprintf(buf, 255, "patch out vec4 %sp%d[%d];\n", name_prefix, ctx->patch_output_range.first, ctx->patch_output_range.last - ctx->patch_output_range.first + 1); + STRCAT_WITH_RET(glsl_hdr, buf); + } } } @@ -3565,7 +3555,7 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr) snprintf(buf, 255, "patch out vec4 %s;\n", ctx->outputs[i].glsl_name); else snprintf(buf, 255, "%sout vec4 %s[];\n", prefix, ctx->outputs[i].glsl_name); - } else if (ctx->prog_type == TGSI_PROCESSOR_GEOMETRY && ctx->outputs[i].stream) + } else if (ctx->prog_type == TGSI_PROCESSOR_GEOMETRY && ctx->outputs[i].stream) snprintf(buf, 255, "layout (stream = %d) %s%sout vec4 %s;\n", ctx->outputs[i].stream, prefix, ctx->outputs[i].invariant ? "invariant " : "", ctx->outputs[i].glsl_name); else snprintf(buf, 255, "%s%sout vec4 %s;\n", prefix, ctx->outputs[i].invariant ? "invariant " : "", ctx->outputs[i].glsl_name); @@ -3683,7 +3673,7 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr) if (ctx->prog_type == TGSI_PROCESSOR_TESS_CTRL || ctx->prog_type == TGSI_PROCESSOR_TESS_EVAL) { if (ctx->num_in_clip_dist || ctx->key->prev_stage_pervertex_out) { - int clip_dist, cull_dist; + int clip_dist, cull_dist; char clip_var[64] = {}, cull_var[64] = {}; clip_dist = ctx->key->prev_stage_num_clip_out ? ctx->key->prev_stage_num_clip_out : ctx->num_in_clip_dist; |