Skip to content

Commit

Permalink
Merge pull request #926 from dictoon/master
Browse files Browse the repository at this point in the history
Miscellaneous changes
  • Loading branch information
est77 committed Nov 22, 2015
2 parents b4c9160 + 5caeaaf commit 87ee180
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 101 deletions.
Expand Up @@ -95,22 +95,23 @@ MaterialCollectionItem::MaterialCollectionItem(
}

#ifdef APPLESEED_WITH_DISNEY_MATERIAL

const Material& MaterialCollectionItem::create_default_disney_material(const string& material_name)
{
auto_release_ptr<Material> material =
DisneyMaterialFactory().create(material_name.c_str(), ParamArray());
Material* material_ptr = material.get();

const Dictionary layer_values = static_cast<DisneyMaterial*>(material.get())->get_new_layer_values();
material->get_parameters().insert(layer_values.get("layer_name"), layer_values);
static_cast<DisneyMaterial*>(material.get())->add_new_default_layer();

Material* material_ptr = material.get();
add_item(material_ptr);

EntityTraits<Material>::insert_entity(material, m_parent);
m_editor_context.m_project_builder.notify_project_modification();

return *material_ptr;
}

#endif // APPLESEED_WITH_DISNEY_MATERIAL

QMenu* MaterialCollectionItem::get_single_item_context_menu() const
Expand Down
8 changes: 4 additions & 4 deletions src/appleseed.studio/mainwindow/rendering/renderwidget.cpp
Expand Up @@ -203,8 +203,8 @@ void RenderWidget::highlight_region(
uint8* dest = get_image_pointer(m_image, x, y);

// Draw a bracket around the tile.
const uint8 BracketColor[3] = { 255, 255, 255 };
const size_t BracketExtent = 5;
const uint8 BracketColor[3] = { 255, 255, 255 };
draw_bracket(
dest,
width,
Expand Down Expand Up @@ -235,10 +235,10 @@ void RenderWidget::blit_frame(const Frame& frame)

allocate_working_storage(frame_props);

for (size_t ty = 0; ty < frame_props.m_tile_count_y; ++ty)
for (size_t y = 0; y < frame_props.m_tile_count_y; ++y)
{
for (size_t tx = 0; tx < frame_props.m_tile_count_x; ++tx)
blit_tile_no_lock(frame, tx, ty);
for (size_t x = 0; x < frame_props.m_tile_count_x; ++x)
blit_tile_no_lock(frame, x, y);
}
}

Expand Down
15 changes: 15 additions & 0 deletions src/appleseed/foundation/image/color.h
Expand Up @@ -88,6 +88,9 @@ class Color
template <typename T, size_t N> bool operator!=(const Color<T, N>& lhs, const Color<T, N>& rhs);
template <typename T, size_t N> bool operator==(const Color<T, N>& lhs, const Color<T, N>& rhs);

// Return whether all components of a color are exactly zero.
template <typename T, size_t N> bool is_zero(const Color<T, N>& c);

// Approximate equality tests.
template <typename T, size_t N> bool feq(const Color<T, N>& lhs, const Color<T, N>& rhs);
template <typename T, size_t N> bool feq(const Color<T, N>& lhs, const Color<T, N>& rhs, const T eps);
Expand Down Expand Up @@ -338,6 +341,18 @@ inline bool operator==(const Color<T, N>& lhs, const Color<T, N>& rhs)
return !(lhs != rhs);
}

template <typename T, size_t N>
inline bool is_zero(const Color<T, N>& c)
{
for (size_t i = 0; i < N; ++i)
{
if (c[i] != T(0.0))
return false;
}

return true;
}

