Removed GLAD from CMake project
Replaced GL integer and size typedefs with native types.
This commit is contained in:
@@ -176,12 +176,12 @@ list (APPEND EXTRA_LIBS "${OPENGL_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
# ---- GLAD ----
|
||||
if(NOT ANDROID)
|
||||
set(GLAD_EXTENSIONS "GL_EXT_texture_filter_anisotropic,GL_EXT_texture_compression_s3tc, GL_S3_s3tc" CACHE STRING "Gl exts" FORCE)
|
||||
add_subdirectory(3rdparty/glad)
|
||||
include_directories(${GLAD_INCLUDE_DIRS})
|
||||
list (APPEND EXTRA_LIBS "glad")
|
||||
endif()
|
||||
# if(NOT ANDROID)
|
||||
# set(GLAD_EXTENSIONS "GL_EXT_texture_filter_anisotropic,GL_EXT_texture_compression_s3tc, GL_S3_s3tc" CACHE STRING "Gl exts" FORCE)
|
||||
# add_subdirectory(3rdparty/glad)
|
||||
# include_directories(${GLAD_INCLUDE_DIRS})
|
||||
# list (APPEND EXTRA_LIBS "glad")
|
||||
# endif()
|
||||
|
||||
add_library(kraken STATIC ${SRCS} ${KRAKEN_PUBLIC_HEADERS})
|
||||
TARGET_LINK_LIBRARIES( kraken ${EXTRA_LIBS} )
|
||||
|
||||
@@ -147,7 +147,7 @@ void KRCamera::renderFrame(VkCommandBuffer& commandBuffer, KRSurface& compositeS
|
||||
GL_PUSH_GROUP_MARKER("Generate Shadowmaps");
|
||||
|
||||
scene.render(commandBuffer, compositeSurface, this, m_viewport.getVisibleBounds(), m_viewport, KRNode::RENDER_PASS_GENERATE_SHADOWMAPS, false /*settings.bEnableDeferredLighting*/);
|
||||
GLDEBUG(glViewport(0, 0, (GLsizei)m_viewport.getSize().x, (GLsizei)m_viewport.getSize().y));
|
||||
GLDEBUG(glViewport(0, 0, (int)m_viewport.getSize().x, (int)m_viewport.getSize().y));
|
||||
GL_POP_GROUP_MARKER;
|
||||
}
|
||||
|
||||
@@ -178,13 +178,13 @@ void KRCamera::renderFrame(VkCommandBuffer& commandBuffer, KRSurface& compositeS
|
||||
// Set render target
|
||||
GLDEBUG(glBindFramebuffer(GL_FRAMEBUFFER, lightAccumulationBuffer));
|
||||
GLDEBUG(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, compositeDepthTexture, 0));
|
||||
GLDEBUG(glViewport(0, 0, (GLsizei)(m_viewport.getSize().x * m_downsample.x), (GLsizei)(m_viewport.getSize().y * m_downsample.y)));
|
||||
GLDEBUG(glViewport(0, 0, (int)(m_viewport.getSize().x * m_downsample.x), (int)(m_viewport.getSize().y * m_downsample.y)));
|
||||
GLDEBUG(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
GLDEBUG(glClear(GL_COLOR_BUFFER_BIT));
|
||||
|
||||
// Set source to buffers from pass 1
|
||||
m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 6, compositeColorTexture);
|
||||
m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 7, compositeDepthTexture);
|
||||
m_pContext->getTextureManager()->selectTexture(0 /*GL_TEXTURE_2D*/, 6, compositeColorTexture);
|
||||
m_pContext->getTextureManager()->selectTexture(0 /*GL_TEXTURE_2D*/, 7, compositeDepthTexture);
|
||||
|
||||
// Render the geometry
|
||||
scene.render(commandBuffer, compositeSurface, this, m_viewport.getVisibleBounds(), m_viewport, KRNode::RENDER_PASS_DEFERRED_LIGHTS, false);
|
||||
@@ -200,7 +200,7 @@ void KRCamera::renderFrame(VkCommandBuffer& commandBuffer, KRSurface& compositeS
|
||||
deferredOpaquePass.begin(commandBuffer, compositeSurface, Vector4::Create(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
|
||||
// Set source to buffers from pass 2
|
||||
m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 6, lightAccumulationTexture);
|
||||
m_pContext->getTextureManager()->selectTexture(0 /*GL_TEXTURE_2D*/, 6, lightAccumulationTexture);
|
||||
|
||||
// Render the geometry
|
||||
// TODO: At this point, we only want to render octree nodes that produced fragments during the 1st pass into the GBuffer
|
||||
@@ -215,7 +215,7 @@ void KRCamera::renderFrame(VkCommandBuffer& commandBuffer, KRSurface& compositeS
|
||||
GL_PUSH_GROUP_MARKER("Forward Rendering - Opaque");
|
||||
/*
|
||||
|
||||
GLDEBUG(glViewport(0, 0, (GLsizei)(m_viewport.getSize().x * m_downsample.x), (GLsizei)(m_viewport.getSize().y * m_downsample.y)));
|
||||
GLDEBUG(glViewport(0, 0, (int)(m_viewport.getSize().x * m_downsample.x), (int)(m_viewport.getSize().y * m_downsample.y)));
|
||||
*/
|
||||
|
||||
// Start render pass
|
||||
@@ -324,9 +324,9 @@ void KRCamera::renderFrame(VkCommandBuffer& commandBuffer, KRSurface& compositeS
|
||||
|
||||
// Disable z-buffer test
|
||||
GLDEBUG(glDisable(GL_DEPTH_TEST));
|
||||
m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 0, compositeDepthTexture);
|
||||
m_pContext->getTextureManager()->selectTexture(0 /*GL_TEXTURE_2D*/, 0, compositeDepthTexture);
|
||||
|
||||
GLDEBUG(glViewport(0, 0, (GLsizei)volumetricLightingViewport.getSize().x, (GLsizei)volumetricLightingViewport.getSize().y));
|
||||
GLDEBUG(glViewport(0, 0, (int)volumetricLightingViewport.getSize().x, (int)volumetricLightingViewport.getSize().y));
|
||||
} else {
|
||||
// Enable z-buffer test
|
||||
GLDEBUG(glEnable(GL_DEPTH_TEST));
|
||||
|
||||
@@ -49,8 +49,7 @@ using namespace kraken;
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <variant>
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <stack>
|
||||
#include <queue>
|
||||
#include <iostream>
|
||||
@@ -73,6 +72,12 @@ using namespace kraken;
|
||||
#include <AudioToolbox/ExtendedAudioFile.h>
|
||||
#include <AudioToolbox/AUGraph.h>
|
||||
|
||||
#include "TargetConditionals.h"
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_time.h>
|
||||
#include <Accelerate/Accelerate.h>
|
||||
#define KRAKEN_HAVE_BLAS 1
|
||||
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -81,9 +86,11 @@ using namespace kraken;
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <limits>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// NOMINMAX required to prevent windows headers from defining max() and min() macros
|
||||
#define NOMINMAX
|
||||
|
||||
// _USE_MATH_DEFINES must be defined to get M_PI in Windows
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
@@ -108,14 +115,6 @@ using std::multimap;
|
||||
using std::stack;
|
||||
using std::queue;
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_time.h>
|
||||
#include <Accelerate/Accelerate.h>
|
||||
#define KRAKEN_HAVE_BLAS 1
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(__i386__) && defined(__arm__)
|
||||
#define KRAKEN_USE_ARM_NEON
|
||||
@@ -165,17 +164,9 @@ fprintf(stderr, "Error at line number %d, in file %s. Returned %d for call %s\n"
|
||||
#define OSDEBUG(x) x;
|
||||
#endif
|
||||
|
||||
#if defined(GL_EXT_debug_marker) && (defined(DEBUG) || defined(_DEBUG))
|
||||
|
||||
#define GL_PUSH_GROUP_MARKER(x) glPushGroupMarkerEXT(0, x)
|
||||
#define GL_POP_GROUP_MARKER glPopGroupMarkerEXT()
|
||||
|
||||
#else
|
||||
|
||||
#define GL_PUSH_GROUP_MARKER(x)
|
||||
#define GL_POP_GROUP_MARKER
|
||||
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
||||
@@ -36,19 +36,6 @@
|
||||
#include "matrix4.h"
|
||||
#include <string>
|
||||
|
||||
#if defined(ANDROID)
|
||||
#include <GLES3/gl3.h>
|
||||
#include <GLES3/gl3ext.h>
|
||||
#elif defined(_WIN32) || defined(_WIN64)
|
||||
#include <glad/glad.h>
|
||||
#elif (defined(__linux__) || defined(__unix__) || defined(__posix__))
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glext.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <OpenGL/gl3ext.h>
|
||||
#endif
|
||||
#include "../3rdparty/tinyxml2/tinyxml2.h"
|
||||
|
||||
#define KRMIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
@@ -477,7 +477,7 @@ void KRLight::allocateShadowBuffers(int cBuffers)
|
||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_EXT, GL_COMPARE_REF_TO_TEXTURE_EXT)); // TODO - Detect GL_EXT_shadow_samplers and only activate if available
|
||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_EXT, GL_LEQUAL)); // TODO - Detect GL_EXT_shadow_samplers and only activate if available
|
||||
#endif
|
||||
GLDEBUG(glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, (GLsizei)viewportSize.x, (GLsizei)viewportSize.y, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL));
|
||||
GLDEBUG(glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, (int)viewportSize.x, (int)viewportSize.y, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL));
|
||||
|
||||
GLDEBUG(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowDepthTexture[iShadow], 0));
|
||||
}
|
||||
@@ -514,12 +514,12 @@ void KRLight::renderShadowBuffers(RenderInfo& ri)
|
||||
GLDEBUG(glBindFramebuffer(GL_FRAMEBUFFER, shadowFramebuffer[iShadow]));
|
||||
GLDEBUG(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowDepthTexture[iShadow], 0));
|
||||
|
||||
GLDEBUG(glViewport(0, 0, (GLsizei)m_shadowViewports[iShadow].getSize().x, (GLsizei)m_shadowViewports[iShadow].getSize().y));
|
||||
GLDEBUG(glViewport(0, 0, (int)m_shadowViewports[iShadow].getSize().x, (int)m_shadowViewports[iShadow].getSize().y));
|
||||
|
||||
GLDEBUG(glClearDepthf(0.0f));
|
||||
GLDEBUG(glClear(GL_DEPTH_BUFFER_BIT));
|
||||
|
||||
GLDEBUG(glViewport(1, 1, (GLsizei)m_shadowViewports[iShadow].getSize().x - 2, (GLsizei)m_shadowViewports[iShadow].getSize().y - 2));
|
||||
GLDEBUG(glViewport(1, 1, (int)m_shadowViewports[iShadow].getSize().x - 2, (int)m_shadowViewports[iShadow].getSize().y - 2));
|
||||
|
||||
GLDEBUG(glClearDepthf(1.0f));
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ void KRMesh::createDataBlocks(KRMeshManager::KRVBOData::vbo_type t)
|
||||
int iBuffer = iVertex / MAX_VBO_SIZE;
|
||||
iVertex = iVertex % MAX_VBO_SIZE;
|
||||
while (cVertexes > 0) {
|
||||
GLsizei cBufferVertexes = iBuffer < cBuffers - 1 ? MAX_VBO_SIZE : vertex_count % MAX_VBO_SIZE;
|
||||
int cBufferVertexes = iBuffer < cBuffers - 1 ? MAX_VBO_SIZE : vertex_count % MAX_VBO_SIZE;
|
||||
int vertex_size = m_vertex_size;
|
||||
|
||||
if ((int)mesh.vertex_data_blocks.size() <= vbo_index) {
|
||||
@@ -493,7 +493,7 @@ void KRMesh::renderSubmesh(VkCommandBuffer& commandBuffer, int iSubmesh, KRNode:
|
||||
int iBuffer = iVertex / MAX_VBO_SIZE;
|
||||
iVertex = iVertex % MAX_VBO_SIZE;
|
||||
while (cVertexes > 0) {
|
||||
GLsizei cBufferVertexes = iBuffer < cBuffers - 1 ? MAX_VBO_SIZE : cVertexes % MAX_VBO_SIZE;
|
||||
int cBufferVertexes = iBuffer < cBuffers - 1 ? MAX_VBO_SIZE : cVertexes % MAX_VBO_SIZE;
|
||||
|
||||
KRMeshManager::KRVBOData& vbo_data_block = **vbo_itr++;
|
||||
assert(vbo_data_block.isVBOReady());
|
||||
|
||||
@@ -641,7 +641,7 @@ void KRPipeline::setPushConstant(PushConstant location, const Matrix4* value, co
|
||||
for (StageInfo& stageInfo : m_stages) {
|
||||
PushConstantInfo& pushConstants = stageInfo.pushConstants;
|
||||
// TODO - Vulkan refactoring
|
||||
// GLDEBUG(glUniformMatrix4fv(pushConstants.offset[KRPipeline::PushConstant::bone_transforms], (GLsizei)bones.size(), GL_FALSE, bone_mats));
|
||||
// GLDEBUG(glUniformMatrix4fv(pushConstants.offset[KRPipeline::PushConstant::bone_transforms], (int)bones.size(), GL_FALSE, bone_mats));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -672,7 +672,7 @@ bool KRPipeline::bind(VkCommandBuffer& commandBuffer, KRCamera& camera, const KR
|
||||
int cShadowBuffers = directional_light->getShadowBufferCount();
|
||||
if (hasPushConstant(PushConstant::shadowtexture1) && cShadowBuffers > 0) {
|
||||
// TODO - Vulkan Refactoring. Note: Sampler needs clamp-to-edge and linear filtering
|
||||
if (m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 3, directional_light->getShadowTextures()[0])) {
|
||||
if (m_pContext->getTextureManager()->selectTexture(0 /*GL_TEXTURE_2D*/, 3, directional_light->getShadowTextures()[0])) {
|
||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
|
||||
}
|
||||
@@ -680,7 +680,7 @@ bool KRPipeline::bind(VkCommandBuffer& commandBuffer, KRCamera& camera, const KR
|
||||
|
||||
if (hasPushConstant(PushConstant::shadowtexture2) && cShadowBuffers > 1 && camera.settings.m_cShadowBuffers > 1) {
|
||||
// TODO - Vulkan Refactoring. Note: Sampler needs clamp-to-edge and linear filtering
|
||||
if (m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 4, directional_light->getShadowTextures()[1])) {
|
||||
if (m_pContext->getTextureManager()->selectTexture(0 /*GL_TEXTURE_2D*/, 4, directional_light->getShadowTextures()[1])) {
|
||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
|
||||
}
|
||||
@@ -688,7 +688,7 @@ bool KRPipeline::bind(VkCommandBuffer& commandBuffer, KRCamera& camera, const KR
|
||||
|
||||
if (hasPushConstant(PushConstant::shadowtexture3) && cShadowBuffers > 2 && camera.settings.m_cShadowBuffers > 2) {
|
||||
// TODO - Vulkan Refactoring. Note: Sampler needs clamp-to-edge and linear filtering
|
||||
if (m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, 5, directional_light->getShadowTextures()[2])) {
|
||||
if (m_pContext->getTextureManager()->selectTexture(0 /*GL_TEXTURE_2D*/, 5, directional_light->getShadowTextures()[2])) {
|
||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
||||
GLDEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ KRTextureKTX::KRTextureKTX(KRContext& context, KRDataBlock* data, std::string na
|
||||
m_min_lod_max_dim = KRMAX(width, height);
|
||||
}
|
||||
|
||||
KRTextureKTX::KRTextureKTX(KRContext& context, std::string name, GLenum internal_format, GLenum base_internal_format, int width, int height, const std::list<KRDataBlock*>& blocks) : KRTexture2D(context, new KRDataBlock(), name)
|
||||
KRTextureKTX::KRTextureKTX(KRContext& context, std::string name, unsigned int internal_format, unsigned int base_internal_format, int width, int height, const std::list<KRDataBlock*>& blocks) : KRTexture2D(context, new KRDataBlock(), name)
|
||||
{
|
||||
memcpy(m_header.identifier, _KTXFileIdentifier, 12);
|
||||
m_header.endianness = 0x04030201;
|
||||
@@ -193,7 +193,7 @@ bool KRTextureKTX::uploadTexture(KRDevice& device, VkImage& image, int lod_max_d
|
||||
block->lock();
|
||||
/*
|
||||
* TODO - Vulkan Refactoring
|
||||
GLDEBUG(glCompressedTexImage2D(target, destination_level, (GLenum)m_header.glInternalFormat, width, height, 0, (GLsizei)block->getSize(), block->getStart()));
|
||||
GLDEBUG(glCompressedTexImage2D(target, destination_level, (unsigned int)m_header.glInternalFormat, width, height, 0, (int)block->getSize(), block->getStart()));
|
||||
*/
|
||||
|
||||
block->unlock();
|
||||
|
||||
@@ -37,7 +37,7 @@ class KRTextureKTX : public KRTexture2D
|
||||
{
|
||||
public:
|
||||
KRTextureKTX(KRContext& context, KRDataBlock* data, std::string name);
|
||||
KRTextureKTX(KRContext& context, std::string name, GLenum internal_format, GLenum base_internal_format, int width, int height, const std::list<KRDataBlock*>& blocks);
|
||||
KRTextureKTX(KRContext& context, std::string name, unsigned int internal_format, unsigned int base_internal_format, int width, int height, const std::list<KRDataBlock*>& blocks);
|
||||
virtual ~KRTextureKTX();
|
||||
virtual std::string getExtension();
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ KRTexture* KRTextureManager::getTexture(const std::string& name)
|
||||
}
|
||||
}
|
||||
|
||||
bool KRTextureManager::selectTexture(GLenum target, int iTextureUnit, int iTextureHandle)
|
||||
bool KRTextureManager::selectTexture(unsigned int target, int iTextureUnit, int iTextureHandle)
|
||||
{
|
||||
// TODO - Vulkan Refactoring
|
||||
return true;
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
virtual KRResource* loadResource(const std::string& name, const std::string& extension, KRDataBlock* data) override;
|
||||
virtual KRResource* getResource(const std::string& name, const std::string& extension) override;
|
||||
|
||||
bool selectTexture(GLenum target, int iTextureUnit, int iTextureHandle);
|
||||
bool selectTexture(unsigned int target, int iTextureUnit, int iTextureHandle);
|
||||
|
||||
KRTexture* loadTexture(const char* szName, const char* szExtension, KRDataBlock* data);
|
||||
KRTexture* getTextureCube(const char* szName);
|
||||
|
||||
@@ -212,7 +212,7 @@ bool KRTexturePVR::uploadTexture(KRDevice& device, VkImage& image, int lod_max_d
|
||||
block->lock();
|
||||
/*
|
||||
* TODO - Vulkan Refactoring
|
||||
GLDEBUG(glCompressedTexImage2D(target, destination_level, m_internalFormat, width, height, 0, (GLsizei)block->getSize(), block->getStart()));
|
||||
GLDEBUG(glCompressedTexImage2D(target, destination_level, m_internalFormat, width, height, 0, (int)block->getSize(), block->getStart()));
|
||||
*/
|
||||
block->unlock();
|
||||
memoryTransferred += (long)block->getSize(); // memoryTransferred does not include throughput of mipmap levels copied through glCopyTextureLevelsAPPLE
|
||||
|
||||
@@ -49,7 +49,7 @@ protected:
|
||||
|
||||
uint32_t m_iWidth;
|
||||
uint32_t m_iHeight;
|
||||
GLenum m_internalFormat;
|
||||
unsigned int m_internalFormat;
|
||||
bool m_bHasAlpha;
|
||||
|
||||
std::list<KRDataBlock*> m_blocks;
|
||||
|
||||
@@ -126,7 +126,7 @@ bool KRTextureTGA::uploadTexture(KRDevice& device, VkImage& image, int lod_max_d
|
||||
|
||||
/*
|
||||
* TODO - Vulkan refactoring to support compressing textures on load
|
||||
GLenum internal_format = GL_RGBA;
|
||||
unsigned int internal_format = GL_RGBA;
|
||||
if(compress) {
|
||||
internal_format = pHeader->bitsperpixel == 24 ? GL_COMPRESSED_RGB_S3TC_DXT1_EXT : GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user