Depth bind fixes

This commit is contained in:
luboslenco 2018-11-28 10:26:48 +01:00
parent 7075374c8f
commit 62b23aa2f0
4 changed files with 29 additions and 30 deletions

View file

@ -368,7 +368,7 @@ void main() {
int numPoints = numLights - numSpots;
#endif
for (int i = 0; i < numLights; i++) {
for (int i = 0; i < min(numLights, maxLightsCluster); i++) {
int li = int(texelFetch(clustersData, ivec2(clusterI, i + 1), 0).r * 255);
// lightsArray[li * 2 ] - pos

View file

@ -189,24 +189,24 @@ class Inc {
#end
}
#if (rp_shadowmap && kha_webgl)
public static function initEmpty() {
// Bind empty when requested target is not found
var tempty = new RenderTargetRaw();
tempty.name = "arm_empty";
tempty.width = 1;
tempty.height = 1;
tempty.format = "DEPTH16";
path.createRenderTarget(tempty);
var temptyCube = new RenderTargetRaw();
temptyCube.name = "arm_empty_cube";
temptyCube.width = 1;
temptyCube.height = 1;
temptyCube.format = "DEPTH16";
temptyCube.is_cubemap = true;
path.createRenderTarget(temptyCube);
}
#end
// #if (rp_shadowmap && kha_webgl)
// public static function initEmpty() {
// // Bind empty when requested target is not found
// var tempty = new RenderTargetRaw();
// tempty.name = "arm_empty";
// tempty.width = 1;
// tempty.height = 1;
// tempty.format = "DEPTH16";
// path.createRenderTarget(tempty);
// var temptyCube = new RenderTargetRaw();
// temptyCube.name = "arm_empty_cube";
// temptyCube.width = 1;
// temptyCube.height = 1;
// temptyCube.format = "DEPTH16";
// temptyCube.is_cubemap = true;
// path.createRenderTarget(temptyCube);
// }
// #end
#if (rp_translucency)
public static function initTranslucency() {

View file

@ -25,9 +25,9 @@ class RenderPathDeferred {
path = _path;
#if (rp_shadowmap && kha_webgl)
Inc.initEmpty();
#end
// #if (rp_shadowmap && kha_webgl)
// Inc.initEmpty();
// #end
#if (rp_background == "World")
{
@ -553,6 +553,7 @@ class RenderPathDeferred {
Inc.drawShadowMap();
#end
path.setDepthFrom("tex", "gbuffer1"); // Unbind depth form tex so we can read it
path.setTarget("tex");
path.bindTarget("_main", "gbufferD");
path.bindTarget("gbuffer0", "gbuffer0");
@ -597,18 +598,11 @@ class RenderPathDeferred {
// }
}
#end
#if kha_webgl
path.setDepthFrom("tex", "gbuffer1"); // Even with depth_write set to false, depth can not be attached..
#end
voxelao_pass ?
path.drawShader("shader_datas/deferred_light/deferred_light_VoxelAOvar") :
path.drawShader("shader_datas/deferred_light/deferred_light");
#if kha_webgl
path.setDepthFrom("tex", "gbuffer0");
#end
path.setDepthFrom("tex", "gbuffer0"); // Re-bind depth
#if rp_probes
if (!path.isProbe) {
@ -655,6 +649,7 @@ class RenderPathDeferred {
#if (rp_background == "World")
{
path.setTarget("tex"); // Re-binds depth
path.drawSkydome("shader_datas/world_pass/world_pass");
}
#end

View file

@ -382,14 +382,18 @@ class DebugConsole extends Trait {
if (ui.panel(Id.handle({selected: false}), 'Render Targets')) {
ui.indent();
#if (kha_opengl || kha_webgl)
ui.imageInvertY = true;
#end
for (rt in iron.RenderPath.active.renderTargets) {
ui.text(rt.raw.name);
if (rt.image != null && !rt.is3D) {
ui.image(rt.image);
}
}
#if (kha_opengl || kha_webgl)
ui.imageInvertY = false;
#end
ui.unindent();
}