mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix some naming, remove NV_draw_texture, move decisions out
This commit is contained in:
parent
3b3461e7ab
commit
2b24f76d34
4 changed files with 21 additions and 37 deletions
|
@ -157,7 +157,7 @@ bool Texture::LoadPNG(const char *filename, bool genMips) {
|
|||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, image_data);
|
||||
if (genMips) {
|
||||
if (gl_extensions.FBO_ARB) {
|
||||
if (gl_extensions.ARB_framebuffer_object) {
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
} else {
|
||||
#ifndef USING_GLES2
|
||||
|
@ -188,7 +188,7 @@ bool Texture::LoadJPEG(const char *filename, bool genMips) {
|
|||
SetTextureParameters(genMips ? ZIM_GEN_MIPS : ZIM_CLAMP);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data);
|
||||
if (genMips) {
|
||||
if (gl_extensions.FBO_ARB) {
|
||||
if (gl_extensions.ARB_framebuffer_object) {
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
} else {
|
||||
#ifndef USING_GLES2
|
||||
|
@ -213,7 +213,7 @@ bool Texture::LoadPNG(const uint8_t *data, size_t size, bool genMips) {
|
|||
SetTextureParameters(genMips ? ZIM_GEN_MIPS : ZIM_CLAMP);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data);
|
||||
if (genMips) {
|
||||
if (gl_extensions.FBO_ARB) {
|
||||
if (gl_extensions.ARB_framebuffer_object) {
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
} else {
|
||||
#ifndef USING_GLES2
|
||||
|
@ -243,7 +243,7 @@ bool Texture::LoadXOR() {
|
|||
SetTextureParameters(ZIM_GEN_MIPS);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, buf);
|
||||
if(gl_extensions.FBO_ARB){
|
||||
if(gl_extensions.ARB_framebuffer_object){
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
}else{
|
||||
#ifndef USING_GLES2
|
||||
|
@ -342,7 +342,7 @@ bool Texture::LoadZIM(const char *filename) {
|
|||
colors, data_type, image_data[l]);
|
||||
}
|
||||
if (num_levels == 1 && (flags & ZIM_GEN_MIPS)) {
|
||||
if(gl_extensions.FBO_ARB) {
|
||||
if(gl_extensions.ARB_framebuffer_object) {
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
}else{
|
||||
#ifndef USING_GLES2
|
||||
|
|
|
@ -133,7 +133,7 @@ FBO *fbo_create(int width, int height, int num_color_textures, bool z_stencil, F
|
|||
CheckGLExtensions();
|
||||
|
||||
#ifndef USING_GLES2
|
||||
if(!gl_extensions.FBO_ARB)
|
||||
if(!gl_extensions.ARB_framebuffer_object)
|
||||
return fbo_ext_create(width, height, num_color_textures, z_stencil, colorDepth);
|
||||
#endif
|
||||
|
||||
|
@ -269,7 +269,7 @@ FBO *fbo_create_from_native_fbo(GLuint native_fbo, FBO *fbo)
|
|||
}
|
||||
|
||||
static GLenum fbo_get_fb_target(bool read, GLuint **cached) {
|
||||
bool supportsBlit = gl_extensions.FBO_ARB;
|
||||
bool supportsBlit = gl_extensions.ARB_framebuffer_object;
|
||||
if (gl_extensions.IsGLES) {
|
||||
supportsBlit = supportsBlit && (gl_extensions.GLES3 || gl_extensions.NV_framebuffer_blit);
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ static void fbo_bind_fb_target(bool read, GLuint name) {
|
|||
GLenum target = fbo_get_fb_target(read, &cached);
|
||||
|
||||
if (*cached != name) {
|
||||
if (gl_extensions.FBO_ARB) {
|
||||
if (gl_extensions.ARB_framebuffer_object) {
|
||||
glBindFramebuffer(target, name);
|
||||
} else {
|
||||
#ifndef USING_GLES2
|
||||
|
@ -312,7 +312,7 @@ void fbo_unbind() {
|
|||
}
|
||||
|
||||
CheckGLExtensions();
|
||||
if (gl_extensions.FBO_ARB) {
|
||||
if (gl_extensions.ARB_framebuffer_object) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
} else {
|
||||
#ifndef USING_GLES2
|
||||
|
@ -364,7 +364,7 @@ void fbo_destroy(FBO *fbo) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (gl_extensions.FBO_ARB) {
|
||||
if (gl_extensions.ARB_framebuffer_object) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo->handle);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
|
||||
|
|
|
@ -256,7 +256,6 @@ void CheckGLExtensions() {
|
|||
gl_extensions.OES_texture_npot = strstr(extString, "GL_ARB_texture_non_power_of_two") != 0
|
||||
&& !(((strncmp(renderer, "ATI RADEON X", 12) == 0) || (strncmp(renderer, "ATI MOBILITY RADEON X", 21) == 0)));
|
||||
|
||||
gl_extensions.NV_draw_texture = strstr(extString, "GL_NV_draw_texture") != 0;
|
||||
gl_extensions.ARB_blend_func_extended = strstr(extString, "GL_ARB_blend_func_extended") != 0;
|
||||
gl_extensions.EXT_blend_func_extended = strstr(extString, "GL_EXT_blend_func_extended") != 0;
|
||||
gl_extensions.ARB_conservative_depth = strstr(extString, "GL_ARB_conservative_depth") != 0;
|
||||
|
@ -264,11 +263,6 @@ void CheckGLExtensions() {
|
|||
gl_extensions.EXT_bgra = strstr(extString, "GL_EXT_bgra") != 0;
|
||||
gl_extensions.EXT_gpu_shader4 = strstr(extString, "GL_EXT_gpu_shader4") != 0;
|
||||
gl_extensions.NV_framebuffer_blit = strstr(extString, "GL_NV_framebuffer_blit") != 0;
|
||||
if (gl_extensions.gpuVendor == GPU_VENDOR_INTEL || !gl_extensions.VersionGEThan(3, 0, 0)) {
|
||||
// Force this extension to off on sub 3.0 OpenGL versions as it does not seem reliable
|
||||
// Also on Intel, see https://github.com/hrydgard/ppsspp/issues/4867
|
||||
gl_extensions.ARB_blend_func_extended = false;
|
||||
}
|
||||
|
||||
if (gl_extensions.IsGLES) {
|
||||
gl_extensions.OES_texture_npot = strstr(extString, "OES_texture_npot") != 0;
|
||||
|
@ -292,10 +286,6 @@ void CheckGLExtensions() {
|
|||
DLOG("Addresses returned for invalid extensions: %p %p", invalidAddress, invalidAddress2);
|
||||
#endif
|
||||
|
||||
if (gl_extensions.NV_draw_texture) {
|
||||
glDrawTextureNV = (PFNGLDRAWTEXTURENVPROC)eglGetProcAddress("glDrawTextureNV");
|
||||
}
|
||||
|
||||
if (gl_extensions.NV_copy_image) {
|
||||
glCopyImageSubDataNV = (PFNGLCOPYIMAGESUBDATANVPROC)eglGetProcAddress("glCopyImageSubDataNV");
|
||||
}
|
||||
|
@ -356,6 +346,7 @@ void CheckGLExtensions() {
|
|||
}
|
||||
#endif
|
||||
|
||||
// This is probably a waste of time, implementations lie.
|
||||
if (gl_extensions.IsGLES || strstr(extString, "GL_ARB_ES2_compatibility")) {
|
||||
const GLint precisions[6] = {
|
||||
GL_LOW_FLOAT, GL_MEDIUM_FLOAT, GL_HIGH_FLOAT,
|
||||
|
@ -372,19 +363,13 @@ void CheckGLExtensions() {
|
|||
}
|
||||
|
||||
if (gl_extensions.IsGLES) {
|
||||
gl_extensions.FBO_ARB = true;
|
||||
gl_extensions.FBO_EXT = false;
|
||||
gl_extensions.ARB_framebuffer_object = true; // TODO: This is a lie! ES2 just has a subset.
|
||||
gl_extensions.EXT_framebuffer_object = false;
|
||||
} else {
|
||||
gl_extensions.FBO_ARB = false;
|
||||
gl_extensions.FBO_EXT = false;
|
||||
gl_extensions.PBO_ARB = true;
|
||||
gl_extensions.PBO_NV = true;
|
||||
if (strlen(extString) != 0) {
|
||||
gl_extensions.FBO_ARB = strstr(extString, "GL_ARB_framebuffer_object") != 0;
|
||||
gl_extensions.FBO_EXT = strstr(extString, "GL_EXT_framebuffer_object") != 0;
|
||||
gl_extensions.PBO_ARB = strstr(extString, "GL_ARB_pixel_buffer_object") != 0;
|
||||
gl_extensions.PBO_NV = strstr(extString, "GL_NV_pixel_buffer_object") != 0;
|
||||
}
|
||||
gl_extensions.ARB_framebuffer_object = strstr(extString, "GL_ARB_framebuffer_object") != 0;
|
||||
gl_extensions.EXT_framebuffer_object = strstr(extString, "GL_EXT_framebuffer_object") != 0;
|
||||
gl_extensions.ARB_pixel_buffer_object = strstr(extString, "GL_ARB_pixel_buffer_object") != 0;
|
||||
gl_extensions.NV_pixel_buffer_object = strstr(extString, "GL_NV_pixel_buffer_object") != 0;
|
||||
}
|
||||
|
||||
ProcessGPUFeatures();
|
||||
|
|
|
@ -45,8 +45,8 @@ struct GLExtensions {
|
|||
bool OES_vertex_array_object;
|
||||
|
||||
// ARB
|
||||
bool FBO_ARB;
|
||||
bool PBO_ARB;
|
||||
bool ARB_framebuffer_object;
|
||||
bool ARB_pixel_buffer_object;
|
||||
bool ARB_blend_func_extended; // dual source blending
|
||||
bool EXT_blend_func_extended; // dual source blending (GLES, new 2015)
|
||||
bool ARB_shader_image_load_store;
|
||||
|
@ -60,15 +60,14 @@ struct GLExtensions {
|
|||
bool EXT_shader_framebuffer_fetch;
|
||||
bool EXT_gpu_shader4;
|
||||
bool EXT_blend_minmax;
|
||||
bool FBO_EXT;
|
||||
bool EXT_framebuffer_object;
|
||||
bool PBO_EXT;
|
||||
|
||||
// NV
|
||||
bool NV_shader_framebuffer_fetch;
|
||||
bool NV_draw_texture;
|
||||
bool NV_copy_image;
|
||||
bool NV_framebuffer_blit;
|
||||
bool PBO_NV; // GL_NV_pixel_buffer_object
|
||||
bool NV_pixel_buffer_object; // GL_NV_pixel_buffer_object
|
||||
|
||||
// ARM
|
||||
bool ARM_shader_framebuffer_fetch;
|
||||
|
|
Loading…
Add table
Reference in a new issue