diff options
author | Marek Olšák <marek.olsak@amd.com> | 2015-01-04 20:09:51 +0100 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2015-01-07 12:06:43 +0100 |
commit | 13de9475fc237dd000bb0ef1d7784b86bee54b39 (patch) | |
tree | 6de0f83886d36d598340e53d93d77d19d53c3a10 /src/gallium | |
parent | e3d4bdd6a854591a54733b7b68035f1a30baeafe (diff) |
radeonsi: remove special handling of TGSI_INTERPOLATE_COLOR in shader codegen
It doesn't do anything useful. And colors are floating-point, so we can use
fs.interp, remove "flatshade" from the shader key, and rely on the FLAT_SHADE
state only (in the next patch).
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 42febe22cf8..5d61a549fe6 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -453,11 +453,6 @@ static void declare_input_fs( interp_param = LLVMGetParam(main_fn, SI_PARAM_LINEAR_CENTER); break; case TGSI_INTERPOLATE_COLOR: - if (si_shader_ctx->shader->key.ps.flatshade) { - interp_param = 0; - break; - } - /* fall through to perspective */ case TGSI_INTERPOLATE_PERSPECTIVE: if (decl->Interp.Location == TGSI_INTERPOLATE_LOC_SAMPLE) interp_param = LLVMGetParam(main_fn, SI_PARAM_PERSP_SAMPLE); @@ -471,9 +466,18 @@ static void declare_input_fs( return; } + /* fs.constant returns the param from the middle vertex, so it's not + * really useful for flat shading. It's meant to be used for custom + * interpolation (but the intrinsic can't fetch from the other two + * vertices). + * + * Luckily, it doesn't matter, because we rely on the FLAT_SHADE state + * to do the right thing. The only reason we use fs.constant is that + * fs.interp cannot be used on integers, because they can be equal + * to NaN. + */ intr_name = interp_param ? "llvm.SI.fs.interp" : "llvm.SI.fs.constant"; - /* XXX: Could there be more than TGSI_NUM_CHANNELS (4) ? */ if (decl->Semantic.Name == TGSI_SEMANTIC_COLOR && si_shader_ctx->shader->key.ps.color_two_side) { LLVMValueRef args[4]; |