diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/lldrawpoolpbropaque.cpp | 42 | ||||
-rw-r--r-- | indra/newview/lldrawpoolpbropaque.h | 13 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 4 |
3 files changed, 49 insertions, 10 deletions
diff --git a/indra/newview/lldrawpoolpbropaque.cpp b/indra/newview/lldrawpoolpbropaque.cpp index 2478aa0cff..f23d2d04a8 100644 --- a/indra/newview/lldrawpoolpbropaque.cpp +++ b/indra/newview/lldrawpoolpbropaque.cpp @@ -73,6 +73,12 @@ void LLDrawPoolPBROpaque::renderDeferred(S32 pass) return; } + const U32 type = LLPipeline::RENDER_TYPE_PASS_PBR_OPAQUE; + if (!gPipeline.hasRenderType(type)) + { + return; + } + gGL.flush(); LLGLDisable blend(GL_BLEND); @@ -86,7 +92,37 @@ void LLDrawPoolPBROpaque::renderDeferred(S32 pass) // TODO: handle under water? // if (LLPipeline::sUnderWaterRender) - // PASS_SIMPLE or PASS_MATERIAL - //pushBatches(LLRenderPass::PASS_SIMPLE, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); -} + LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); + LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type); + + for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) + { + LLDrawInfo& params = **i; + +//gGL.getTexUnit(0)->activate(); + if (mShaderLevel > 1) + { + if (params.mTexture.notNull()) + { + gGL.getTexUnit(-1)->bindFast(params.mTexture); // diffuse + } + } + + if (params.mNormalMap) + { + gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap); + } + + if (params.mSpecularMap) + { + gDeferredPBROpaqueProgram.bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap); // Packed Occlusion Roughness Metal + } + + // Similar to LLDrawPooLMaterials::pushMaterialsBatch(params, getVertexDataMask(), false); + + LLRenderPass::applyModelMatrix(params); + params.mVertexBuffer->setBufferFast(getVertexDataMask()); + params.mVertexBuffer->drawRangeFast(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset); + } +} diff --git a/indra/newview/lldrawpoolpbropaque.h b/indra/newview/lldrawpoolpbropaque.h index ada806a3bf..413bcb800c 100644 --- a/indra/newview/lldrawpoolpbropaque.h +++ b/indra/newview/lldrawpoolpbropaque.h @@ -34,11 +34,14 @@ class LLDrawPoolPBROpaque : public LLRenderPass public: enum { - VERTEX_DATA_MASK = 0 - | LLVertexBuffer::MAP_VERTEX - | LLVertexBuffer::MAP_NORMAL - | LLVertexBuffer::MAP_TEXCOORD0 - | LLVertexBuffer::MAP_COLOR + // See: DEFERRED_VB_MASK + VERTEX_DATA_MASK = 0 + | LLVertexBuffer::MAP_VERTEX + | LLVertexBuffer::MAP_NORMAL + | LLVertexBuffer::MAP_TEXCOORD0 // Diffuse + | LLVertexBuffer::MAP_TEXCOORD1 // Normal + | LLVertexBuffer::MAP_TEXCOORD2 // Spec <-- ORM Occlusion Roughness Metal + | LLVertexBuffer::MAP_COLOR }; virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index c041d2470c..d0f7f70c81 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1626,9 +1626,9 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredPBROpaqueProgram.mShaderFiles.clear(); gDeferredPBROpaqueProgram.mShaderFiles.push_back(make_pair("deferred/pbropaqueV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredPBROpaqueProgram.mShaderFiles.push_back(make_pair("deferred/pbropaqueF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredPBROpaqueProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredPBROpaqueProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; - //gDeferredPBROpaqueProgram.addPermutation("HAS_NORMAL_MAP", "1"); + gDeferredPBROpaqueProgram.addPermutation("HAS_NORMAL_MAP", "1"); + gDeferredPBROpaqueProgram.addPermutation("HAS_SPECULAR_MAP", "1"); success = gDeferredPBROpaqueProgram.createShader(NULL, NULL); llassert(success); } |