Skip to content

Commit

Permalink
D3D11: _create2DTex() with mSurface.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthurfernades committed Jan 14, 2025
1 parent 7cd7063 commit 520d211
Show file tree
Hide file tree
Showing 6 changed files with 521 additions and 610 deletions.
4 changes: 1 addition & 3 deletions OgreMain/include/OgreTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ namespace Ogre {
TEX_TYPE_2D_ARRAY = 5,
/// GLES2 only OES texture type
TEX_TYPE_EXTERNAL_OES = 6,
/// 2D texture, used when you already have a surface
TEX_TYPE_2D_WITH_SURFACE = 7
};

/** Enum identifying special mipmap numbers
Expand Down Expand Up @@ -150,7 +148,7 @@ namespace Ogre {

/** Sets the surface when you already have one
*/
void setSurface(void* surface) { mSurface = surface; }
virtual void _setSurface(void* surface) { mSurface = surface; }

/** Gets the surface
*/
Expand Down
21 changes: 2 additions & 19 deletions OgreMain/include/OgreTextureManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,7 @@ namespace Ogre {
TextureType texType, uint width, uint height, uint depth,
int numMipmaps, PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0,
bool hwGammaCorrection = false, uint fsaa = 0, const String& fsaaHint = BLANKSTRING);

TexturePtr createManualWithSurface(const String& name, const String& group, TextureType texType, uint width,
uint height, uint depth, int numMipmaps, PixelFormat format,
int usage = TU_DEFAULT, void* surface = nullptr,
ManualResourceLoader* loader = 0, bool hwGammaCorrection = false,
uint fsaa = 0, const String& fsaaHint = BLANKSTRING);


/** @overload
*/
TexturePtr createManual(const String & name, const String& group,
Expand All @@ -278,18 +272,7 @@ namespace Ogre {
{
return createManual(name, group, texType, width, height, 1,
numMipmaps, format, usage, loader, hwGammaCorrection, fsaa, fsaaHint);
}

TexturePtr createManualWithSurface(const String& name, const String& group, TextureType texType, uint width,
uint height, int numMipmaps, PixelFormat format, int usage = TU_DEFAULT,
void* surface = nullptr, ManualResourceLoader* loader = 0,
bool hwGammaCorrection = false, uint fsaa = 0,
const String& fsaaHint = BLANKSTRING)
{
return createManualWithSurface(name, group, texType, width, height, 1, numMipmaps, format, usage, surface,
loader, hwGammaCorrection, fsaa, fsaaHint);
}

}
/** Sets preferred bit depth for integer pixel format textures.
@param
bits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
Expand Down
35 changes: 0 additions & 35 deletions OgreMain/src/OgreTextureManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,41 +216,6 @@ namespace Ogre {
return ret;
}
//-----------------------------------------------------------------------
TexturePtr TextureManager::createManualWithSurface(const String& name, const String& group, TextureType texType,
uint width, uint height, uint depth, int numMipmaps,
PixelFormat format, int usage, void* surface,
ManualResourceLoader* loader, bool hwGamma, uint fsaa,
const String& fsaaHint)
{
TexturePtr ret;

OgreAssert(width && height && depth, "total size of texture must not be zero");

// Check for texture support
const auto caps = Root::getSingleton().getRenderSystem()->getCapabilities();
if (((texType == TEX_TYPE_3D) && !caps->hasCapability(RSC_TEXTURE_3D)) ||
((texType == TEX_TYPE_2D_ARRAY) && !caps->hasCapability(RSC_TEXTURE_2D_ARRAY)))
return ret;

ret = create(name, group, true, loader);

if (!ret)
return ret;

ret->setSurface(surface);
ret->setTextureType(texType);
ret->setWidth(width);
ret->setHeight(height);
ret->setDepth(depth);
ret->setNumMipmaps((numMipmaps == MIP_DEFAULT) ? mDefaultNumMipmaps : static_cast<uint32>(numMipmaps));
ret->setFormat(format);
ret->setUsage(usage);
ret->setHardwareGammaEnabled(hwGamma);
ret->setFSAA(fsaa, fsaaHint);
ret->createInternalResources();
return ret;
}
//-----------------------------------------------------------------------
void TextureManager::setPreferredIntegerBitDepth(ushort bits, bool reloadTextures)
{
mPreferredIntegerBitDepth = bits;
Expand Down
4 changes: 1 addition & 3 deletions RenderSystems/Direct3D11/include/OgreD3D11Texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ namespace Ogre {
/// internal method, create a blank normal 1D Dtexture
void _create1DTex();
/// internal method, create a blank normal 2D texture
void _create2DTex();
/// internal method, use a normal 2D texture
void _create2DTexWithSurface();
void _create2DTex();
/// internal method, create a blank cube texture
void _create3DTex();

Expand Down
2 changes: 0 additions & 2 deletions RenderSystems/Direct3D11/src/OgreD3D11HardwarePixelBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ namespace Ogre {
case TEX_TYPE_1D: return "1D texture";
case TEX_TYPE_CUBE_MAP: return "cube map texture";
case TEX_TYPE_2D: return "2D texture";
case TEX_TYPE_2D_WITH_SURFACE: return "2D texture with surface";
case TEX_TYPE_2D_ARRAY: return "2D texture array";
case TEX_TYPE_3D: return "3D texture";
default: return "texture";
Expand Down Expand Up @@ -482,7 +481,6 @@ namespace Ogre {
}
break;
case TEX_TYPE_2D:
case TEX_TYPE_2D_WITH_SURFACE:
case TEX_TYPE_CUBE_MAP:
case TEX_TYPE_2D_ARRAY:
{
Expand Down
Loading

0 comments on commit 520d211

Please sign in to comment.