+1
This commit is contained in:
@@ -116,11 +116,8 @@ ComputeZBounds(
|
|||||||
float laneMinZ = cameraFar;
|
float laneMinZ = cameraFar;
|
||||||
float laneMaxZ = cameraNear;
|
float laneMaxZ = cameraNear;
|
||||||
for (uniform int32 y = tileStartY; y < tileEndY; ++y) {
|
for (uniform int32 y = tileStartY; y < tileEndY; ++y) {
|
||||||
// foreach (x = tileStartX ... tileEndX)
|
foreach (x = tileStartX ... tileEndX)
|
||||||
for (uniform int xb = tileStartX; xb < tileEndX; xb += programCount)
|
|
||||||
{
|
{
|
||||||
const int x = xb + programIndex;
|
|
||||||
if (x >= tileEndX) break;
|
|
||||||
// Unproject depth buffer Z value into view space
|
// Unproject depth buffer Z value into view space
|
||||||
float z = zBuffer[y * gBufferWidth + x];
|
float z = zBuffer[y * gBufferWidth + x];
|
||||||
float viewSpaceZ = cameraProj_43 / (z - cameraProj_33);
|
float viewSpaceZ = cameraProj_43 / (z - cameraProj_33);
|
||||||
@@ -182,10 +179,8 @@ IntersectLightsWithTileMinMax(
|
|||||||
|
|
||||||
uniform int32 tileNumLights = 0;
|
uniform int32 tileNumLights = 0;
|
||||||
|
|
||||||
// foreach (lightIndex = 0 ... numLights)
|
foreach (lightIndex = 0 ... numLights)
|
||||||
for (uniform int lightIndexB = 0; lightIndexB < numLights; lightIndexB += programCount)
|
|
||||||
{
|
{
|
||||||
const int lightIndex = lightIndexB + programIndex;
|
|
||||||
float light_positionView_z = light_positionView_z_array[lightIndex];
|
float light_positionView_z = light_positionView_z_array[lightIndex];
|
||||||
float light_attenuationEnd = light_attenuationEnd_array[lightIndex];
|
float light_attenuationEnd = light_attenuationEnd_array[lightIndex];
|
||||||
float light_attenuationEndNeg = -light_attenuationEnd;
|
float light_attenuationEndNeg = -light_attenuationEnd;
|
||||||
@@ -292,11 +287,8 @@ ShadeTile(
|
|||||||
if (tileNumLights == 0 || visualizeLightCount) {
|
if (tileNumLights == 0 || visualizeLightCount) {
|
||||||
uniform unsigned int8 c = (unsigned int8)(min(tileNumLights << 2, 255));
|
uniform unsigned int8 c = (unsigned int8)(min(tileNumLights << 2, 255));
|
||||||
for (uniform int32 y = tileStartY; y < tileEndY; ++y) {
|
for (uniform int32 y = tileStartY; y < tileEndY; ++y) {
|
||||||
// foreach (x = tileStartX ... tileEndX)
|
foreach (x = tileStartX ... tileEndX)
|
||||||
for (uniform int xb = tileStartX ; xb < tileEndX; xb += programCount)
|
|
||||||
{
|
{
|
||||||
const int x = xb + programIndex;
|
|
||||||
if (x >= tileEndX) continue;
|
|
||||||
int32 framebufferIndex = (y * gBufferWidth + x);
|
int32 framebufferIndex = (y * gBufferWidth + x);
|
||||||
framebuffer_r[framebufferIndex] = c;
|
framebuffer_r[framebufferIndex] = c;
|
||||||
framebuffer_g[framebufferIndex] = c;
|
framebuffer_g[framebufferIndex] = c;
|
||||||
@@ -310,10 +302,7 @@ ShadeTile(
|
|||||||
for (uniform int32 y = tileStartY; y < tileEndY; ++y) {
|
for (uniform int32 y = tileStartY; y < tileEndY; ++y) {
|
||||||
uniform float positionScreen_y = -(((0.5f + y) * twoOverGBufferHeight) - 1.f);
|
uniform float positionScreen_y = -(((0.5f + y) * twoOverGBufferHeight) - 1.f);
|
||||||
|
|
||||||
// foreach (x = tileStartX ... tileEndX) {
|
foreach (x = tileStartX ... tileEndX) {
|
||||||
for (uniform int xb = tileStartX ; xb < tileEndX; xb += programCount)
|
|
||||||
{
|
|
||||||
const int x = xb + programIndex;
|
|
||||||
int32 gBufferOffset = y * gBufferWidth + x;
|
int32 gBufferOffset = y * gBufferWidth + x;
|
||||||
|
|
||||||
// Reconstruct position and (negative) view vector from G-buffer
|
// Reconstruct position and (negative) view vector from G-buffer
|
||||||
|
|||||||
@@ -127,7 +127,8 @@ ComputeZBounds(
|
|||||||
// Find Z bounds
|
// Find Z bounds
|
||||||
float laneMinZ = cameraFar;
|
float laneMinZ = cameraFar;
|
||||||
float laneMaxZ = cameraNear;
|
float laneMaxZ = cameraNear;
|
||||||
foreach_tiled (y = tileStartY ... tileEndY, x = tileStartX ... tileEndX)
|
for (uniform int32 y = tileStartY; y < tileEndY; ++y)
|
||||||
|
foreach (x = tileStartX ... tileEndX)
|
||||||
{
|
{
|
||||||
// Unproject depth buffer Z value into view space
|
// Unproject depth buffer Z value into view space
|
||||||
float z = zBuffer[y * gBufferWidth + x];
|
float z = zBuffer[y * gBufferWidth + x];
|
||||||
@@ -297,7 +298,8 @@ ShadeTile(
|
|||||||
{
|
{
|
||||||
if (tileNumLights == 0 || visualizeLightCount) {
|
if (tileNumLights == 0 || visualizeLightCount) {
|
||||||
uniform unsigned int8 c = (unsigned int8)(min(tileNumLights << 2, 255));
|
uniform unsigned int8 c = (unsigned int8)(min(tileNumLights << 2, 255));
|
||||||
foreach_tiled (y = tileStartY ... tileEndY, x = tileStartX ... tileEndX)
|
for (uniform int32 y = tileStartY; y < tileEndY; ++y)
|
||||||
|
foreach (x = tileStartX ... tileEndX)
|
||||||
{
|
{
|
||||||
int32 framebufferIndex = (y * gBufferWidth + x);
|
int32 framebufferIndex = (y * gBufferWidth + x);
|
||||||
framebuffer_r[framebufferIndex] = c;
|
framebuffer_r[framebufferIndex] = c;
|
||||||
@@ -308,9 +310,10 @@ ShadeTile(
|
|||||||
uniform float twoOverGBufferWidth = 2.0f / gBufferWidth;
|
uniform float twoOverGBufferWidth = 2.0f / gBufferWidth;
|
||||||
uniform float twoOverGBufferHeight = 2.0f / gBufferHeight;
|
uniform float twoOverGBufferHeight = 2.0f / gBufferHeight;
|
||||||
|
|
||||||
foreach_tiled (y = tileStartY ... tileEndY, x = tileStartX ... tileEndX)
|
for (uniform int32 y = tileStartY; y < tileEndY; ++y) {
|
||||||
{
|
uniform float positionScreen_y = -(((0.5f + y) * twoOverGBufferHeight) - 1.f);
|
||||||
float positionScreen_y = -(((0.5f + y) * twoOverGBufferHeight) - 1.f);
|
|
||||||
|
foreach (x = tileStartX ... tileEndX) {
|
||||||
int32 gBufferOffset = y * gBufferWidth + x;
|
int32 gBufferOffset = y * gBufferWidth + x;
|
||||||
|
|
||||||
// Reconstruct position and (negative) view vector from G-buffer
|
// Reconstruct position and (negative) view vector from G-buffer
|
||||||
@@ -454,6 +457,7 @@ ShadeTile(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user