From 65ed98839b612ada9b5a3da3bedff135798bdb74 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 16 Nov 2017 01:10:27 +0100 Subject: [PATCH] mesa: reduce the size of gl_program gl_program: 1456 -> 976 bytes Reviewed-by: Brian Paul --- src/compiler/glsl/link_uniforms.cpp | 9 ++++----- src/mesa/main/mtypes.h | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index 15813cb0aed..a73dcd47275 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -1423,11 +1423,10 @@ link_assign_uniform_storage(struct gl_context *ctx, } } - STATIC_ASSERT(sizeof(shader->Program->sh.SamplerTargets) == - sizeof(parcel.targets)); - memcpy(shader->Program->sh.SamplerTargets, - parcel.targets, - sizeof(shader->Program->sh.SamplerTargets)); + STATIC_ASSERT(ARRAY_SIZE(shader->Program->sh.SamplerTargets) == + ARRAY_SIZE(parcel.targets)); + for (unsigned j = 0; j < ARRAY_SIZE(parcel.targets); j++) + shader->Program->sh.SamplerTargets[j] = parcel.targets[j]; } #ifndef NDEBUG diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f829fa3ff05..c80d3b950ca 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2168,7 +2168,7 @@ struct gl_program /** Subset of OutputsWritten outputs written with non-zero index. */ GLbitfield64 SecondaryOutputsWritten; /** TEXTURE_x_BIT bitmask */ - GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; + GLbitfield16 TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; /** Bitfield of which samplers are used */ GLbitfield SamplersUsed; /** Texture units used for shadow sampling. */ @@ -2246,7 +2246,7 @@ struct gl_program /** Which texture target is being sampled * (TEXTURE_1D/2D/3D/etc_INDEX) */ - gl_texture_index SamplerTargets[MAX_SAMPLERS]; + GLubyte SamplerTargets[MAX_SAMPLERS]; /** * Number of samplers declared with the bindless_sampler layout -- 2.30.2