Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_extensions.c
| Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | static struct GPUGlobal { | ||||
| GLint maxtexlayers; | GLint maxtexlayers; | ||||
| GLint maxcubemapsize; | GLint maxcubemapsize; | ||||
| GLint maxtextures; | GLint maxtextures; | ||||
| GLint maxtexturesfrag; | GLint maxtexturesfrag; | ||||
| GLint maxtexturesgeom; | GLint maxtexturesgeom; | ||||
| GLint maxtexturesvert; | GLint maxtexturesvert; | ||||
| GLint maxubosize; | GLint maxubosize; | ||||
| GLint maxubobinds; | GLint maxubobinds; | ||||
| int colordepth; | |||||
| int samples_color_texture_max; | int samples_color_texture_max; | ||||
| eGPUDeviceType device; | eGPUDeviceType device; | ||||
| eGPUOSType os; | eGPUOSType os; | ||||
| eGPUDriverType driver; | eGPUDriverType driver; | ||||
| float line_width_range[2]; | float line_width_range[2]; | ||||
| /* workaround for different calculation of dfdy factors on GPUs. Some GPUs/drivers | /* workaround for different calculation of dfdy factors on GPUs. Some GPUs/drivers | ||||
| * calculate dfdy in shader differently when drawing to an offscreen buffer. First | * calculate dfdy in shader differently when drawing to an offscreen buffer. First | ||||
| * number is factor on screen and second is off-screen */ | * number is factor on screen and second is off-screen */ | ||||
| ▲ Show 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | |||||
| #ifndef NDEBUG | #ifndef NDEBUG | ||||
| GLint ret; | GLint ret; | ||||
| glBindFramebuffer(GL_FRAMEBUFFER, 0); | glBindFramebuffer(GL_FRAMEBUFFER, 0); | ||||
| glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &ret); | glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &ret); | ||||
| /* We expect FRONT_LEFT to be the default buffer. */ | /* We expect FRONT_LEFT to be the default buffer. */ | ||||
| BLI_assert(ret == GL_FRAMEBUFFER_DEFAULT); | BLI_assert(ret == GL_FRAMEBUFFER_DEFAULT); | ||||
| #endif | #endif | ||||
| GLint r, g, b; | |||||
| glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, &r); | |||||
| glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, &g); | |||||
| glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, &b); | |||||
| GG.colordepth = r + g + b; /* Assumes same depth for RGB. */ | |||||
| glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &GG.samples_color_texture_max); | glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &GG.samples_color_texture_max); | ||||
| const char *vendor = (const char *)glGetString(GL_VENDOR); | const char *vendor = (const char *)glGetString(GL_VENDOR); | ||||
| const char *renderer = (const char *)glGetString(GL_RENDERER); | const char *renderer = (const char *)glGetString(GL_RENDERER); | ||||
| const char *version = (const char *)glGetString(GL_VERSION); | const char *version = (const char *)glGetString(GL_VERSION); | ||||
| if (strstr(vendor, "ATI") || strstr(vendor, "AMD")) { | if (strstr(vendor, "ATI") || strstr(vendor, "AMD")) { | ||||
| GG.device = GPU_DEVICE_ATI; | GG.device = GPU_DEVICE_ATI; | ||||
| ▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | #endif | ||||
| GPU_invalid_tex_init(); | GPU_invalid_tex_init(); | ||||
| } | } | ||||
| void gpu_extensions_exit(void) | void gpu_extensions_exit(void) | ||||
| { | { | ||||
| GPU_invalid_tex_free(); | GPU_invalid_tex_free(); | ||||
| } | } | ||||
| int GPU_color_depth(void) | |||||
| { | |||||
| return GG.colordepth; | |||||
| } | |||||
| bool GPU_mem_stats_supported(void) | bool GPU_mem_stats_supported(void) | ||||
| { | { | ||||
| return (GLEW_NVX_gpu_memory_info || GLEW_ATI_meminfo) && (G.debug & G_DEBUG_GPU_MEM); | return (GLEW_NVX_gpu_memory_info || GLEW_ATI_meminfo) && (G.debug & G_DEBUG_GPU_MEM); | ||||
| } | } | ||||
| void GPU_mem_stats_get(int *totalmem, int *freemem) | void GPU_mem_stats_get(int *totalmem, int *freemem) | ||||
| { | { | ||||
| Show All 20 Lines | |||||