init commit

This commit is contained in:
marauder2k7 2023-07-19 13:36:14 +01:00
parent ae108d0411
commit e325902bac
6 changed files with 11 additions and 5 deletions

View file

@ -186,10 +186,10 @@ GFXD3D11StateBlock::GFXD3D11StateBlock(const GFXStateBlockDesc& desc)
else else
mSamplerDesc[i].Filter = comparison ? D3D11_FILTER_COMPARISON_ANISOTROPIC : D3D11_FILTER_ANISOTROPIC; mSamplerDesc[i].Filter = comparison ? D3D11_FILTER_COMPARISON_ANISOTROPIC : D3D11_FILTER_ANISOTROPIC;
mSamplerDesc[i].BorderColor[0] = 1.0f; mSamplerDesc[i].BorderColor[0] = gfxSamplerState.borderColor.red;
mSamplerDesc[i].BorderColor[1] = 1.0f; mSamplerDesc[i].BorderColor[1] = gfxSamplerState.borderColor.green;
mSamplerDesc[i].BorderColor[2] = 1.0f; mSamplerDesc[i].BorderColor[2] = gfxSamplerState.borderColor.blue;
mSamplerDesc[i].BorderColor[3] = 1.0f; mSamplerDesc[i].BorderColor[3] = gfxSamplerState.borderColor.alpha;
mSamplerDesc[i].ComparisonFunc = GFXD3D11CmpFunc[gfxSamplerState.samplerFunc]; mSamplerDesc[i].ComparisonFunc = GFXD3D11CmpFunc[gfxSamplerState.samplerFunc];
hr = D3D11DEVICE->CreateSamplerState(&mSamplerDesc[i], &mSamplerStates[i]); hr = D3D11DEVICE->CreateSamplerState(&mSamplerDesc[i], &mSamplerStates[i]);

View file

@ -278,6 +278,7 @@ GFXSamplerStateDesc::GFXSamplerStateDesc()
samplerFunc = GFXCmpNever; samplerFunc = GFXCmpNever;
maxAnisotropy = 1; maxAnisotropy = 1;
mipLODBias = 0.0f; mipLODBias = 0.0f;
borderColor = LinearColorF::WHITE;
} }
GFXSamplerStateDesc GFXSamplerStateDesc::getWrapLinear() GFXSamplerStateDesc GFXSamplerStateDesc::getWrapLinear()

View file

@ -49,6 +49,8 @@ struct GFXSamplerStateDesc
GFXCmpFunc samplerFunc; GFXCmpFunc samplerFunc;
LinearColorF borderColor;
/// The maximum anisotropy used when one of the filter types /// The maximum anisotropy used when one of the filter types
/// is set to anisotropic. /// is set to anisotropic.
/// ///

View file

@ -93,7 +93,7 @@ void GFXGLEnumTranslate::init()
GFXGLTextureAddress[GFXAddressWrap] = GL_REPEAT; GFXGLTextureAddress[GFXAddressWrap] = GL_REPEAT;
GFXGLTextureAddress[GFXAddressMirror] = GL_REPEAT; GFXGLTextureAddress[GFXAddressMirror] = GL_REPEAT;
GFXGLTextureAddress[GFXAddressClamp] = GL_CLAMP_TO_EDGE; GFXGLTextureAddress[GFXAddressClamp] = GL_CLAMP_TO_EDGE;
GFXGLTextureAddress[GFXAddressBorder] = GL_REPEAT; GFXGLTextureAddress[GFXAddressBorder] = GL_CLAMP_TO_BORDER;
GFXGLTextureAddress[GFXAddressMirrorOnce] = GL_REPEAT; GFXGLTextureAddress[GFXAddressMirrorOnce] = GL_REPEAT;
// Stencil ops // Stencil ops

View file

@ -220,6 +220,7 @@ void GFXGLTextureObject::initSamplerState(const GFXSamplerStateDesc &ssd)
if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() ) if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() )
glTexParameterf(mBinding, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy); glTexParameterf(mBinding, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy);
glTexParameterfv(mBinding, GL_TEXTURE_BORDER_COLOR, ssd.borderColor);
mNeedInitSamplerState = false; mNeedInitSamplerState = false;
mSampler = ssd; mSampler = ssd;
} }

View file

@ -315,6 +315,8 @@ void GFXSamplerStateData::initPersistFields()
endGroup( "Filter State" ); endGroup( "Filter State" );
addField("borderColor", TypeColorF, Offset(mState.borderColor, GFXSamplerStateData), "");
addField("samplerFunc", TypeGFXCmpFunc, Offset(mState.samplerFunc, GFXSamplerStateData), addField("samplerFunc", TypeGFXCmpFunc, Offset(mState.samplerFunc, GFXSamplerStateData),
"Compares sampled data against existing sampled data. The default is GFXCmpNever."); "Compares sampled data against existing sampled data. The default is GFXCmpNever.");
} }