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:
|
||||
|
||||
void Unlink( void );
|
||||
void Link( plDXDeviceRef **back );
|
||||
plDXDeviceRef *GetNext( void ) { return fNext; }
|
||||
bool IsLinked( void ) { return fBack != nil; }
|
||||
virtual void Release( void ) { }
|
||||
void Unlink();
|
||||
void Link(plDXDeviceRef **back);
|
||||
plDXDeviceRef *GetNext() const { return fNext; }
|
||||
bool IsLinked() const { return fBack != nullptr; }
|
||||
virtual void Release() { }
|
||||
|
||||
plDXDeviceRef();
|
||||
|
||||
|
@ -121,7 +121,9 @@ HRESULT plDXPixelShader::ICreate(plDXPipeline* pipe)
|
||||
|
||||
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());
|
||||
|
@ -54,7 +54,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
plDXShader::plDXShader(plShader* owner)
|
||||
: fOwner(owner),
|
||||
fErrorString(nil),
|
||||
fPipe(nil)
|
||||
{
|
||||
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)
|
||||
{
|
||||
ISetError(errStr);
|
||||
|
@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define plDXShader_inc
|
||||
|
||||
#include "plDXDeviceRef.h"
|
||||
#include "plString.h"
|
||||
|
||||
class plShader;
|
||||
class plDXPipeline;
|
||||
@ -52,11 +53,11 @@ class plDXShader : public plDXDeviceRef
|
||||
{
|
||||
protected:
|
||||
plShader* fOwner;
|
||||
char* fErrorString;
|
||||
plString fErrorString;
|
||||
plDXPipeline* fPipe;
|
||||
|
||||
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 ISetConstants(plDXPipeline* pipe) = 0; // On error, sets error string.
|
||||
@ -65,7 +66,7 @@ public:
|
||||
plDXShader(plShader* owner);
|
||||
virtual ~plDXShader();
|
||||
|
||||
const char* GetErrorString() const { return fErrorString; }
|
||||
plString GetErrorString() const { return fErrorString; }
|
||||
void SetOwner(plShader* owner);
|
||||
};
|
||||
|
||||
|
@ -124,7 +124,9 @@ HRESULT plDXVertexShader::ICreate(plDXPipeline* pipe)
|
||||
|
||||
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());
|
||||
|
Reference in New Issue
Block a user