Ignore:
Timestamp:
Aug 18, 2012, 9:26:03 PM (8 years ago)
Author:
sam
Message:

gpu: create the ShaderTexture class, replace Shader::SetTexture with a
Shader::SetUniform override, and implement most of the FBO code for
the Direct3D backend.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gpu/framebuffer.cpp

    r1761 r1773  
    4545
    4646#if defined USE_D3D9
     47    LPDIRECT3DTEXTURE9 m_texture;
     48    LPDIRECT3DSURFACE9 m_surface, m_back_surface;
    4749#elif defined _XBOX
    4850#else
     
    6163    m_data->m_size = size;
    6264#if defined USE_D3D9 || defined _XBOX
    63     /* FIXME: not implemented on Direct3D */
     65    if (FAILED(g_d3ddevice->CreateTexture(size.x, size.y, 1,
     66                                          D3DUSAGE_RENDERTARGET,
     67                                          D3DFMT_R8G8B8, D3DPOOL_DEFAULT,
     68                                          &m_data->m_texture, NULL)))
     69        Abort();
     70    if (FAILED(m_data->m_texture->GetSurfaceLevel(0, &m_data->m_surface)))
     71        Abort();
    6472#else
    6573#   if GL_VERSION_1_1
     
    125133{
    126134#if defined USE_D3D9 || defined _XBOX
     135    m_data->m_surface->Release();
     136    m_data->m_texture->Release();
    127137#else
    128138#   if GL_VERSION_1_1 || GL_ES_VERSION_2_0
     
    140150}
    141151
    142 int FrameBuffer::GetTexture() const
     152ShaderTexture FrameBuffer::GetTexture() const
    143153{
     154    ShaderTexture ret;
    144155#if defined USE_D3D9 || defined _XBOX
    145     return 0;
     156    ret.m_flags = (uint64_t)(uintptr_t)m_data->m_texture;
    146157#else
    147     return m_data->m_texture;
     158    ret.m_flags = m_data->m_texture;
    148159#endif
     160    return ret;
    149161}
    150162
     
    152164{
    153165#if defined USE_D3D9 || defined _XBOX
     166    if (FAILED(g_d3ddevice->GetRenderTarget(0, &m_data->m_back_surface)))
     167        Abort();
     168    if (FAILED(g_d3ddevice->SetRenderTarget(0, m_data->m_surface)))
     169        Abort();
    154170#else
    155171#   if GL_VERSION_1_1 || GL_ES_VERSION_2_0
     
    164180{
    165181#if defined USE_D3D9 || defined _XBOX
     182    if (FAILED(g_d3ddevice->SetRenderTarget(0, m_data->m_back_surface)))
     183        Abort();
    166184#else
    167185#   if GL_VERSION_1_1 || GL_ES_VERSION_2_0
Note: See TracChangeset for help on using the changeset viewer.