aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/uniforms.h
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2014-11-05 18:44:21 -0800
committerIan Romanick <[email protected]>2017-01-26 09:46:14 -0800
commit9be5fd3c87f8f463ad82dc6d80fe18ebc795119c (patch)
tree11117e6c4303f0c3a278d8e3a3023f9a58310222 /src/mesa/main/uniforms.h
parent9f7ac45ce46f18b53777fc5c040e38049c1cbb47 (diff)
mesa: Arrange _mesa_uniform parameters to match the call sites
By putting the parameters first that match the parameters to the call site, 4 (of 14) instructions are saved at _mesa_Uniform4fv on x64. On IA32, the details of the instructions change, but it is the same count and mix of instructions. Before: 0000000000000830 <_mesa_Uniform4fv>: 830: 48 83 ec 10 sub $0x10,%rsp 834: 49 89 d0 mov %rdx,%r8 837: 48 8b 15 00 00 00 00 mov 0x0(%rip),%rdx # 83e <_mesa_Uniform4fv+0xe> 83e: 89 f8 mov %edi,%eax 840: 89 f1 mov %esi,%ecx 842: 41 b9 02 00 00 00 mov $0x2,%r9d 848: 64 48 8b 3a mov %fs:(%rdx),%rdi 84c: 48 8b 97 c8 01 02 00 mov 0x201c8(%rdi),%rdx 853: 48 8b 72 70 mov 0x70(%rdx),%rsi 857: 6a 04 pushq $0x4 859: 89 c2 mov %eax,%edx 85b: e8 00 00 00 00 callq 860 <_mesa_Uniform4fv+0x30> 860: 48 83 c4 18 add $0x18,%rsp 864: c3 retq After: 00000000000007f0 <_mesa_Uniform4fv>: 7f0: 48 83 ec 10 sub $0x10,%rsp 7f4: 48 8b 05 00 00 00 00 mov 0x0(%rip),%rax # 7fb <_mesa_Uniform4fv+0xb> 7fb: 41 b9 02 00 00 00 mov $0x2,%r9d 801: 64 48 8b 08 mov %fs:(%rax),%rcx 805: 48 8b 81 c8 01 02 00 mov 0x201c8(%rcx),%rax 80c: 6a 04 pushq $0x4 80e: 4c 8b 40 70 mov 0x70(%rax),%r8 812: e8 00 00 00 00 callq 817 <_mesa_Uniform4fv+0x27> 817: 48 83 c4 18 add $0x18,%rsp 81b: c3 retq Saves a measly 416 bytes of text on x64. Depending on exactly when this is applied, a lot of variation is possible due to function alignment. 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 6343348 293872 29880 6667100 65bb5c lib64/i965_dri.so before 6342932 293872 29880 6666684 65b9bc lib64/i965_dri.so after There is likely to be no performance change with just this patch. _mesa_uniform immediately calls validate_uniform_parameters with parameters in the "wrong" (different from the call site) order. v2: Rebase on GL_ARB_gpu_shader_fp64. v3: Rebase on GL_ARB_gpu_shader_int64. 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.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
index 2859ad05591..0656b3a6efd 100644
--- a/src/mesa/main/uniforms.h
+++ b/src/mesa/main/uniforms.h
@@ -430,11 +430,9 @@ void GLAPIENTRY
_mesa_ProgramUniform4ui64vARB(GLuint, GLint, GLsizei, const GLuint64 *);
void
-_mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program,
- GLint location, GLsizei count,
- const GLvoid *values,
- enum glsl_base_type basicType,
- unsigned src_components);
+_mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
+ struct gl_context *, struct gl_shader_program *,
+ enum glsl_base_type basicType, unsigned src_components);
void
_mesa_uniform_matrix(GLint location, GLsizei count,