[Mesa-dev] [PATCH] gallium/swr: Make flat shading tris work.
Cherniak, Bruce
bruce.cherniak at intel.com
Wed Apr 13 17:20:35 UTC 2016
Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
On 4/13/16, 10:48 AM, "mesa-dev on behalf of George Kyriazis" <mesa-dev-bounces at lists.freedesktop.org on behalf of george.kyriazis at intel.com> wrote:
>- Incorporate flatshade flag into the shader generation
>- Use provoking vertex (vc) in shader when flat shading.
>---
> src/gallium/drivers/swr/swr_shader.cpp | 4 ++++
> src/gallium/drivers/swr/swr_shader.h | 1 +
> 2 files changed, 5 insertions(+)
>
>diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp
>index 90f0f22..83e3216 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);
>
>diff --git a/src/gallium/drivers/swr/swr_shader.h b/src/gallium/drivers/swr/swr_shader.h
>index 4814b9d..3f79570 100644
>--- a/src/gallium/drivers/swr/swr_shader.h
>+++ b/src/gallium/drivers/swr/swr_shader.h
>@@ -51,6 +51,7 @@ struct swr_jit_sampler_key {
> struct swr_jit_fs_key : swr_jit_sampler_key {
> unsigned nr_cbufs;
> unsigned light_twoside;
>+ unsigned flatshade;
> ubyte vs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
> ubyte vs_output_semantic_idx[PIPE_MAX_SHADER_OUTPUTS];
> };
>--
>2.5.0
>
>_______________________________________________
>mesa-dev mailing list
>mesa-dev at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list