add ARB_derivative_control support

adds the new TGSI opcodes for fine derivs

Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
macos/master
Dave Airlie 7 years ago
parent 6b5d7919c5
commit 7d4b9f972c
  1. 1
      src/virgl_hw.h
  2. 3
      src/vrend_renderer.c
  3. 13
      src/vrend_shader.c

@ -239,6 +239,7 @@ struct virgl_caps_bool_set1 {
unsigned has_sample_shading:1;
unsigned has_cull:1;
unsigned conditional_render_inverted:1;
unsigned derivative_control:1;
};
/* endless expansion capabilites - current gallium has 252 formats */

@ -6955,11 +6955,14 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
if (gl_ver >= 45) {
caps->v1.bset.has_cull = 1;
caps->v1.bset.conditional_render_inverted = 1;
caps->v1.bset.derivative_control = 1;
} else {
if (epoxy_has_gl_extension("GL_ARB_cull_distance"))
caps->v1.bset.has_cull = 1;
if (epoxy_has_gl_extension("GL_ARB_conditional_render_inverted"))
caps->v1.bset.conditional_render_inverted = 1;
if (epoxy_has_gl_extension("GL_ARB_derivative_control"))
caps->v1.bset.derivative_control = 1;
}
if (epoxy_has_gl_extension("GL_EXT_texture_mirror_clamp") ||

@ -158,6 +158,7 @@ struct dump_ctx {
bool uses_sample_shading;
bool uses_gpu_shader5;
bool write_mul_temp;
bool derivative_control;
};
static inline const char *tgsi_proc_to_prefix(int shader_type)
@ -2198,6 +2199,16 @@ iter_instruction(struct tgsi_iterate_context *iter,
emit_op1("dFdy");
EMIT_BUF_WITH_RET(ctx, buf);
break;
case TGSI_OPCODE_DDX_FINE:
ctx->derivative_control = true;
emit_op1("dFdxFine");
EMIT_BUF_WITH_RET(ctx, buf);
break;
case TGSI_OPCODE_DDY_FINE:
ctx->derivative_control = true;
emit_op1("dFdyFine");
EMIT_BUF_WITH_RET(ctx, buf);
break;
case TGSI_OPCODE_RCP:
snprintf(buf, 255, "%s = %s(1.0/(%s));\n", dsts[0], dstconv, srcs[0]);
EMIT_BUF_WITH_RET(ctx, buf);
@ -2626,6 +2637,8 @@ static char *emit_header(struct dump_ctx *ctx, char *glsl_hdr)
STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_gpu_shader5 : require\n");
if (ctx->num_cull_dist_prop || ctx->key->prev_stage_num_cull_out)
STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_cull_distance : require\n");
if (ctx->derivative_control)
STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_derivative_control : require\n");
}
return glsl_hdr;
}

Loading…
Cancel
Save