template <typename T, size_t N>
inline bool feq(const Color<T, N>& lhs, const Color<T, N>& rhs)
{
Expand Down
125 changes: 63 additions & 62 deletions src/appleseed/foundation/platform/system.cpp
Expand Up @@ -537,183 +537,184 @@ namespace
// Descriptor decode values from the Intel manual, Table 2-7.
switch ((regs[i / 4] >> (i % 4) * 8) & 0xFF)
{
case 0x0A:
case 0x0A:
caches[L1D].size = 8;
caches[L1D].linesize = 32;
break;
case 0x0C:
case 0x0C:
caches[L1D].size = 16;
caches[L1D].linesize = 32;
break;
case 0x0D:
case 0x60:
case 0x67:
case 0x0D:
case 0x60:
case 0x67:
caches[L1D].size = 16;
caches[L1D].linesize = 64;
break;
case 0x21:
case 0x3C:
case 0x7A:
case 0x21:
case 0x3C:
case 0x7A:
caches[L2].size = 256;
caches[L2].linesize = 64;
break;
case 0x22:
case 0xD0:
case 0x22:
case 0xD0:
caches[L3].size = 512;
caches[L3].linesize = 64;
break;
case 0x23:
case 0xD1:
case 0xD6:
case 0x23:
case 0xD1:
case 0xD6:
caches[L3].size = 1024;
caches[L3].linesize = 64;
break;
case 0x25:
case 0xD2:
case 0xD7:
case 0xE2:
case 0x25:
case 0xD2:
case 0xD7:
case 0xE2:
caches[L3].size = 2048;
caches[L3].linesize = 64;
break;
case 0x29:
case 0x46:
case 0xD8:
case 0xE3:
case 0x29:
case 0x46:
case 0xD8:
case 0xE3:
caches[L3].size = 4096;
caches[L3].linesize = 64;
break;
case 0x2C:
case 0x2C:
caches[L1D].size = 32;
caches[L1D].linesize = 64;
break;
case 0x39:
case 0x3B:
case 0x79:
case 0x39:
case 0x3B:
case 0x79:
caches[L2].size = 128;
caches[L2].linesize = 64;
break;
case 0x3A:
case 0x3A:
caches[L2].size = 192;
caches[L2].linesize = 64;
break;
case 0x3D:
case 0x3D:
caches[L2].size = 384;
caches[L2].linesize = 64;
break;
case 0x3E:
case 0x7B:
case 0x7F:
case 0x86:
case 0x3E:
case 0x7B:
case 0x7F:
case 0x86:
caches[L2].size = 512;
caches[L2].linesize = 64;
break;
case 0x40:
case 0x40:
no_higher_level_cache = 1;
break;
case 0x41:
case 0x41:
caches[L2].size = 128;
caches[L2].linesize = 32;
break;
case 0x42:
case 0x82:
case 0x42:
case 0x82:
caches[L2].size = 256;
caches[L2].linesize = 32;
break;
case 0x43:
case 0x83:
case 0x43:
case 0x83:
caches[L2].size = 512;
caches[L2].linesize = 32;
break;
case 0x44:
case 0x44:
caches[L2].size = 1024;
caches[L2].linesize = 32;
break;
case 0x45:
case 0x45:
caches[L2].size = 2048;
caches[L2].linesize = 32;
break;
case 0x47:
case 0x4B:
case 0xE4:
case 0x47:
case 0x4B:
case 0xE4:
caches[L3].size = 8192;
caches[L3].linesize = 64;
break;
case 0x48:
case 0x48:
caches[L2].size = 3072;
caches[L2].linesize = 64;
break;
case 0x49:
case 0x49:
// TODO: check for Intel Xeon processor MP, Family 0Fh,
// Model 06h, because 0x49 means L3 cache (4MB, 16-way,
// 64-byte linesize) for this CPU.
caches[L2].size = 4096;
caches[L2].linesize = 64;
break;
case 0x4A:
case 0xDE:
case 0x4A:
case 0xDE:
caches[L3].size = 6 * 1024;
caches[L3].linesize = 64;
break;
case 0x4C:
case 0xEA:
case 0x4C:
case 0xEA:
caches[L3].size = 12 * 1024;
caches[L3].linesize = 64;
break;
case 0x4D:
case 0x4D:
caches[L3].size = 16 * 1024;
caches[L3].linesize = 64;
break;
case 0x4E:
case 0x4E:
caches[L2].size = 6 * 1024;
caches[L2].linesize = 64;
break;
case 0x66:
case 0x66:
caches[L1D].size = 8;
caches[L1D].linesize = 64;
break;
case 0x68:
case 0x68:
caches[L1D].size = 32;
caches[L1D].linesize = 64;
break;
case 0x78:
case 0x7C:
case 0x78:
case 0x7C:
caches[L2].size = 1024;
caches[L2].linesize = 64;
break;
case 0x7D:
case 0x7D:
caches[L2].size = 2048;
caches[L2].linesize = 64;
break;
case 0x84:
case 0x84:
caches[L2].size = 1024;
caches[L2].linesize = 32;
break;
case 0x85:
case 0x85:
caches[L2].size = 2048;
caches[L2].linesize = 32;
break;
case 0x87:
case 0x87:
caches[L2].size = 1024;
caches[L2].linesize = 64;
break;
case 0xDC:
case 0xDC:
caches[L3].size = 1536;
caches[L3].linesize = 64;
break;
case 0xDD:
case 0xDD:
caches[L3].size = 3 * 1024;
caches[L3].linesize = 64;
break;
case 0xEB:
case 0xEB:
caches[L3].size = 18 * 1024;
caches[L3].linesize = 64;
break;
case 0xEC:
case 0xEC:
caches[L3].size = 24 * 1024;
caches[L3].linesize = 64;
break;
}
}

// Convert Kbytes to bytes.
caches[L1D].size *= 1024;
caches[L2].size *= 1024;
Expand Down
Expand Up @@ -58,14 +58,17 @@ void SerialRendererController::on_rendering_begin()

void SerialRendererController::on_rendering_success()
{
// Execute any pending callback since the
// last time on_progress was called.
// Execute any pending callback since the last time on_progress() was called.
exec_callbacks();

m_controller->on_rendering_success();
}

void SerialRendererController::on_rendering_abort()
{
// Execute any pending callback since the last time on_progress() was called.
exec_callbacks();

m_controller->on_rendering_abort();
}

Expand Down Expand Up @@ -142,20 +145,20 @@ void SerialRendererController::add_post_render_tile_callback(const Frame* frame)
m_pending_callbacks.push_back(callback);
}

void SerialRendererController::exec_callback(const PendingTileCallback& call)
void SerialRendererController::exec_callback(const PendingTileCallback& cb)
{
switch (call.m_type)
switch (cb.m_type)
{
case PendingTileCallback::PreRender:
m_tile_callback->pre_render(call.m_x, call.m_y, call.m_width, call.m_height);
m_tile_callback->pre_render(cb.m_x, cb.m_y, cb.m_width, cb.m_height);
break;

case PendingTileCallback::PostRenderTile:
m_tile_callback->post_render_tile(call.m_frame, call.m_x, call.m_y);
m_tile_callback->post_render_tile(cb.m_frame, cb.m_x, cb.m_y);
break;

case PendingTileCallback::PostRender:
m_tile_callback->post_render(call.m_frame);
m_tile_callback->post_render(cb.m_frame);
break;

assert_otherwise;
Expand Down
Expand Up @@ -105,7 +105,7 @@ class SerialRendererController
boost::mutex m_mutex;
std::deque<PendingTileCallback> m_pending_callbacks;

void exec_callback(const PendingTileCallback& call);
void exec_callback(const PendingTileCallback& cb);
void exec_callbacks();
};

Expand Down

0 comments on commit 87ee180

Please sign in to comment.