forked from bartvdbraak/blender
Cleanup: style
This commit is contained in:
parent
61bed8768d
commit
c517778a8b
@ -134,7 +134,7 @@ typedef struct GlyphBLF {
|
|||||||
int advance_i;
|
int advance_i;
|
||||||
|
|
||||||
/* texture id where this glyph is store. */
|
/* texture id where this glyph is store. */
|
||||||
GPUTexture* tex;
|
GPUTexture *tex;
|
||||||
|
|
||||||
/* position inside the texture where this glyph is store. */
|
/* position inside the texture where this glyph is store. */
|
||||||
int offset_x;
|
int offset_x;
|
||||||
|
@ -174,4 +174,4 @@ int workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd, Image *i
|
|||||||
color_type = V3D_SHADING_MATERIAL_COLOR;
|
color_type = V3D_SHADING_MATERIAL_COLOR;
|
||||||
}
|
}
|
||||||
return color_type;
|
return color_type;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,9 @@ GPUTexture *GPU_texture_from_blender(
|
|||||||
GPUTexture *GPU_texture_from_preview(struct PreviewImage *prv, int mipmap);
|
GPUTexture *GPU_texture_from_preview(struct PreviewImage *prv, int mipmap);
|
||||||
|
|
||||||
void GPU_texture_update(GPUTexture *tex, const void *pixels);
|
void GPU_texture_update(GPUTexture *tex, const void *pixels);
|
||||||
void GPU_texture_update_sub(GPUTexture *tex, const void *pixels, int offset_x, int offset_y, int offset_z, int width, int height, int depth);
|
void GPU_texture_update_sub(
|
||||||
|
GPUTexture *tex, const void *pixels,
|
||||||
|
int offset_x, int offset_y, int offset_z, int width, int height, int depth);
|
||||||
|
|
||||||
void GPU_invalid_tex_init(void);
|
void GPU_invalid_tex_init(void);
|
||||||
void GPU_invalid_tex_bind(int mode);
|
void GPU_invalid_tex_bind(int mode);
|
||||||
|
@ -886,11 +886,13 @@ GPUTexture *GPU_texture_create_from_vertbuf(Gwn_VertBuf *vert)
|
|||||||
return GPU_texture_create_buffer(data_type, vert->vbo_id);
|
return GPU_texture_create_buffer(data_type, vert->vbo_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_texture_update_sub(GPUTexture *tex, const void *pixels, int offset_x, int offset_y, int offset_z, int width, int height, int depth)
|
void GPU_texture_update_sub(
|
||||||
|
GPUTexture *tex, const void *pixels,
|
||||||
|
int offset_x, int offset_y, int offset_z, int width, int height, int depth)
|
||||||
{
|
{
|
||||||
BLI_assert((int)tex->format > -1);
|
BLI_assert((int)tex->format > -1);
|
||||||
BLI_assert(tex->components > -1);
|
BLI_assert(tex->components > -1);
|
||||||
|
|
||||||
GLenum format, data_format;
|
GLenum format, data_format;
|
||||||
GLint alignment;
|
GLint alignment;
|
||||||
gpu_texture_get_format(tex->components, tex->format, &format, &data_format,
|
gpu_texture_get_format(tex->components, tex->format, &format, &data_format,
|
||||||
@ -899,7 +901,7 @@ void GPU_texture_update_sub(GPUTexture *tex, const void *pixels, int offset_x, i
|
|||||||
/* The default pack size for textures is 4, which won't work for byte based textures */
|
/* The default pack size for textures is 4, which won't work for byte based textures */
|
||||||
if (tex->bytesize == 1) {
|
if (tex->bytesize == 1) {
|
||||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
|
glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(tex->target, tex->bindcode);
|
glBindTexture(tex->target, tex->bindcode);
|
||||||
@ -907,14 +909,18 @@ void GPU_texture_update_sub(GPUTexture *tex, const void *pixels, int offset_x, i
|
|||||||
case GL_TEXTURE_2D:
|
case GL_TEXTURE_2D:
|
||||||
case GL_TEXTURE_2D_MULTISAMPLE:
|
case GL_TEXTURE_2D_MULTISAMPLE:
|
||||||
case GL_TEXTURE_1D_ARRAY:
|
case GL_TEXTURE_1D_ARRAY:
|
||||||
glTexSubImage2D(tex->target, 0, offset_x, offset_y, width, height, format, data_format, pixels);
|
glTexSubImage2D(
|
||||||
|
tex->target, 0, offset_x, offset_y,
|
||||||
|
width, height, format, data_format, pixels);
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_1D:
|
case GL_TEXTURE_1D:
|
||||||
glTexSubImage1D(tex->target, 0, offset_x, width, format, data_format, pixels);
|
glTexSubImage1D(tex->target, 0, offset_x, width, format, data_format, pixels);
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_3D:
|
case GL_TEXTURE_3D:
|
||||||
case GL_TEXTURE_2D_ARRAY:
|
case GL_TEXTURE_2D_ARRAY:
|
||||||
glTexSubImage3D(tex->target, 0, offset_x, offset_y, offset_z, width, height, depth, format, data_format, pixels);
|
glTexSubImage3D(
|
||||||
|
tex->target, 0, offset_x, offset_y, offset_z,
|
||||||
|
width, height, depth, format, data_format, pixels);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BLI_assert(!"tex->target mode not supported");
|
BLI_assert(!"tex->target mode not supported");
|
||||||
@ -1064,9 +1070,10 @@ void GPU_texture_mipmap_mode(GPUTexture *tex, bool use_mipmap, bool use_filter)
|
|||||||
BLI_assert((!use_filter && !use_mipmap) || !(GPU_texture_stencil(tex) || GPU_texture_integer(tex)));
|
BLI_assert((!use_filter && !use_mipmap) || !(GPU_texture_stencil(tex) || GPU_texture_integer(tex)));
|
||||||
|
|
||||||
GLenum filter = (use_filter) ? GL_LINEAR : GL_NEAREST;
|
GLenum filter = (use_filter) ? GL_LINEAR : GL_NEAREST;
|
||||||
GLenum mipmap = (use_filter)
|
GLenum mipmap = (
|
||||||
? (use_mipmap) ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR
|
(use_filter) ?
|
||||||
: (use_mipmap) ? GL_NEAREST_MIPMAP_LINEAR : GL_NEAREST;
|
(use_mipmap) ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR :
|
||||||
|
(use_mipmap) ? GL_NEAREST_MIPMAP_LINEAR : GL_NEAREST);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0 + tex->number);
|
glActiveTexture(GL_TEXTURE0 + tex->number);
|
||||||
glTexParameteri(tex->target_base, GL_TEXTURE_MIN_FILTER, mipmap);
|
glTexParameteri(tex->target_base, GL_TEXTURE_MIN_FILTER, mipmap);
|
||||||
@ -1089,22 +1096,21 @@ void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat)
|
|||||||
|
|
||||||
static GLenum gpu_get_gl_filterfunction(GPUFilterFunction filter)
|
static GLenum gpu_get_gl_filterfunction(GPUFilterFunction filter)
|
||||||
{
|
{
|
||||||
switch (filter)
|
switch (filter) {
|
||||||
{
|
|
||||||
case GPU_NEAREST:
|
case GPU_NEAREST:
|
||||||
return GL_NEAREST;
|
return GL_NEAREST;
|
||||||
case GPU_LINEAR:
|
case GPU_LINEAR:
|
||||||
return GL_LINEAR;
|
return GL_LINEAR;
|
||||||
default:
|
default:
|
||||||
BLI_assert(!"Unhandled filter mode");
|
BLI_assert(!"Unhandled filter mode");
|
||||||
return GL_NEAREST;
|
return GL_NEAREST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_texture_filters(GPUTexture *tex, GPUFilterFunction min_filter, GPUFilterFunction mag_filter)
|
void GPU_texture_filters(GPUTexture *tex, GPUFilterFunction min_filter, GPUFilterFunction mag_filter)
|
||||||
{
|
{
|
||||||
WARN_NOT_BOUND(tex);
|
WARN_NOT_BOUND(tex);
|
||||||
|
|
||||||
/* Stencil and integer format does not support filtering. */
|
/* Stencil and integer format does not support filtering. */
|
||||||
BLI_assert(!(GPU_texture_stencil(tex) || GPU_texture_integer(tex)));
|
BLI_assert(!(GPU_texture_stencil(tex) || GPU_texture_integer(tex)));
|
||||||
BLI_assert(mag_filter == GPU_NEAREST || mag_filter == GPU_LINEAR);
|
BLI_assert(mag_filter == GPU_NEAREST || mag_filter == GPU_LINEAR);
|
||||||
@ -1281,7 +1287,9 @@ static GLenum gpu_get_gl_blendfunction(GPUBlendFunction blend)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_blend_set_func_separate(GPUBlendFunction src_rgb, GPUBlendFunction dst_rgb, GPUBlendFunction src_alpha, GPUBlendFunction dst_alpha)
|
void GPU_blend_set_func_separate(
|
||||||
|
GPUBlendFunction src_rgb, GPUBlendFunction dst_rgb,
|
||||||
|
GPUBlendFunction src_alpha, GPUBlendFunction dst_alpha)
|
||||||
{
|
{
|
||||||
glBlendFuncSeparate(gpu_get_gl_blendfunction(src_rgb),
|
glBlendFuncSeparate(gpu_get_gl_blendfunction(src_rgb),
|
||||||
gpu_get_gl_blendfunction(dst_rgb),
|
gpu_get_gl_blendfunction(dst_rgb),
|
||||||
@ -1293,4 +1301,3 @@ void GPU_blend_set_func(GPUBlendFunction sfactor, GPUBlendFunction dfactor)
|
|||||||
{
|
{
|
||||||
glBlendFunc(gpu_get_gl_blendfunction(sfactor), gpu_get_gl_blendfunction(dfactor));
|
glBlendFunc(gpu_get_gl_blendfunction(sfactor), gpu_get_gl_blendfunction(dfactor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user