Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 777 vs 781 for /trunk/Source Code/Geometry/Material/Material.cpp

Diff revisions: vs.
  @@ -131,9 +131,9 @@
131 131
132 132 void Material::update(const U64 deltaTime) {
133 133 for (ShaderProgramInfo& info : _shaderInfo) {
134 - if (info._shaderCompStage == ShaderProgramInfo::BuildStage::COMPUTED) {
134 + if (info.computeStage() == ShaderProgramInfo::BuildStage::COMPUTED) {
135 135 if (info._shaderRef->getState() == ResourceState::RES_LOADED) {
136 - info._shaderCompStage = ShaderProgramInfo::BuildStage::READY;
136 + info.computeStage(ShaderProgramInfo::BuildStage::READY);
137 137 _dirty = true;
138 138 }
139 139 }
  @@ -204,7 +204,6 @@
204 204 void Material::setShaderProgramInternal(const stringImpl& shader,
205 205 RenderStage renderStage,
206 206 const bool computeOnAdd) {
207 -
208 207 U32 stageIndex = to_uint(renderStage);
209 208 ShaderProgramInfo& info = _shaderInfo[stageIndex];
210 209 // if we already had a shader assigned ...
  @@ -241,8 +240,6 @@
241 240 } else {
242 241 shaderQueue.addToQueueBack(queueElement);
243 242 }
244 -
245 - info._shaderCompStage = ShaderProgramInfo::BuildStage::QUEUED;
246 243 }
247 244
248 245 void Material::clean() {
  @@ -258,7 +255,7 @@
258 255 void Material::recomputeShaders() {
259 256 for (ShaderProgramInfo& info : _shaderInfo) {
260 257 if (!info._customShader) {
261 - info._shaderCompStage = ShaderProgramInfo::BuildStage::REQUESTED;
258 + info.computeStage(ShaderProgramInfo::BuildStage::REQUESTED);
262 259 }
263 260 }
264 261 }
  @@ -266,7 +263,7 @@
266 263 bool Material::canDraw(RenderStage renderStage) {
267 264 for (U32 i = 0; i < to_const_uint(RenderStage::COUNT); ++i) {
268 265 ShaderProgramInfo& info = _shaderInfo[i];
269 - if (info._shaderCompStage != ShaderProgramInfo::BuildStage::READY) {
266 + if (info.computeStage() != ShaderProgramInfo::BuildStage::READY) {
270 267 computeShader(static_cast<RenderStage>(i), _highPriority);
271 268 return false;
272 269 }
  @@ -311,21 +308,20 @@
311 308 /// If the current material doesn't have a shader associated with it, then add
312 309 /// the default ones.
313 310 bool Material::computeShader(RenderStage renderStage, const bool computeOnAdd){
314 -
315 311 ShaderProgramInfo& info = _shaderInfo[to_uint(renderStage)];
316 312 // If shader's invalid, try to request a recompute as it might fix it
317 - if (info._shaderCompStage == ShaderProgramInfo::BuildStage::COUNT) {
318 - info._shaderCompStage = ShaderProgramInfo::BuildStage::REQUESTED;
313 + if (info.computeStage() == ShaderProgramInfo::BuildStage::COUNT) {
314 + info.computeStage(ShaderProgramInfo::BuildStage::REQUESTED);
319 315 return false;
320 316 }
321 317
322 - // If the shader is valid and a recomput wasn't requested, just return true
323 - if (info._shaderCompStage != ShaderProgramInfo::BuildStage::REQUESTED) {
324 - return info._shaderCompStage == ShaderProgramInfo::BuildStage::READY;
318 + // If the shader is valid and a recompute wasn't requested, just return true
319 + if (info.computeStage() != ShaderProgramInfo::BuildStage::REQUESTED) {
320 + return info.computeStage() == ShaderProgramInfo::BuildStage::READY;
325 321 }
326 322
327 323 // At this point, only computation requests are processed
328 - assert(info._shaderCompStage == ShaderProgramInfo::BuildStage::REQUESTED);
324 + assert(info.computeStage() == ShaderProgramInfo::BuildStage::REQUESTED);
329 325
330 326 const U32 slot0 = to_const_uint(ShaderProgram::TextureUsage::UNIT0);
331 327 const U32 slot1 = to_const_uint(ShaderProgram::TextureUsage::UNIT1);