renderer: emit prescale from geom shader when present

the scaling stuff needs to happen in the geom shader instead
of the vertex shader if a geom shader is present.

fixes: tests/spec/glsl-1.50/execution/geometry/core-inputs.shader_test
macos/master
Dave Airlie 10 years ago
parent 7710274294
commit 1af42f7a98
  1. 22
      src/vrend_shader.c

@ -1738,9 +1738,11 @@ iter_instruction(struct tgsi_iterate_context *iter,
if (ret) if (ret)
return FALSE; return FALSE;
} }
ret = emit_prescale(ctx); if (!ctx->key->gs_present) {
if (ret) ret = emit_prescale(ctx);
return FALSE; if (ret)
return FALSE;
}
ret = emit_clip_dist_movs(ctx); ret = emit_clip_dist_movs(ctx);
if (ret) if (ret)
@ -1798,9 +1800,15 @@ iter_instruction(struct tgsi_iterate_context *iter,
EMIT_BUF_WITH_RET(ctx, buf); EMIT_BUF_WITH_RET(ctx, buf);
break; break;
case TGSI_OPCODE_EMIT: case TGSI_OPCODE_EMIT:
if (ctx->so && ctx->key->gs_present) if (ctx->so && ctx->key->gs_present) {
emit_so_movs(ctx); emit_so_movs(ctx);
emit_clip_dist_movs(ctx); }
ret = emit_prescale(ctx);
if (ret)
return FALSE;
ret = emit_clip_dist_movs(ctx);
if (ret)
return FALSE;
snprintf(buf, 255, "EmitVertex();\n"); snprintf(buf, 255, "EmitVertex();\n");
EMIT_BUF_WITH_RET(ctx, buf); EMIT_BUF_WITH_RET(ctx, buf);
break; break;
@ -2015,6 +2023,8 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
} }
if (ctx->prog_type == TGSI_PROCESSOR_GEOMETRY) { if (ctx->prog_type == TGSI_PROCESSOR_GEOMETRY) {
snprintf(buf, 255, "uniform vec4 winsys_adjust;\n");
STRCAT_WITH_RET(glsl_hdr, buf);
if (ctx->num_in_clip_dist || ctx->key->clip_plane_enable) { if (ctx->num_in_clip_dist || ctx->key->clip_plane_enable) {
snprintf(buf, 255, "in gl_PerVertex {\n vec4 gl_Position;\n float gl_PointSize; \n float gl_ClipDistance[%d];\n} gl_in[];\n", ctx->num_in_clip_dist ? ctx->num_in_clip_dist : 8); snprintf(buf, 255, "in gl_PerVertex {\n vec4 gl_Position;\n float gl_PointSize; \n float gl_ClipDistance[%d];\n} gl_in[];\n", ctx->num_in_clip_dist ? ctx->num_in_clip_dist : 8);
STRCAT_WITH_RET(glsl_hdr, buf); STRCAT_WITH_RET(glsl_hdr, buf);

Loading…
Cancel
Save