mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 00:17:25 +02:00
Fixed compilation on Mac, Ubuntu and Android
This commit is contained in:
parent
72d0693252
commit
8ad58754da
3 changed files with 32 additions and 12 deletions
|
@ -20,6 +20,29 @@ using namespace gpu::gles;
|
||||||
|
|
||||||
const std::string GLESBackend::GLES_VERSION { "GLES" };
|
const std::string GLESBackend::GLES_VERSION { "GLES" };
|
||||||
|
|
||||||
|
void GLESBackend::draw(GLenum mode, uint32 numVertices, uint32 startVertex) {
|
||||||
|
if (isStereo()) {
|
||||||
|
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
|
||||||
|
glDrawArraysInstanced(mode, startVertex, numVertices, 2);
|
||||||
|
#else
|
||||||
|
setupStereoSide(0);
|
||||||
|
glDrawArrays(mode, startVertex, numVertices);
|
||||||
|
setupStereoSide(1);
|
||||||
|
glDrawArrays(mode, startVertex, numVertices);
|
||||||
|
#endif
|
||||||
|
_stats._DSNumTriangles += 2 * numVertices / 3;
|
||||||
|
_stats._DSNumDrawcalls += 2;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
glDrawArrays(mode, startVertex, numVertices);
|
||||||
|
_stats._DSNumTriangles += numVertices / 3;
|
||||||
|
_stats._DSNumDrawcalls++;
|
||||||
|
}
|
||||||
|
_stats._DSNumAPIDrawcalls++;
|
||||||
|
|
||||||
|
(void)CHECK_GL_ERROR();
|
||||||
|
}
|
||||||
|
|
||||||
void GLESBackend::do_draw(const Batch& batch, size_t paramOffset) {
|
void GLESBackend::do_draw(const Batch& batch, size_t paramOffset) {
|
||||||
Primitive primitiveType = (Primitive)batch._params[paramOffset + 2]._uint;
|
Primitive primitiveType = (Primitive)batch._params[paramOffset + 2]._uint;
|
||||||
GLenum mode = gl::PRIMITIVE_TO_GL[primitiveType];
|
GLenum mode = gl::PRIMITIVE_TO_GL[primitiveType];
|
||||||
|
|
|
@ -126,6 +126,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
void draw(GLenum mode, uint32 numVertices, uint32 startVertex) override;
|
||||||
|
|
||||||
GLuint getFramebufferID(const FramebufferPointer& framebuffer) override;
|
GLuint getFramebufferID(const FramebufferPointer& framebuffer) override;
|
||||||
GLFramebuffer* syncGPUObject(const Framebuffer& framebuffer) override;
|
GLFramebuffer* syncGPUObject(const Framebuffer& framebuffer) override;
|
||||||
|
|
||||||
|
|
|
@ -208,24 +208,24 @@ AmbientOcclusionEffectConfig::AmbientOcclusionEffectConfig() :
|
||||||
render::GPUJobConfig::Persistent(QStringList() << "Render" << "Engine" << "Ambient Occlusion", false),
|
render::GPUJobConfig::Persistent(QStringList() << "Render" << "Engine" << "Ambient Occlusion", false),
|
||||||
perspectiveScale{ 1.0f },
|
perspectiveScale{ 1.0f },
|
||||||
edgeSharpness{ 1.0f },
|
edgeSharpness{ 1.0f },
|
||||||
resolutionLevel{ 2 },
|
|
||||||
blurRadius{ 4 },
|
blurRadius{ 4 },
|
||||||
|
resolutionLevel{ 2 },
|
||||||
|
|
||||||
ssaoRadius{ 1.0f },
|
ssaoRadius{ 1.0f },
|
||||||
ssaoObscuranceLevel{ 0.4f },
|
ssaoObscuranceLevel{ 0.4f },
|
||||||
ssaoFalloffAngle{ 0.1f },
|
ssaoFalloffAngle{ 0.1f },
|
||||||
ssaoNumSamples{ 32 },
|
|
||||||
ssaoNumSpiralTurns{ 7.0f },
|
ssaoNumSpiralTurns{ 7.0f },
|
||||||
|
ssaoNumSamples{ 32 },
|
||||||
|
|
||||||
hbaoRadius{ 0.7f },
|
hbaoRadius{ 0.7f },
|
||||||
hbaoObscuranceLevel{ 0.75f },
|
hbaoObscuranceLevel{ 0.75f },
|
||||||
hbaoFalloffAngle{ 0.3f },
|
hbaoFalloffAngle{ 0.3f },
|
||||||
hbaoNumSamples{ 1 },
|
hbaoNumSamples{ 1 },
|
||||||
|
|
||||||
|
horizonBased{ false },
|
||||||
ditheringEnabled{ true },
|
ditheringEnabled{ true },
|
||||||
borderingEnabled{ true },
|
borderingEnabled{ true },
|
||||||
fetchMipsEnabled{ true },
|
fetchMipsEnabled{ true },
|
||||||
horizonBased{ false },
|
|
||||||
jitterEnabled{ false }{
|
jitterEnabled{ false }{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,9 +446,9 @@ void AmbientOcclusionEffect::updateRandomSamples() {
|
||||||
if (_aoParametersBuffer->isHorizonBased()) {
|
if (_aoParametersBuffer->isHorizonBased()) {
|
||||||
const int B = 3;
|
const int B = 3;
|
||||||
const float invB = 1.0f / (float)B;
|
const float invB = 1.0f / (float)B;
|
||||||
float sampleScale = 2.0f * M_PI / _aoParametersBuffer->getNumSamples();
|
float sampleScale = float(2.0f * M_PI / _aoParametersBuffer->getNumSamples());
|
||||||
|
|
||||||
for (int i = 0; i < _randomSamples.size(); i++) {
|
for (auto i = 0; i < _randomSamples.size(); i++) {
|
||||||
int index = i + 1; // Indices start at 1, not 0
|
int index = i + 1; // Indices start at 1, not 0
|
||||||
float f = 1.0f;
|
float f = 1.0f;
|
||||||
float r = 0.0f;
|
float r = 0.0f;
|
||||||
|
@ -461,7 +461,7 @@ void AmbientOcclusionEffect::updateRandomSamples() {
|
||||||
_randomSamples[i] = r * sampleScale;
|
_randomSamples[i] = r * sampleScale;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < _randomSamples.size(); i++) {
|
for (auto i = 0; i < _randomSamples.size(); i++) {
|
||||||
_randomSamples[i] = randFloat() * 2.0f * M_PI;
|
_randomSamples[i] = randFloat() * 2.0f * M_PI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,6 @@ void AmbientOcclusionEffect::updateFramebufferSizes() {
|
||||||
|
|
||||||
const int resolutionLevel = _aoParametersBuffer.get().getResolutionLevel();
|
const int resolutionLevel = _aoParametersBuffer.get().getResolutionLevel();
|
||||||
const int depthResolutionLevel = getDepthResolutionLevel();
|
const int depthResolutionLevel = getDepthResolutionLevel();
|
||||||
const auto occlusionDepthFrameSize = sourceFrameSideSize >> depthResolutionLevel;
|
|
||||||
const auto occlusionFrameSize = sourceFrameSideSize >> resolutionLevel;
|
const auto occlusionFrameSize = sourceFrameSideSize >> resolutionLevel;
|
||||||
auto normalTextureSize = _framebuffer->getNormalTexture()->getDimensions();
|
auto normalTextureSize = _framebuffer->getNormalTexture()->getDimensions();
|
||||||
|
|
||||||
|
@ -602,10 +601,7 @@ void AmbientOcclusionEffect::run(const render::RenderContextPointer& renderConte
|
||||||
const auto& linearDepthFramebuffer = inputs.get2();
|
const auto& linearDepthFramebuffer = inputs.get2();
|
||||||
|
|
||||||
const int resolutionLevel = _aoParametersBuffer->getResolutionLevel();
|
const int resolutionLevel = _aoParametersBuffer->getResolutionLevel();
|
||||||
const auto resolutionScale = powf(0.5f, resolutionLevel);
|
|
||||||
|
|
||||||
const auto depthResolutionLevel = getDepthResolutionLevel();
|
const auto depthResolutionLevel = getDepthResolutionLevel();
|
||||||
const auto depthResolutionScale = powf(0.5f, depthResolutionLevel);
|
|
||||||
const auto isHorizonBased = _aoParametersBuffer->isHorizonBased();
|
const auto isHorizonBased = _aoParametersBuffer->isHorizonBased();
|
||||||
|
|
||||||
auto fullResDepthTexture = linearDepthFramebuffer->getLinearDepthTexture();
|
auto fullResDepthTexture = linearDepthFramebuffer->getLinearDepthTexture();
|
||||||
|
@ -638,7 +634,6 @@ void AmbientOcclusionEffect::run(const render::RenderContextPointer& renderConte
|
||||||
outputs.edit0() = _framebuffer;
|
outputs.edit0() = _framebuffer;
|
||||||
outputs.edit1() = _aoParametersBuffer;
|
outputs.edit1() = _aoParametersBuffer;
|
||||||
|
|
||||||
auto framebufferSize = _framebuffer->getSourceFrameSize();
|
|
||||||
auto occlusionPipeline = getOcclusionPipeline();
|
auto occlusionPipeline = getOcclusionPipeline();
|
||||||
auto bilateralBlurPipeline = getBilateralBlurPipeline();
|
auto bilateralBlurPipeline = getBilateralBlurPipeline();
|
||||||
auto mipCreationPipeline = getMipCreationPipeline();
|
auto mipCreationPipeline = getMipCreationPipeline();
|
||||||
|
@ -651,7 +646,6 @@ void AmbientOcclusionEffect::run(const render::RenderContextPointer& renderConte
|
||||||
auto splitSize = glm::ivec2(_framebuffer->getOcclusionSplitTexture()->getDimensions());
|
auto splitSize = glm::ivec2(_framebuffer->getOcclusionSplitTexture()->getDimensions());
|
||||||
auto splitViewport = glm::ivec4{ 0, 0, splitSize.x, splitSize.y };
|
auto splitViewport = glm::ivec4{ 0, 0, splitSize.x, splitSize.y };
|
||||||
#endif
|
#endif
|
||||||
auto occlusionDepthSize = glm::ivec2(occlusionDepthTexture->getDimensions());
|
|
||||||
|
|
||||||
// Update sample rotation
|
// Update sample rotation
|
||||||
if (_isJitterEnabled) {
|
if (_isJitterEnabled) {
|
||||||
|
|
Loading…
Reference in a new issue