AbstractTexture: Move Bind() method to Renderer

This makes state tracking simpler, and enables easier porting to command
lists later on.
This commit is contained in:
Stenzek
2018-01-21 23:13:25 +10:00
parent fca56d532a
commit 38e0b6e2ab
23 changed files with 70 additions and 90 deletions

View File

@ -91,11 +91,6 @@ D3DTexture2D* DXTexture::GetRawTexIdentifier() const
return m_texture;
}
void DXTexture::Bind(unsigned int stage)
{
D3D::stateman->SetTexture(stage, m_texture->GetSRV());
}
void DXTexture::CopyRectangleFromTexture(const AbstractTexture* src,
const MathUtil::Rectangle<int>& src_rect, u32 src_layer,
u32 src_level, const MathUtil::Rectangle<int>& dst_rect,

View File

@ -19,8 +19,6 @@ public:
explicit DXTexture(const TextureConfig& tex_config);
~DXTexture();
void Bind(unsigned int stage) override;
void CopyRectangleFromTexture(const AbstractTexture* src,
const MathUtil::Rectangle<int>& src_rect, u32 src_layer,
u32 src_level, const MathUtil::Rectangle<int>& dst_rect,

View File

@ -733,11 +733,24 @@ void Renderer::SetDepthState(const DepthState& state)
m_gx_state.zmode.hex = state.hex;
}
void Renderer::SetTexture(u32 index, const AbstractTexture* texture)
{
D3D::stateman->SetTexture(
index,
texture ? static_cast<const DXTexture*>(texture)->GetRawTexIdentifier()->GetSRV() : nullptr);
}
void Renderer::SetSamplerState(u32 index, const SamplerState& state)
{
m_gx_state.samplers[index].hex = state.hex;
}
void Renderer::UnbindTexture(const AbstractTexture* texture)
{
D3D::stateman->UnsetTexture(
static_cast<const DXTexture*>(texture)->GetRawTexIdentifier()->GetSRV());
}
void Renderer::SetInterlacingMode()
{
// TODO

View File

@ -30,7 +30,9 @@ public:
void SetScissorRect(const EFBRectangle& rc) override;
void SetRasterizationState(const RasterizationState& state) override;
void SetDepthState(const DepthState& state) override;
void SetTexture(u32 index, const AbstractTexture* texture) override;
void SetSamplerState(u32 index, const SamplerState& state) override;
void UnbindTexture(const AbstractTexture* texture) override;
void SetInterlacingMode() override;
void SetViewport() override;
void SetFullscreen(bool enable_fullscreen) override;