| 180 | } |
| 181 | |
| 182 | void Resource::setSubresourceState(uint32_t arraySlice, uint32_t mipLevel, State newState) const |
| 183 | { |
| 184 | const Texture* pTexture = dynamic_cast<const Texture*>(this); |
| 185 | if (pTexture == nullptr) |
| 186 | { |
| 187 | logWarning("Calling Resource::setSubresourceState() on an object that is not a texture. This is invalid. Ignoring call"); |
| 188 | return; |
| 189 | } |
| 190 | |
| 191 | // If we are transitioning from a global to local state, initialize the subresource array |
| 192 | if (mState.isGlobal) |
| 193 | { |
| 194 | std::fill(mState.perSubresource.begin(), mState.perSubresource.end(), mState.global); |
| 195 | } |
| 196 | mState.isGlobal = false; |
| 197 | mState.perSubresource[pTexture->getSubresourceIndex(arraySlice, mipLevel)] = newState; |
| 198 | } |
| 199 | |
| 200 | SharedResourceApiHandle Resource::getSharedApiHandle() const |
| 201 | { |
no test coverage detected