mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Convert plDXShader's error string to a plString, and do some cleanup
This commit is contained in:
@ -67,11 +67,11 @@ class plDXDeviceRef : public hsGDeviceRef
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void Unlink( void );
|
void Unlink();
|
||||||
void Link( plDXDeviceRef **back );
|
void Link(plDXDeviceRef **back);
|
||||||
plDXDeviceRef *GetNext( void ) { return fNext; }
|
plDXDeviceRef *GetNext() const { return fNext; }
|
||||||
bool IsLinked( void ) { return fBack != nil; }
|
bool IsLinked() const { return fBack != nullptr; }
|
||||||
virtual void Release( void ) { }
|
virtual void Release() { }
|
||||||
|
|
||||||
plDXDeviceRef();
|
plDXDeviceRef();
|
||||||
|
|
||||||
|
@ -121,7 +121,9 @@ HRESULT plDXPixelShader::ICreate(plDXPipeline* pipe)
|
|||||||
|
|
||||||
if( FAILED(hr) )
|
if( FAILED(hr) )
|
||||||
{
|
{
|
||||||
return IOnError(hr, compilationErrors ? (char*)compilationErrors->GetBufferPointer() : "File not found");
|
return IOnError(hr, compilationErrors
|
||||||
|
? reinterpret_cast<const char *>(compilationErrors->GetBufferPointer())
|
||||||
|
: "File not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
shaderCodes = (DWORD*)(compiledShader->GetBufferPointer());
|
shaderCodes = (DWORD*)(compiledShader->GetBufferPointer());
|
||||||
|
@ -54,7 +54,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
plDXShader::plDXShader(plShader* owner)
|
plDXShader::plDXShader(plShader* owner)
|
||||||
: fOwner(owner),
|
: fOwner(owner),
|
||||||
fErrorString(nil),
|
|
||||||
fPipe(nil)
|
fPipe(nil)
|
||||||
{
|
{
|
||||||
owner->SetDeviceRef(this);
|
owner->SetDeviceRef(this);
|
||||||
@ -77,17 +76,6 @@ void plDXShader::SetOwner(plShader* owner)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* plDXShader::ISetError(const char* errStr)
|
|
||||||
{
|
|
||||||
delete [] fErrorString;
|
|
||||||
if( errStr )
|
|
||||||
fErrorString = hsStrcpy(errStr);
|
|
||||||
else
|
|
||||||
fErrorString = nil;
|
|
||||||
|
|
||||||
return fErrorString;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT plDXShader::IOnError(HRESULT hr, const char* errStr)
|
HRESULT plDXShader::IOnError(HRESULT hr, const char* errStr)
|
||||||
{
|
{
|
||||||
ISetError(errStr);
|
ISetError(errStr);
|
||||||
|
@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#define plDXShader_inc
|
#define plDXShader_inc
|
||||||
|
|
||||||
#include "plDXDeviceRef.h"
|
#include "plDXDeviceRef.h"
|
||||||
|
#include "plString.h"
|
||||||
|
|
||||||
class plShader;
|
class plShader;
|
||||||
class plDXPipeline;
|
class plDXPipeline;
|
||||||
@ -52,11 +53,11 @@ class plDXShader : public plDXDeviceRef
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
plShader* fOwner;
|
plShader* fOwner;
|
||||||
char* fErrorString;
|
plString fErrorString;
|
||||||
plDXPipeline* fPipe;
|
plDXPipeline* fPipe;
|
||||||
|
|
||||||
HRESULT IOnError(HRESULT hr, const char* errStr);
|
HRESULT IOnError(HRESULT hr, const char* errStr);
|
||||||
const char* ISetError(const char* errStr);
|
void ISetError(const char* errStr) { fErrorString = errStr; }
|
||||||
|
|
||||||
virtual HRESULT ICreate(plDXPipeline* pipe) = 0;
|
virtual HRESULT ICreate(plDXPipeline* pipe) = 0;
|
||||||
virtual HRESULT ISetConstants(plDXPipeline* pipe) = 0; // On error, sets error string.
|
virtual HRESULT ISetConstants(plDXPipeline* pipe) = 0; // On error, sets error string.
|
||||||
@ -65,7 +66,7 @@ public:
|
|||||||
plDXShader(plShader* owner);
|
plDXShader(plShader* owner);
|
||||||
virtual ~plDXShader();
|
virtual ~plDXShader();
|
||||||
|
|
||||||
const char* GetErrorString() const { return fErrorString; }
|
plString GetErrorString() const { return fErrorString; }
|
||||||
void SetOwner(plShader* owner);
|
void SetOwner(plShader* owner);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -124,7 +124,9 @@ HRESULT plDXVertexShader::ICreate(plDXPipeline* pipe)
|
|||||||
|
|
||||||
if( FAILED(hr) )
|
if( FAILED(hr) )
|
||||||
{
|
{
|
||||||
return IOnError(hr, compilationErrors ? (char*)compilationErrors->GetBufferPointer() : "File not found");
|
return IOnError(hr, compilationErrors
|
||||||
|
? reinterpret_cast<const char *>(compilationErrors->GetBufferPointer())
|
||||||
|
: "File not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
shaderCodes = (DWORD*)(compiledShader->GetBufferPointer());
|
shaderCodes = (DWORD*)(compiledShader->GetBufferPointer());
|
||||||
|
Reference in New Issue
Block a user