Merge branch 'master' into custom-normals-bmesh

This commit is contained in:
2016-06-09 15:45:26 +02:00
38 changed files with 212 additions and 163 deletions

View File

@@ -1181,6 +1181,10 @@ static void emDM_drawMappedFaces(
/* if non zero we know a face was rendered */
if (poly_prev != GL_ZERO) glEnd();
if (draw_option_prev == DM_DRAW_OPTION_STIPPLE) {
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
}
}
static void bmdm_get_tri_uv(BMLoop *ltri[3], MLoopUV *luv[3], const int cd_loop_uv_offset)

View File

@@ -608,7 +608,7 @@ static MovieClip *movieclip_alloc(Main *bmain, const char *name)
return clip;
}
static void movieclip_load_get_szie(MovieClip *clip)
static void movieclip_load_get_size(MovieClip *clip)
{
int width, height;
MovieClipUser user = {0};
@@ -670,7 +670,7 @@ MovieClip *BKE_movieclip_file_add(Main *bmain, const char *name)
detect_clip_source(clip);
movieclip_load_get_szie(clip);
movieclip_load_get_size(clip);
if (clip->lastsize[0]) {
int width = clip->lastsize[0];
@@ -1276,7 +1276,7 @@ void BKE_movieclip_reload(MovieClip *clip)
detect_clip_source(clip);
clip->lastsize[0] = clip->lastsize[1] = 0;
movieclip_load_get_szie(clip);
movieclip_load_get_size(clip);
movieclip_calc_length(clip);

View File

@@ -529,7 +529,7 @@ typedef struct AccessCacheKey {
static unsigned int accesscache_hashhash(const void *key_v)
{
const AccessCacheKey *key = (const AccessCacheKey *) key_v;
/* TODP(sergey): Need better hasing here for faster frame access. */
/* TODP(sergey): Need better hashing here for faster frame access. */
return key->clip_index << 16 | key->frame;
}

View File

@@ -69,7 +69,7 @@ const unsigned int hashsizes[] = {
/**
* \note Max load #GHASH_LIMIT_GROW used to be 3. (pre 2.74).
* Python uses 0.6666, tommyhaslib even goes down to 0.5.
* Python uses 0.6666, tommyhashlib even goes down to 0.5.
* Reducing our from 3 to 0.75 gives huge speedup (about twice quicker pure GHash insertions/lookup,
* about 25% - 30% quicker 'dynamic-topology' stroke drawing e.g.).
* Min load #GHASH_LIMIT_SHRINK is a quarter of max load, to avoid resizing to quickly.

View File

@@ -36,7 +36,7 @@
*
* This diagram is an overview of the structure of a single array-store.
*
* \note The only 2 structues here which are referenced externally are the.
* \note The only 2 structures here which are referenced externally are the.
*
* - BArrayStore: The whole array store.
* - BArrayState: Represents a single state (array) of data.
@@ -92,7 +92,7 @@
* First matches at either end of the array are detected.
* For identical arrays this is all thats needed.
*
* De-duplication is performed on any remaining chunks, by hasing the first few bytes of the chunk
* De-duplication is performed on any remaining chunks, by hashing the first few bytes of the chunk
* (see: BCHUNK_HASH_TABLE_ACCUMULATE_STEPS).
*
* \note This is cached for reuse since the referenced data never changes.
@@ -650,7 +650,7 @@ static void bchunk_list_append_data(
* Use for adding arrays of arbitrary sized memory at once.
*
* \note This function takes care not to perform redundant chunk-merging checks,
* so we can write succesive fixed size chunks quickly.
* so we can write successive fixed size chunks quickly.
*/
static void bchunk_list_append_data_n(
const BArrayInfo *info, BArrayMemory *bs_mem,
@@ -1680,7 +1680,7 @@ void *BLI_array_store_state_data_get_alloc(
/** \} */
/** \name Debigging API (for testing).
/** \name Debugging API (for testing).
* \{ */
/* only for test validation */

View File

@@ -65,7 +65,7 @@ MALWAYS_INLINE __m128 linearrgb_to_srgb_v4_simd(const __m128 c)
MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
{
float r[4] = {srgb[0], srgb[1], srgb[2], 0.0f};
float r[4] = {srgb[0], srgb[1], srgb[2], 1.0f};
__m128 *rv = (__m128 *)&r;
*rv = srgb_to_linearrgb_v4_simd(*rv);
linear[0] = r[0];
@@ -75,7 +75,7 @@ MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
{
float r[4] = {linear[0], linear[1], linear[2], 0.0f};
float r[4] = {linear[0], linear[1], linear[2], 1.0f};
__m128 *rv = (__m128 *)&r;
*rv = linearrgb_to_srgb_v4_simd(*rv);
srgb[0] = r[0];

View File

@@ -1316,11 +1316,12 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *ob,
OperationKey done_key(&ob->id, DEPSNODE_TYPE_BONE, parchan->name, DEG_OPCODE_BONE_DONE);
add_relation(solver_key, done_key, DEPSREL_TYPE_TRANSFORM, "IK Chain Result");
} else {
OperationKey final_transforms_key(&ob->id, DEPSNODE_TYPE_BONE, parchan->name, DEG_OPCODE_BONE_DONE);
add_relation(solver_key, final_transforms_key, DEPSREL_TYPE_TRANSFORM, "IK Solver Result");
}
parchan->flag |= POSE_DONE;
OperationKey final_transforms_key(&ob->id, DEPSNODE_TYPE_BONE, parchan->name, DEG_OPCODE_BONE_DONE);
add_relation(solver_key, final_transforms_key, DEPSREL_TYPE_TRANSFORM, "IK Solver Result");
root_map->add_bone(parchan->name, rootchan->name);

View File

@@ -80,11 +80,12 @@ static void flush_init_func(void *data_v, int i)
*/
Depsgraph *graph = (Depsgraph *)data_v;
OperationDepsNode *node = graph->operations[i];
IDDepsNode *id_node = node->owner->owner;
ComponentDepsNode *comp_node = node->owner;
IDDepsNode *id_node = comp_node->owner;
id_node->done = 0;
comp_node->done = 0;
node->scheduled = false;
node->owner->flags &= ~DEPSCOMP_FULLY_SCHEDULED;
if (node->owner->type == DEPSNODE_TYPE_PROXY) {
if (comp_node->type == DEPSNODE_TYPE_PROXY) {
node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
}
}
@@ -136,49 +137,10 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
for (;;) {
node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
IDDepsNode *id_node = node->owner->owner;
if (id_node->done == 0) {
deg_editors_id_update(bmain, id_node->id);
id_node->done = 1;
}
lib_id_recalc_tag(bmain, id_node->id);
/* TODO(sergey): For until we've got proper data nodes in the graph. */
lib_id_recalc_data_tag(bmain, id_node->id);
ID *id = id_node->id;
/* This code is used to preserve those areas which does direct
* object update,
*
* Plus it ensures visibility changes and relations and layers
* visibility update has proper flags to work with.
*/
if (GS(id->name) == ID_OB) {
Object *object = (Object *)id;
ComponentDepsNode *comp_node = node->owner;
if (comp_node->type == DEPSNODE_TYPE_ANIMATION) {
object->recalc |= OB_RECALC_TIME;
}
else if (comp_node->type == DEPSNODE_TYPE_TRANSFORM) {
object->recalc |= OB_RECALC_OB;
}
else {
object->recalc |= OB_RECALC_DATA;
}
}
/* TODO(sergey): For until incremental updates are possible
* witin a component at least we tag the whole component
* for update.
*/
ComponentDepsNode *component = node->owner;
if ((component->flags & DEPSCOMP_FULLY_SCHEDULED) == 0) {
foreach (OperationDepsNode *op, component->operations) {
op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
}
component->flags |= DEPSCOMP_FULLY_SCHEDULED;
}
ComponentDepsNode *comp_node = node->owner;
IDDepsNode *id_node = comp_node->owner;
id_node->done = 1;
comp_node->done = 1;
/* Flush to nodes along links... */
if (node->outlinks.size() == 1) {
@@ -203,6 +165,52 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
}
}
}
GHASH_FOREACH_BEGIN(DEG::IDDepsNode *, id_node, graph->id_hash)
{
if (id_node->done == 1) {
ID *id = id_node->id;
Object *object = NULL;
if (GS(id->name) == ID_OB) {
object = (Object *)id;
}
deg_editors_id_update(bmain, id_node->id);
lib_id_recalc_tag(bmain, id_node->id);
/* TODO(sergey): For until we've got proper data nodes in the graph. */
lib_id_recalc_data_tag(bmain, id_node->id);
GHASH_FOREACH_BEGIN(const ComponentDepsNode *, comp_node, id_node->components)
{
if (comp_node->done) {
foreach (OperationDepsNode *op, comp_node->operations) {
op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
}
if (object != NULL) {
/* This code is used to preserve those areas which does
* direct object update,
*
* Plus it ensures visibility changes and relations and
* layers visibility update has proper flags to work with.
*/
if (comp_node->type == DEPSNODE_TYPE_ANIMATION) {
object->recalc |= OB_RECALC_TIME;
}
else if (comp_node->type == DEPSNODE_TYPE_TRANSFORM) {
object->recalc |= OB_RECALC_OB;
}
else {
object->recalc |= OB_RECALC_DATA;
}
}
}
}
GHASH_FOREACH_END();
}
}
GHASH_FOREACH_END();
}
static void graph_clear_func(void *data_v, int i)

View File

@@ -86,7 +86,6 @@ static void comp_node_hash_value_free(void *value_v)
ComponentDepsNode::ComponentDepsNode() :
entry_operation(NULL),
exit_operation(NULL),
flags(0),
layers(0)
{
operations_map = BLI_ghash_new(comp_node_hash_key,

View File

@@ -47,13 +47,6 @@ struct Depsgraph;
struct OperationDepsNode;
struct BoneComponentDepsNode;
typedef enum eDepsComponent_Flag {
/* Temporary flags, meaning all the component's operations has been
* scheduled for update.
*/
DEPSCOMP_FULLY_SCHEDULED = 1,
} eDepsComponent_Flag;
/* ID Component - Base type for all components */
struct ComponentDepsNode : public DepsNode {
/* Key used to look up operations within a component */
@@ -165,8 +158,6 @@ struct ComponentDepsNode : public DepsNode {
// XXX: a poll() callback to check if component's first node can be started?
int flags;
/* Temporary bitmask, used during graph construction. */
int layers;
};

View File

@@ -2035,7 +2035,7 @@ bool autokeyframe_cfra_can_key(Scene *scene, ID *id)
else {
/* Normal Mode (or treat as being normal mode):
*
* Just in case the flags are't set properly (i.e. only on/off is set, without a mode)
* Just in case the flags aren't set properly (i.e. only on/off is set, without a mode)
* let's set the "normal" flag too, so that it will all be sane everywhere...
*/
scene->toolsettings->autokey_mode = AUTOKEY_MODE_NORMAL;

View File

@@ -94,6 +94,7 @@ void glutil_draw_filled_arc(float start, float angle, float radius, int nsegment
* The param must cause only one value to be gotten from GL.
*/
float glaGetOneFloat(int param);
int glaGetOneInt(int param);
/**
* Functions like glRasterPos2i, except ensures that the resulting

View File

@@ -608,7 +608,7 @@ typedef enum eAnimUnitConv_Flags {
ANIM_UNITCONV_SKIPKNOTS = (1 << 4),
/* Scale FCurve i a way it fits to -1..1 space */
ANIM_UNITCONV_NORMALIZE = (1 << 5),
/* Only whennormalization is used: use scale factor from previous run,
/* Only when normalization is used: use scale factor from previous run,
* prevents curves from jumping all over the place when tweaking them.
*/
ANIM_UNITCONV_NORMALIZE_FREEZE = (1 << 6),

View File

@@ -8436,6 +8436,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
uiListDyn *dyn_data;
int retval = WM_UI_HANDLER_CONTINUE;
int type = event->type, val = event->val;
bool redraw = false;
int mx, my;
ui_list = listbox->custom_data;
@@ -8525,7 +8526,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
ui_apply_but_undo(listbox);
ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM;
ED_region_tag_redraw(ar);
redraw = true;
}
retval = WM_UI_HANDLER_BREAK;
}
@@ -8537,8 +8538,8 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
ui_list->list_grip += (type == WHEELUPMOUSE) ? -1 : 1;
ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM;
ED_region_tag_redraw(ar);
redraw = true;
retval = WM_UI_HANDLER_BREAK;
}
else if (ELEM(type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
@@ -8546,13 +8547,22 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
/* list template will clamp */
ui_list->list_scroll += (type == WHEELUPMOUSE) ? -1 : 1;
ED_region_tag_redraw(ar);
redraw = true;
retval = WM_UI_HANDLER_BREAK;
}
}
}
if (redraw) {
if (listbox->block->flag & UI_BLOCK_POPUP) {
/* popups need special refreshing */
ED_region_tag_refresh_ui(ar);
}
else {
ED_region_tag_redraw(ar);
}
}
return retval;
}
@@ -9794,11 +9804,21 @@ static int ui_handle_menus_recursive(
}
else {
uiBlock *block = menu->region->uiblocks.first;
uiBut *listbox = ui_list_find_mouse_over(menu->region, event);
if (block->flag & UI_BLOCK_RADIAL)
if (block->flag & UI_BLOCK_RADIAL) {
retval = ui_pie_handler(C, event, menu);
else if (event->type == LEFTMOUSE || event->val != KM_DBL_CLICK)
retval = ui_handle_menu_event(C, event, menu, level, is_parent_inside, is_parent_menu, is_floating);
}
else if (event->type == LEFTMOUSE || event->val != KM_DBL_CLICK) {
if (listbox) {
retval = ui_handle_list_event(C, event, menu->region, listbox);
}
if (retval == WM_UI_HANDLER_CONTINUE) {
retval = ui_handle_menu_event(
C, event, menu, level,
is_parent_inside, is_parent_menu, is_floating);
}
}
}
}

View File

@@ -2818,7 +2818,7 @@ static void uilist_prepare(
layoutdata->end_idx = min_ii(layoutdata->start_idx + rows * columns, len);
}
static void uilist_resize_update_cb(bContext *UNUSED(C), void *arg1, void *UNUSED(arg2))
static void uilist_resize_update_cb(bContext *C, void *arg1, void *UNUSED(arg2))
{
uiList *ui_list = arg1;
uiListDyn *dyn_data = ui_list->dyn_data;
@@ -2831,6 +2831,9 @@ static void uilist_resize_update_cb(bContext *UNUSED(C), void *arg1, void *UNUSE
dyn_data->resize_prev += diff * UI_UNIT_Y;
ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM;
}
/* In case uilist is in popup, we need special refreshing */
ED_region_tag_refresh_ui(CTX_wm_menu(C));
}
static void *uilist_item_use_dynamic_tooltip(PointerRNA *itemptr, const char *propname)

View File

@@ -327,6 +327,13 @@ float glaGetOneFloat(int param)
return v;
}
int glaGetOneInt(int param)
{
GLint v;
glGetIntegerv(param, &v);
return v;
}
void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y)
{
GLubyte dummy = 0;

View File

@@ -202,7 +202,7 @@ typedef struct ProjPaintImage {
*/
typedef struct ProjStrokeHandle {
/* Support for painting from multiple views at once,
* currently used to impliment summetry painting,
* currently used to impliment symmetry painting,
* we can assume at least the first is set while painting. */
struct ProjPaintState *ps_views[8];
int ps_views_tot;
@@ -717,7 +717,7 @@ static bool project_paint_PickColor(
}
/**
* Check if 'pt' is infront of the 3 verts on the Z axis (used for screenspace occlusuion test)
* Check if 'pt' is infront of the 3 verts on the Z axis (used for screenspace occlusion test)
* \return
* - `0`: no occlusion
* - `-1`: no occlusion but 2D intersection is true

View File

@@ -1323,7 +1323,7 @@ static bool do_weight_paint_normalize_all_locked(
/**
* \note same as function above except it does a second pass without active group
* if nomalize fails with it.
* if normalize fails with it.
*/
static void do_weight_paint_normalize_all_locked_try_active(
MDeformVert *dvert, const int defbase_tot, const bool *vgroup_validmap,
@@ -1340,7 +1340,7 @@ static void do_weight_paint_normalize_all_locked_try_active(
* - With 1.0 weight painted into active:
* nonzero locked weight; first pass zeroed out unlocked weight; scale 1 down to fit.
* - With 0.0 weight painted into active:
* no unlocked groups; first pass did nothing; increaze 0 to fit.
* no unlocked groups; first pass did nothing; increase 0 to fit.
*/
do_weight_paint_normalize_all_locked(dvert, defbase_tot, vgroup_validmap, lock_flags);
}

View File

@@ -986,10 +986,11 @@ static GLubyte bm_dot7[] = {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38};
static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id,
bPoseChannel *pchan, EditBone *ebone)
{
/* call this once, avoid constant changing */
BLI_assert(glaGetOneInt(GL_UNPACK_ALIGNMENT) == 1);
float length;
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (pchan)
length = pchan->bone->length;
else
@@ -2699,6 +2700,11 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (v3d->flag2 & V3D_RENDER_OVERRIDE)
return true;
/* needed for 'draw_line_bone' which draws pixel. */
if (arm->drawtype == ARM_LINE) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
}
if (dt > OB_WIRE) {
/* we use color for solid lighting */
if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
@@ -2774,5 +2780,9 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* restore */
glFrontFace(GL_CCW);
if (arm->drawtype == ARM_LINE) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
}
return retval;
}

View File

@@ -369,15 +369,18 @@ static bool set_draw_settings_cached(int clearcache, MTexPoly *texface, Material
}
if (c_badtex) lit = 0;
if (lit != c_lit || ma != c_ma) {
if (lit != c_lit || ma != c_ma || textured != c_textured) {
int options = GPU_SHADER_USE_COLOR;
if (c_textured && !c_badtex) {
options |= GPU_SHADER_TEXTURE_2D;
}
if (gtexdraw.two_sided_lighting) {
options |= GPU_SHADER_TWO_SIDED;
}
if (lit) {
int options = GPU_SHADER_LIGHTING | GPU_SHADER_USE_COLOR;
if (gtexdraw.two_sided_lighting)
options |= GPU_SHADER_TWO_SIDED;
if (c_textured && !c_badtex)
options |= GPU_SHADER_TEXTURE_2D;
options |= GPU_SHADER_LIGHTING;
if (!ma)
ma = give_current_material_or_def(NULL, 0); /* default material */
@@ -385,12 +388,10 @@ static bool set_draw_settings_cached(int clearcache, MTexPoly *texface, Material
mul_v3_v3fl(specular, &ma->specr, ma->spec);
GPU_basic_shader_colors(NULL, specular, ma->har, 1.0f);
GPU_basic_shader_bind(options);
}
else {
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
}
GPU_basic_shader_bind(options);
c_lit = lit;
c_ma = ma;
}

View File

@@ -4911,7 +4911,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
* Get the world-space 3d location from a screen-space 2d point.
*
* \param mval: Input screen-space pixel location.
* \param mouse_worldloc: Output world-space loction.
* \param mouse_worldloc: Output world-space location.
* \param fallback_depth_pt: Use this points depth when no depth can be found.
*/
bool ED_view3d_autodist(

View File

@@ -686,7 +686,7 @@ static void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Tilt";
/* optionals -
/* optional -
* "Tilt selected vertices"
* "Specify an extra axis rotation for selected vertices of 3D curve" */
ot->description = "Tilt selected control vertices of 3D curve";

View File

@@ -198,7 +198,7 @@ static void raycast_all_cb(void *userdata, int index, const BVHTreeRay *ray, BVH
mul_m3_v3((float(*)[3])data->timat, normal);
normalize_v3(normal);
/* currently unused, and causes issues when looptri's havn't been calculated.
/* currently unused, and causes issues when looptri's haven't been calculated.
* since theres some overhead in ensuring this data is valid, it may need to be optional. */
#if 0
if (data->dm) {
@@ -735,7 +735,7 @@ static bool snapDerivedMesh(
if (bb) {
BoundBox bb_temp;
/* We cannot aford a bbox with some null dimension, which may happen in some cases...
/* We cannot afford a bounding box with some null dimension, which may happen in some cases...
* Threshold is rather high, but seems to be needed to get good behavior, see T46099. */
bb = BKE_boundbox_ensure_minimum_dimensions(bb, &bb_temp, 1e-1f);

View File

@@ -93,8 +93,9 @@ if (GPU_basic_shader_use_glsl_get()) { \
} ((void)0)
void GPU_basic_shader_colors(const float diffuse[3], const float specular[3],
int shininess, float alpha);
void GPU_basic_shader_colors(
const float diffuse[3], const float specular[3],
int shininess, float alpha);
/* Fixed Function Lighting */

View File

@@ -97,8 +97,9 @@ void GPU_clear_tpage(bool force);
* - this affects fixed functions materials and texface, not glsl */
int GPU_default_lights(void);
int GPU_scene_object_lights(struct Scene *scene, struct Object *ob,
int lay, float viewmat[4][4], int ortho);
int GPU_scene_object_lights(
struct Scene *scene, struct Object *ob,
int lay, float viewmat[4][4], int ortho);
/* Text render
* - based on moving uv coordinates */
@@ -132,13 +133,15 @@ void GPU_set_gpu_mipmapping(int gpu_mipmap);
void GPU_paint_update_image(struct Image *ima, struct ImageUser *iuser, int x, int y, int w, int h);
void GPU_update_images_framechange(void);
int GPU_update_image_time(struct Image *ima, double time);
int GPU_verify_image(struct Image *ima,
struct ImageUser *iuser, int textarget, int tftile, bool compare, bool mipmap, bool is_data);
void GPU_create_gl_tex(unsigned int *bind, unsigned int *rect, float *frect, int rectw, int recth,
int textarget, bool mipmap, bool use_hight_bit_depth, struct Image *ima);
int GPU_verify_image(
struct Image *ima, struct ImageUser *iuser,
int textarget, int tftile, bool compare, bool mipmap, bool is_data);
void GPU_create_gl_tex(
unsigned int *bind, unsigned int *rect, float *frect, int rectw, int recth,
int textarget, bool mipmap, bool use_hight_bit_depth, struct Image *ima);
void GPU_create_gl_tex_compressed(
unsigned int *bind, unsigned int *pix, int x, int y, int mipmap,
int textarget, struct Image *ima, struct ImBuf *ibuf);
unsigned int *bind, unsigned int *pix, int x, int y, int mipmap,
int textarget, struct Image *ima, struct ImBuf *ibuf);
bool GPU_upload_dxt_texture(struct ImBuf *ibuf);
void GPU_free_image(struct Image *ima);
void GPU_free_images(void);

View File

@@ -521,8 +521,9 @@ int GPU_basic_shader_bound_options(void)
/* Material Colors */
void GPU_basic_shader_colors(const float diffuse[3], const float specular[3],
int shininess, float alpha)
void GPU_basic_shader_colors(
const float diffuse[3], const float specular[3],
int shininess, float alpha)
{
float gl_diffuse[4], gl_specular[4];

View File

@@ -53,8 +53,6 @@
#include "BKE_mesh.h"
#include "BKE_pbvh.h"
#include "DNA_userdef_types.h"
#include "GPU_buffers.h"
#include "GPU_draw.h"
#include "GPU_basic_shader.h"

View File

@@ -86,8 +86,10 @@ typedef struct GPUFunction {
} GPUFunction;
/* Indices match the GPUType enum */
static const char *GPU_DATATYPE_STR[17] = {"", "float", "vec2", "vec3", "vec4",
NULL, NULL, NULL, NULL, "mat3", NULL, NULL, NULL, NULL, NULL, NULL, "mat4"};
static const char *GPU_DATATYPE_STR[17] = {
"", "float", "vec2", "vec3", "vec4",
NULL, NULL, NULL, NULL, "mat3", NULL, NULL, NULL, NULL, NULL, NULL, "mat4",
};
/* GLSL code parsing for finding function definitions.
* These are stored in a hash for lookup when creating a material. */

View File

@@ -34,16 +34,11 @@
#include "BLI_sys_types.h"
#include "BLI_rect.h"
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_linklist.h"
#include "BLI_rand.h"
#include "DNA_vec_types.h"
#include "DNA_view3d_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_camera_types.h"
#include "DNA_gpu_types.h"
#include "GPU_compositing.h"

View File

@@ -39,7 +39,6 @@
#include <string.h>
#include "GPU_glew.h"
#include "GPU_debug.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
@@ -70,10 +69,11 @@
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_subsurf.h"
#include "BKE_DerivedMesh.h"
#ifdef WITH_GAMEENGINE
# include "BKE_object.h"
#endif
#include "GPU_basic_shader.h"
#include "GPU_buffers.h"
@@ -85,9 +85,13 @@
#include "PIL_time.h"
#include "smoke_API.h"
#ifdef WITH_SMOKE
# include "smoke_API.h"
#endif
#ifdef WITH_OPENSUBDIV
# include "BKE_subsurf.h"
# include "BKE_DerivedMesh.h"
# include "BKE_editmesh.h"
# include "gpu_codegen.h"
@@ -561,7 +565,9 @@ static void gpu_verify_high_bit_srgb_buffer(float *srgb_frect,
}
}
int GPU_verify_image(Image *ima, ImageUser *iuser, int textarget, int tftile, bool compare, bool mipmap, bool is_data)
int GPU_verify_image(
Image *ima, ImageUser *iuser,
int textarget, int tftile, bool compare, bool mipmap, bool is_data)
{
unsigned int *bind = NULL;
int tpx = 0, tpy = 0;
@@ -843,8 +849,9 @@ static void gpu_del_cube_map(void **cube_map)
}
/* Image *ima can be NULL */
void GPU_create_gl_tex(unsigned int *bind, unsigned int *rect, float *frect, int rectw, int recth,
int textarget, bool mipmap, bool use_high_bit_depth, Image *ima)
void GPU_create_gl_tex(
unsigned int *bind, unsigned int *rect, float *frect, int rectw, int recth,
int textarget, bool mipmap, bool use_high_bit_depth, Image *ima)
{
ImBuf *ibuf = NULL;

View File

@@ -32,9 +32,6 @@
* with checks for drivers and GPU support.
*/
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
#include "BLI_math_vector.h"
@@ -42,7 +39,6 @@
#include "BKE_global.h"
#include "GPU_basic_shader.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "GPU_glew.h"
#include "GPU_texture.h"

View File

@@ -29,8 +29,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
#include "BLI_math_vector.h"
#include "BKE_global.h"

View File

@@ -29,11 +29,8 @@
* \ingroup gpu
*/
#include "BKE_DerivedMesh.h"
#include "BLI_sys_types.h"
#include "GPU_init_exit.h" /* interface */
#include "GPU_buffers.h"
#include "BKE_global.h"

View File

@@ -31,7 +31,6 @@
* Manages materials, lights and textures.
*/
#include <math.h>
#include <string.h>
@@ -49,7 +48,6 @@
#include "BKE_anim.h"
#include "BKE_colortools.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_main.h"
@@ -68,7 +66,9 @@
#include "gpu_codegen.h"
#include <string.h>
#ifdef WITH_OPENSUBDIV
# include "BKE_DerivedMesh.h"
#endif
/* Structs */

View File

@@ -27,7 +27,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
#include "BLI_math_vector.h"

View File

@@ -32,7 +32,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
#include "BLI_math_vector.h"
#include "BKE_global.h"

View File

@@ -233,19 +233,15 @@ static void wm_gesture_draw_circle(wmGesture *gt)
}
struct LassoFillData {
unsigned int *px;
unsigned char *px;
int width;
};
static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data)
{
struct LassoFillData *data = user_data;
unsigned char *col = (unsigned char *)&(data->px[(y * data->width) + x]);
do {
col[0] = col[1] = col[2] = 0xff;
col[3] = 0x10;
col += 4;
} while (++x != x_end);
unsigned char *col = &(data->px[(y * data->width) + x]);
memset(col, 0x10, x_end - x);
}
static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
@@ -273,7 +269,7 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
if (BLI_rcti_is_empty(&rect) == false) {
const int w = BLI_rcti_size_x(&rect);
const int h = BLI_rcti_size_y(&rect);
unsigned int *pixel_buf = MEM_callocN(sizeof(*pixel_buf) * w * h, __func__);
unsigned char *pixel_buf = MEM_callocN(sizeof(*pixel_buf) * w * h, __func__);
struct LassoFillData lasso_fill_data = {pixel_buf, w};
fill_poly_v2i_n(
@@ -281,19 +277,27 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
(const int (*)[2])moves, tot,
draw_filled_lasso_px_cb, &lasso_fill_data);
int bound_options;
GPU_BASIC_SHADER_DISABLE_AND_STORE(bound_options);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glColor4f(1, 1, 1, 1);
glPixelTransferf(GL_RED_BIAS, 1);
glPixelTransferf(GL_GREEN_BIAS, 1);
glPixelTransferf(GL_BLUE_BIAS, 1);
GPU_basic_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR);
glEnable(GL_BLEND);
// glColor4f(1.0, 1.0, 1.0, 0.05);
glRasterPos2f(rect.xmin, rect.ymin);
glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixel_buf);
GPU_BASIC_SHADER_ENABLE_AND_RESTORE(bound_options);
glaDrawPixelsTex(rect.xmin, rect.ymin, w, h, GL_ALPHA, GL_UNSIGNED_BYTE, GL_NEAREST, pixel_buf);
glDisable(GL_BLEND);
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
glPixelTransferf(GL_RED_BIAS, 0);
glPixelTransferf(GL_GREEN_BIAS, 0);
glPixelTransferf(GL_BLUE_BIAS, 0);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
MEM_freeN(pixel_buf);
}

View File

@@ -1391,7 +1391,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
}
}
static void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg))
static void popup_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg))
{
wmOperator *op = op_ptr;
if (op->type->check) {
@@ -1423,7 +1423,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
UI_block_func_set(block, dialog_check_cb, op, NULL);
UI_block_func_set(block, popup_check_cb, op, NULL);
uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE);
@@ -1463,9 +1463,13 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
UI_block_func_set(block, popup_check_cb, op, NULL);
/* since ui is defined the auto-layout args are not used */
uiLayoutOperatorButs(C, layout, op, NULL, 'V', 0);
UI_block_func_set(block, NULL, NULL, NULL);
UI_block_bounds_set_popup(block, 4, 0, 0);
return block;