diff options
author | Ian Romanick <[email protected]> | 2014-11-05 17:48:40 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2017-01-26 09:46:09 -0800 |
commit | 9f7ac45ce46f18b53777fc5c040e38049c1cbb47 (patch) | |
tree | 3f16ee82678361f710d1fc3355708d28131e5595 /src/mesa/main/uniforms.h | |
parent | 874393186b43f80ebd5921e3eb909aeec415e7c5 (diff) |
mesa: Arrange _mesa_uniform_matrix parameters to match the call sites
By putting the parameters first that match the parameters to the call
site, 4 (of 16) instructions are saved at _mesa_UniformMatrix4fv on
x64. On IA32, the details of the instructions change, but it is the
same count and mix of instructions.
Before:
0000000000001380 <_mesa_UniformMatrix4fv>:
1380: 48 83 ec 10 sub $0x10,%rsp
1384: 48 8b 05 00 00 00 00 mov 0x0(%rip),%rax # 138b <_mesa_UniformMatrix4fv+0xb>
138b: 41 89 f8 mov %edi,%r8d
138e: 41 89 f1 mov %esi,%r9d
1391: 0f b6 d2 movzbl %dl,%edx
1394: 64 48 8b 38 mov %fs:(%rax),%rdi
1398: 48 8b b7 c8 01 02 00 mov 0x201c8(%rdi),%rsi
139f: 48 8b 76 70 mov 0x70(%rsi),%rsi
13a3: 68 06 14 00 00 pushq $0x1406
13a8: 51 push %rcx
13a9: 52 push %rdx
13aa: b9 04 00 00 00 mov $0x4,%ecx
13af: ba 04 00 00 00 mov $0x4,%edx
13b4: e8 00 00 00 00 callq 13b9 <_mesa_UniformMatrix4fv+0x39>
13b9: 48 83 c4 28 add $0x28,%rsp
13bd: c3 retq
After:
0000000000001360 <_mesa_UniformMatrix4fv>:
1360: 48 83 ec 10 sub $0x10,%rsp
1364: 48 8b 05 00 00 00 00 mov 0x0(%rip),%rax # 136b <_mesa_UniformMatrix4fv+0xb>
136b: 0f b6 d2 movzbl %dl,%edx
136e: 64 4c 8b 00 mov %fs:(%rax),%r8
1372: 49 8b 80 c8 01 02 00 mov 0x201c8(%r8),%rax
1379: 68 06 14 00 00 pushq $0x1406
137e: 6a 04 pushq $0x4
1380: 6a 04 pushq $0x4
1382: 4c 8b 48 70 mov 0x70(%rax),%r9
1386: e8 00 00 00 00 callq 138b <_mesa_UniformMatrix4fv+0x2b>
138b: 48 83 c4 28 add $0x28,%rsp
138f: c3 retq
Saves a measly 576 bytes of text on x64.
text data bss dec hex filename
6670131 228340 22552 6921023 699b3f lib/i965_dri.so before
6670131 228340 22552 6921023 699b3f lib/i965_dri.so after
6343924 293872 29880 6667676 65bd9c lib64/i965_dri.so before
6343348 293872 29880 6667100 65bb5c lib64/i965_dri.so after
v2: Rebase on GL_ARB_gpu_shader_fp64.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa/main/uniforms.h')
-rw-r--r-- | src/mesa/main/uniforms.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h index 77e9ba37acf..2859ad05591 100644 --- a/src/mesa/main/uniforms.h +++ b/src/mesa/main/uniforms.h @@ -437,11 +437,10 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program, unsigned src_components); void -_mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, - GLuint cols, GLuint rows, - GLint location, GLsizei count, - GLboolean transpose, - const GLvoid *values, enum glsl_base_type basicType); +_mesa_uniform_matrix(GLint location, GLsizei count, + GLboolean transpose, const void *values, + struct gl_context *, struct gl_shader_program *, + GLuint cols, GLuint rows, enum glsl_base_type basicType); void _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location, |