Merge branch 'master' of github.com:highfidelity/hifi into black-bis

This commit is contained in:
sam gateau 2018-09-05 17:50:21 -07:00
commit 4ef8f29522
12 changed files with 125 additions and 100 deletions

View file

@ -4,8 +4,8 @@ set(EXTERNAL_NAME serverless-content)
ExternalProject_Add( ExternalProject_Add(
${EXTERNAL_NAME} ${EXTERNAL_NAME}
URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC72.zip URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC73.zip
URL_MD5 b1d8faf9266bfbff88274a484911eb99 URL_MD5 0c5edfb63cafb042311d3cf25261fbf2
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""

View file

@ -6365,7 +6365,6 @@ void Application::clearDomainOctreeDetails() {
} }
void Application::clearDomainAvatars() { void Application::clearDomainAvatars() {
getMyAvatar()->setAvatarEntityDataChanged(true); // to recreate worn entities
DependencyManager::get<AvatarManager>()->clearOtherAvatars(); DependencyManager::get<AvatarManager>()->clearOtherAvatars();
} }

View file

@ -139,7 +139,6 @@ Avatar::~Avatar() {
} }
}); });
} }
auto geometryCache = DependencyManager::get<GeometryCache>(); auto geometryCache = DependencyManager::get<GeometryCache>();
if (geometryCache) { if (geometryCache) {
geometryCache->releaseID(_nameRectGeometryID); geometryCache->releaseID(_nameRectGeometryID);

View file

@ -1861,7 +1861,9 @@ qint64 AvatarData::packTrait(AvatarTraits::TraitType traitType, ExtendedIODevice
} }
qint64 AvatarData::packTraitInstance(AvatarTraits::TraitType traitType, AvatarTraits::TraitInstanceID traitInstanceID, qint64 AvatarData::packTraitInstance(AvatarTraits::TraitType traitType, AvatarTraits::TraitInstanceID traitInstanceID,
ExtendedIODevice& destination, AvatarTraits::TraitVersion traitVersion) { ExtendedIODevice& destination, AvatarTraits::TraitVersion traitVersion,
AvatarTraits::TraitInstanceID wireInstanceID) {
qint64 bytesWritten = 0; qint64 bytesWritten = 0;
bytesWritten += destination.writePrimitive(traitType); bytesWritten += destination.writePrimitive(traitType);
@ -1870,7 +1872,11 @@ qint64 AvatarData::packTraitInstance(AvatarTraits::TraitType traitType, AvatarTr
bytesWritten += destination.writePrimitive(traitVersion); bytesWritten += destination.writePrimitive(traitVersion);
} }
if (!wireInstanceID.isNull()) {
bytesWritten += destination.write(wireInstanceID.toRfc4122());
} else {
bytesWritten += destination.write(traitInstanceID.toRfc4122()); bytesWritten += destination.write(traitInstanceID.toRfc4122());
}
if (traitType == AvatarTraits::AvatarEntity) { if (traitType == AvatarTraits::AvatarEntity) {
// grab a read lock on the avatar entities and check for entity data for the given ID // grab a read lock on the avatar entities and check for entity data for the given ID
@ -1895,6 +1901,16 @@ qint64 AvatarData::packTraitInstance(AvatarTraits::TraitType traitType, AvatarTr
return bytesWritten; return bytesWritten;
} }
void AvatarData::prepareResetTraitInstances() {
if (_clientTraitsHandler) {
_avatarEntitiesLock.withReadLock([this]{
foreach (auto entityID, _avatarEntityData.keys()) {
_clientTraitsHandler->markInstancedTraitUpdated(AvatarTraits::AvatarEntity, entityID);
}
});
}
}
void AvatarData::processTrait(AvatarTraits::TraitType traitType, QByteArray traitBinaryData) { void AvatarData::processTrait(AvatarTraits::TraitType traitType, QByteArray traitBinaryData) {
if (traitType == AvatarTraits::SkeletonModelURL) { if (traitType == AvatarTraits::SkeletonModelURL) {
// get the URL from the binary data // get the URL from the binary data
@ -2792,7 +2808,7 @@ void AvatarData::setAvatarEntityData(const AvatarEntityMap& avatarEntityData) {
if (_clientTraitsHandler) { if (_clientTraitsHandler) {
// if we have a client traits handler, flag any updated or created entities // if we have a client traits handler, flag any updated or created entities
// so that we send changes for them next frame // so that we send changes for them next frame
foreach (auto entityID, _avatarEntityData) { foreach (auto entityID, _avatarEntityData.keys()) {
_clientTraitsHandler->markInstancedTraitUpdated(AvatarTraits::AvatarEntity, entityID); _clientTraitsHandler->markInstancedTraitUpdated(AvatarTraits::AvatarEntity, entityID);
} }
} }

View file

@ -962,7 +962,10 @@ public:
qint64 packTrait(AvatarTraits::TraitType traitType, ExtendedIODevice& destination, qint64 packTrait(AvatarTraits::TraitType traitType, ExtendedIODevice& destination,
AvatarTraits::TraitVersion traitVersion = AvatarTraits::NULL_TRAIT_VERSION); AvatarTraits::TraitVersion traitVersion = AvatarTraits::NULL_TRAIT_VERSION);
qint64 packTraitInstance(AvatarTraits::TraitType traitType, AvatarTraits::TraitInstanceID instanceID, qint64 packTraitInstance(AvatarTraits::TraitType traitType, AvatarTraits::TraitInstanceID instanceID,
ExtendedIODevice& destination, AvatarTraits::TraitVersion traitVersion = AvatarTraits::NULL_TRAIT_VERSION); ExtendedIODevice& destination, AvatarTraits::TraitVersion traitVersion = AvatarTraits::NULL_TRAIT_VERSION,
AvatarTraits::TraitInstanceID wireInstanceID = AvatarTraits::TraitInstanceID());
void prepareResetTraitInstances();
void processTrait(AvatarTraits::TraitType traitType, QByteArray traitBinaryData); void processTrait(AvatarTraits::TraitType traitType, QByteArray traitBinaryData);
void processTraitInstance(AvatarTraits::TraitType traitType, void processTraitInstance(AvatarTraits::TraitType traitType,
@ -1190,6 +1193,9 @@ public:
void setReplicaIndex(int replicaIndex) { _replicaIndex = replicaIndex; } void setReplicaIndex(int replicaIndex) { _replicaIndex = replicaIndex; }
int getReplicaIndex() { return _replicaIndex; } int getReplicaIndex() { return _replicaIndex; }
const AvatarTraits::TraitInstanceID getTraitInstanceXORID() const { return _traitInstanceXORID; }
void cycleTraitInstanceXORID() { _traitInstanceXORID = QUuid::createUuid(); }
signals: signals:
/**jsdoc /**jsdoc
@ -1496,6 +1502,8 @@ private:
// privatize the copy constructor and assignment operator so they cannot be called // privatize the copy constructor and assignment operator so they cannot be called
AvatarData(const AvatarData&); AvatarData(const AvatarData&);
AvatarData& operator= (const AvatarData&); AvatarData& operator= (const AvatarData&);
AvatarTraits::TraitInstanceID _traitInstanceXORID { QUuid::createUuid() };
}; };
Q_DECLARE_METATYPE(AvatarData*) Q_DECLARE_METATYPE(AvatarData*)

View file

@ -85,7 +85,8 @@ void AvatarReplicas::processDeletedTraitInstance(const QUuid& parentID, AvatarTr
if (_replicasMap.find(parentID) != _replicasMap.end()) { if (_replicasMap.find(parentID) != _replicasMap.end()) {
auto &replicas = _replicasMap[parentID]; auto &replicas = _replicasMap[parentID];
for (auto avatar : replicas) { for (auto avatar : replicas) {
avatar->processDeletedTraitInstance(traitType, instanceID); avatar->processDeletedTraitInstance(traitType,
AvatarTraits::xoredInstanceID(instanceID, avatar->getTraitInstanceXORID()));
} }
} }
} }
@ -94,7 +95,9 @@ void AvatarReplicas::processTraitInstance(const QUuid& parentID, AvatarTraits::T
if (_replicasMap.find(parentID) != _replicasMap.end()) { if (_replicasMap.find(parentID) != _replicasMap.end()) {
auto &replicas = _replicasMap[parentID]; auto &replicas = _replicasMap[parentID];
for (auto avatar : replicas) { for (auto avatar : replicas) {
avatar->processTraitInstance(traitType, instanceID, traitBinaryData); avatar->processTraitInstance(traitType,
AvatarTraits::xoredInstanceID(instanceID, avatar->getTraitInstanceXORID()),
traitBinaryData);
} }
} }
} }
@ -335,16 +338,28 @@ void AvatarHashMap::processBulkAvatarTraits(QSharedPointer<ReceivedMessage> mess
AvatarTraits::TraitInstanceID traitInstanceID = AvatarTraits::TraitInstanceID traitInstanceID =
QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID)); QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
// XOR the incoming trait instance ID with this avatar object's personal XOR ID
// this ensures that we have separate entity instances in the local tree
// if we briefly end up with two Avatar objects for this node
// (which can occur if the shared pointer for the
// previous instance of an avatar hasn't yet gone out of scope before the
// new instance is created)
auto xoredInstanceID = AvatarTraits::xoredInstanceID(traitInstanceID, avatar->getTraitInstanceXORID());
message->readPrimitive(&traitBinarySize); message->readPrimitive(&traitBinarySize);
auto& processedInstanceVersion = lastProcessedVersions.getInstanceValueRef(traitType, traitInstanceID); auto& processedInstanceVersion = lastProcessedVersions.getInstanceValueRef(traitType, traitInstanceID);
if (packetTraitVersion > processedInstanceVersion) { if (packetTraitVersion > processedInstanceVersion) {
// in order to handle re-connections to the avatar mixer when the other
if (traitBinarySize == AvatarTraits::DELETED_TRAIT_SIZE) { if (traitBinarySize == AvatarTraits::DELETED_TRAIT_SIZE) {
avatar->processDeletedTraitInstance(traitType, traitInstanceID); avatar->processDeletedTraitInstance(traitType, xoredInstanceID);
_replicas.processDeletedTraitInstance(avatarID, traitType, traitInstanceID); _replicas.processDeletedTraitInstance(avatarID, traitType, traitInstanceID);
} else { } else {
auto traitData = message->read(traitBinarySize); auto traitData = message->read(traitBinarySize);
avatar->processTraitInstance(traitType, traitInstanceID, traitData); avatar->processTraitInstance(traitType, xoredInstanceID, traitData);
_replicas.processTraitInstance(avatarID, traitType, traitInstanceID, traitData); _replicas.processTraitInstance(avatarID, traitType, traitInstanceID, traitData);
} }
processedInstanceVersion = packetTraitVersion; processedInstanceVersion = packetTraitVersion;

View file

@ -41,7 +41,8 @@ namespace AvatarTraits {
const TraitWireSize DELETED_TRAIT_SIZE = -1; const TraitWireSize DELETED_TRAIT_SIZE = -1;
inline qint64 packInstancedTraitDelete(TraitType traitType, TraitInstanceID instanceID, ExtendedIODevice& destination, inline qint64 packInstancedTraitDelete(TraitType traitType, TraitInstanceID instanceID, ExtendedIODevice& destination,
TraitVersion traitVersion = NULL_TRAIT_VERSION) { TraitVersion traitVersion = NULL_TRAIT_VERSION,
TraitInstanceID xoredInstanceID = TraitInstanceID()) {
qint64 bytesWritten = 0; qint64 bytesWritten = 0;
bytesWritten += destination.writePrimitive(traitType); bytesWritten += destination.writePrimitive(traitType);
@ -50,12 +51,28 @@ namespace AvatarTraits {
bytesWritten += destination.writePrimitive(traitVersion); bytesWritten += destination.writePrimitive(traitVersion);
} }
if (xoredInstanceID.isNull()) {
bytesWritten += destination.write(instanceID.toRfc4122()); bytesWritten += destination.write(instanceID.toRfc4122());
} else {
bytesWritten += destination.write(xoredInstanceID.toRfc4122());
}
bytesWritten += destination.writePrimitive(DELETED_TRAIT_SIZE); bytesWritten += destination.writePrimitive(DELETED_TRAIT_SIZE);
return bytesWritten; return bytesWritten;
} }
inline TraitInstanceID xoredInstanceID(TraitInstanceID localInstanceID, TraitInstanceID xorKeyID) {
QByteArray xoredInstanceID { NUM_BYTES_RFC4122_UUID, 0 };
auto xorKeyIDBytes = xorKeyID.toRfc4122();
auto localInstanceIDBytes = localInstanceID.toRfc4122();
for (auto i = 0; i < localInstanceIDBytes.size(); ++i) {
xoredInstanceID[i] = localInstanceIDBytes[i] ^ xorKeyIDBytes[i];
}
return QUuid::fromRfc4122(xoredInstanceID);
}
}; };
#endif // hifi_AvatarTraits_h #endif // hifi_AvatarTraits_h

View file

@ -37,6 +37,15 @@ void ClientTraitsHandler::resetForNewMixer() {
// mark that all traits should be sent next time // mark that all traits should be sent next time
_shouldPerformInitialSend = true; _shouldPerformInitialSend = true;
// reset the trait statuses
_traitStatuses.reset();
// pre-fill the instanced statuses that we will need to send next frame
_owningAvatar->prepareResetTraitInstances();
// reset the trait XOR ID since we're resetting for a new avatar mixer
_owningAvatar->cycleTraitInstanceXORID();
} }
void ClientTraitsHandler::sendChangedTraitsToMixer() { void ClientTraitsHandler::sendChangedTraitsToMixer() {
@ -87,11 +96,19 @@ void ClientTraitsHandler::sendChangedTraitsToMixer() {
|| instanceIDValuePair.value == Updated) { || instanceIDValuePair.value == Updated) {
// this is a changed trait we need to send or we haven't send out trait information yet // this is a changed trait we need to send or we haven't send out trait information yet
// ask the owning avatar to pack it // ask the owning avatar to pack it
_owningAvatar->packTraitInstance(instancedIt->traitType, instanceIDValuePair.id, *traitsPacketList);
// since this is going to the mixer, use the XORed instance ID (to anonymize trait instance IDs
// that would typically persist across sessions)
_owningAvatar->packTraitInstance(instancedIt->traitType, instanceIDValuePair.id, *traitsPacketList,
AvatarTraits::NULL_TRAIT_VERSION,
AvatarTraits::xoredInstanceID(instanceIDValuePair.id,
_owningAvatar->getTraitInstanceXORID()));
} else if (!_shouldPerformInitialSend && instanceIDValuePair.value == Deleted) { } else if (!_shouldPerformInitialSend && instanceIDValuePair.value == Deleted) {
// pack delete for this trait instance // pack delete for this trait instance
AvatarTraits::packInstancedTraitDelete(instancedIt->traitType, instanceIDValuePair.id, AvatarTraits::packInstancedTraitDelete(instancedIt->traitType, instanceIDValuePair.id,
*traitsPacketList); *traitsPacketList, AvatarTraits::NULL_TRAIT_VERSION,
AvatarTraits::xoredInstanceID(instanceIDValuePair.id,
_owningAvatar->getTraitInstanceXORID()));
} }
} }

View file

@ -30,9 +30,9 @@ public:
void markTraitUpdated(AvatarTraits::TraitType updatedTrait) void markTraitUpdated(AvatarTraits::TraitType updatedTrait)
{ _traitStatuses[updatedTrait] = Updated; _hasChangedTraits = true; } { _traitStatuses[updatedTrait] = Updated; _hasChangedTraits = true; }
void markInstancedTraitUpdated(AvatarTraits::TraitType traitType, QUuid updatedInstanceID) void markInstancedTraitUpdated(AvatarTraits::TraitType traitType, AvatarTraits::TraitInstanceID updatedInstanceID)
{ _traitStatuses.instanceInsert(traitType, updatedInstanceID, Updated); _hasChangedTraits = true; } { _traitStatuses.instanceInsert(traitType, updatedInstanceID, Updated); _hasChangedTraits = true; }
void markInstancedTraitDeleted(AvatarTraits::TraitType traitType, QUuid deleteInstanceID) void markInstancedTraitDeleted(AvatarTraits::TraitType traitType, AvatarTraits::TraitInstanceID deleteInstanceID)
{ _traitStatuses.instanceInsert(traitType, deleteInstanceID, Deleted); _hasChangedTraits = true; } { _traitStatuses.instanceInsert(traitType, deleteInstanceID, Deleted); _hasChangedTraits = true; }
void resetForNewMixer(); void resetForNewMixer();

View file

@ -38,33 +38,6 @@ void DebugDeferredBufferConfig::setMode(int newMode) {
emit dirty(); emit dirty();
} }
#if 0
enum TextureSlot {
Albedo = 0,
Normal,
Specular,
Depth,
Lighting,
Shadow,
LinearDepth,
HalfLinearDepth,
HalfNormal,
Curvature,
DiffusedCurvature,
Scattering,
AmbientOcclusion,
AmbientOcclusionBlurred,
Velocity,
};
enum ParamSlot {
CameraCorrection = 0,
DeferredFrameTransform,
ShadowTransform,
DebugParametersBuffer
};
#endif
static const std::string DEFAULT_ALBEDO_SHADER{ static const std::string DEFAULT_ALBEDO_SHADER{
"vec4 getFragmentColor() {" "vec4 getFragmentColor() {"
" DeferredFragment frag = unpackDeferredFragmentNoPosition(uv);" " DeferredFragment frag = unpackDeferredFragmentNoPosition(uv);"
@ -178,19 +151,19 @@ static const std::string DEFAULT_SHADOW_CASCADE_SHADER{
static const std::string DEFAULT_LINEAR_DEPTH_SHADER{ static const std::string DEFAULT_LINEAR_DEPTH_SHADER{
"vec4 getFragmentColor() {" "vec4 getFragmentColor() {"
" return vec4(vec3(1.0 - texture(linearDepthMap, uv).x * 0.01), 1.0);" " return vec4(vec3(1.0 - texture(debugTexture0, uv).x * 0.01), 1.0);"
"}" "}"
}; };
static const std::string DEFAULT_HALF_LINEAR_DEPTH_SHADER{ static const std::string DEFAULT_HALF_LINEAR_DEPTH_SHADER{
"vec4 getFragmentColor() {" "vec4 getFragmentColor() {"
" return vec4(vec3(1.0 - texture(halfLinearDepthMap, uv).x * 0.01), 1.0);" " return vec4(vec3(1.0 - texture(debugTexture0, uv).x * 0.01), 1.0);"
" }" " }"
}; };
static const std::string DEFAULT_HALF_NORMAL_SHADER{ static const std::string DEFAULT_HALF_NORMAL_SHADER{
"vec4 getFragmentColor() {" "vec4 getFragmentColor() {"
" return vec4(vec3(texture(halfNormalMap, uv).xyz), 1.0);" " return vec4(vec3(texture(debugTexture0, uv).xyz), 1.0);"
" }" " }"
}; };
@ -240,27 +213,27 @@ static const std::string DEFAULT_CURVATURE_OCCLUSION_SHADER{
static const std::string DEFAULT_DEBUG_SCATTERING_SHADER{ static const std::string DEFAULT_DEBUG_SCATTERING_SHADER{
"vec4 getFragmentColor() {" "vec4 getFragmentColor() {"
" return vec4(pow(vec3(texture(scatteringMap, uv).xyz), vec3(1.0 / 2.2)), 1.0);" " return vec4(pow(vec3(texture(debugTexture0, uv).xyz), vec3(1.0 / 2.2)), 1.0);"
// " return vec4(vec3(texture(scatteringMap, uv).xyz), 1.0);" // " return vec4(vec3(texture(debugTexture0, uv).xyz), 1.0);"
" }" " }"
}; };
static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER{ static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER{
"vec4 getFragmentColor() {" "vec4 getFragmentColor() {"
" return vec4(vec3(texture(obscuranceMap, uv).x), 1.0);" " return vec4(vec3(texture(obscuranceMap, uv).x), 1.0);"
// When drawing color " return vec4(vec3(texture(occlusionMap, uv).xyz), 1.0);" // When drawing color " return vec4(vec3(texture(debugTexture0, uv).xyz), 1.0);"
// when drawing normal" return vec4(normalize(texture(occlusionMap, uv).xyz * 2.0 - vec3(1.0)), 1.0);" // when drawing normal" return vec4(normalize(texture(debugTexture0, uv).xyz * 2.0 - vec3(1.0)), 1.0);"
" }" " }"
}; };
static const std::string DEFAULT_AMBIENT_OCCLUSION_BLURRED_SHADER{ static const std::string DEFAULT_AMBIENT_OCCLUSION_BLURRED_SHADER{
"vec4 getFragmentColor() {" "vec4 getFragmentColor() {"
" return vec4(vec3(texture(occlusionBlurredMap, uv).xyz), 1.0);" " return vec4(vec3(texture(debugTexture0, uv).xyz), 1.0);"
" }" " }"
}; };
static const std::string DEFAULT_VELOCITY_SHADER{ static const std::string DEFAULT_VELOCITY_SHADER{
"vec4 getFragmentColor() {" "vec4 getFragmentColor() {"
" return vec4(vec2(texture(velocityMap, uv).xy), 0.0, 1.0);" " return vec4(vec2(texture(debugTexture0, uv).xy), 0.0, 1.0);"
" }" " }"
}; };
@ -463,13 +436,10 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
batch.setResourceTexture(Textures::DeferredDepth, deferredFramebuffer->getPrimaryDepthTexture()); batch.setResourceTexture(Textures::DeferredDepth, deferredFramebuffer->getPrimaryDepthTexture());
batch.setResourceTexture(Textures::DeferredLighting, deferredFramebuffer->getLightingTexture()); batch.setResourceTexture(Textures::DeferredLighting, deferredFramebuffer->getLightingTexture());
} }
if (velocityFramebuffer) { if (velocityFramebuffer && _mode == VelocityMode) {
batch.setResourceTexture(Textures::DebugVelocity, velocityFramebuffer->getVelocityTexture()); batch.setResourceTexture(Textures::DebugTexture0, velocityFramebuffer->getVelocityTexture());
} }
// FIXME can't find the corresponding buffer
// batch.setUniformBuffer(UBOs:: DebugParametersBuffer, _parameters);
auto lightStage = renderContext->_scene->getStage<LightStage>(); auto lightStage = renderContext->_scene->getStage<LightStage>();
assert(lightStage); assert(lightStage);
assert(lightStage->getNumLights() > 0); assert(lightStage->getNumLights() > 0);
@ -479,12 +449,17 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
batch.setResourceTexture(Textures::Shadow, globalShadow->map); batch.setResourceTexture(Textures::Shadow, globalShadow->map);
batch.setUniformBuffer(UBOs::ShadowParams, globalShadow->getBuffer()); batch.setUniformBuffer(UBOs::ShadowParams, globalShadow->getBuffer());
batch.setUniformBuffer(UBOs::DeferredFrameTransform, frameTransform->getFrameTransformBuffer()); batch.setUniformBuffer(UBOs::DeferredFrameTransform, frameTransform->getFrameTransformBuffer());
batch.setUniformBuffer(UBOs::DebugDeferredParams, _parameters);
} }
if (linearDepthTarget) { if (linearDepthTarget) {
batch.setResourceTexture(Textures::DebugDepth, linearDepthTarget->getLinearDepthTexture()); if (_mode == DepthMode) {
batch.setResourceTexture(Textures::DebugHalfDepth, linearDepthTarget->getHalfLinearDepthTexture()); batch.setResourceTexture(Textures::DebugTexture0, linearDepthTarget->getLinearDepthTexture());
batch.setResourceTexture(Textures::DebugHalfNormal, linearDepthTarget->getHalfNormalTexture()); } else if (_mode == HalfLinearDepthMode) {
batch.setResourceTexture(Textures::DebugTexture0, linearDepthTarget->getHalfLinearDepthTexture());
} else if (_mode == HalfNormalMode) {
batch.setResourceTexture(Textures::DebugTexture0, linearDepthTarget->getHalfNormalTexture());
}
} }
if (surfaceGeometryFramebuffer) { if (surfaceGeometryFramebuffer) {
batch.setResourceTexture(Textures::DeferredCurvature, surfaceGeometryFramebuffer->getCurvatureTexture()); batch.setResourceTexture(Textures::DeferredCurvature, surfaceGeometryFramebuffer->getCurvatureTexture());
@ -492,9 +467,11 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
surfaceGeometryFramebuffer->getLowCurvatureTexture()); surfaceGeometryFramebuffer->getLowCurvatureTexture());
} }
if (ambientOcclusionFramebuffer) { if (ambientOcclusionFramebuffer) {
batch.setResourceTexture(Textures::DebugOcclusion, ambientOcclusionFramebuffer->getOcclusionTexture()); if (_mode == AmbientOcclusionMode) {
batch.setResourceTexture(Textures::DebugOcclusionBlurred, batch.setResourceTexture(Textures::DebugTexture0, ambientOcclusionFramebuffer->getOcclusionTexture());
ambientOcclusionFramebuffer->getOcclusionBlurredTexture()); } else if (_mode == AmbientOcclusionBlurredMode) {
batch.setResourceTexture(Textures::DebugTexture0, ambientOcclusionFramebuffer->getOcclusionBlurredTexture());
}
} }
const glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f); const glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f);
const glm::vec2 bottomLeft(_size.x, _size.y); const glm::vec2 bottomLeft(_size.x, _size.y);
@ -505,19 +482,14 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
batch.setResourceTexture(Textures::DeferredNormal, nullptr); batch.setResourceTexture(Textures::DeferredNormal, nullptr);
batch.setResourceTexture(Textures::DeferredSpecular, nullptr); batch.setResourceTexture(Textures::DeferredSpecular, nullptr);
batch.setResourceTexture(Textures::DeferredDepth, nullptr); batch.setResourceTexture(Textures::DeferredDepth, nullptr);
batch.setResourceTexture(Textures::DeferredLighting, nullptr);
batch.setResourceTexture(Textures::Shadow, nullptr);
batch.setResourceTexture(Textures::DebugDepth, nullptr);
batch.setResourceTexture(Textures::DebugHalfDepth, nullptr);
batch.setResourceTexture(Textures::DebugHalfNormal, nullptr);
batch.setResourceTexture(Textures::DeferredCurvature, nullptr); batch.setResourceTexture(Textures::DeferredCurvature, nullptr);
batch.setResourceTexture(Textures::DeferredDiffusedCurvature, nullptr); batch.setResourceTexture(Textures::DeferredDiffusedCurvature, nullptr);
batch.setResourceTexture(Textures::DeferredLighting, nullptr);
batch.setResourceTexture(Textures::DebugOcclusion, nullptr); for (auto i = 0; i < SHADOW_CASCADE_MAX_COUNT; i++) {
batch.setResourceTexture(Textures::DebugOcclusionBlurred, nullptr); batch.setResourceTexture(Textures::Shadow + i, nullptr);
}
batch.setResourceTexture(Textures::DebugVelocity, nullptr);
batch.setResourceTexture(Textures::DebugTexture0, nullptr);
}); });
} }

View file

@ -16,14 +16,8 @@
<@include gpu/Color.slh@> <@include gpu/Color.slh@>
<$declareColorWheel()$> <$declareColorWheel()$>
layout(binding=RENDER_UTILS_TEXTURE_DEBUG_DEPTH) uniform sampler2D linearDepthMap; layout(binding=RENDER_UTILS_DEBUG_TEXTURE0) uniform sampler2D debugTexture0;
layout(binding=RENDER_UTILS_TEXTURE_DEBUG_HALF_DEPTH) uniform sampler2D halfLinearDepthMap; layout(binding=RENDER_UTILS_TEXTURE_SHADOW) uniform sampler2DArrayShadow shadowMaps;
layout(binding=RENDER_UTILS_TEXTURE_DEBUG_HALF_NORMAL) uniform sampler2D halfNormalMap;
layout(binding=RENDER_UTILS_TEXTURE_DEBUG_OCCLUSION) uniform sampler2D occlusionMap;
layout(binding=RENDER_UTILS_TEXTURE_DEBUG_OCCLUSION_BLURRED) uniform sampler2D occlusionBlurredMap;
layout(binding=RENDER_UTILS_TEXTURE_DEBUG_SCATTERING) uniform sampler2D scatteringMap;
layout(binding=RENDER_UTILS_TEXTURE_DEBUG_VELOCITY) uniform sampler2D velocityMap;
layout(binding=RENDER_UTILS_TEXTURE_DEBUG_SHADOWS) uniform sampler2DArrayShadow shadowMaps;
<@include ShadowCore.slh@> <@include ShadowCore.slh@>
@ -31,7 +25,7 @@ layout(binding=RENDER_UTILS_TEXTURE_DEBUG_SHADOWS) uniform sampler2DArrayShadow
<@include debug_deferred_buffer_shared.slh@> <@include debug_deferred_buffer_shared.slh@>
layout(std140) uniform parametersBuffer { layout(std140, binding=RENDER_UTILS_BUFFER_DEBUG_DEFERRED_PARAMS) uniform parametersBuffer {
DebugParameters parameters; DebugParameters parameters;
}; };

View file

@ -126,14 +126,8 @@
// Debugging // Debugging
#define RENDER_UTILS_BUFFER_DEBUG_SKYBOX 5 #define RENDER_UTILS_BUFFER_DEBUG_SKYBOX 5
#define RENDER_UTILS_TEXTURE_DEBUG_DEPTH 11 #define RENDER_UTILS_DEBUG_TEXTURE0 11
#define RENDER_UTILS_TEXTURE_DEBUG_HALF_DEPTH 12 #define RENDER_UTILS_BUFFER_DEBUG_DEFERRED_PARAMS 1
#define RENDER_UTILS_TEXTURE_DEBUG_OCCLUSION 13
#define RENDER_UTILS_TEXTURE_DEBUG_OCCLUSION_BLURRED 14
#define RENDER_UTILS_TEXTURE_DEBUG_VELOCITY 15
#define RENDER_UTILS_TEXTURE_DEBUG_SHADOWS 16
#define RENDER_UTILS_TEXTURE_DEBUG_HALF_NORMAL 17
#define RENDER_UTILS_TEXTURE_DEBUG_SCATTERING 18
// <! // <!
#include <gpu/ShaderConstants.h> #include <gpu/ShaderConstants.h>
@ -174,6 +168,7 @@ enum Buffer {
BloomParams = RENDER_UTILS_BUFFER_BLOOM_PARAMS, BloomParams = RENDER_UTILS_BUFFER_BLOOM_PARAMS,
ToneMappingParams = RENDER_UTILS_BUFFER_TM_PARAMS, ToneMappingParams = RENDER_UTILS_BUFFER_TM_PARAMS,
ShadowParams = RENDER_UTILS_BUFFER_SHADOW_PARAMS, ShadowParams = RENDER_UTILS_BUFFER_SHADOW_PARAMS,
DebugDeferredParams = RENDER_UTILS_BUFFER_DEBUG_DEFERRED_PARAMS,
}; };
} // namespace buffer } // namespace buffer
@ -212,14 +207,7 @@ enum Texture {
BloomColor = RENDER_UTILS_TEXTURE_BLOOM_COLOR, BloomColor = RENDER_UTILS_TEXTURE_BLOOM_COLOR,
ToneMappingColor = RENDER_UTILS_TEXTURE_TM_COLOR, ToneMappingColor = RENDER_UTILS_TEXTURE_TM_COLOR,
TextFont = RENDER_UTILS_TEXTURE_TEXT_FONT, TextFont = RENDER_UTILS_TEXTURE_TEXT_FONT,
DebugDepth = RENDER_UTILS_TEXTURE_DEBUG_DEPTH, DebugTexture0 = RENDER_UTILS_DEBUG_TEXTURE0,
DebugHalfDepth = RENDER_UTILS_TEXTURE_DEBUG_HALF_DEPTH,
DebugOcclusion = RENDER_UTILS_TEXTURE_DEBUG_OCCLUSION,
DebugOcclusionBlurred = RENDER_UTILS_TEXTURE_DEBUG_OCCLUSION_BLURRED,
DebugVelocity = RENDER_UTILS_TEXTURE_DEBUG_VELOCITY,
DebugShadows = RENDER_UTILS_TEXTURE_DEBUG_SHADOWS,
DebugHalfNormal = RENDER_UTILS_TEXTURE_DEBUG_HALF_NORMAL,
DebugScattering = RENDER_UTILS_TEXTURE_DEBUG_SCATTERING,
}; };
} // namespace texture } // namespace texture