Fix Win32 HW render.

This commit is contained in:
Themaister 2013-03-29 02:12:08 +01:00
parent 6758bca69d
commit f4e9547e68
3 changed files with 18 additions and 4 deletions

View File

@ -700,10 +700,13 @@ void gl_init_fbo(void *data, unsigned width, unsigned height)
gl->fbo_inited = true;
}
void gl_init_hw_render(gl_t *gl, unsigned width, unsigned height)
bool gl_init_hw_render(gl_t *gl, unsigned width, unsigned height)
{
RARCH_LOG("[GL]: Initializing HW render (%u x %u).\n", width, height);
if (!load_fbo_proc(gl))
return false;
glBindTexture(GL_TEXTURE_2D, 0);
pglGenFramebuffers(TEXTURES, gl->hw_render_fbo);
@ -713,11 +716,15 @@ void gl_init_hw_render(gl_t *gl, unsigned width, unsigned height)
pglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gl->texture[i], 0);
GLenum status = pglCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
{
RARCH_ERR("[GL]: Failed to create HW render FBO.\n");
return false;
}
}
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
gl->hw_render_fbo_init = true;
return true;
}
#endif
@ -1936,8 +1943,13 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
// Set up render to texture.
gl_init_fbo(gl, gl->tex_w, gl->tex_h);
if (g_extern.system.hw_render_callback.context_type == RETRO_HW_CONTEXT_OPENGL)
gl_init_hw_render(gl, gl->tex_w, gl->tex_h);
if (g_extern.system.hw_render_callback.context_type == RETRO_HW_CONTEXT_OPENGL
&& !gl_init_hw_render(gl, gl->tex_w, gl->tex_h))
{
context_destroy_func();
free(gl);
return NULL;
}
#endif
if (input && input_data)

View File

@ -27,6 +27,7 @@ else
TARGET := retro.dll
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
GL_LIB := -lopengl32
CFLAGS += -I..
endif
ifeq ($(DEBUG), 1)
@ -48,7 +49,7 @@ endif
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(fpic) $(SHARED) $(LIBS) $(INCLUDES) -o $@ $(OBJECTS) -lm
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LIBS) -lm
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<

View File

@ -277,6 +277,7 @@ bool retro_load_game(const struct retro_game_info *info)
if (!environ_cb(RETRO_ENVIRONMENT_SET_HW_RENDER, &hw_render))
return false;
fprintf(stderr, "Loaded game!\n");
(void)info;
return true;
}