mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
gallivm/llvmpipe: add support for front facing in sysval.
This wires up the front facing value as a sysval, I'd like to remove the other facing code but I'd need to confirm VMware don't use it first. Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
f52cdaa517
commit
502548a09c
6 changed files with 14 additions and 1 deletions
|
|
@ -1149,6 +1149,7 @@ static void visit_intrinsic(struct lp_build_nir_context *bld_base,
|
||||||
case nir_intrinsic_load_local_invocation_id:
|
case nir_intrinsic_load_local_invocation_id:
|
||||||
case nir_intrinsic_load_num_work_groups:
|
case nir_intrinsic_load_num_work_groups:
|
||||||
case nir_intrinsic_load_invocation_id:
|
case nir_intrinsic_load_invocation_id:
|
||||||
|
case nir_intrinsic_load_front_face:
|
||||||
bld_base->sysval_intrin(bld_base, instr, result);
|
bld_base->sysval_intrin(bld_base, instr, result);
|
||||||
break;
|
break;
|
||||||
case nir_intrinsic_discard_if:
|
case nir_intrinsic_discard_if:
|
||||||
|
|
|
||||||
|
|
@ -943,6 +943,9 @@ static void emit_sysval_intrin(struct lp_build_nir_context *bld_base,
|
||||||
case nir_intrinsic_load_invocation_id:
|
case nir_intrinsic_load_invocation_id:
|
||||||
result[0] = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.invocation_id);
|
result[0] = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.invocation_id);
|
||||||
break;
|
break;
|
||||||
|
case nir_intrinsic_load_front_face:
|
||||||
|
result[0] = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.front_facing);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,7 @@ struct lp_bld_tgsi_system_values {
|
||||||
LLVMValueRef thread_id;
|
LLVMValueRef thread_id;
|
||||||
LLVMValueRef block_id;
|
LLVMValueRef block_id;
|
||||||
LLVMValueRef grid_size;
|
LLVMValueRef grid_size;
|
||||||
|
LLVMValueRef front_facing;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1336,6 +1336,10 @@ emit_fetch_system_value(
|
||||||
atype = TGSI_TYPE_UNSIGNED;
|
atype = TGSI_TYPE_UNSIGNED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TGSI_SEMANTIC_FACE:
|
||||||
|
res = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.front_facing);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(!"unexpected semantic in emit_fetch_system_value");
|
assert(!"unexpected semantic in emit_fetch_system_value");
|
||||||
res = bld_base->base.zero;
|
res = bld_base->base.zero;
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,6 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
||||||
case PIPE_CAP_MULTI_DRAW_INDIRECT:
|
case PIPE_CAP_MULTI_DRAW_INDIRECT:
|
||||||
case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
|
case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
|
||||||
case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL:
|
case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL:
|
||||||
case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL:
|
|
||||||
case PIPE_CAP_INVALIDATE_BUFFER:
|
case PIPE_CAP_INVALIDATE_BUFFER:
|
||||||
case PIPE_CAP_GENERATE_MIPMAP:
|
case PIPE_CAP_GENERATE_MIPMAP:
|
||||||
case PIPE_CAP_STRING_MARKER:
|
case PIPE_CAP_STRING_MARKER:
|
||||||
|
|
@ -392,6 +391,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
||||||
return LP_MAX_TGSI_SHADER_BUFFER_SIZE;
|
return LP_MAX_TGSI_SHADER_BUFFER_SIZE;
|
||||||
case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
|
case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
|
||||||
case PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE:
|
case PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE:
|
||||||
|
case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL:
|
||||||
return 1;
|
return 1;
|
||||||
case PIPE_CAP_LOAD_CONSTBUF:
|
case PIPE_CAP_LOAD_CONSTBUF:
|
||||||
case PIPE_CAP_PACKED_UNIFORMS:
|
case PIPE_CAP_PACKED_UNIFORMS:
|
||||||
|
|
|
||||||
|
|
@ -342,6 +342,10 @@ generate_fs_loop(struct gallivm_state *gallivm,
|
||||||
|
|
||||||
memset(&system_values, 0, sizeof(system_values));
|
memset(&system_values, 0, sizeof(system_values));
|
||||||
|
|
||||||
|
/* truncate then sign extend. */
|
||||||
|
system_values.front_facing = LLVMBuildTrunc(gallivm->builder, facing, LLVMInt1TypeInContext(gallivm->context), "");
|
||||||
|
system_values.front_facing = LLVMBuildSExt(gallivm->builder, system_values.front_facing, LLVMInt32TypeInContext(gallivm->context), "");
|
||||||
|
|
||||||
if (key->depth.enabled ||
|
if (key->depth.enabled ||
|
||||||
key->stencil[0].enabled) {
|
key->stencil[0].enabled) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue