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

@@ -41,40 +41,40 @@
CCL_NAMESPACE_BEGIN
DeviceScene::DeviceScene(Device *device)
: bvh_nodes(device, "__bvh_nodes"),
bvh_leaf_nodes(device, "__bvh_leaf_nodes"),
object_node(device, "__object_node"),
prim_tri_index(device, "__prim_tri_index"),
prim_tri_verts(device, "__prim_tri_verts"),
prim_type(device, "__prim_type"),
prim_visibility(device, "__prim_visibility"),
prim_index(device, "__prim_index"),
prim_object(device, "__prim_object"),
prim_time(device, "__prim_time"),
tri_shader(device, "__tri_shader"),
tri_vnormal(device, "__tri_vnormal"),
tri_vindex(device, "__tri_vindex"),
tri_patch(device, "__tri_patch"),
tri_patch_uv(device, "__tri_patch_uv"),
curves(device, "__curves"),
curve_keys(device, "__curve_keys"),
patches(device, "__patches"),
objects(device, "__objects"),
objects_vector(device, "__objects_vector"),
attributes_map(device, "__attributes_map"),
attributes_float(device, "__attributes_float"),
attributes_float3(device, "__attributes_float3"),
attributes_uchar4(device, "__attributes_uchar4"),
light_distribution(device, "__light_distribution"),
light_data(device, "__light_data"),
light_background_marginal_cdf(device, "__light_background_marginal_cdf"),
light_background_conditional_cdf(device, "__light_background_conditional_cdf"),
particles(device, "__particles"),
svm_nodes(device, "__svm_nodes"),
shader_flag(device, "__shader_flag"),
object_flag(device, "__object_flag"),
lookup_table(device, "__lookup_table"),
sobol_directions(device, "__sobol_directions")
: bvh_nodes(device, "__bvh_nodes", MEM_TEXTURE),
bvh_leaf_nodes(device, "__bvh_leaf_nodes", MEM_TEXTURE),
object_node(device, "__object_node", MEM_TEXTURE),
prim_tri_index(device, "__prim_tri_index", MEM_TEXTURE),
prim_tri_verts(device, "__prim_tri_verts", MEM_TEXTURE),
prim_type(device, "__prim_type", MEM_TEXTURE),
prim_visibility(device, "__prim_visibility", MEM_TEXTURE),
prim_index(device, "__prim_index", MEM_TEXTURE),
prim_object(device, "__prim_object", MEM_TEXTURE),
prim_time(device, "__prim_time", MEM_TEXTURE),
tri_shader(device, "__tri_shader", MEM_TEXTURE),
tri_vnormal(device, "__tri_vnormal", MEM_TEXTURE),
tri_vindex(device, "__tri_vindex", MEM_TEXTURE),
tri_patch(device, "__tri_patch", MEM_TEXTURE),
tri_patch_uv(device, "__tri_patch_uv", MEM_TEXTURE),
curves(device, "__curves", MEM_TEXTURE),
curve_keys(device, "__curve_keys", MEM_TEXTURE),
patches(device, "__patches", MEM_TEXTURE),
objects(device, "__objects", MEM_TEXTURE),
objects_vector(device, "__objects_vector", MEM_TEXTURE),
attributes_map(device, "__attributes_map", MEM_TEXTURE),
attributes_float(device, "__attributes_float", MEM_TEXTURE),
attributes_float3(device, "__attributes_float3", MEM_TEXTURE),
attributes_uchar4(device, "__attributes_uchar4", MEM_TEXTURE),
light_distribution(device, "__light_distribution", MEM_TEXTURE),
light_data(device, "__light_data", MEM_TEXTURE),
light_background_marginal_cdf(device, "__light_background_marginal_cdf", MEM_TEXTURE),
light_background_conditional_cdf(device, "__light_background_conditional_cdf", MEM_TEXTURE),
particles(device, "__particles", MEM_TEXTURE),
svm_nodes(device, "__svm_nodes", MEM_TEXTURE),
shader_flag(device, "__shader_flag", MEM_TEXTURE),
object_flag(device, "__object_flag", MEM_TEXTURE),
lookup_table(device, "__lookup_table", MEM_TEXTURE),
sobol_directions(device, "__sobol_directions", MEM_TEXTURE)
{
memset(&data, 0, sizeof(data));
}