Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 924 vs 929 for /trunk/Source Code/Rendering/PostFX/CustomOperators/BloomPreRenderOperator.cpp

Diff revisions: vs.
  @@ -50,7 +50,7 @@
50 50 blur.setThreadedLoading(false);
51 51 _blur = CreateResource<ShaderProgram>(cache, blur);
52 52
53 - _blur->Uniform("kernelSize", 10);
53 + _bloomCalcConstants.set("kernelSize", PushConstantType::INT, 10);
54 54 _horizBlur = _blur->GetSubroutineIndex(ShaderType::FRAGMENT, "blurHorizontal");
55 55 _vertBlur = _blur->GetSubroutineIndex(ShaderType::FRAGMENT, "blurVertical");
56 56 }
  @@ -62,7 +62,7 @@
62 62 }
63 63
64 64 void BloomPreRenderOperator::idle(const Configuration& config) {
65 - _bloomApply->Uniform("bloomFactor", config.rendering.bloomFactor);
65 + _bloomApplyConstants.set("bloomFactor", PushConstantType::FLOAT, config.rendering.bloomFactor);
66 66 }
67 67
68 68 void BloomPreRenderOperator::reshape(U16 width, U16 height) {
  @@ -74,7 +74,7 @@
74 74 _bloomBlurBuffer[0]._rt->resize(width, height);
75 75 _bloomBlurBuffer[1]._rt->resize(width, height);
76 76
77 - _blur->Uniform("size", vec2<F32>(width, height));
77 + _bloomCalcConstants.set("size", PushConstantType::VEC2, vec2<F32>(width, height));
78 78 }
79 79
80 80 // Order: luminance calc -> bloom -> tonemap
  @@ -94,8 +94,7 @@
94 94 // render all of the "bright spots"
95 95 _context.renderTargetPool().drawToTargetBegin(_bloomOutput._targetID);
96 96 pipelineDescriptor._shaderProgram = _bloomCalc;
97 - triangleCmd.pipeline(_context.newPipeline(pipelineDescriptor));
98 - _context.draw(triangleCmd);
97 + _context.draw(triangleCmd, _context.newPipeline(pipelineDescriptor));
99 98 _context.renderTargetPool().drawToTargetEnd();
100 99
101 100 // Step 2: blur bloom
  @@ -104,10 +103,10 @@
104 103 _blur->SetSubroutine(ShaderType::FRAGMENT, _horizBlur);
105 104 _bloomOutput._rt->bind(to_U8(ShaderProgram::TextureUsage::UNIT0), RTAttachmentType::Colour, 0);
106 105
106 + Pipeline blurPipeline = _context.newPipeline(pipelineDescriptor);
107 107 _context.renderTargetPool().drawToTargetBegin(_bloomBlurBuffer[0]._targetID);
108 108 pipelineDescriptor._shaderProgram = _blur;
109 - triangleCmd.pipeline(_context.newPipeline(pipelineDescriptor));
110 - _context.draw(triangleCmd);
109 + _context.draw(triangleCmd, blurPipeline, _bloomCalcConstants);
111 110 _context.renderTargetPool().drawToTargetEnd();
112 111
113 112 // Blur vertically (recycle the render target. We have a copy)
  @@ -115,7 +114,7 @@
115 114 _bloomBlurBuffer[0]._rt->bind(to_U8(ShaderProgram::TextureUsage::UNIT0), RTAttachmentType::Colour, 0);
116 115
117 116 _context.renderTargetPool().drawToTargetBegin(_bloomBlurBuffer[1]._targetID);
118 - _context.draw(triangleCmd);
117 + _context.draw(triangleCmd, blurPipeline, _bloomCalcConstants);
119 118 _context.renderTargetPool().drawToTargetEnd();
120 119
121 120 // Step 3: apply bloom
  @@ -125,8 +124,7 @@
125 124
126 125 _context.renderTargetPool().drawToTargetBegin(screen._targetID, _screenOnlyDraw);
127 126 pipelineDescriptor._shaderProgram = _bloomApply;
128 - triangleCmd.pipeline(_context.newPipeline(pipelineDescriptor));
129 - _context.draw(triangleCmd);
127 + _context.draw(triangleCmd, _context.newPipeline(pipelineDescriptor), _bloomApplyConstants);
130 128 _context.renderTargetPool().drawToTargetEnd();
131 129 }
132 130