v3d: Garbage collect unused uniforms code.
authorEric Anholt <eric@anholt.net>
Mon, 3 Dec 2018 16:52:36 +0000 (08:52 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 8 Dec 2018 00:48:23 +0000 (16:48 -0800)
src/broadcom/compiler/v3d_compiler.h
src/gallium/drivers/v3d/v3d_uniforms.c

index 7423edc85c78c3072bfab6f3a13369f954e22132..bed5b588e0d5a533d013cca41b3334d4f3362d1e 100644 (file)
@@ -243,8 +243,6 @@ enum quniform_contents {
         QUNIFORM_TEXRECT_SCALE_X,
         QUNIFORM_TEXRECT_SCALE_Y,
 
-        QUNIFORM_TEXTURE_BORDER_COLOR,
-
         QUNIFORM_ALPHA_REF,
 
         /**
index ebf65b6099350ae1647eb3abb6d8ba87ab5102e6..6d927deeec5014b926c7963d2e7716e4b5d2b731 100644 (file)
 #include "compiler/v3d_compiler.h"
 #include "broadcom/cle/v3d_packet_v33_pack.h"
 
-#if 0
-
-#define SWIZ(x,y,z,w) {          \
-        PIPE_SWIZZLE_##x, \
-        PIPE_SWIZZLE_##y, \
-        PIPE_SWIZZLE_##z, \
-        PIPE_SWIZZLE_##w  \
-}
-
-static void
-write_texture_border_color(struct v3d_job *job,
-                           struct v3d_cl_out **uniforms,
-                           struct v3d_texture_stateobj *texstate,
-                           uint32_t unit)
-{
-        struct pipe_sampler_state *sampler = texstate->samplers[unit];
-        struct pipe_sampler_view *texture = texstate->textures[unit];
-        struct v3d_resource *rsc = v3d_resource(texture->texture);
-        union util_color uc;
-
-        const struct util_format_description *tex_format_desc =
-                util_format_description(texture->format);
-
-        float border_color[4];
-        for (int i = 0; i < 4; i++)
-                border_color[i] = sampler->border_color.f[i];
-        if (util_format_is_srgb(texture->format)) {
-                for (int i = 0; i < 3; i++)
-                        border_color[i] =
-                                util_format_linear_to_srgb_float(border_color[i]);
-        }
-
-        /* Turn the border color into the layout of channels that it would
-         * have when stored as texture contents.
-         */
-        float storage_color[4];
-        util_format_unswizzle_4f(storage_color,
-                                 border_color,
-                                 tex_format_desc->swizzle);
-
-        /* Now, pack so that when the v3d_format-sampled texture contents are
-         * replaced with our border color, the v3d_get_format_swizzle()
-         * swizzling will get the right channels.
-         */
-        if (util_format_is_depth_or_stencil(texture->format)) {
-                uc.ui[0] = util_pack_z(PIPE_FORMAT_Z24X8_UNORM,
-                                       sampler->border_color.f[0]) << 8;
-        } else {
-                switch (rsc->v3d_format) {
-                default:
-                case VC5_TEXTURE_TYPE_RGBA8888:
-                        util_pack_color(storage_color,
-                                        PIPE_FORMAT_R8G8B8A8_UNORM, &uc);
-                        break;
-                case VC5_TEXTURE_TYPE_RGBA4444:
-                        util_pack_color(storage_color,
-                                        PIPE_FORMAT_A8B8G8R8_UNORM, &uc);
-                        break;
-                case VC5_TEXTURE_TYPE_RGB565:
-                        util_pack_color(storage_color,
-                                        PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
-                        break;
-                case VC5_TEXTURE_TYPE_ALPHA:
-                        uc.ui[0] = float_to_ubyte(storage_color[0]) << 24;
-                        break;
-                case VC5_TEXTURE_TYPE_LUMALPHA:
-                        uc.ui[0] = ((float_to_ubyte(storage_color[1]) << 24) |
-                                    (float_to_ubyte(storage_color[0]) << 0));
-                        break;
-                }
-        }
-
-        cl_aligned_u32(uniforms, uc.ui[0]);
-}
-#endif
-
 static uint32_t
 get_texrect_scale(struct v3d_texture_stateobj *texstate,
                   enum quniform_contents contents,
@@ -323,13 +247,6 @@ v3d_write_uniforms(struct v3d_context *v3d, struct v3d_compiled_shader *shader,
                                          uinfo->data[i]);
                         break;
 
-#if 0
-                case QUNIFORM_TEXTURE_FIRST_LEVEL:
-                        write_texture_first_level(job, &uniforms, texstate,
-                                                  uinfo->data[i]);
-                        break;
-#endif
-
                 case QUNIFORM_TEXRECT_SCALE_X:
                 case QUNIFORM_TEXRECT_SCALE_Y:
                         cl_aligned_u32(&uniforms,
@@ -374,10 +291,6 @@ v3d_write_uniforms(struct v3d_context *v3d, struct v3d_compiled_shader *shader,
                                      texstate->textures[uinfo->data[i]]->u.tex.first_level);
                         break;
 
-                case QUNIFORM_TEXTURE_BORDER_COLOR:
-                        /* XXX */
-                        break;
-
                 case QUNIFORM_SPILL_OFFSET:
                         cl_aligned_reloc(&job->indirect, &uniforms,
                                          v3d->prog.spill_bo, 0);
@@ -441,7 +354,6 @@ v3d_set_shader_uniform_dirty_flags(struct v3d_compiled_shader *shader)
                 case QUNIFORM_TMU_CONFIG_P0:
                 case QUNIFORM_TMU_CONFIG_P1:
                 case QUNIFORM_TEXTURE_CONFIG_P1:
-                case QUNIFORM_TEXTURE_BORDER_COLOR:
                 case QUNIFORM_TEXTURE_FIRST_LEVEL:
                 case QUNIFORM_TEXRECT_SCALE_X:
                 case QUNIFORM_TEXRECT_SCALE_Y: