Skip to content

Commit becd840

Browse files
authored
testtex: make the tex_thread_workout cases all honor --handle (#1778)
There was a --handle flag that lets you test performance differences between the texture calls that take handles, versus the ones that take filenames and figure out the handles by looking it up in the file cache. But it turns out I had implemented that option fully for the usual "make a texture image" tests, but not for the special thread workload test you get with the --threadtimes option.
1 parent a5b934d commit becd840

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/testtex/testtex.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,8 +1120,12 @@ do_tex_thread_workout (int iterations, int mythread)
11201120
float *dresultds = test_derivs ? ALLOCA (float, nchannels) : NULL;
11211121
float *dresultdt = test_derivs ? ALLOCA (float, nchannels) : NULL;
11221122
TextureSystem::Perthread *perthread_info = texsys->get_perthread_info ();
1123-
TextureSystem::TextureHandle *texture_handle = texsys->get_texture_handle (filenames[0]);
11241123
int pixel, whichfile = 0;
1124+
1125+
std::vector<TextureSystem::TextureHandle *> texture_handles;
1126+
for (auto f : filenames)
1127+
texture_handles.emplace_back (texsys->get_texture_handle(f));
1128+
11251129
ImageSpec spec0;
11261130
texsys->get_imagespec (filenames[0], 0, spec0);
11271131
// Compute a filter size that's between the first and second MIP levels.
@@ -1139,7 +1143,7 @@ do_tex_thread_workout (int iterations, int mythread)
11391143
// texture coordinates all the time, one file), with handles
11401144
// and per-thread data already queried only once rather than
11411145
// per-call.
1142-
ok = texsys->texture (texture_handle, perthread_info, opt, s, t,
1146+
ok = texsys->texture (texture_handles[0], perthread_info, opt, s, t,
11431147
dsdx, dtdx, dsdy, dtdy, nchannels,
11441148
result, dresultds, dresultdt);
11451149
break;
@@ -1193,9 +1197,15 @@ do_tex_thread_workout (int iterations, int mythread)
11931197
if (! ok) {
11941198
s = (((2*pixel) % spec0.width) + 0.5f) / spec0.width;
11951199
t = (((2*((2*pixel) / spec0.width)) % spec0.height) + 0.5f) / spec0.height;
1196-
ok = texsys->texture (filenames[whichfile], opt, s, t,
1197-
dsdx, dtdx, dsdy, dtdy, nchannels,
1198-
result, dresultds, dresultdt);
1200+
if (use_handle)
1201+
ok = texsys->texture (texture_handles[whichfile],
1202+
perthread_info, opt, s, t,
1203+
dsdx, dtdx, dsdy, dtdy, nchannels,
1204+
result, dresultds, dresultdt);
1205+
else
1206+
ok = texsys->texture (filenames[whichfile], opt, s, t,
1207+
dsdx, dtdx, dsdy, dtdy, nchannels,
1208+
result, dresultds, dresultdt);
11991209
}
12001210
if (! ok) {
12011211
lock_guard lock (error_mutex);

0 commit comments

Comments
 (0)