add support for shader clock.

This was pretty trivial.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
macos/master
Dave Airlie 6 years ago
parent 8c155eca46
commit f60737c039
  1. 4
      src/gallium/auxiliary/tgsi/tgsi_info.c
  2. 3
      src/gallium/include/pipe/p_shader_tokens.h
  3. 1
      src/virgl_hw.h
  4. 4
      src/vrend_renderer.c
  5. 7
      src/vrend_shader.c

@ -262,7 +262,8 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 1, 0, 0, 0, 0, COMP, "DFLR", TGSI_OPCODE_DFLR },
{ 1, 1, 0, 0, 0, 0, COMP, "DROUND", TGSI_OPCODE_DROUND },
{ 1, 1, 0, 0, 0, 0, COMP, "DSSG", TGSI_OPCODE_DSSG },
{ 1, 2, 0, 0, 0, 0, COMP, "DDIV", TGSI_OPCODE_DDIV }
{ 1, 2, 0, 0, 0, 0, COMP, "DDIV", TGSI_OPCODE_DDIV },
{ 1, 0, 0, 0, 0, 0, OTHR, "CLOCK", TGSI_OPCODE_CLOCK }
};
const struct tgsi_opcode_info *
@ -354,6 +355,7 @@ tgsi_opcode_infer_type( uint opcode )
case TGSI_OPCODE_LSB:
case TGSI_OPCODE_UMSB:
case TGSI_OPCODE_D2U:
case TGSI_OPCODE_CLOCK:
return TGSI_TYPE_UNSIGNED;
case TGSI_OPCODE_ARL:
case TGSI_OPCODE_ARR:

@ -569,7 +569,8 @@ struct tgsi_property_data {
#define TGSI_OPCODE_DROUND 221 /* nvc0 */
#define TGSI_OPCODE_DSSG 222
#define TGSI_OPCODE_DDIV 223
#define TGSI_OPCODE_LAST 224
#define TGSI_OPCODE_CLOCK 224
#define TGSI_OPCODE_LAST 225
/**
* Opcode is the operation code to execute. A given operation defines the

@ -228,6 +228,7 @@ enum virgl_formats {
#define VIRGL_CAP_FB_NO_ATTACH (1 << 8)
#define VIRGL_CAP_ROBUST_BUFFER_ACCESS (1 << 9)
#define VIRGL_CAP_TGSI_FBFETCH (1 << 10)
#define VIRGL_CAP_SHADER_CLOCK (1 << 11)
/* virgl bind flags - these are compatible with mesa 10.5 gallium.
* but are fixed, no other should be passed to virgl either.

@ -122,6 +122,7 @@ enum features_id
feat_sample_mask,
feat_sample_shading,
feat_samplers,
feat_shader_clock,
feat_ssbo,
feat_ssbo_barrier,
feat_stencil_texturing,
@ -185,6 +186,7 @@ static const struct {
[feat_sample_mask] = { 32, 31, { "GL_ARB_texture_multisample" } },
[feat_sample_shading] = { 40, UNAVAIL, { "GL_ARB_sample_shading" } },
[feat_samplers] = { 33, 30, { "GL_ARB_sampler_objects" } },
[feat_shader_clock] = { UNAVAIL, UNAVAIL, { "GL_ARB_shader_clock" } },
[feat_ssbo] = { 43, 31, { "GL_ARB_shader_storage_buffer_object" } },
[feat_ssbo_barrier] = { 43, 31, {} },
[feat_stencil_texturing] = { 43, 31, { "GL_ARB_stencil_texturing" } },
@ -8161,6 +8163,8 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver, union virgl_c
if (has_feature(feat_framebuffer_fetch))
caps->v2.capability_bits |= VIRGL_CAP_TGSI_FBFETCH;
if (has_feature(feat_shader_clock))
caps->v2.capability_bits |= VIRGL_CAP_SHADER_CLOCK;
}
void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,

@ -61,6 +61,7 @@ extern int vrend_dump_shaders;
#define SHADER_REQ_IMAGE_SIZE (1 << 17)
#define SHADER_REQ_TXQS (1 << 18)
#define SHADER_REQ_FBFETCH (1 << 19)
#define SHADER_REQ_SHADER_CLOCK (1 << 20)
struct vrend_shader_io {
unsigned name;
@ -237,6 +238,7 @@ static const struct vrend_shader_table shader_req_table[] = {
{ SHADER_REQ_IMAGE_SIZE, "GL_ARB_shader_image_size" },
{ SHADER_REQ_TXQS, "GL_ARB_shader_texture_image_samples" },
{ SHADER_REQ_FBFETCH, "GL_EXT_shader_framebuffer_fetch" },
{ SHADER_REQ_SHADER_CLOCK, "GL_ARB_shader_clock" },
};
enum vrend_type_qualifier {
@ -3894,6 +3896,11 @@ iter_instruction(struct tgsi_iterate_context *iter,
if (ret)
return FALSE;
break;
case TGSI_OPCODE_CLOCK:
ctx->shader_req_bits |= SHADER_REQ_SHADER_CLOCK;
snprintf(buf, 255, "%s = uintBitsToFloat(clock2x32ARB());\n", dsts[0]);
EMIT_BUF_WITH_RET(ctx, buf);
break;
default:
fprintf(stderr,"failed to convert opcode %d\n", inst->Instruction.Opcode);
break;

Loading…
Cancel
Save