added deferred shading foreach_tile

This commit is contained in:
Evghenii
2013-11-14 16:49:47 +01:00
parent 83b9cc5c0a
commit 599ada8354
2 changed files with 159 additions and 156 deletions

View File

@@ -191,7 +191,6 @@ IntersectLightsWithTileMinMax(
foreach (lightIndex = 0 ... numLights) foreach (lightIndex = 0 ... numLights)
{ {
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;
@@ -309,7 +308,7 @@ 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) foreach_tiled (y = tileStartY ... tileEndY, x = tileStartX ... tileEndX)
{ {
float positionScreen_y = -(((0.5f + y) * twoOverGBufferHeight) - 1.f); float positionScreen_y = -(((0.5f + y) * twoOverGBufferHeight) - 1.f);
int32 gBufferOffset = y * gBufferWidth + x; int32 gBufferOffset = y * gBufferWidth + x;

View File

@@ -116,6 +116,10 @@ void createContext(const int deviceId = 0)
// Create driver context // Create driver context
checkCudaErrors(cuCtxCreate(&context, 0, device)); checkCudaErrors(cuCtxCreate(&context, 0, device));
const size_t stackLimit = 4*1024;
// const size_t heapLimit = 1024*1024*1024;
checkCudaErrors(cuCtxSetLimit(CU_LIMIT_STACK_SIZE,stackLimit));
// checkCudaErrors(cuCtxSetLimit(CU_LIMIT_MALLOC_HEAP_SIZE,heapLimit));
} }
void destroyContext() void destroyContext()
{ {