LoadTexture.cpp
bool LoadTextureFromFile(const char* filename, ID3D12Device* d3d_device, D3D12_CPU_DESCRIPTOR_HANDLE srv_cpu_handle, ID3D12Resource** out_tex_resource, int* out_width, int* out_height)
{
  // Load from disk into a raw RGBA buffer
  int image_width = 0;
  int image_height = 0;
  unsigned char* image_data = stbi_load(filename, &image_width, &image_height, NULL, 4);
  if (image_data == NULL)
    return false;

  if (LoadTextureFromImageData(image_data, image_width, image_height, d3d_device, srv_cpu_handle, out_tex_resource)) {
    stbi_image_free(image_data);

    return true;
  }

  return false;
}
// Simple helper function to load an image into a DX12 texture with common settings
// Returns true on success, with the SRV CPU handle having an SRV for the newly-created texture placed in it (srv_cpu_handle must be a handle in a valid descriptor heap)
Simple helper function to load an image into a DX12 texture with common settings
Returns true on success, with the SRV CPU handle having an SRV for the newly-created texture placed in it (srv_cpu_handle must be a handle in a valid descriptor heap)
Simple helper function to load an image into a DX12 texture with common settings Returns true on success with the SRV CPU handle having an SRV for the newly - created texture placed in it ( srv_cpu_handle must be a handle in a valid descriptor heap )
bool LoadTextureFromFile(const char* filename, ID3D12Device* d3d_device, D3D12_CPU_DESCRIPTOR_HANDLE srv_cpu_handle, ID3D12Resource** out_tex_resource, int* out_width, int* out_height)
{
  int image_width = 0;
  int image_height = 0;
  unsigned char* image_data = stbi_load(filename, &image_width, &image_height, NULL, 4);
  if (image_data == NULL)
    return false;
  if (LoadTextureFromImageData(image_data, image_width, image_height, d3d_device, srv_cpu_handle, out_tex_resource)) {
    stbi_image_free(image_data);
    return true;
  }
  return false;
}
bool LoadTextureFromFile ( const char * filename , ID3D12Device * d3d_device , D3D12_CPU_DESCRIPTOR_HANDLE srv_cpu_handle , ID3D12Resource * * out_tex_resource , int * out_width , int * out_height ) { int image_width = 0 ; int image_height = 0 ; unsigned char * image_data = stbi_load ( filename , & image_width , & image_height , NULL , 4 ) ; if ( image_data == NULL ) return false ; if ( LoadTextureFromImageData ( image_data , image_width , image_height , d3d_device , srv_cpu_handle , out_tex_resource ) ) { stbi_image_free ( image_data ) ; return true ; } return false ; }
Simple helper function to load an image into a DX12 texture with common settings
Returns true on success, with the SRV CPU handle having an SRV for the newly-created texture placed in it (srv_cpu_handle must be a handle in a valid descriptor heap)
Simple helper function to load an image into a DX12 texture with common settings Returns true on success with the SRV CPU handle having an SRV for the newly - created texture placed in it ( srv_cpu_handle must be a handle in a valid descriptor heap )
// Load from disk into a raw RGBA buffer