Explorar el Código

nx: ensure projects that use OpenGL compile properly.

legacy
Sam Hocevar hace 5 años
padre
commit
c4df7f7f91
Se han modificado 6 ficheros con 20 adiciones y 14 borrados
  1. +1
    -1
      build/msbuild/lol.rules.props
  2. +4
    -0
      build/msbuild/lol.vars.props
  3. +11
    -11
      src/gpu/framebuffer.cpp
  4. +1
    -1
      src/lol/engine.h
  5. +2
    -0
      src/lolgl.h
  6. +1
    -1
      src/private/nx

+ 1
- 1
build/msbuild/lol.rules.props Ver fichero

@@ -32,11 +32,11 @@
$(PegtlIncludes);
$(ImguiIncludes);
$(BtPhysIncludes);
$(GlIncludes);
%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>

<AdditionalIncludeDirectories Condition="'$(Platform)'=='Win32' Or '$(Platform)'=='x64'">
$(GlIncludes);
$(SdlIncludes);
$(FfmpegIncludes);
$(AssimpIncludes);


+ 4
- 0
build/msbuild/lol.vars.props Ver fichero

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />

<PropertyGroup Label="UserMacros">
<ExternalDir>$(LolDir)\external</ExternalDir>

@@ -142,6 +143,9 @@
<BuildMacro Include="XinputLibs"><Value>$(XinputLibs)</Value></BuildMacro>
<BuildMacro Include="XinputDeps"><Value>$(XinputDeps)</Value></BuildMacro>
<BuildMacro Include="Win32Defines"><Value>$(Win32Defines)</Value></BuildMacro>
<BuildMacro Include="Nx64Deps"><Value>$(Nx64Deps)</Value></BuildMacro>
<BuildMacro Include="Nx64Libs"><Value>$(Nx64Libs)</Value></BuildMacro>
<BuildMacro Include="Nx64Defines"><Value>$(Nx64Defines)</Value></BuildMacro>
<BuildMacro Include="OrbisDeps"><Value>$(OrbisDeps)</Value></BuildMacro>
<BuildMacro Include="OrbisLibs"><Value>$(OrbisLibs)</Value></BuildMacro>
<BuildMacro Include="OrbisDefines"><Value>$(OrbisDefines)</Value></BuildMacro>


+ 11
- 11
src/gpu/framebuffer.cpp Ver fichero

@@ -173,12 +173,12 @@ Framebuffer::Framebuffer(ivec2 size, FramebufferFormat fbo_format)
{
m_data->m_size = size;
m_data->m_bound = false;
#if GL_ES_VERSION_2_0
#if defined GL_ES_VERSION_2_0
/* In OpenGL ES, internal format and format must match. */
GLenum internal_format = fbo_format.GetFormat();
GLenum format = fbo_format.GetFormat();
GLenum depth = GL_DEPTH_COMPONENT16; /* for WebGL */
#elif GL_VERSION_1_1
#elif defined GL_VERSION_1_1
GLenum internal_format = fbo_format.GetFormat();
GLenum format = fbo_format.GetFormatOrder();
GLenum depth = GL_DEPTH_COMPONENT;
@@ -190,7 +190,7 @@ Framebuffer::Framebuffer(ivec2 size, FramebufferFormat fbo_format)
GLenum wrapmode = GL_CLAMP_TO_EDGE;
GLenum filtering = GL_LINEAR;

#if GL_VERSION_1_1 || GL_ES_VERSION_2_0
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0
glGenFramebuffers(1, &m_data->m_fbo);
glBindFramebuffer(GL_FRAMEBUFFER, m_data->m_fbo);
#else
@@ -208,7 +208,7 @@ Framebuffer::Framebuffer(ivec2 size, FramebufferFormat fbo_format)
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, size.x, size.y, 0,
format, GL_UNSIGNED_BYTE, nullptr);

#if GL_VERSION_1_1 || GL_ES_VERSION_2_0
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, m_data->m_texture, 0);
#else
@@ -217,7 +217,7 @@ Framebuffer::Framebuffer(ivec2 size, FramebufferFormat fbo_format)
#endif

m_data->m_depth = GL_INVALID_ENUM;
#if GL_VERSION_1_1 || GL_ES_VERSION_2_0
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0
if (depth != GL_INVALID_ENUM)
{
/* XXX: might not work on GL ES, see
@@ -233,13 +233,13 @@ Framebuffer::Framebuffer(ivec2 size, FramebufferFormat fbo_format)

glBindTexture(GL_TEXTURE_2D, 0);

#if GL_VERSION_1_1 || GL_ES_VERSION_2_0
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
ASSERT(status == GL_FRAMEBUFFER_COMPLETE,
"invalid framebuffer status 0x%x", status);
#endif

#if GL_VERSION_1_1 || GL_ES_VERSION_2_0
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#else
glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
@@ -248,13 +248,13 @@ Framebuffer::Framebuffer(ivec2 size, FramebufferFormat fbo_format)

Framebuffer::~Framebuffer()
{
#if GL_VERSION_1_1 || GL_ES_VERSION_2_0
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0
glDeleteFramebuffers(1, &m_data->m_fbo);
#else
glDeleteFramebuffersOES(1, &m_data->m_fbo);
#endif
glDeleteTextures(1, &m_data->m_texture);
#if GL_VERSION_1_1 || GL_ES_VERSION_2_0
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0
if (m_data->m_depth != GL_INVALID_ENUM)
glDeleteRenderbuffers(1, &m_data->m_depth);
#endif
@@ -289,7 +289,7 @@ void Framebuffer::Bind()
{
ASSERT(!m_data->m_bound, "trying to bind an already bound framebuffer");

#if GL_VERSION_1_1 || GL_ES_VERSION_2_0
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0
glBindFramebuffer(GL_FRAMEBUFFER, m_data->m_fbo);
#else
glBindFramebufferOES(GL_FRAMEBUFFER_OES, m_data->m_fbo);
@@ -308,7 +308,7 @@ void Framebuffer::Unbind()
{
ASSERT(m_data->m_bound, "trying to unbind an unbound framebuffer");

#if GL_VERSION_1_1 || GL_ES_VERSION_2_0
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#else
glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);


+ 1
- 1
src/lol/engine.h Ver fichero

@@ -23,7 +23,7 @@
#endif

// If using NX, do that, too
#if NN_NINTENDO_SDK
#if __NX__
# define main lol_nx_main
#endif



+ 2
- 0
src/lolgl.h Ver fichero

@@ -35,6 +35,8 @@
* links with X11 whereas we want the system’s Cocoa-friendly GL libs. */
#if defined LOL_USE_GLEW && !defined __APPLE__
# include <GL/glew.h>
#elif defined HAVE_NN_GLL_GLL_GL_H
# include <nn/gll/gll_Gl.h>
#elif defined HAVE_GL_2X
# if defined __APPLE__ && defined __MACH__ && defined __arm__
# include <OpenGL/gl.h>


+ 1
- 1
src/private/nx

@@ -1 +1 @@
Subproject commit 659497041784fef0adff7b0ce7ab22b9379e5f66
Subproject commit c2da1a20c6fa7b23efab7f1154d9d0ee49e7cd37

Cargando…
Cancelar
Guardar