d3dcompiler: Make SlWriteBytecode return the shader size.
This commit is contained in:
parent
c2073b7ba2
commit
ddab7fcda9
|
@ -2543,22 +2543,8 @@ static HRESULT call_instr_handler(struct bc_writer *writer,
|
|||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
/* SlWriteBytecode (wineshader.@)
|
||||
*
|
||||
* Writes shader version specific bytecode from the shader passed in.
|
||||
* The returned bytecode can be passed to the Direct3D runtime like
|
||||
* IDirect3DDevice9::Create*Shader.
|
||||
*
|
||||
* Parameters:
|
||||
* shader: Shader to translate into bytecode
|
||||
* version: Shader version to generate(d3d version token)
|
||||
* dxversion: DirectX version the code targets
|
||||
* result: the resulting shader bytecode
|
||||
*
|
||||
* Return values:
|
||||
* S_OK on success
|
||||
*/
|
||||
DWORD SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD **result) {
|
||||
HRESULT SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD **result, DWORD *size)
|
||||
{
|
||||
struct bc_writer *writer;
|
||||
struct bytecode_buffer *buffer = NULL;
|
||||
HRESULT hr;
|
||||
|
@ -2610,12 +2596,8 @@ DWORD SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD
|
|||
goto error;
|
||||
}
|
||||
|
||||
/* Cut off unneeded memory from the result buffer */
|
||||
*result = d3dcompiler_realloc(buffer->data,
|
||||
sizeof(DWORD) * buffer->size);
|
||||
if(!*result) {
|
||||
*result = buffer->data;
|
||||
}
|
||||
*size = buffer->size * sizeof(DWORD);
|
||||
*result = buffer->data;
|
||||
buffer->data = NULL;
|
||||
hr = S_OK;
|
||||
|
||||
|
|
|
@ -396,9 +396,8 @@ static HRESULT assemble_shader(const char *preproc_shader,
|
|||
struct bwriter_shader *shader;
|
||||
char *messages = NULL;
|
||||
HRESULT hr;
|
||||
DWORD *res;
|
||||
LPD3DBLOB buffer;
|
||||
int size;
|
||||
DWORD *res, size;
|
||||
ID3DBlob *buffer;
|
||||
char *pos;
|
||||
|
||||
shader = SlAssembleShader(preproc_shader, &messages);
|
||||
|
@ -443,7 +442,7 @@ static HRESULT assemble_shader(const char *preproc_shader,
|
|||
return D3DXERR_INVALIDDATA;
|
||||
}
|
||||
|
||||
hr = SlWriteBytecode(shader, 9, &res);
|
||||
hr = SlWriteBytecode(shader, 9, &res, &size);
|
||||
SlDeleteShader(shader);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -453,7 +452,6 @@ static HRESULT assemble_shader(const char *preproc_shader,
|
|||
|
||||
if (shader_blob)
|
||||
{
|
||||
size = HeapSize(GetProcessHeap(), 0, res);
|
||||
hr = D3DCreateBlob(size, &buffer);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
|
|
@ -570,7 +570,7 @@ typedef enum _BWRITERDECLUSAGE {
|
|||
#define T3_REG 5
|
||||
|
||||
struct bwriter_shader *SlAssembleShader(const char *text, char **messages) DECLSPEC_HIDDEN;
|
||||
DWORD SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD **result) DECLSPEC_HIDDEN;
|
||||
HRESULT SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD **result, DWORD *size) DECLSPEC_HIDDEN;
|
||||
void SlDeleteShader(struct bwriter_shader *shader) DECLSPEC_HIDDEN;
|
||||
|
||||
#define MAKE_TAG(ch0, ch1, ch2, ch3) \
|
||||
|
|
Loading…
Reference in New Issue