Use feature name for ifdef

This commit is contained in:
Atlante45 2016-01-21 11:53:41 -08:00
parent 838b637591
commit 52885545ea
4 changed files with 13 additions and 10 deletions

View file

@ -9,8 +9,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef gpu__GPUConfig__
#define gpu__GPUConfig__
#ifndef hifi_gpu_GPUConfig_h
#define hifi_gpu_GPUConfig_h
#define GL_GLEXT_PROTOTYPES 1
@ -38,8 +38,6 @@
#define GPU_FEATURE_PROFILE GPU_CORE
#define GPU_INPUT_PROFILE GPU_CORE_43
#elif defined(ANDROID)
#else
#include <GL/glew.h>
@ -50,4 +48,9 @@
#endif
#if (GPU_INPUT_PROFILE == GPU_CORE_43)
#define GPU_SSBO_DRAW_CALL_INFO
#endif
#endif // hifi_gpu_GPUConfig_h

View file

@ -30,7 +30,7 @@ namespace gpu {
enum ReservedSlot {
#ifdef WIN32
#ifdef GPU_SSBO_DRAW_CALL_INFO
TRANSFORM_OBJECT_SLOT = 6,
#else
TRANSFORM_OBJECT_SLOT = 31,

View file

@ -92,7 +92,7 @@ void makeBindings(GLBackend::GLShader* shader) {
// now assign the ubo binding, then DON't relink!
//Check for gpu specific uniform slotBindings
#ifdef WIN32
#ifdef GPU_SSBO_DRAW_CALL_INFO
loc = glGetProgramResourceIndex(glprogram, GL_SHADER_STORAGE_BLOCK, "transformObjectBuffer");
if (loc >= 0) {
glShaderStorageBlockBinding(glprogram, loc, gpu::TRANSFORM_OBJECT_SLOT);

View file

@ -62,7 +62,7 @@ void GLBackend::initTransform() {
glGenBuffers(1, &_transform._objectBuffer);
glGenBuffers(1, &_transform._cameraBuffer);
glGenBuffers(1, &_transform._drawCallInfoBuffer);
#ifndef WIN32
#ifndef GPU_SSBO_DRAW_CALL_INFO
glGenTextures(1, &_transform._objectBufferTexture);
#endif
size_t cameraSize = sizeof(TransformCamera);
@ -75,7 +75,7 @@ void GLBackend::killTransform() {
glDeleteBuffers(1, &_transform._objectBuffer);
glDeleteBuffers(1, &_transform._cameraBuffer);
glDeleteBuffers(1, &_transform._drawCallInfoBuffer);
#ifndef WIN32
#ifndef GPU_SSBO_DRAW_CALL_INFO
glDeleteTextures(1, &_transform._objectBufferTexture);
#endif
}
@ -143,7 +143,7 @@ void GLBackend::TransformStageState::transfer(const Batch& batch) const {
bufferData.resize(byteSize);
memcpy(bufferData.data(), batch._objects.data(), byteSize);
#ifdef WIN32
#ifdef GPU_SSBO_DRAW_CALL_INFO
glBindBuffer(GL_SHADER_STORAGE_BUFFER, _objectBuffer);
glBufferData(GL_SHADER_STORAGE_BUFFER, bufferData.size(), bufferData.data(), GL_DYNAMIC_DRAW);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
@ -169,7 +169,7 @@ void GLBackend::TransformStageState::transfer(const Batch& batch) const {
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
#ifdef WIN32
#ifdef GPU_SSBO_DRAW_CALL_INFO
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, TRANSFORM_OBJECT_SLOT, _objectBuffer);
#else
glActiveTexture(GL_TEXTURE0 + TRANSFORM_OBJECT_SLOT);