Cleanup: GPU: Remove GPU_glew.h outside of GPU module
Remove use of GL* constants and types inside the codebase. There is still a few occurence to get rid of.
This commit is contained in:
parent
9e23dbd060
commit
18cca0e704
|
@ -32,8 +32,6 @@
|
|||
#include "CCGSubSurf.h"
|
||||
#include "CCGSubSurf_intern.h"
|
||||
|
||||
#include "GPU_glew.h"
|
||||
|
||||
/***/
|
||||
|
||||
int BKE_ccg_gridsize(int level)
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "ED_view3d.h"
|
||||
|
||||
#include "GPU_batch.h"
|
||||
#include "GPU_glew.h"
|
||||
#include "GPU_immediate.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
|
|
@ -416,10 +416,10 @@ static bool gpencil_render_offscreen(tGPDfill *tgpf)
|
|||
|
||||
/* create a image to see result of template */
|
||||
if (ibuf->rect_float) {
|
||||
GPU_offscreen_read_pixels(offscreen, GL_FLOAT, ibuf->rect_float);
|
||||
GPU_offscreen_read_pixels(offscreen, GPU_DATA_FLOAT, ibuf->rect_float);
|
||||
}
|
||||
else if (ibuf->rect) {
|
||||
GPU_offscreen_read_pixels(offscreen, GL_UNSIGNED_BYTE, ibuf->rect);
|
||||
GPU_offscreen_read_pixels(offscreen, GPU_DATA_UNSIGNED_BYTE, ibuf->rect);
|
||||
}
|
||||
if (ibuf->rect_float && ibuf->rect) {
|
||||
IMB_rect_from_float(ibuf);
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#include "BKE_screen.h"
|
||||
#include "BKE_unit.h"
|
||||
|
||||
#include "GPU_glew.h"
|
||||
#include "GPU_matrix.h"
|
||||
#include "GPU_state.h"
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "GPU_glew.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "IMB_colormanagement.h"
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
#include "RNA_define.h"
|
||||
|
||||
#include "GPU_framebuffer.h"
|
||||
#include "GPU_glew.h"
|
||||
#include "GPU_matrix.h"
|
||||
|
||||
#include "render_intern.h"
|
||||
|
@ -351,7 +350,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
|
|||
G.f &= ~G_FLAG_RENDER_VIEWPORT;
|
||||
|
||||
gp_rect = MEM_mallocN(sizex * sizey * sizeof(uchar) * 4, "offscreen rect");
|
||||
GPU_offscreen_read_pixels(oglrender->ofs, GL_UNSIGNED_BYTE, gp_rect);
|
||||
GPU_offscreen_read_pixels(oglrender->ofs, GPU_DATA_UNSIGNED_BYTE, gp_rect);
|
||||
|
||||
for (i = 0; i < sizex * sizey * 4; i += 4) {
|
||||
blend_color_mix_byte(&render_rect[i], &render_rect[i], &gp_rect[i]);
|
||||
|
|
|
@ -619,7 +619,7 @@ void ED_screen_preview_render(const bScreen *screen, int size_x, int size_y, uin
|
|||
|
||||
screen_preview_draw(screen, size_x, size_y);
|
||||
|
||||
GPU_offscreen_read_pixels(offscreen, GL_UNSIGNED_BYTE, r_rect);
|
||||
GPU_offscreen_read_pixels(offscreen, GPU_DATA_UNSIGNED_BYTE, r_rect);
|
||||
GPU_offscreen_unbind(offscreen, true);
|
||||
|
||||
GPU_offscreen_free(offscreen);
|
||||
|
|
|
@ -50,8 +50,6 @@
|
|||
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "GPU_glew.h"
|
||||
|
||||
#include "buttons_intern.h" /* own include */
|
||||
|
||||
/* ******************** default callbacks for buttons space ***************** */
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#include "IMB_imbuf.h"
|
||||
|
||||
#include "GPU_framebuffer.h"
|
||||
#include "GPU_glew.h"
|
||||
#include "GPU_matrix.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
|
|
|
@ -1954,10 +1954,10 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph,
|
|||
NULL);
|
||||
|
||||
if (ibuf->rect_float) {
|
||||
GPU_offscreen_read_pixels(ofs, GL_FLOAT, ibuf->rect_float);
|
||||
GPU_offscreen_read_pixels(ofs, GPU_DATA_FLOAT, ibuf->rect_float);
|
||||
}
|
||||
else if (ibuf->rect) {
|
||||
GPU_offscreen_read_pixels(ofs, GL_UNSIGNED_BYTE, ibuf->rect);
|
||||
GPU_offscreen_read_pixels(ofs, GPU_DATA_UNSIGNED_BYTE, ibuf->rect);
|
||||
}
|
||||
|
||||
/* unbind */
|
||||
|
|
|
@ -97,7 +97,6 @@
|
|||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "GPU_glew.h"
|
||||
#include "GPU_matrix.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "GPU_glew.h"
|
||||
#include "GPU_matrix.h"
|
||||
#include "GPU_select.h"
|
||||
#include "GPU_state.h"
|
||||
|
|
|
@ -212,7 +212,7 @@ GPUOffScreen *GPU_offscreen_create(
|
|||
void GPU_offscreen_free(GPUOffScreen *ofs);
|
||||
void GPU_offscreen_bind(GPUOffScreen *ofs, bool save);
|
||||
void GPU_offscreen_unbind(GPUOffScreen *ofs, bool restore);
|
||||
void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels);
|
||||
void GPU_offscreen_read_pixels(GPUOffScreen *ofs, eGPUDataFormat type, void *pixels);
|
||||
void GPU_offscreen_draw_to_screen(GPUOffScreen *ofs, int x, int y);
|
||||
int GPU_offscreen_width(const GPUOffScreen *ofs);
|
||||
int GPU_offscreen_height(const GPUOffScreen *ofs);
|
||||
|
|
|
@ -1033,14 +1033,15 @@ void GPU_offscreen_draw_to_screen(GPUOffScreen *ofs, int x, int y)
|
|||
glBindFramebuffer(GL_READ_FRAMEBUFFER, GPU_framebuffer_default());
|
||||
}
|
||||
|
||||
void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels)
|
||||
void GPU_offscreen_read_pixels(GPUOffScreen *ofs, eGPUDataFormat type, void *pixels)
|
||||
{
|
||||
const int w = GPU_texture_width(ofs->color);
|
||||
const int h = GPU_texture_height(ofs->color);
|
||||
|
||||
BLI_assert(type == GL_UNSIGNED_BYTE || type == GL_FLOAT);
|
||||
BLI_assert(ELEM(type, GPU_DATA_UNSIGNED_BYTE, GL_FLOAT));
|
||||
GLenum gl_type = (type == GPU_DATA_FLOAT) ? GL_FLOAT : GL_UNSIGNED_BYTE;
|
||||
|
||||
glReadPixels(0, 0, w, h, GL_RGBA, type, pixels);
|
||||
glReadPixels(0, 0, w, h, GL_RGBA, gl_type, pixels);
|
||||
}
|
||||
|
||||
int GPU_offscreen_width(const GPUOffScreen *ofs)
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "ED_select_utils.h"
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#include "GPU_glew.h"
|
||||
#include "GPU_matrix.h"
|
||||
#include "GPU_select.h"
|
||||
#include "GPU_state.h"
|
||||
|
@ -582,7 +581,7 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos,
|
|||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
rcti rect;
|
||||
/* Almost certainly overkill, but allow for many custom gizmos. */
|
||||
GLuint buffer[MAXPICKBUF];
|
||||
uint buffer[MAXPICKBUF];
|
||||
short hits;
|
||||
|
||||
BLI_rcti_init_pt_radius(&rect, co, hotspot);
|
||||
|
@ -625,7 +624,7 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos,
|
|||
|
||||
GPU_matrix_unproject_with_precalc(&unproj_precalc, co_screen, co_3d_origin);
|
||||
|
||||
GLuint *buf_iter = buffer;
|
||||
uint *buf_iter = buffer;
|
||||
int hit_found = -1;
|
||||
float dot_best = FLT_MAX;
|
||||
|
||||
|
@ -649,7 +648,7 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos,
|
|||
return hit_found;
|
||||
}
|
||||
else {
|
||||
const GLuint *hit_near = GPU_select_buffer_near(buffer, hits);
|
||||
const uint *hit_near = GPU_select_buffer_near(buffer, hits);
|
||||
return hit_near ? hit_near[3] : -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#ifndef __WM_DRAW_H__
|
||||
#define __WM_DRAW_H__
|
||||
|
||||
#include "GPU_glew.h"
|
||||
|
||||
struct GPUOffScreen;
|
||||
struct GPUTexture;
|
||||
struct GPUViewport;
|
||||
|
|
Loading…
Reference in New Issue