Removing XESAFERELEASE.
This commit is contained in:
parent
5b83cf5fd1
commit
187d0ad277
|
@ -162,7 +162,7 @@ void XAudio2AudioDriver::Shutdown() {
|
|||
mastering_voice_ = NULL;
|
||||
|
||||
audio_->StopEngine();
|
||||
XESAFERELEASE(audio_);
|
||||
audio_->Release();
|
||||
|
||||
delete voice_callback_;
|
||||
CloseHandle(wait_handle_);
|
||||
|
|
|
@ -29,7 +29,7 @@ D3D11IndexBufferResource::D3D11IndexBufferResource(
|
|||
}
|
||||
|
||||
D3D11IndexBufferResource::~D3D11IndexBufferResource() {
|
||||
XESAFERELEASE(handle_);
|
||||
SafeRelease(handle_);
|
||||
}
|
||||
|
||||
int D3D11IndexBufferResource::CreateHandle() {
|
||||
|
@ -95,7 +95,7 @@ D3D11VertexBufferResource::D3D11VertexBufferResource(
|
|||
}
|
||||
|
||||
D3D11VertexBufferResource::~D3D11VertexBufferResource() {
|
||||
XESAFERELEASE(handle_);
|
||||
SafeRelease(handle_);
|
||||
}
|
||||
|
||||
int D3D11VertexBufferResource::CreateHandle() {
|
||||
|
|
|
@ -11,11 +11,9 @@
|
|||
#define XENIA_GPU_D3D11_D3D11_BUFFER_RESOURCE_H_
|
||||
|
||||
#include <xenia/gpu/buffer_resource.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d11 {
|
||||
|
|
|
@ -31,8 +31,8 @@ D3D11GeometryShader::D3D11GeometryShader(ID3D11Device* device)
|
|||
}
|
||||
|
||||
D3D11GeometryShader::~D3D11GeometryShader() {
|
||||
XESAFERELEASE(handle_);
|
||||
XESAFERELEASE(device_);
|
||||
SafeRelease(handle_);
|
||||
SafeRelease(device_);
|
||||
}
|
||||
|
||||
int D3D11GeometryShader::Prepare(D3D11VertexShaderResource* vertex_shader) {
|
||||
|
@ -61,7 +61,7 @@ int D3D11GeometryShader::Prepare(D3D11VertexShaderResource* vertex_shader) {
|
|||
byte_code = xe_malloc(byte_code_length);
|
||||
xe_copy_struct(
|
||||
byte_code, shader_blob->GetBufferPointer(), byte_code_length);
|
||||
XESAFERELEASE(shader_blob);
|
||||
SafeRelease(shader_blob);
|
||||
|
||||
// Create shader.
|
||||
HRESULT hr = device_->CreateGeometryShader(
|
||||
|
@ -124,7 +124,7 @@ ID3D10Blob* D3D11GeometryShader::Compile(const char* shader_source) {
|
|||
char* msg = (char*)error_blob->GetBufferPointer();
|
||||
XELOGE("D3D11: shader compile failed with %s", msg);
|
||||
}
|
||||
XESAFERELEASE(error_blob);
|
||||
SafeRelease(error_blob);
|
||||
if (FAILED(hr)) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
#include <xenia/core.h>
|
||||
|
||||
#include <alloy/string_buffer.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -12,20 +12,23 @@
|
|||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu.h>
|
||||
#include <d3d11.h>
|
||||
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu.h>
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d11 {
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
void SafeRelease(T* ptr) {
|
||||
if (ptr) {
|
||||
ptr->Release();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace d3d11
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_D3D11_D3D11_GPU_PRIVATE_H_
|
||||
|
|
|
@ -67,29 +67,29 @@ D3D11GraphicsDriver::D3D11GraphicsDriver(
|
|||
|
||||
D3D11GraphicsDriver::~D3D11GraphicsDriver() {
|
||||
RebuildRenderTargets(0, 0);
|
||||
XESAFERELEASE(state_.constant_buffers.float_constants);
|
||||
XESAFERELEASE(state_.constant_buffers.bool_constants);
|
||||
XESAFERELEASE(state_.constant_buffers.loop_constants);
|
||||
XESAFERELEASE(state_.constant_buffers.vs_consts);
|
||||
XESAFERELEASE(state_.constant_buffers.gs_consts);
|
||||
SafeRelease(state_.constant_buffers.float_constants);
|
||||
SafeRelease(state_.constant_buffers.bool_constants);
|
||||
SafeRelease(state_.constant_buffers.loop_constants);
|
||||
SafeRelease(state_.constant_buffers.vs_consts);
|
||||
SafeRelease(state_.constant_buffers.gs_consts);
|
||||
for (auto it = rasterizer_state_cache_.begin();
|
||||
it != rasterizer_state_cache_.end(); ++it) {
|
||||
XESAFERELEASE(it->second);
|
||||
SafeRelease(it->second);
|
||||
}
|
||||
for (auto it = blend_state_cache_.begin();
|
||||
it != blend_state_cache_.end(); ++it) {
|
||||
XESAFERELEASE(it->second);
|
||||
SafeRelease(it->second);
|
||||
}
|
||||
for (auto it = depth_stencil_state_cache_.begin();
|
||||
it != depth_stencil_state_cache_.end(); ++it) {
|
||||
XESAFERELEASE(it->second);
|
||||
SafeRelease(it->second);
|
||||
}
|
||||
XESAFERELEASE(invalid_texture_view_);
|
||||
XESAFERELEASE(invalid_texture_sampler_state_);
|
||||
SafeRelease(invalid_texture_view_);
|
||||
SafeRelease(invalid_texture_sampler_state_);
|
||||
delete resource_cache_;
|
||||
XESAFERELEASE(context_);
|
||||
XESAFERELEASE(device_);
|
||||
XESAFERELEASE(swap_chain_);
|
||||
SafeRelease(context_);
|
||||
SafeRelease(device_);
|
||||
SafeRelease(swap_chain_);
|
||||
}
|
||||
|
||||
int D3D11GraphicsDriver::Initialize() {
|
||||
|
@ -138,7 +138,7 @@ void D3D11GraphicsDriver::InitializeInvalidTexture() {
|
|||
texture_view_desc.Texture2D.MostDetailedMip = 0;
|
||||
hr = device_->CreateShaderResourceView(
|
||||
texture, &texture_view_desc, &invalid_texture_view_);
|
||||
XESAFERELEASE(texture);
|
||||
SafeRelease(texture);
|
||||
|
||||
D3D11_SAMPLER_DESC sampler_desc;
|
||||
xe_zero_struct(&sampler_desc, sizeof(sampler_desc));
|
||||
|
@ -826,12 +826,12 @@ int D3D11GraphicsDriver::RebuildRenderTargets(uint32_t width,
|
|||
// Remove old versions.
|
||||
for (int n = 0; n < XECOUNT(render_targets_.color_buffers); n++) {
|
||||
auto& cb = render_targets_.color_buffers[n];
|
||||
XESAFERELEASE(cb.buffer);
|
||||
XESAFERELEASE(cb.color_view_8888);
|
||||
SafeRelease(cb.buffer);
|
||||
SafeRelease(cb.color_view_8888);
|
||||
}
|
||||
XESAFERELEASE(render_targets_.depth_buffer);
|
||||
XESAFERELEASE(render_targets_.depth_view_d28s8);
|
||||
XESAFERELEASE(render_targets_.depth_view_d28fs8);
|
||||
SafeRelease(render_targets_.depth_buffer);
|
||||
SafeRelease(render_targets_.depth_view_d28s8);
|
||||
SafeRelease(render_targets_.depth_view_d28fs8);
|
||||
|
||||
render_targets_.width = width;
|
||||
render_targets_.height = height;
|
||||
|
@ -917,7 +917,7 @@ int D3D11GraphicsDriver::Resolve() {
|
|||
} else {
|
||||
// TODO(benvanik): scale size using a quad draw.
|
||||
}
|
||||
XESAFERELEASE(back_buffer);
|
||||
SafeRelease(back_buffer);
|
||||
|
||||
// TODO(benvanik): remove!
|
||||
float color[4] = { 0.5f, 0.5f, 0.0f, 1.0f };
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#include <xenia/gpu/d3d11/d3d11_resource_cache.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
|
|
@ -188,9 +188,9 @@ void D3D11GraphicsSystem::Shutdown() {
|
|||
DeleteTimerQueueEx(timer_queue_, NULL);
|
||||
}
|
||||
|
||||
XESAFERELEASE(device_);
|
||||
SafeRelease(device_);
|
||||
device_ = 0;
|
||||
XESAFERELEASE(dxgi_factory_);
|
||||
SafeRelease(dxgi_factory_);
|
||||
dxgi_factory_ = 0;
|
||||
delete window_;
|
||||
window_ = 0;
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
#include <xenia/gpu/graphics_system.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
|
|
@ -369,7 +369,7 @@ bool D3D11ProfilerDisplay::SetupFont() {
|
|||
texture_view_desc.Texture2D.MostDetailedMip = 0;
|
||||
hr = device->CreateShaderResourceView(
|
||||
font_texture, &texture_view_desc, &font_texture_view_);
|
||||
XESAFERELEASE(font_texture);
|
||||
SafeRelease(font_texture);
|
||||
if (FAILED(hr)) {
|
||||
XELOGE("Unable to create profiler font texture view");
|
||||
return false;
|
||||
|
@ -403,15 +403,15 @@ bool D3D11ProfilerDisplay::SetupFont() {
|
|||
}
|
||||
|
||||
D3D11ProfilerDisplay::~D3D11ProfilerDisplay() {
|
||||
XESAFERELEASE(blend_state_);
|
||||
XESAFERELEASE(depth_stencil_state_);
|
||||
XESAFERELEASE(vertex_shader_);
|
||||
XESAFERELEASE(pixel_shader_);
|
||||
XESAFERELEASE(shader_constants_);
|
||||
XESAFERELEASE(shader_layout_);
|
||||
XESAFERELEASE(font_texture_view_);
|
||||
XESAFERELEASE(font_sampler_state_);
|
||||
XESAFERELEASE(vertex_buffer_);
|
||||
SafeRelease(blend_state_);
|
||||
SafeRelease(depth_stencil_state_);
|
||||
SafeRelease(vertex_shader_);
|
||||
SafeRelease(pixel_shader_);
|
||||
SafeRelease(shader_constants_);
|
||||
SafeRelease(shader_layout_);
|
||||
SafeRelease(font_texture_view_);
|
||||
SafeRelease(font_sampler_state_);
|
||||
SafeRelease(vertex_buffer_);
|
||||
}
|
||||
|
||||
uint32_t D3D11ProfilerDisplay::width() const {
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#define XENIA_GPU_D3D11_D3D11_PROFILER_DISPLAY_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -31,8 +31,8 @@ D3D11ResourceCache::D3D11ResourceCache(Memory* memory,
|
|||
}
|
||||
|
||||
D3D11ResourceCache::~D3D11ResourceCache() {
|
||||
XESAFERELEASE(device_);
|
||||
XESAFERELEASE(context_);
|
||||
SafeRelease(device_);
|
||||
SafeRelease(context_);
|
||||
}
|
||||
|
||||
VertexShaderResource* D3D11ResourceCache::CreateVertexShader(
|
||||
|
|
|
@ -12,10 +12,9 @@
|
|||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
#include <xenia/gpu/resource_cache.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
|
|
@ -27,7 +27,7 @@ D3D11SamplerStateResource::D3D11SamplerStateResource(
|
|||
}
|
||||
|
||||
D3D11SamplerStateResource::~D3D11SamplerStateResource() {
|
||||
XESAFERELEASE(handle_);
|
||||
SafeRelease(handle_);
|
||||
}
|
||||
|
||||
int D3D11SamplerStateResource::Prepare() {
|
||||
|
|
|
@ -10,12 +10,11 @@
|
|||
#ifndef XENIA_GPU_D3D11_D3D11_SAMPLER_STATE_RESOURCE_H_
|
||||
#define XENIA_GPU_D3D11_D3D11_SAMPLER_STATE_RESOURCE_H_
|
||||
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
#include <xenia/gpu/sampler_state_resource.h>
|
||||
#include <xenia/gpu/xenos/ucode.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
|
|
@ -80,7 +80,7 @@ ID3D10Blob* D3D11ShaderCompile(XE_GPU_SHADER_TYPE type,
|
|||
char* msg = (char*)error_blob->GetBufferPointer();
|
||||
XELOGE("D3D11: shader compile failed with %s", msg);
|
||||
}
|
||||
XESAFERELEASE(error_blob);
|
||||
SafeRelease(error_blob);
|
||||
if (FAILED(hr)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -103,8 +103,8 @@ D3D11VertexShaderResource::D3D11VertexShaderResource(
|
|||
}
|
||||
|
||||
D3D11VertexShaderResource::~D3D11VertexShaderResource() {
|
||||
XESAFERELEASE(handle_);
|
||||
XESAFERELEASE(input_layout_);
|
||||
SafeRelease(handle_);
|
||||
SafeRelease(input_layout_);
|
||||
for (int i = 0; i < XECOUNT(geometry_shaders_); ++i) {
|
||||
delete geometry_shaders_[i];
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ int D3D11VertexShaderResource::Prepare(
|
|||
byte_code = xe_malloc(byte_code_length);
|
||||
xe_copy_struct(
|
||||
byte_code, shader_blob->GetBufferPointer(), byte_code_length);
|
||||
XESAFERELEASE(shader_blob);
|
||||
SafeRelease(shader_blob);
|
||||
|
||||
// Create shader.
|
||||
HRESULT hr = resource_cache_->device()->CreateVertexShader(
|
||||
|
@ -328,7 +328,7 @@ D3D11PixelShaderResource::D3D11PixelShaderResource(
|
|||
}
|
||||
|
||||
D3D11PixelShaderResource::~D3D11PixelShaderResource() {
|
||||
XESAFERELEASE(handle_);
|
||||
SafeRelease(handle_);
|
||||
xe_free(translated_src_);
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ int D3D11PixelShaderResource::Prepare(const xe_gpu_program_cntl_t& program_cntl,
|
|||
byte_code = xe_malloc(byte_code_length);
|
||||
xe_copy_struct(
|
||||
byte_code, shader_blob->GetBufferPointer(), byte_code_length);
|
||||
XESAFERELEASE(shader_blob);
|
||||
SafeRelease(shader_blob);
|
||||
|
||||
// Create shader.
|
||||
HRESULT hr = resource_cache_->device()->CreatePixelShader(
|
||||
|
|
|
@ -30,8 +30,8 @@ D3D11TextureResource::D3D11TextureResource(
|
|||
}
|
||||
|
||||
D3D11TextureResource::~D3D11TextureResource() {
|
||||
XESAFERELEASE(texture_);
|
||||
XESAFERELEASE(handle_);
|
||||
SafeRelease(texture_);
|
||||
SafeRelease(handle_);
|
||||
}
|
||||
|
||||
int D3D11TextureResource::CreateHandle() {
|
||||
|
|
|
@ -10,11 +10,10 @@
|
|||
#ifndef XENIA_GPU_D3D11_D3D11_TEXTURE_RESOURCE_H_
|
||||
#define XENIA_GPU_D3D11_D3D11_TEXTURE_RESOURCE_H_
|
||||
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
#include <xenia/gpu/texture_resource.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
|
|
@ -42,11 +42,11 @@ D3D11Window::~D3D11Window() {
|
|||
if (context_) {
|
||||
context_->ClearState();
|
||||
}
|
||||
XESAFERELEASE(render_target_view_);
|
||||
XESAFERELEASE(context_);
|
||||
XESAFERELEASE(swap_chain_);
|
||||
XESAFERELEASE(device_);
|
||||
XESAFERELEASE(dxgi_factory_);
|
||||
SafeRelease(render_target_view_);
|
||||
SafeRelease(context_);
|
||||
SafeRelease(swap_chain_);
|
||||
SafeRelease(device_);
|
||||
SafeRelease(dxgi_factory_);
|
||||
}
|
||||
|
||||
int D3D11Window::Initialize(const std::wstring& title, uint32_t width,
|
||||
|
|
|
@ -12,10 +12,9 @@
|
|||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
#include <xenia/ui/win32/win32_window.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
|
|
@ -91,10 +91,6 @@ typedef XECACHEALIGN volatile void xe_aligned_void_t;
|
|||
#define XECOUNT(array) (sizeof(array) / sizeof(array[0]))
|
||||
#endif // MSVC
|
||||
|
||||
#if XE_PLATFORM_WIN32
|
||||
#define XESAFERELEASE(p) if (p) { p->Release(); }
|
||||
#endif // WIN32
|
||||
|
||||
#define XEFAIL() goto XECLEANUP
|
||||
#define XEEXPECT(expr) if (!(expr) ) { goto XECLEANUP; }
|
||||
#define XEEXPECTTRUE(expr) if (!(expr) ) { goto XECLEANUP; }
|
||||
|
|
Loading…
Reference in New Issue