summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_shader.cpp
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2016-04-13 10:48:55 -0500
committerTim Rowley <[email protected]>2016-04-13 13:46:37 -0500
commitf69a61b1aa7f7fc8dd190cb3d5da1e7bca7de809 (patch)
tree38baaef8f1d01c507e52b4a4036b37fdb5026d64 /src/gallium/drivers/swr/swr_shader.cpp
parentc53a12fedc519a179dd815586f432df7c7180732 (diff)
gallium/swr: Make flat shading tris work.
- Incorporate flatshade flag into the shader generation - Use provoking vertex (vc) in shader when flat shading. Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_shader.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_shader.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp
index 90f0f22a6a2..83e32163ecc 100644
--- a/src/gallium/drivers/swr/swr_shader.cpp
+++ b/src/gallium/drivers/swr/swr_shader.cpp
@@ -102,6 +102,7 @@ swr_generate_fs_key(struct swr_jit_fs_key &key,
key.nr_cbufs = ctx->framebuffer.nr_cbufs;
key.light_twoside = ctx->rasterizer->light_twoside;
+ key.flatshade = ctx->rasterizer->flatshade;
memcpy(&key.vs_output_semantic_name,
&ctx->vs->info.base.output_semantic_name,
sizeof(key.vs_output_semantic_name));
@@ -491,6 +492,9 @@ BuilderSWR::CompileFS(struct swr_context *ctx, swr_jit_fs_key &key)
if (interpMode == TGSI_INTERPOLATE_CONSTANT) {
inputs[attrib][channel] = wrap(va);
+ } else if ((interpMode == TGSI_INTERPOLATE_COLOR) &&
+ (key.flatshade == true)) {
+ inputs[attrib][channel] = wrap(vc);
} else {
Value *vk = FSUB(FSUB(VIMMED1(1.0f), vi), vj);