d3d10: Implement ID3D10EffectVariable::AsScalar().

This commit is contained in:
Henri Verbeet 2009-09-09 18:12:41 +02:00 committed by Alexandre Julliard
parent 1ba006037c
commit fbbbdc09a5
1 changed files with 316 additions and 3 deletions

View File

@ -47,6 +47,7 @@ static const struct ID3D10EffectTechniqueVtbl d3d10_effect_technique_vtbl;
static const struct ID3D10EffectPassVtbl d3d10_effect_pass_vtbl;
static const struct ID3D10EffectVariableVtbl d3d10_effect_variable_vtbl;
static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_vtbl;
static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl;
static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl;
/* null objects - needed for invalid calls */
@ -55,6 +56,8 @@ static struct d3d10_effect_pass null_pass = {&d3d10_effect_pass_vtbl, NULL, NULL
static struct d3d10_effect_local_buffer null_local_buffer =
{&d3d10_effect_constant_buffer_vtbl, NULL, NULL, 0, 0, 0, NULL};
static struct d3d10_effect_variable null_variable = {&d3d10_effect_variable_vtbl, NULL, NULL, 0, 0, 0, NULL};
static struct d3d10_effect_variable null_scalar_variable =
{(ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl, NULL, NULL, 0, 0, 0, NULL};
static inline void read_dword(const char **ptr, DWORD *d)
{
@ -591,6 +594,18 @@ static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char *
return E_FAIL;
}
switch (v->type->type_class)
{
case D3D10_SVC_SCALAR:
v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl;
break;
default:
FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class));
v->vtbl = &d3d10_effect_variable_vtbl;
break;
}
skip_dword_unknown(ptr, 1);
read_dword(ptr, &v->buffer_offset);
@ -654,7 +669,6 @@ static HRESULT parse_fx10_local_buffer(struct d3d10_effect_local_buffer *l, cons
struct d3d10_effect_variable *v = &l->variables[i];
HRESULT hr;
v->vtbl = &d3d10_effect_variable_vtbl;
v->buffer = l;
hr = parse_fx10_variable(v, ptr, data);
@ -1529,9 +1543,14 @@ static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_variab
static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsScalar(
ID3D10EffectVariable *iface)
{
FIXME("iface %p stub!\n", iface);
struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface;
return NULL;
TRACE("iface %p\n", iface);
if (This->vtbl == (ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl)
return (ID3D10EffectScalarVariable *)This;
return (ID3D10EffectScalarVariable *)&null_scalar_variable;
}
static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsVector(
@ -1941,6 +1960,300 @@ static const struct ID3D10EffectConstantBufferVtbl d3d10_effect_constant_buffer_
d3d10_effect_constant_buffer_GetTextureBuffer,
};
/* ID3D10EffectVariable methods */
static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
{
TRACE("iface %p\n", iface);
return (struct d3d10_effect_variable *)iface != &null_scalar_variable;
}
static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetType(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetDesc(ID3D10EffectScalarVariable *iface,
D3D10_EFFECT_VARIABLE_DESC *desc)
{
return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
}
static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByIndex(
ID3D10EffectScalarVariable *iface, UINT index)
{
return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
}
static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetAnnotationByName(
ID3D10EffectScalarVariable *iface, LPCSTR name)
{
return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
}
static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByIndex(
ID3D10EffectScalarVariable *iface, UINT index)
{
return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
}
static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberByName(
ID3D10EffectScalarVariable *iface, LPCSTR name)
{
return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
}
static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetMemberBySemantic(
ID3D10EffectScalarVariable *iface, LPCSTR semantic)
{
return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
}
static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetElement(
ID3D10EffectScalarVariable *iface, UINT index)
{
return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
}
static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetParentConstantBuffer(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsScalar(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsVector(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsMatrix(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsString(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShaderResource(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRenderTargetView(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencilView(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsConstantBuffer(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsShader(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsBlend(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsDepthStencil(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsRasterizer(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
}
static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_scalar_variable_AsSampler(
ID3D10EffectScalarVariable *iface)
{
return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetRawValue(ID3D10EffectScalarVariable *iface,
void *data, UINT offset, UINT count)
{
return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetRawValue(ID3D10EffectScalarVariable *iface,
void *data, UINT offset, UINT count)
{
return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
}
/* ID3D10EffectScalarVariable methods */
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloat(ID3D10EffectScalarVariable *iface,
float value)
{
FIXME("iface %p, value %.8e stub!\n", iface, value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloat(ID3D10EffectScalarVariable *iface,
float *value)
{
FIXME("iface %p, value %p stub!\n", iface, value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetFloatArray(ID3D10EffectScalarVariable *iface,
float *values, UINT offset, UINT count)
{
FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetFloatArray(ID3D10EffectScalarVariable *iface,
float *values, UINT offset, UINT count)
{
FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetInt(ID3D10EffectScalarVariable *iface,
int value)
{
FIXME("iface %p, value %d stub!\n", iface, value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetInt(ID3D10EffectScalarVariable *iface,
int *value)
{
FIXME("iface %p, value %p stub!\n", iface, value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetIntArray(ID3D10EffectScalarVariable *iface,
int *values, UINT offset, UINT count)
{
FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetIntArray(ID3D10EffectScalarVariable *iface,
int *values, UINT offset, UINT count)
{
FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBool(ID3D10EffectScalarVariable *iface,
BOOL value)
{
FIXME("iface %p, value %d stub!\n", iface, value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBool(ID3D10EffectScalarVariable *iface,
BOOL *value)
{
FIXME("iface %p, value %p stub!\n", iface, value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_SetBoolArray(ID3D10EffectScalarVariable *iface,
BOOL *values, UINT offset, UINT count)
{
FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_scalar_variable_GetBoolArray(ID3D10EffectScalarVariable *iface,
BOOL *values, UINT offset, UINT count)
{
FIXME("iface %p, values %p, offset %u, count %u stub!\n", iface, values, offset, count);
return E_NOTIMPL;
}
static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_vtbl =
{
/* ID3D10EffectVariable methods */
d3d10_effect_scalar_variable_IsValid,
d3d10_effect_scalar_variable_GetType,
d3d10_effect_scalar_variable_GetDesc,
d3d10_effect_scalar_variable_GetAnnotationByIndex,
d3d10_effect_scalar_variable_GetAnnotationByName,
d3d10_effect_scalar_variable_GetMemberByIndex,
d3d10_effect_scalar_variable_GetMemberByName,
d3d10_effect_scalar_variable_GetMemberBySemantic,
d3d10_effect_scalar_variable_GetElement,
d3d10_effect_scalar_variable_GetParentConstantBuffer,
d3d10_effect_scalar_variable_AsScalar,
d3d10_effect_scalar_variable_AsVector,
d3d10_effect_scalar_variable_AsMatrix,
d3d10_effect_scalar_variable_AsString,
d3d10_effect_scalar_variable_AsShaderResource,
d3d10_effect_scalar_variable_AsRenderTargetView,
d3d10_effect_scalar_variable_AsDepthStencilView,
d3d10_effect_scalar_variable_AsConstantBuffer,
d3d10_effect_scalar_variable_AsShader,
d3d10_effect_scalar_variable_AsBlend,
d3d10_effect_scalar_variable_AsDepthStencil,
d3d10_effect_scalar_variable_AsRasterizer,
d3d10_effect_scalar_variable_AsSampler,
d3d10_effect_scalar_variable_SetRawValue,
d3d10_effect_scalar_variable_GetRawValue,
/* ID3D10EffectScalarVariable methods */
d3d10_effect_scalar_variable_SetFloat,
d3d10_effect_scalar_variable_GetFloat,
d3d10_effect_scalar_variable_SetFloatArray,
d3d10_effect_scalar_variable_GetFloatArray,
d3d10_effect_scalar_variable_SetInt,
d3d10_effect_scalar_variable_GetInt,
d3d10_effect_scalar_variable_SetIntArray,
d3d10_effect_scalar_variable_GetIntArray,
d3d10_effect_scalar_variable_SetBool,
d3d10_effect_scalar_variable_GetBool,
d3d10_effect_scalar_variable_SetBoolArray,
d3d10_effect_scalar_variable_GetBoolArray,
};
static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
{
FIXME("iface %p stub!\n", iface);