Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a.
This commit is contained in:
@@ -196,16 +196,16 @@ static void safe_release(T *&p)
|
||||
{
|
||||
if (p) {
|
||||
p->Release();
|
||||
p = nullptr;
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void report_d3d_error(HRESULT hr, char *call, char *context)
|
||||
{
|
||||
if (hr == E_OUTOFMEMORY)
|
||||
IggyGDrawSendWarning(nullptr, "GDraw D3D out of memory in %s%s", call, context);
|
||||
IggyGDrawSendWarning(NULL, "GDraw D3D out of memory in %s%s", call, context);
|
||||
else
|
||||
IggyGDrawSendWarning(nullptr, "GDraw D3D error in %s%s: 0x%08x", call, context, hr);
|
||||
IggyGDrawSendWarning(NULL, "GDraw D3D error in %s%s: 0x%08x", call, context, hr);
|
||||
}
|
||||
|
||||
static void unbind_resources(void)
|
||||
@@ -215,12 +215,12 @@ static void unbind_resources(void)
|
||||
// unset active textures and vertex/index buffers,
|
||||
// to make sure there are no dangling refs
|
||||
static ID3D1X(ShaderResourceView) *no_views[3] = { 0 };
|
||||
ID3D1X(Buffer) *no_vb = nullptr;
|
||||
ID3D1X(Buffer) *no_vb = NULL;
|
||||
UINT no_offs = 0;
|
||||
|
||||
d3d->PSSetShaderResources(0, 3, no_views);
|
||||
d3d->IASetVertexBuffers(0, 1, &no_vb, &no_offs, &no_offs);
|
||||
d3d->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0);
|
||||
d3d->IASetIndexBuffer(NULL, DXGI_FORMAT_UNKNOWN, 0);
|
||||
}
|
||||
|
||||
static void api_free_resource(GDrawHandle *r)
|
||||
@@ -251,11 +251,11 @@ static void RADLINK gdraw_UnlockHandles(GDrawStats * /*stats*/)
|
||||
|
||||
static void *start_write_dyn(DynBuffer *buf, U32 size)
|
||||
{
|
||||
U8 *ptr = nullptr;
|
||||
U8 *ptr = NULL;
|
||||
|
||||
if (size > buf->size) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size);
|
||||
return nullptr;
|
||||
IggyGDrawSendWarning(NULL, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// update statistics
|
||||
@@ -373,19 +373,19 @@ extern GDrawTexture *gdraw_D3D1X_(WrappedTextureCreate)(ID3D1X(ShaderResourceVie
|
||||
{
|
||||
GDrawStats stats={0};
|
||||
GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); // it may need to free one item to give us a handle
|
||||
p->handle.tex.d3d = nullptr;
|
||||
p->handle.tex.d3d = NULL;
|
||||
p->handle.tex.d3d_view = tex_view;
|
||||
p->handle.tex.d3d_rtview = nullptr;
|
||||
p->handle.tex.d3d_rtview = NULL;
|
||||
p->handle.tex.w = 1;
|
||||
p->handle.tex.h = 1;
|
||||
gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned);
|
||||
gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned);
|
||||
return (GDrawTexture *) p;
|
||||
}
|
||||
|
||||
extern void gdraw_D3D1X_(WrappedTextureChange)(GDrawTexture *tex, ID3D1X(ShaderResourceView) *tex_view)
|
||||
{
|
||||
GDrawHandle *p = (GDrawHandle *) tex;
|
||||
p->handle.tex.d3d = nullptr;
|
||||
p->handle.tex.d3d = NULL;
|
||||
p->handle.tex.d3d_view = tex_view;
|
||||
}
|
||||
|
||||
@@ -407,12 +407,12 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo
|
||||
|
||||
static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats)
|
||||
{
|
||||
GDrawHandle *t = nullptr;
|
||||
GDrawHandle *t = NULL;
|
||||
DXGI_FORMAT dxgi_fmt;
|
||||
S32 bpp, size = 0, nmips = 0;
|
||||
|
||||
if (width >= 16384 || height >= 16384) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height);
|
||||
IggyGDrawSendWarning(NULL, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height,
|
||||
// try to allocate memory for the client to write to
|
||||
p->texture_data = (U8 *) IggyGDrawMalloc(size);
|
||||
if (!p->texture_data) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height);
|
||||
IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -446,9 +446,9 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height,
|
||||
|
||||
t->handle.tex.w = width;
|
||||
t->handle.tex.h = height;
|
||||
t->handle.tex.d3d = nullptr;
|
||||
t->handle.tex.d3d_view = nullptr;
|
||||
t->handle.tex.d3d_rtview = nullptr;
|
||||
t->handle.tex.d3d = NULL;
|
||||
t->handle.tex.d3d_view = NULL;
|
||||
t->handle.tex.d3d_rtview = NULL;
|
||||
|
||||
p->texture_type = GDRAW_TEXTURE_TYPE_rgba;
|
||||
p->p0 = t;
|
||||
@@ -512,7 +512,7 @@ static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingI
|
||||
|
||||
// and create a corresponding shader resource view
|
||||
failed_call = "CreateShaderResourceView";
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view);
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view);
|
||||
|
||||
done:
|
||||
if (!FAILED(hr)) {
|
||||
@@ -525,7 +525,7 @@ done:
|
||||
safe_release(t->handle.tex.d3d_view);
|
||||
|
||||
gdraw_HandleCacheAllocateFail(t);
|
||||
t = nullptr;
|
||||
t = NULL;
|
||||
report_d3d_error(hr, failed_call, " while creating texture");
|
||||
}
|
||||
|
||||
@@ -554,8 +554,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void * /*unique_id*/
|
||||
static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats)
|
||||
{
|
||||
GDrawHandle *t = (GDrawHandle *) tt;
|
||||
assert(t != nullptr); // @GDRAW_ASSERT
|
||||
if (t->owner == unique_id || unique_id == nullptr) {
|
||||
assert(t != NULL); // @GDRAW_ASSERT
|
||||
if (t->owner == unique_id || unique_id == NULL) {
|
||||
if (t->cache == &gdraw->rendertargets) {
|
||||
gdraw_HandleCacheUnlock(t);
|
||||
// cache it by simply not freeing it
|
||||
@@ -595,7 +595,7 @@ static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8 *rgba)
|
||||
return;
|
||||
}
|
||||
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, nullptr, &gdraw->aa_tex_view);
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, NULL, &gdraw->aa_tex_view);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreateShaderResourceView", " while creating texture");
|
||||
safe_release(gdraw->aa_tex);
|
||||
@@ -616,8 +616,8 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat
|
||||
if (p->vertex_data && p->index_data) {
|
||||
GDrawHandle *vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, stats);
|
||||
if (vb) {
|
||||
vb->handle.vbuf.verts = nullptr;
|
||||
vb->handle.vbuf.inds = nullptr;
|
||||
vb->handle.vbuf.verts = NULL;
|
||||
vb->handle.vbuf.inds = NULL;
|
||||
|
||||
p->vertex_data_length = vbuf_size;
|
||||
p->index_data_length = ibuf_size;
|
||||
@@ -661,7 +661,7 @@ static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuf
|
||||
safe_release(vb->handle.vbuf.inds);
|
||||
|
||||
gdraw_HandleCacheAllocateFail(vb);
|
||||
vb = nullptr;
|
||||
vb = NULL;
|
||||
|
||||
report_d3d_error(hr, "CreateBuffer", " creating vertex buffer");
|
||||
} else {
|
||||
@@ -682,7 +682,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni
|
||||
static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats)
|
||||
{
|
||||
GDrawHandle *h = (GDrawHandle *) vb;
|
||||
assert(h != nullptr); // @GDRAW_ASSERT
|
||||
assert(h != NULL); // @GDRAW_ASSERT
|
||||
if (h->owner == unique_id)
|
||||
gdraw_res_free(h, stats);
|
||||
}
|
||||
@@ -712,31 +712,31 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats)
|
||||
// ran out of RTs, allocate a new one
|
||||
S32 size = gdraw->frametex_width * gdraw->frametex_height * 4;
|
||||
if (gdraw->rendertargets.bytes_free < size) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes);
|
||||
return nullptr;
|
||||
IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets);
|
||||
if (!t) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit");
|
||||
IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit");
|
||||
return t;
|
||||
}
|
||||
|
||||
D3D1X_(TEXTURE2D_DESC) desc = { gdraw->frametex_width, gdraw->frametex_height, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM, { 1, 0 },
|
||||
D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_SHADER_RESOURCE) | D3D1X_(BIND_RENDER_TARGET), 0, 0 };
|
||||
|
||||
t->handle.tex.d3d = nullptr;
|
||||
t->handle.tex.d3d_view = nullptr;
|
||||
t->handle.tex.d3d_rtview = nullptr;
|
||||
t->handle.tex.d3d = NULL;
|
||||
t->handle.tex.d3d_view = NULL;
|
||||
t->handle.tex.d3d_rtview = NULL;
|
||||
|
||||
HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &t->handle.tex.d3d);
|
||||
HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &t->handle.tex.d3d);
|
||||
failed_call = "CreateTexture2D";
|
||||
if (!FAILED(hr)) {
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view);
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view);
|
||||
failed_call = "CreateTexture2D";
|
||||
}
|
||||
if (!FAILED(hr)) {
|
||||
hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_rtview);
|
||||
hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_rtview);
|
||||
failed_call = "CreateRenderTargetView";
|
||||
}
|
||||
|
||||
@@ -748,7 +748,7 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats)
|
||||
|
||||
report_d3d_error(hr, failed_call, " creating rendertarget");
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gdraw_HandleCacheAllocateEnd(t, size, (void *) 1, GDRAW_HANDLE_STATE_locked);
|
||||
@@ -768,10 +768,10 @@ static ID3D1X(DepthStencilView) *get_rendertarget_depthbuffer(GDrawStats *stats)
|
||||
D3D1X_(TEXTURE2D_DESC) desc = { gdraw->frametex_width, gdraw->frametex_height, 1, 1, DXGI_FORMAT_D24_UNORM_S8_UINT, { 1, 0 },
|
||||
D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_DEPTH_STENCIL), 0, 0 };
|
||||
|
||||
HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &gdraw->rt_depth_buffer);
|
||||
HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &gdraw->rt_depth_buffer);
|
||||
failed_call = "CreateTexture2D";
|
||||
if (!FAILED(hr)) {
|
||||
hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, nullptr, &gdraw->depth_buffer[1]);
|
||||
hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, NULL, &gdraw->depth_buffer[1]);
|
||||
failed_call = "CreateDepthStencilView while creating rendertarget";
|
||||
}
|
||||
|
||||
@@ -1110,7 +1110,7 @@ static void set_render_target(GDrawStats *stats)
|
||||
gdraw->d3d_context->OMSetRenderTargets(1, &target, gdraw->depth_buffer[0]);
|
||||
gdraw->d3d_context->RSSetState(gdraw->raster_state[gdraw->main_msaa]);
|
||||
} else {
|
||||
ID3D1X(DepthStencilView) *depth = nullptr;
|
||||
ID3D1X(DepthStencilView) *depth = NULL;
|
||||
if (gdraw->cur->flags & (GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil))
|
||||
depth = get_rendertarget_depthbuffer(stats);
|
||||
|
||||
@@ -1125,15 +1125,15 @@ static void set_render_target(GDrawStats *stats)
|
||||
static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_texture_format /*format*/, U32 flags, void *owner, GDrawStats *stats)
|
||||
{
|
||||
GDrawFramebufferState *n = gdraw->cur+1;
|
||||
GDrawHandle *t = nullptr;
|
||||
GDrawHandle *t = NULL;
|
||||
if (gdraw->tw == 0 || gdraw->th == 0) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget");
|
||||
IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) {
|
||||
assert(0);
|
||||
IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH");
|
||||
IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1147,10 +1147,10 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex
|
||||
|
||||
n->flags = flags;
|
||||
n->color_buffer = t;
|
||||
assert(n->color_buffer != nullptr); // @GDRAW_ASSERT
|
||||
assert(n->color_buffer != NULL); // @GDRAW_ASSERT
|
||||
|
||||
++gdraw->cur;
|
||||
gdraw->cur->cached = owner != nullptr;
|
||||
gdraw->cur->cached = owner != NULL;
|
||||
if (owner) {
|
||||
gdraw->cur->base_x = region->x0;
|
||||
gdraw->cur->base_y = region->y0;
|
||||
@@ -1229,9 +1229,9 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats)
|
||||
assert(m >= gdraw->frame); // bug in Iggy -- unbalanced
|
||||
|
||||
if (m != gdraw->frame) {
|
||||
assert(m->color_buffer != nullptr); // @GDRAW_ASSERT
|
||||
assert(m->color_buffer != NULL); // @GDRAW_ASSERT
|
||||
}
|
||||
assert(n->color_buffer != nullptr); // @GDRAW_ASSERT
|
||||
assert(n->color_buffer != NULL); // @GDRAW_ASSERT
|
||||
|
||||
// switch back to old render target
|
||||
set_render_target(stats);
|
||||
@@ -1288,8 +1288,8 @@ static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap
|
||||
{
|
||||
ID3D1XContext *d3d = gdraw->d3d_context;
|
||||
|
||||
if (tex == nullptr) {
|
||||
ID3D1X(ShaderResourceView) *notex = nullptr;
|
||||
if (tex == NULL) {
|
||||
ID3D1X(ShaderResourceView) *notex = NULL;
|
||||
d3d->PSSetShaderResources(texunit, 1, ¬ex);
|
||||
} else {
|
||||
GDrawHandle *h = (GDrawHandle *) tex;
|
||||
@@ -1300,7 +1300,7 @@ static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap
|
||||
|
||||
static void RADLINK gdraw_Set3DTransform(F32 *mat)
|
||||
{
|
||||
if (mat == nullptr)
|
||||
if (mat == NULL)
|
||||
gdraw->use_3d = 0;
|
||||
else {
|
||||
gdraw->use_3d = 1;
|
||||
@@ -1363,9 +1363,9 @@ static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawSta
|
||||
// in stencil set mode, prefer not doing any shading at all
|
||||
// but if alpha test is on, we need to make an exception
|
||||
|
||||
#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do nullptr PS it seems
|
||||
#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do NULL PS it seems
|
||||
if (which != GDRAW_TEXTURE_alpha_test)
|
||||
program = nullptr;
|
||||
program = NULL;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -1475,7 +1475,7 @@ static int vertsize[GDRAW_vformat__basic_count] = {
|
||||
// Draw triangles with a given renderstate
|
||||
//
|
||||
|
||||
static void tag_resources(void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr)
|
||||
static void tag_resources(void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL)
|
||||
{
|
||||
U64 now = gdraw->frame_counter;
|
||||
if (r1) ((GDrawHandle *) r1)->fence.value = now;
|
||||
@@ -1687,7 +1687,7 @@ static void set_clamp_constant(F32 *constant, GDrawTexture *tex)
|
||||
|
||||
static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *stats)
|
||||
{
|
||||
if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats))
|
||||
if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats))
|
||||
return;
|
||||
|
||||
set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp);
|
||||
@@ -1775,7 +1775,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1
|
||||
assert(0);
|
||||
}
|
||||
} else {
|
||||
GDrawHandle *blend_tex = nullptr;
|
||||
GDrawHandle *blend_tex = NULL;
|
||||
|
||||
// for crazy blend modes, we need to read back from the framebuffer
|
||||
// and do the blending in the pixel shader. we do this with copies
|
||||
@@ -1859,18 +1859,18 @@ static void destroy_shader(ProgramWithCachedVariableLocations *p)
|
||||
{
|
||||
if (p->pshader) {
|
||||
p->pshader->Release();
|
||||
p->pshader = nullptr;
|
||||
p->pshader = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static ID3D1X(Buffer) *create_dynamic_buffer(U32 size, U32 bind)
|
||||
{
|
||||
D3D1X_(BUFFER_DESC) desc = { size, D3D1X_(USAGE_DYNAMIC), bind, D3D1X_(CPU_ACCESS_WRITE), 0 };
|
||||
ID3D1X(Buffer) *buf = nullptr;
|
||||
HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, nullptr, &buf);
|
||||
ID3D1X(Buffer) *buf = NULL;
|
||||
HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, NULL, &buf);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreateBuffer", " creating dynamic vertex buffer");
|
||||
buf = nullptr;
|
||||
buf = NULL;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
@@ -1907,7 +1907,7 @@ static void create_all_shaders_and_state(void)
|
||||
HRESULT hr = d3d->CreateInputLayout(vformats[i].desc, vformats[i].nelem, vsh->bytecode, vsh->size, &gdraw->inlayout[i]);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreateInputLayout", "");
|
||||
gdraw->inlayout[i] = nullptr;
|
||||
gdraw->inlayout[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2026,11 +2026,11 @@ static void create_all_shaders_and_state(void)
|
||||
hr = gdraw->d3d_device->CreateBuffer(&bufdesc, &data, &gdraw->quad_ib);
|
||||
if (FAILED(hr)) {
|
||||
report_d3d_error(hr, "CreateBuffer", " for constants");
|
||||
gdraw->quad_ib = nullptr;
|
||||
gdraw->quad_ib = NULL;
|
||||
}
|
||||
IggyGDrawFree(inds);
|
||||
} else
|
||||
gdraw->quad_ib = nullptr;
|
||||
gdraw->quad_ib = NULL;
|
||||
}
|
||||
|
||||
static void destroy_all_shaders_and_state()
|
||||
@@ -2103,7 +2103,7 @@ static void free_gdraw()
|
||||
if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache);
|
||||
if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache);
|
||||
IggyGDrawFree(gdraw);
|
||||
gdraw = nullptr;
|
||||
gdraw = NULL;
|
||||
}
|
||||
|
||||
static bool alloc_dynbuffer(U32 size)
|
||||
@@ -2139,7 +2139,7 @@ static bool alloc_dynbuffer(U32 size)
|
||||
gdraw->max_quad_vert_count = RR_MIN(size / sizeof(gswf_vertex_xyst), QUAD_IB_COUNT * 4);
|
||||
gdraw->max_quad_vert_count &= ~3; // must be multiple of four
|
||||
|
||||
return gdraw->dyn_vb.buffer != nullptr && gdraw->dyn_ib.buffer != nullptr;
|
||||
return gdraw->dyn_vb.buffer != NULL && gdraw->dyn_ib.buffer != NULL;
|
||||
}
|
||||
|
||||
int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 num_bytes)
|
||||
@@ -2178,7 +2178,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3
|
||||
IggyGDrawFree(gdraw->texturecache);
|
||||
}
|
||||
gdraw->texturecache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_texture));
|
||||
return gdraw->texturecache != nullptr;
|
||||
return gdraw->texturecache != NULL;
|
||||
|
||||
case GDRAW_D3D1X_(RESOURCE_vertexbuffer):
|
||||
if (gdraw->vbufcache) {
|
||||
@@ -2186,7 +2186,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3
|
||||
IggyGDrawFree(gdraw->vbufcache);
|
||||
}
|
||||
gdraw->vbufcache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_vertexbuffer));
|
||||
return gdraw->vbufcache != nullptr;
|
||||
return gdraw->vbufcache != NULL;
|
||||
|
||||
case GDRAW_D3D1X_(RESOURCE_dynbuffer):
|
||||
unbind_resources();
|
||||
@@ -2202,7 +2202,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3
|
||||
static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32 w, S32 h)
|
||||
{
|
||||
gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw));
|
||||
if (!gdraw) return nullptr;
|
||||
if (!gdraw) return NULL;
|
||||
|
||||
memset(gdraw, 0, sizeof(*gdraw));
|
||||
|
||||
@@ -2217,7 +2217,7 @@ static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32
|
||||
|
||||
if (!gdraw->texturecache || !gdraw->vbufcache || !alloc_dynbuffer(gdraw_limits[GDRAW_D3D1X_(RESOURCE_dynbuffer)].num_bytes)) {
|
||||
free_gdraw();
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
create_all_shaders_and_state();
|
||||
@@ -2288,7 +2288,7 @@ void gdraw_D3D1X_(DestroyContext)(void)
|
||||
if (gdraw->texturecache) gdraw_res_flush(gdraw->texturecache, &stats);
|
||||
if (gdraw->vbufcache) gdraw_res_flush(gdraw->vbufcache, &stats);
|
||||
|
||||
gdraw->d3d_device = nullptr;
|
||||
gdraw->d3d_device = NULL;
|
||||
}
|
||||
|
||||
free_gdraw();
|
||||
@@ -2351,7 +2351,7 @@ void RADLINK gdraw_D3D1X_(GetResourceUsageStats)(gdraw_resourcetype type, S32 *h
|
||||
case GDRAW_D3D1X_(RESOURCE_texture): cache = gdraw->texturecache; break;
|
||||
case GDRAW_D3D1X_(RESOURCE_vertexbuffer): cache = gdraw->vbufcache; break;
|
||||
case GDRAW_D3D1X_(RESOURCE_dynbuffer): *handles_used = 0; *bytes_used = gdraw->last_dyn_maxalloc; return;
|
||||
default: cache = nullptr; break;
|
||||
default: cache = NULL; break;
|
||||
}
|
||||
|
||||
*handles_used = *bytes_used = 0;
|
||||
@@ -2408,7 +2408,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file,
|
||||
case IFT_FORMAT_DXT3 : size=16; d3dfmt = DXGI_FORMAT_BC2_UNORM; blk = 4; break;
|
||||
case IFT_FORMAT_DXT5 : size=16; d3dfmt = DXGI_FORMAT_BC3_UNORM; blk = 4; break;
|
||||
default: {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format);
|
||||
IggyGDrawSendWarning(NULL, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -2424,7 +2424,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file,
|
||||
|
||||
free_data = (U8 *) IggyGDrawMalloc(total_size);
|
||||
if (!free_data) {
|
||||
IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height);
|
||||
IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2457,7 +2457,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file,
|
||||
if (FAILED(hr)) goto done;
|
||||
|
||||
failed_call = "CreateShaderResourceView for texture creation";
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(tex, nullptr, &view);
|
||||
hr = gdraw->d3d_device->CreateShaderResourceView(tex, NULL, &view);
|
||||
if (FAILED(hr)) goto done;
|
||||
|
||||
t = gdraw_D3D1X_(WrappedTextureCreate)(view);
|
||||
|
||||
Reference in New Issue
Block a user