Code refactor: move more memory allocation logic into device API.

* Remove tex_* and pixels_* functions, replace by mem_*.
* Add MEM_TEXTURE and MEM_PIXELS as memory types recognized by devices.
* No longer create device_memory and call mem_* directly, always go
  through device_only_memory, device_vector and device_pixels.
This commit is contained in:
Brecht Van Lommel
2017-10-21 01:09:59 +02:00
parent aa8b4c5d81
commit 070a668d04
30 changed files with 939 additions and 860 deletions

View File

@@ -191,11 +191,11 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
int dimensions = PRNG_BASE_NUM + max_samples*PRNG_BOUNCE_NUM;
dimensions = min(dimensions, SOBOL_MAX_DIMENSIONS);
uint *directions = dscene->sobol_directions.resize(SOBOL_BITS*dimensions);
uint *directions = dscene->sobol_directions.alloc(SOBOL_BITS*dimensions);
sobol_generate_direction_vectors((uint(*)[SOBOL_BITS])directions, dimensions);
device->tex_alloc(dscene->sobol_directions);
dscene->sobol_directions.copy_to_device();
/* Clamping. */
bool use_sample_clamp = (sample_clamp_direct != 0.0f ||
@@ -208,10 +208,9 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
need_update = false;
}
void Integrator::device_free(Device *device, DeviceScene *dscene)
void Integrator::device_free(Device *, DeviceScene *dscene)
{
device->tex_free(dscene->sobol_directions);
dscene->sobol_directions.clear();
dscene->sobol_directions.free();
}
bool Integrator::modified(const Integrator& integrator)