[Bf-blender-cvs] [b25e4b3] master: OpenGL: remove non-power-of-two texture check, where even ES 2.0 does not need it.
Brecht Van Lommel
noreply at git.blender.org
Tue Dec 8 20:22:13 CET 2015
Commit: b25e4b310f87fc86942acd29fccf1474ea5120df
Author: Brecht Van Lommel
Date: Sun Dec 6 21:41:21 2015 +0100
Branches: master
https://developer.blender.org/rBb25e4b310f87fc86942acd29fccf1474ea5120df
OpenGL: remove non-power-of-two texture check, where even ES 2.0 does not need it.
===================================================================
M source/blender/blenfont/intern/blf_glyph.c
M source/blender/editors/interface/interface_icons.c
M source/blender/editors/space_view3d/drawobject.c
M source/blender/editors/space_view3d/drawvolume.c
M source/blender/editors/space_view3d/view3d_intern.h
M source/blender/gpu/GPU_extensions.h
M source/blender/gpu/intern/gpu_compositing.c
M source/blender/gpu/intern/gpu_draw.c
M source/blender/gpu/intern/gpu_extensions.c
M source/blender/gpu/intern/gpu_material.c
M source/blender/windowmanager/intern/wm_draw.c
M source/blender/windowmanager/intern/wm_stereo.c
M source/blender/windowmanager/wm_draw.h
M source/gameengine/Ketsji/BL_Texture.cpp
M source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
===================================================================
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 4399cbf..1c13e42 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -170,8 +170,8 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
glGenTextures(1, &gc->textures[gc->cur_tex]);
glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state = gc->textures[gc->cur_tex]));
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 43b48e3..8e6558c 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -627,7 +627,7 @@ static void init_internal_icons(void)
}
/* we only use a texture for cards with non-power of two */
- if (GPU_non_power_of_two_support()) {
+ if (GPU_full_non_power_of_two_support()) {
glGenTextures(1, &icongltex.id);
if (icongltex.id) {
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 8944c31..f2240c6 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -8039,13 +8039,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
if (!sds->wt || !(sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
sds->tex = NULL;
GPU_create_smoke(smd, 0);
- draw_smoke_volume(sds, ob, p0, p1, sds->res, viewnormal);
+ draw_smoke_volume(sds, ob, p0, p1, viewnormal);
GPU_free_smoke(smd);
}
else if (sds->wt && (sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
sds->tex = NULL;
GPU_create_smoke(smd, 1);
- draw_smoke_volume(sds, ob, p0, p1, sds->res_wt, viewnormal);
+ draw_smoke_volume(sds, ob, p0, p1, viewnormal);
GPU_free_smoke(smd);
}
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 7f102bc..3029aae 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -135,9 +135,9 @@ static GPUTexture *create_flame_spectrum_texture(void)
void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
const float min[3], const float max[3],
- const int res[3], const float viewnormal[3])
+ const float viewnormal[3])
{
- GPUTexture *tex_spec;
+ GPUTexture *tex_spec = NULL;
GPUProgram *smoke_program;
const int progtype = (sds->active_fields & SM_ACTIVE_COLORS) ? GPU_PROGRAM_SMOKE_COLORED
: GPU_PROGRAM_SMOKE;
@@ -152,7 +152,6 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
float d /*, d0 */ /* UNUSED */, dd, ds;
float (*points)[3] = NULL;
int numpoints = 0;
- float cor[3] = {1.0f, 1.0f, 1.0f};
int gl_depth = 0, gl_blend = 0;
const bool use_fire = (sds->active_fields & SM_ACTIVE_FIRE) != 0;
@@ -171,6 +170,7 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
};
const float size[3] = { max[0] - min[0], max[1] - min[1], max[2] - min[2] };
+ const float invsize[3] = { 1.0f / size[0], 1.0f / size[1], 1.0f / size[2] };
/* edges have the form edges[n][0][xyz] + t*edges[n][1][xyz] */
const float edges[12][2][3] = {
@@ -257,16 +257,6 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
GPU_texture_bind(tex_spec, 3);
}
- if (!GPU_non_power_of_two_support()) {
- cor[0] = (float)res[0] / (float)power_of_2_max_u(res[0]);
- cor[1] = (float)res[1] / (float)power_of_2_max_u(res[1]);
- cor[2] = (float)res[2] / (float)power_of_2_max_u(res[2]);
- }
-
- cor[0] /= size[0];
- cor[1] /= size[1];
- cor[2] /= size[2];
-
/* our slices are defined by the plane equation a*x + b*y +c*z + d = 0
* (a,b,c), the plane normal, are given by viewdir
* d is the parameter along the view direction. the first d is given by
@@ -318,9 +308,9 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
GPU_program_parameter_4f(smoke_program, 2, 1.0, 0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
for (i = 0; i < numpoints; i++) {
- glTexCoord3d((points[i][0] - min[0]) * cor[0],
- (points[i][1] - min[1]) * cor[1],
- (points[i][2] - min[2]) * cor[2]);
+ glTexCoord3d((points[i][0] - min[0]) * invsize[0],
+ (points[i][1] - min[1]) * invsize[1],
+ (points[i][2] - min[2]) * invsize[2]);
glVertex3f(points[i][0] * ob_sizei[0],
points[i][1] * ob_sizei[1],
points[i][2] * ob_sizei[2]);
@@ -334,9 +324,9 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
GPU_program_parameter_4f(smoke_program, 2, -1.0, 0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
for (i = 0; i < numpoints; i++) {
- glTexCoord3d((points[i][0] - min[0]) * cor[0],
- (points[i][1] - min[1]) * cor[1],
- (points[i][2] - min[2]) * cor[2]);
+ glTexCoord3d((points[i][0] - min[0]) * invsize[0],
+ (points[i][1] - min[1]) * invsize[1],
+ (points[i][2] - min[2]) * invsize[2]);
glVertex3f(points[i][0] * ob_sizei[0],
points[i][1] * ob_sizei[1],
points[i][2] * ob_sizei[2]);
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 325fd9e..2c6d762 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -274,7 +274,7 @@ extern const char *view3d_context_dir[]; /* doc access */
/* draw_volume.c */
void draw_smoke_volume(struct SmokeDomainSettings *sds, struct Object *ob,
const float min[3], const float max[3],
- const int res[3], const float viewnormal[3]);
+ const float viewnormal[3]);
//#define SMOKE_DEBUG_VELOCITY
//#define SMOKE_DEBUG_HEAT
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index a5bcedb..ef582b6 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -61,7 +61,7 @@ void GPU_extensions_disable(void);
bool GPU_legacy_support(void);
bool GPU_glsl_support(void);
-bool GPU_non_power_of_two_support(void);
+bool GPU_full_non_power_of_two_support(void);
bool GPU_display_list_support(void);
bool GPU_bicubic_bump_support(void);
bool GPU_geometry_shader_support(void);
@@ -107,9 +107,7 @@ bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver);
* - always returns unsigned char RGBA textures
* - if texture with non square dimensions is created, depending on the
* graphics card capabilities the texture may actually be stored in a
- * larger texture with power of two dimensions. the actual dimensions
- * may be queried with GPU_texture_opengl_width/height. GPU_texture_coord_2f
- * calls glTexCoord2f with the coordinates adjusted for this.
+ * larger texture with power of two dimensions.
* - can use reference counting:
* - reference counter after GPU_texture_create is 1
* - GPU_texture_ref increases by one
@@ -151,8 +149,8 @@ void GPU_texture_filter_mode(GPUTexture *tex, bool compare, bool use_filter);
GPUFrameBuffer *GPU_texture_framebuffer(GPUTexture *tex);
int GPU_texture_target(const GPUTexture *tex);
-int GPU_texture_opengl_width(const GPUTexture *tex);
-int GPU_texture_opengl_height(const GPUTexture *tex);
+int GPU_texture_width(const GPUTexture *tex);
+int GPU_texture_height(const GPUTexture *tex);
int GPU_texture_opengl_bindcode(const GPUTexture *tex);
/* GPU Framebuffer
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index 1ad35c1..dfea4a5 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -304,7 +304,7 @@ bool GPU_fx_compositor_initialize_passes(
fx->effects = 0;
- if (!GPU_non_power_of_two_support() || !GLEW_EXT_framebuffer_object)
+ if (!GLEW_EXT_framebuffer_object)
return false;
if (!fx_settings) {
@@ -1082,12 +1082,12 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
{
int invrendertargetdim_uniform, color_uniform, depth_uniform, dof_uniform;
int viewvecs_uniform;
- float invrendertargetdim[2] = {1.0f / GPU_texture_opengl_width(fx->dof_near_coc_blurred_buffer),
- 1.0f / GPU_texture_opengl_height(fx->dof_near_coc_blurred_buffer)};
+ float invrendertargetdim[2] = {1.0f / GPU_texture_width(fx->dof_near_coc_blurred_buffer),
+ 1.0f / GPU_texture_height(fx->dof_near_coc_blurred_buffer)};
float tmp = invrendertargetdim[0];
invrendertargetdim[0] = 0.0f;
- dof_params[2] = GPU_texture_opengl_width(fx->dof_near_coc_blurred_buffer) / (scale_camera * fx_dof->sensor);
+ dof_params[2] = GPU_texture_width(fx->dof_near_coc_blurred_buffer) / (scale_camera * fx_dof->sensor);
dof_uniform = GPU_shader_get_uniform(dof_shader_pass2, "dof_params");
invrendertargetdim_uniform = GPU_shader_get_uniform(dof_shader_pass2, "invrendertargetdim");
@@ -1174,8 +1174,8 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
{
int near_coc_downsampled;
int invrendertargetdim_uniform;
- float invrendertargetdim[2] = {1.0f / GPU_texture_opengl_width(fx->dof_near_coc_blurred_buffer),
- 1.0f / GPU_texture_opengl_height(fx->dof_near_coc_blurred_buffer)};
+ float invrendertargetdim[2] = {1.0f / GPU_texture_width(fx->dof_near_coc_blurred_buffer),
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list