-// SwiftShader Software Renderer
+// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
//
-// Copyright(c) 2005-2011 TransGaming Inc.
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-// All rights reserved. No part of this software may be copied, distributed, transmitted,
-// transcribed, stored in a retrieval system, translated into any human or computer
-// language by any means, or disclosed to third parties without the explicit written
-// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
-// or implied, including but not limited to any patent rights, are granted to you.
+// http://www.apache.org/licenses/LICENSE-2.0
//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
#include "Direct3DVolumeTexture9.hpp"
this->levels = sw::log2(sw::max((int)width, (int)height, (int)depth, 1)) + 1;
}
- for(unsigned int level = 0; level < MIPMAP_LEVELS; level++)
+ for(unsigned int level = 0; level < sw::MIPMAP_LEVELS; level++)
{
if(level < this->levels)
{
Direct3DVolumeTexture9::~Direct3DVolumeTexture9()
{
- resource->lock(sw::DESTRUCT);
-
- for(int level = 0; level < MIPMAP_LEVELS; level++)
+ for(int level = 0; level < sw::MIPMAP_LEVELS; level++)
{
if(volumeLevel[level])
{
volumeLevel[level] = 0;
}
}
-
- resource->unlock();
}
long Direct3DVolumeTexture9::QueryInterface(const IID &iid, void **object)
source->lockInternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
dest->lockInternal(0, 0, 0, sw::LOCK_DISCARD, sw::PUBLIC);
- int sWidth = source->getInternalWidth();
- int sHeight = source->getInternalHeight();
- int sDepth = source->getInternalDepth();
+ int sWidth = source->getWidth();
+ int sHeight = source->getHeight();
+ int sDepth = source->getDepth();
- int dWidth = dest->getInternalWidth();
- int dHeight = dest->getInternalHeight();
- int dDepth = dest->getInternalDepth();
+ int dWidth = dest->getWidth();
+ int dHeight = dest->getHeight();
+ int dDepth = dest->getDepth();
D3DTEXTUREFILTERTYPE filter = GetAutoGenFilterType();
for(int i = 0; i < dWidth; i++)
{
- sw::Color<float> color;
-
- if(filter <= D3DTEXF_POINT)
- {
- color = source->readInternal((int)x, (int)y, (int)z);
- }
- else // filter >= D3DTEXF_LINEAR
- {
- color = source->sampleInternal(x, y, z);
- }
-
- dest->writeInternal(i, j, k, color);
+ dest->copyInternal(source, i, j, k, x, y, z, filter > D3DTEXF_POINT);
x += w;
}