i965: Enable EXT_shader_samples_identical
On the vec4 backend, textureSamplesIdentical() will always return
false. There are currently no test cases for the vec4 backend, so we
don't have much confidence in any implementation. We also don't think
anyone is likely to miss it.
v2: Handle immediate value for MCS smarter. Rebase on changes to
nir_texop_sampels_identical (missing second parameter). Suggested by
Jason.
v3: Add Neil's code to handle 16x MSAA in the FS. Also rebase on top of
f9a9ba5e
. Stub out the vec4 implementation.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> [v2]
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> [v2]
This commit is contained in:
parent
84b6c64efc
commit
99840eb983
|
@ -2625,6 +2625,7 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
|
||||||
switch (instr->op) {
|
switch (instr->op) {
|
||||||
case nir_texop_txf:
|
case nir_texop_txf:
|
||||||
case nir_texop_txf_ms:
|
case nir_texop_txf_ms:
|
||||||
|
case nir_texop_samples_identical:
|
||||||
coordinate = retype(src, BRW_REGISTER_TYPE_D);
|
coordinate = retype(src, BRW_REGISTER_TYPE_D);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2687,7 +2688,8 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instr->op == nir_texop_txf_ms) {
|
if (instr->op == nir_texop_txf_ms ||
|
||||||
|
instr->op == nir_texop_samples_identical) {
|
||||||
if (devinfo->gen >= 7 &&
|
if (devinfo->gen >= 7 &&
|
||||||
key_tex->compressed_multisample_layout_mask & (1 << sampler)) {
|
key_tex->compressed_multisample_layout_mask & (1 << sampler)) {
|
||||||
mcs = emit_mcs_fetch(coordinate, instr->coord_components, sampler_reg);
|
mcs = emit_mcs_fetch(coordinate, instr->coord_components, sampler_reg);
|
||||||
|
|
|
@ -259,6 +259,26 @@ fs_visitor::emit_texture(ir_texture_opcode op,
|
||||||
lod = brw_imm_ud(0u);
|
lod = brw_imm_ud(0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (op == ir_samples_identical) {
|
||||||
|
fs_reg dst = vgrf(glsl_type::get_instance(dest_type->base_type, 1, 1));
|
||||||
|
|
||||||
|
/* If mcs is an immediate value, it means there is no MCS. In that case
|
||||||
|
* just return false.
|
||||||
|
*/
|
||||||
|
if (mcs.file == BRW_IMMEDIATE_VALUE) {
|
||||||
|
bld.MOV(dst, brw_imm_ud(0u));
|
||||||
|
} else if ((key_tex->msaa_16 & (1 << sampler))) {
|
||||||
|
fs_reg tmp = vgrf(glsl_type::uint_type);
|
||||||
|
bld.OR(tmp, mcs, offset(mcs, bld, 1));
|
||||||
|
bld.CMP(dst, tmp, brw_imm_ud(0u), BRW_CONDITIONAL_EQ);
|
||||||
|
} else {
|
||||||
|
bld.CMP(dst, mcs, brw_imm_ud(0u), BRW_CONDITIONAL_EQ);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->result = dst;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (coordinate.file != BAD_FILE) {
|
if (coordinate.file != BAD_FILE) {
|
||||||
/* FINISHME: Texture coordinate rescaling doesn't work with non-constant
|
/* FINISHME: Texture coordinate rescaling doesn't work with non-constant
|
||||||
* samplers. This should only be a problem with GL_CLAMP on Gen7.
|
* samplers. This should only be a problem with GL_CLAMP on Gen7.
|
||||||
|
|
|
@ -1615,6 +1615,7 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
|
||||||
switch (instr->op) {
|
switch (instr->op) {
|
||||||
case nir_texop_txf:
|
case nir_texop_txf:
|
||||||
case nir_texop_txf_ms:
|
case nir_texop_txf_ms:
|
||||||
|
case nir_texop_samples_identical:
|
||||||
coordinate = get_nir_src(instr->src[i].src, BRW_REGISTER_TYPE_D,
|
coordinate = get_nir_src(instr->src[i].src, BRW_REGISTER_TYPE_D,
|
||||||
src_size);
|
src_size);
|
||||||
coord_type = glsl_type::ivec(src_size);
|
coord_type = glsl_type::ivec(src_size);
|
||||||
|
@ -1695,7 +1696,8 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instr->op == nir_texop_txf_ms) {
|
if (instr->op == nir_texop_txf_ms ||
|
||||||
|
instr->op == nir_texop_samples_identical) {
|
||||||
assert(coord_type != NULL);
|
assert(coord_type != NULL);
|
||||||
if (devinfo->gen >= 7 &&
|
if (devinfo->gen >= 7 &&
|
||||||
key_tex->compressed_multisample_layout_mask & (1 << sampler)) {
|
key_tex->compressed_multisample_layout_mask & (1 << sampler)) {
|
||||||
|
|
|
@ -909,6 +909,13 @@ vec4_visitor::emit_texture(ir_texture_opcode op,
|
||||||
unreachable("TXB is not valid for vertex shaders.");
|
unreachable("TXB is not valid for vertex shaders.");
|
||||||
case ir_lod:
|
case ir_lod:
|
||||||
unreachable("LOD is not valid for vertex shaders.");
|
unreachable("LOD is not valid for vertex shaders.");
|
||||||
|
case ir_samples_identical: {
|
||||||
|
/* There are some challenges implementing this for vec4, and it seems
|
||||||
|
* unlikely to be used anyway. For now, just return false ways.
|
||||||
|
*/
|
||||||
|
emit(MOV(dest, brw_imm_ud(0u)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
unreachable("Unrecognized tex op");
|
unreachable("Unrecognized tex op");
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,6 +333,7 @@ intelInitExtensions(struct gl_context *ctx)
|
||||||
ctx->Extensions.ARB_texture_compression_bptc = true;
|
ctx->Extensions.ARB_texture_compression_bptc = true;
|
||||||
ctx->Extensions.ARB_texture_view = true;
|
ctx->Extensions.ARB_texture_view = true;
|
||||||
ctx->Extensions.ARB_shader_storage_buffer_object = true;
|
ctx->Extensions.ARB_shader_storage_buffer_object = true;
|
||||||
|
ctx->Extensions.EXT_shader_samples_identical = true;
|
||||||
|
|
||||||
if (can_do_pipelined_register_writes(brw)) {
|
if (can_do_pipelined_register_writes(brw)) {
|
||||||
ctx->Extensions.ARB_draw_indirect = true;
|
ctx->Extensions.ARB_draw_indirect = true;
|
||||||
|
|
Loading…
Reference in New Issue