i965: Only use the effective subset of the WM sampler key.
The whole structure is 836 bytes, but if only the first one or two samplers are used (as is common), the part that matters is only 56 or 108 bytes. By using just that subset as the key (since the key size is also part of the key), we improve firefox-talos-gfx performance by 1%.
This commit is contained in:
@@ -229,7 +229,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
|
||||
GLcontext *ctx = &brw->intel.ctx;
|
||||
int unit;
|
||||
|
||||
memset(key, 0, sizeof(*key));
|
||||
key->sampler_count = 0;
|
||||
|
||||
for (unit = 0; unit < BRW_MAX_TEX_UNIT; unit++) {
|
||||
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
|
||||
@@ -240,6 +240,8 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
|
||||
struct gl_texture_image *firstImage =
|
||||
texObj->Image[0][intelObj->firstLevel];
|
||||
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
|
||||
entry->tex_target = texObj->Target;
|
||||
|
||||
entry->seamless_cube_map = (texObj->Target == GL_TEXTURE_CUBE_MAP)
|
||||
@@ -288,7 +290,7 @@ static void upload_wm_samplers( struct brw_context *brw )
|
||||
{
|
||||
GLcontext *ctx = &brw->intel.ctx;
|
||||
struct wm_sampler_key key;
|
||||
int i;
|
||||
int i, sampler_key_size;
|
||||
|
||||
brw_wm_sampler_populate_key(brw, &key);
|
||||
|
||||
@@ -302,8 +304,11 @@ static void upload_wm_samplers( struct brw_context *brw )
|
||||
if (brw->wm.sampler_count == 0)
|
||||
return;
|
||||
|
||||
/* Only include the populated portion of the key in the search. */
|
||||
sampler_key_size = offsetof(struct wm_sampler_key,
|
||||
sampler[key.sampler_count]);
|
||||
brw->wm.sampler_bo = brw_search_cache(&brw->cache, BRW_SAMPLER,
|
||||
&key, sizeof(key),
|
||||
&key, sampler_key_size,
|
||||
brw->wm.sdc_bo, key.sampler_count,
|
||||
NULL);
|
||||
|
||||
@@ -323,7 +328,7 @@ static void upload_wm_samplers( struct brw_context *brw )
|
||||
}
|
||||
|
||||
brw->wm.sampler_bo = brw_upload_cache(&brw->cache, BRW_SAMPLER,
|
||||
&key, sizeof(key),
|
||||
&key, sampler_key_size,
|
||||
brw->wm.sdc_bo, key.sampler_count,
|
||||
&sampler, sizeof(sampler));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user