This commit is contained in:
bkaradzic 2012-06-04 19:24:08 -07:00
parent 7210c270e5
commit e53ff3c2b0
5 changed files with 53 additions and 39 deletions

View file

@ -7,11 +7,9 @@
# error GL_IMPORT(_optional, _proto, _func) must be defined!
#endif // GL_IMPORT
#if BGFX_CONFIG_RENDERER_OPENGL
// OpenGL 2.1 Reference Pages
// http://www.opengl.org/sdk/docs/man/
//
// OpenGL ES 2.0 Reference Pages
// http://www.khronos.org/opengles/sdk/docs/man/
GL_IMPORT(false, PFNGLACTIVETEXTUREPROC, glActiveTexture);
GL_IMPORT(false, PFNGLCOMPRESSEDTEXIMAGE2DPROC, glCompressedTexImage2D);
@ -90,3 +88,12 @@ GL_IMPORT(true, PFNGLSAMPLECOVERAGEARBPROC, glSampleCoverageARB);
GL_IMPORT(true, PFNGLSTRINGMARKERGREMEDYPROC, glStringMarkerGREMEDY);
GL_IMPORT(true, PFNGLFRAMETERMINATORGREMEDYPROC, glFrameTerminatorGREMEDY);
#endif // BGFX_CONFIG_DEBUG_GREMEDY
#else
// OpenGL ES 2.0 Reference Pages
// http://www.khronos.org/opengles/sdk/docs/man/
GL_IMPORT(true, PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC, glGetTranslatedShaderSourceANGLE);
#endif // BGFX_CONFIG_RENDERER_

View file

@ -259,11 +259,11 @@ namespace bgfx
BX_TRACE("Max fragment shader 2.0 instr. slots: %d", m_caps.PS20Caps.NumInstructionSlots);
BX_TRACE("Max fragment shader 3.0 instr. slots: %d", m_caps.MaxPixelShader30InstructionSlots);
m_fmtNULL = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_NULL) );
m_fmtDF16 = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_DF16) );
m_fmtDF24 = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_DF24) );
m_fmtINTZ = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_INTZ) );
m_fmtRAWZ = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_RAWZ) );
m_fmtNULL = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_NULL) );
m_fmtDF16 = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_DF16) );
m_fmtDF24 = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_DF24) );
m_fmtINTZ = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_INTZ) );
m_fmtRAWZ = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_RAWZ) );
uint32_t index = 1;
for (const D3DFORMAT* fmt = &s_checkColorFormats[index]; *fmt != D3DFMT_UNKNOWN; ++fmt, ++index)

View file

@ -61,6 +61,8 @@ typedef DWORD (WINAPI *D3DPERF_GetStatusFunc)();
# define D3DMULTISAMPLE_8_SAMPLES D3DMULTISAMPLE_4_SAMPLES
# define D3DMULTISAMPLE_16_SAMPLES D3DMULTISAMPLE_4_SAMPLES
# define D3DFMT_DF24 D3DFMT_D24FS8
# define _PIX_SETMARKER(_col, _name) do {} while(0)
# define _PIX_BEGINEVENT(_col, _name) do {} while(0)
# define _PIX_ENDEVENT() do {} while(0)

View file

@ -16,11 +16,9 @@
namespace bgfx
{
#if BGFX_CONFIG_RENDERER_OPENGL
# define GL_IMPORT(_optional, _proto, _func) _proto _func
# include "glimports.h"
# undef GL_IMPORT
#endif // BGFX_CONFIG_RENDERER_OPENGL
#define GL_IMPORT(_optional, _proto, _func) _proto _func
#include "glimports.h"
#undef GL_IMPORT
typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height);
@ -101,6 +99,14 @@ namespace bgfx
m_instInterface->BindGraphics(m_instance, m_context);
glSetCurrentContextPPAPI(m_context);
m_graphicsInterface->SwapBuffers(m_context, naclSwapComplete);
// # define GL_IMPORT(_optional, _proto, _func) \
// { \
// _func = (_proto)eglGetProcAddress(#_func); \
// BGFX_FATAL(_optional || NULL != _func, bgfx::Fatal::OPENGL_UnableToCreateContext, "Failed to create OpenGL context. eglGetProcAddress(\"%s\")", #_func); \
// }
// # include "glimports.h"
// # undef GL_IMPORT
}
else
{
@ -403,6 +409,14 @@ namespace bgfx
ARB_framebuffer_sRGB,
EXT_framebuffer_sRGB,
ARB_multisample,
CHROMIUM_framebuffer_multisample,
ANGLE_translated_shader_source,
ANGLE_instanced_arrays,
OES_texture_float,
OES_texture_float_linear,
OES_texture_half_float,
OES_texture_half_float_linear,
EXT_occlusion_query_boolean,
Count
};
@ -431,6 +445,14 @@ namespace bgfx
{ "GL_ARB_framebuffer_sRGB", false, true },
{ "GL_EXT_framebuffer_sRGB", false, true },
{ "GL_ARB_multisample", false, true },
{ "GL_CHROMIUM_framebuffer_multisample", false, true },
{ "GL_ANGLE_translated_shader_source", false, true },
{ "GL_ANGLE_instanced_arrays", false, true },
{ "GL_OES_texture_float", false, true },
{ "GL_OES_texture_float_linear", false, true },
{ "GL_OES_texture_half_float", false, true },
{ "GL_OES_texture_half_float_linear", false, true },
{ "GL_EXT_occlusion_query_boolean", false, true },
};
static const GLenum s_primType[] =

View file

@ -37,30 +37,15 @@
# include <gl/glext.h>
#elif BGFX_CONFIG_RENDERER_OPENGLES
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
//# include <EGL/egl.h>
# ifndef GL_BGRA_EXT
# define GL_BGRA_EXT 0x80E1
# endif // GL_BGRA_EXT
# ifndef GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE
# define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
# endif // GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE
# ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
# define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
# endif // GL_COMPRESSED_RGB_S3TC_DXT1_EXT
typedef void (*PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
# ifndef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
# define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
# endif // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
# ifndef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
# define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
# endif // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
# ifndef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
# define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
# endif // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
# ifndef GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
# define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
# endif // GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES
#endif // BGFX_CONFIG_RENDERER_OPENGL
#if BX_PLATFORM_NACL
@ -119,11 +104,9 @@ namespace bgfx
#define GREMEDY_SETMARKER(_string) _GREMEDY_SETMARKER(_string)
#define GREMEDY_FRAMETERMINATOR() _GREMEDY_FRAMETERMINATOR()
#if BGFX_CONFIG_RENDERER_OPENGL
# define GL_IMPORT(_optional, _proto, _func) extern _proto _func
# include "glimports.h"
# undef GL_IMPORT
#endif // BGFX_CONFIG_RENDERER_OPENGL
#define GL_IMPORT(_optional, _proto, _func) extern _proto _func
#include "glimports.h"
#undef GL_IMPORT
class ConstantBuffer;