REvert unecessary modified files to upstream master, just leaving the true new feature in this branch

This commit is contained in:
Sam Gateau 2019-04-22 09:14:32 -07:00
parent 6539482cc2
commit 97632534e5
12 changed files with 21 additions and 1078 deletions

View file

@ -26,8 +26,6 @@ bool DebugHmdDisplayPlugin::isSupported() const {
void DebugHmdDisplayPlugin::resetSensors() {
_currentRenderFrameInfo.renderPose = glm::mat4(); // identity
_currentRenderFrameInfo.renderPose = glm::translate(glm::mat4(), glm::vec3(0.0f, 1.76f, 0.0f));
}
bool DebugHmdDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
@ -37,8 +35,6 @@ bool DebugHmdDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
// FIXME simulate head movement
//_currentRenderFrameInfo.renderPose = ;
//_currentRenderFrameInfo.presentPose = _currentRenderFrameInfo.renderPose;
_currentRenderFrameInfo.renderPose = glm::translate(glm::mat4(), glm::vec3(0.0f, 1.76f, 0.0f));
_currentRenderFrameInfo.presentPose = _currentRenderFrameInfo.renderPose;
withNonPresentThreadLock([&] {
_frameInfos[frameIndex] = _currentRenderFrameInfo;
@ -78,7 +74,6 @@ bool DebugHmdDisplayPlugin::internalActivate() {
// uncomment to capture a quarter size frame
//_renderTargetSize /= 2;
_cullingProjection = _eyeProjections[0];
// This must come after the initialization, so that the values calculated
// above are available during the customizeContext call (when not running
// in threaded present mode)

View file

@ -447,24 +447,20 @@ void GLBackend::render(const Batch& batch) {
renderPassTransfer(batch);
}
//#ifdef GPU_STEREO_DRAWCALL_INSTANCED
#ifdef GPU_STEREO_VIEWPORT_CLIPPED
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
if (_stereo.isStereo()) {
glEnable(GL_CLIP_DISTANCE0);
}
#endif
//#endif
{
GL_PROFILE_RANGE(render_gpu_gl_detail, _stereo.isStereo() ? "Render Stereo" : "Render");
renderPassDraw(batch);
}
//#ifdef GPU_STEREO_DRAWCALL_INSTANCED
#ifdef GPU_STEREO_VIEWPORT_CLIPPED
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
if (_stereo.isStereo()) {
glDisable(GL_CLIP_DISTANCE0);
}
#endif
//#endif
// Restore the saved stereo state for the next batch
_stereo._enable = savedStereo;

View file

@ -36,8 +36,7 @@
#define GPU_STEREO_TECHNIQUE_DOUBLED_SIMPLE
#else
//#define GPU_STEREO_TECHNIQUE_DOUBLED_SMARTER
//#define GPU_STEREO_TECHNIQUE_INSTANCED
#define GPU_STEREO_TECHNIQUE_INSTANCED_MULTIVIEWPORT
#define GPU_STEREO_TECHNIQUE_INSTANCED
#endif
// Let these be configured by the one define picked above
@ -52,13 +51,6 @@
#ifdef GPU_STEREO_TECHNIQUE_INSTANCED
#define GPU_STEREO_DRAWCALL_INSTANCED
#define GPU_STEREO_VIEWPORT_CLIPPED
#define GPU_STEREO_CAMERA_BUFFER
#endif
#ifdef GPU_STEREO_TECHNIQUE_INSTANCED_MULTIVIEWPORT
#define GPU_STEREO_DRAWCALL_INSTANCED
#define GPU_STEREO_MULTI_VIEWPORT
#define GPU_STEREO_CAMERA_BUFFER
#endif

View file

@ -39,48 +39,6 @@ void GLBackend::do_setViewportTransform(const Batch& batch, size_t paramOffset)
#ifdef GPU_STEREO_DRAWCALL_INSTANCED
{
#ifdef GPU_STEREO_MULTI_VIEWPORT
ivec4& vp = _transform._viewport;
auto sideWidth = vp.z / 2;
vec4 leftRight[3];
// Mono
leftRight[0] = vp;
// adding this here as im doing Layered, force the first viewport here to be half of it
leftRight[0].x = 0;
leftRight[0].z = sideWidth;
// Left side
leftRight[1] = vp;
leftRight[1].x = 0;
leftRight[1].z = sideWidth;
// right side
leftRight[2] = vp;
leftRight[2].x = sideWidth;
leftRight[2].z = sideWidth;
glViewportArrayv(0, 3, (float*)leftRight);
// Where we assign the GL viewport
if (_stereo.isStereo()) {
// ivec4 leftRight[3];
// leftRight[0] = vp;
vp.z /= 2;
/* leftRight[1] = vp; // left side
leftRight[2] = vp; // right side
leftRight[2].x += vp.z;
glViewportArrayv(0, 3, (float*) leftRight);
*/
if (_stereo._pass) {
vp.x += vp.z;
}
} else {
// glViewport(vp.x, vp.y, vp.z, vp.w);
}
#else
ivec4& vp = _transform._viewport;
glViewport(vp.x, vp.y, vp.z, vp.w);
@ -91,7 +49,6 @@ void GLBackend::do_setViewportTransform(const Batch& batch, size_t paramOffset)
vp.x += vp.z;
}
}
#endif
}
#else
if (!_inRenderTransferPass && !isStereo()) {
@ -166,7 +123,7 @@ void GLBackend::TransformStageState::preUpdate(size_t commandIndex, const Stereo
if (_invalidView || _invalidProj || _invalidViewport) {
size_t offset = _cameraUboSize * _cameras.size();
Vec2 finalJitter = _projectionJitter / Vec2(framebufferSize);
Vec2 finalJitter = _projectionJitter / Vec2(framebufferSize);
_cameraOffsets.push_back(TransformStageState::Pair(commandIndex, offset));
if (stereo.isStereo()) {

View file

@ -60,23 +60,12 @@ public:
}
if (gltexture) {
if (!_gpuObject.isLayered()) {
if (gltexture->_target == GL_TEXTURE_2D) {
glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0);
} else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) {
glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0);
} else {
glNamedFramebufferTextureLayer(_id, colorAttachments[unit], gltexture->_texture, 0, b._subresource);
}
if (gltexture->_target == GL_TEXTURE_2D) {
glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0);
} else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) {
glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0);
} else {
if (gltexture->_target == GL_TEXTURE_2D) {
glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0);
} else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) {
glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0);
} else {
glNamedFramebufferTextureLayer(_id, colorAttachments[unit], gltexture->_texture, 0,
b._subresource);
}
glNamedFramebufferTextureLayer(_id, colorAttachments[unit], gltexture->_texture, 0, b._subresource);
}
_colorBuffers.push_back(colorAttachments[unit]);
} else {

View file

@ -421,951 +421,6 @@ void gpu::doInBatch(const char* name,
const std::shared_ptr<gpu::Context>& context,
const std::function<void(Batch& batch)>& f) {
auto batch = Context::acquireBatch(name);
f(*batch);
context->appendFrameBatch(batch);
}

View file

@ -82,14 +82,6 @@ uint32 Framebuffer::getFrameCount() const {
}
}
uint16 evalRenderBufferNumLayers(const Texture& texture, uint16 subresource) {
if (subresource == TextureView::UNDEFINED_SUBRESOURCE) {
return texture.getNumSlices();
} else {
return 1;
}
}
bool Framebuffer::validateTargetCompatibility(const Texture& texture, uint32 subresource) const {
if (texture.getType() == Texture::TEX_1D) {
return false;
@ -100,8 +92,7 @@ bool Framebuffer::validateTargetCompatibility(const Texture& texture, uint32 sub
} else {
if ((texture.getWidth() == getWidth()) &&
(texture.getHeight() == getHeight()) &&
(texture.getNumSamples() == getNumSamples()) &&
(evalRenderBufferNumLayers(texture, subresource) == getNumLayers())) {
(texture.getNumSamples() == getNumSamples())) {
return true;
} else {
return false;
@ -109,7 +100,7 @@ bool Framebuffer::validateTargetCompatibility(const Texture& texture, uint32 sub
}
}
void Framebuffer::updateSize(const TexturePointer& texture, uint32 subresource) {
void Framebuffer::updateSize(const TexturePointer& texture) {
if (!isEmpty()) {
return;
}
@ -118,9 +109,8 @@ void Framebuffer::updateSize(const TexturePointer& texture, uint32 subresource)
_width = texture->getWidth();
_height = texture->getHeight();
_numSamples = texture->getNumSamples();
_numLayers = evalRenderBufferNumLayers(*texture, subresource);
} else {
_width = _height = _numSamples = _numLayers = 0;
_width = _height = _numSamples = 0;
}
}
@ -148,14 +138,6 @@ uint16 Framebuffer::getNumSamples() const {
}
}
uint16 Framebuffer::getNumLayers() const {
if (isSwapchain()) {
return getSwapchain()->getNumLayers();
} else {
return _numLayers;
}
}
// Render buffers
int Framebuffer::setRenderBuffer(uint32 slot, const TexturePointer& texture, uint32 subresource) {
if (isSwapchain()) {
@ -182,7 +164,7 @@ int Framebuffer::setRenderBuffer(uint32 slot, const TexturePointer& texture, uin
++_colorStamps[slot];
updateSize(texture, subresource);
updateSize(texture);
// assign the new one
_renderBuffers[slot] = TextureView(texture, subresource);
@ -209,7 +191,7 @@ void Framebuffer::removeRenderBuffers() {
renderBuffer._texture.reset();
}
updateSize(TexturePointer(nullptr), TextureView::UNDEFINED_SUBRESOURCE);
updateSize(TexturePointer(nullptr));
}
@ -258,7 +240,7 @@ bool Framebuffer::assignDepthStencilBuffer(const TexturePointer& texture, const
}
++_depthStamp;
updateSize(texture, subresource);
updateSize(texture);
// assign the new one
_depthStencilBuffer = TextureView(texture, subresource, format);

View file

@ -27,7 +27,6 @@ public:
uint16 getWidth() const { return _width; }
uint16 getHeight() const { return _height; }
uint16 getNumSamples() const { return _numSamples; }
uint16 getNumLayers() const { return _numLayers; }
bool hasDepthStencil() const { return _hasDepthStencil; }
bool isFullscreen() const { return _isFullscreen; }
@ -55,7 +54,6 @@ protected:
uint16 _width = 1;
uint16 _height = 1;
uint16 _numSamples = 1;
uint16 _numLayers = 1;
uint16 _swapInterval = 0;
bool _hasDepthStencil = false;
@ -117,6 +115,7 @@ public:
uint32 getDepthStencilBufferSubresource() const;
Format getDepthStencilBufferFormat() const;
// Properties
Masks getBufferMask() const { return _bufferMask; }
bool isEmpty() const { return (_bufferMask == 0); }
@ -131,10 +130,6 @@ public:
uint16 getWidth() const;
uint16 getHeight() const;
uint16 getNumSamples() const;
uint16 getNumLayers() const;
bool isLayered() const { return getNumLayers() > 1; }
const std::string& getName() const { return _name; }
void setName(const std::string& name) { _name = name; }
@ -175,9 +170,7 @@ protected:
uint16 _height = 0;
uint16 _numSamples = 0;
uint16 _numLayers = 0;
void updateSize(const TexturePointer& texture, uint32 subresource);
void updateSize(const TexturePointer& texture);
bool assignDepthStencilBuffer(const TexturePointer& texture, const Format& format, uint32 subresource);
friend class Serializer;

View file

@ -646,11 +646,9 @@ typedef std::vector< TexturePointer > Textures;
class TextureView {
public:
typedef Resource::Size Size;
static const uint16 UNDEFINED_SUBRESOURCE { uint16(-1) };
TexturePointer _texture = TexturePointer(NULL);
uint16 _subresource = UNDEFINED_SUBRESOURCE;
uint16 _subresource = 0;
Element _element = Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
TextureView() {};
@ -662,7 +660,7 @@ public:
// create the TextureView and own the Texture
TextureView(Texture* newTexture, const Element& element) :
_texture(newTexture),
_subresource(UNDEFINED_SUBRESOURCE),
_subresource(0),
_element(element)
{};
TextureView(const TexturePointer& texture, uint16 subresource, const Element& element) :
@ -684,8 +682,6 @@ public:
bool operator !() const { return (!_texture); }
bool isValid() const { return bool(_texture); }
bool isSubresource() const { return (_subresource != UNDEFINED_SUBRESOURCE); }
};
typedef std::vector<TextureView> TextureViews;

View file

@ -168,17 +168,10 @@ TransformObject getTransformObject() {
vec2 eyeOffsetScale = vec2(-0.5, +0.5);
uint eyeIndex = uint(_stereoSide);
#if !defined(GPU_GLES) || (defined(HAVE_EXT_clip_cull_distance) && !defined(VULKAN))
#ifdef GPU_GL450
/* gl_ViewportIndex = _stereoSide + 1;
// gl_ViewportIndex = 2 - _stereoSide;
*/// THIs is the layered version
gl_Layer = _stereoSide;
#else
gl_ClipDistance[0] = dot(<$clipPos$>, eyeClipEdge[eyeIndex]);
#endif
#endif
// float newClipPosX = <$clipPos$>.x * 0.5 + eyeOffsetScale[eyeIndex] * <$clipPos$>.w;
// <$clipPos$>.x = newClipPosX;
float newClipPosX = <$clipPos$>.x * 0.5 + eyeOffsetScale[eyeIndex] * <$clipPos$>.w;
<$clipPos$>.x = newClipPosX;
#endif
#else

View file

@ -1,4 +1,3 @@
#extension GL_ARB_shader_viewport_layer_array : require
#define GPU_SSBO_TRANSFORM_OBJECT
#define BITFIELD int
#define LAYOUT(X) layout(X)

View file

@ -215,10 +215,6 @@ def processCommand(line):
if (dialect == '310es'): spirvCrossDialect = '320es'
spirvCrossArgs = [spirvCrossExec, '--output', glslFile, spirvFile, '--version', spirvCrossDialect]
if (dialect == '410'): spirvCrossArgs.append('--no-420pack-extension')
if (dialect == '450'):
spirvCrossArgs.append('--extension')
spirvCrossArgs.append('GL_ARB_shader_viewport_layer_array')
executeSubprocess(spirvCrossArgs)
else:
# This logic is necessary because cmake will agressively keep re-executing the shadergen