Cycles Bake: use size_t instead of width, height

(original patch by Sergey Sharybin)

Note: RNA API can't use size_t at the moment. Once it does this patch
can be tweaked a bit to fully benefit from size_t larger dimensions.
(right now num_pixels is passed as int)

Reviewed By: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D688
This commit is contained in:
Dalai Felinto 2014-07-28 14:29:03 -03:00
parent 9952699978
commit 5c3c3abb45
Notes: blender-bot 2023-02-14 10:17:41 +01:00
Referenced by issue #41770, Can't add plane, circles and other mesh except cube
Referenced by issue #41395, Set Object As Camera - Monkey Render bug?
Referenced by issue #41358, Complete crash when using CTRL-Z with graph editor open
Referenced by issue #41258, crash when entering edit mode while viewport render is enabled
Referenced by issue #41257, New paint system always crashes when used on a multi-material mesh.
Referenced by issue #41231, Cycles 3D Viewport Preview crashes after adjusting nodes.
5 changed files with 11 additions and 11 deletions

View File

@ -179,7 +179,7 @@ static PyObject *bake_func(PyObject *self, PyObject *args)
python_thread_state_save(&session->python_thread_state);
session->bake(b_object, pass_type, b_bake_pixel, num_pixels, depth, (float *)b_result);
session->bake(b_object, pass_type, b_bake_pixel, (size_t)num_pixels, depth, (float *)b_result);
python_thread_state_restore(&session->python_thread_state);

View File

@ -492,7 +492,7 @@ static void populate_bake_data(BakeData *data, BL::BakePixel pixel_array, const
}
}
void BlenderSession::bake(BL::Object b_object, const string& pass_type, BL::BakePixel pixel_array, int num_pixels, int depth, float result[])
void BlenderSession::bake(BL::Object b_object, const string& pass_type, BL::BakePixel pixel_array, const size_t num_pixels, const int depth, float result[])
{
ShaderEvalType shader_type = get_shader_type(pass_type);
size_t object_index = OBJECT_NONE;

View File

@ -52,7 +52,7 @@ public:
/* offline render */
void render();
void bake(BL::Object b_object, const string& pass_type, BL::BakePixel pixel_array, int num_pixels, int depth, float pixels[]);
void bake(BL::Object b_object, const string& pass_type, BL::BakePixel pixel_array, const size_t num_pixels, const int depth, float pixels[]);
void write_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile);
void write_render_tile(RenderTile& rtile);

View File

@ -19,7 +19,7 @@
CCL_NAMESPACE_BEGIN
BakeData::BakeData(const int object, const int tri_offset, const int num_pixels):
BakeData::BakeData(const int object, const size_t tri_offset, const size_t num_pixels):
m_object(object),
m_tri_offset(tri_offset),
m_num_pixels(num_pixels)
@ -60,7 +60,7 @@ int BakeData::object()
return m_object;
}
int BakeData::size()
size_t BakeData::size()
{
return m_num_pixels;
}
@ -113,7 +113,7 @@ void BakeManager::set_baking(const bool value)
m_is_baking = value;
}
BakeData *BakeManager::init(const int object, const int tri_offset, const int num_pixels)
BakeData *BakeManager::init(const int object, const size_t tri_offset, const size_t num_pixels)
{
m_bake_data = new BakeData(object, tri_offset, num_pixels);
return m_bake_data;

View File

@ -27,20 +27,20 @@ CCL_NAMESPACE_BEGIN
class BakeData {
public:
BakeData(const int object, const int tri_offset, const int num_pixels);
BakeData(const int object, const size_t tri_offset, const size_t num_pixels);
~BakeData();
void set(int i, int prim, float uv[2], float dudx, float dudy, float dvdx, float dvdy);
int object();
int size();
size_t size();
uint4 data(int i);
uint4 differentials(int i);
bool is_valid(int i);
private:
int m_object;
int m_tri_offset;
int m_num_pixels;
size_t m_tri_offset;
size_t m_num_pixels;
vector<int>m_primitive;
vector<float>m_u;
vector<float>m_v;
@ -58,7 +58,7 @@ public:
bool get_baking();
void set_baking(const bool value);
BakeData *init(const int object, const int tri_offset, const int num_pixels);
BakeData *init(const int object, const size_t tri_offset, const size_t num_pixels);
bool bake(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress, ShaderEvalType shader_type, BakeData *bake_data, float result[]);