[PATCH 6/6] d3d10: Implement ID3D10EffectVariable::AsMatrix().

Henri Verbeet hverbeet at codeweavers.com
Wed Sep 9 11:12:43 CDT 2009


---
 dlls/d3d10/effect.c |  276 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 274 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index fa1024c..9d7b270 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -49,6 +49,7 @@ 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 ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_vtbl;
+static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl;
 static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl;
 
 /* null objects - needed for invalid calls */
@@ -61,6 +62,8 @@ static struct d3d10_effect_variable null_scalar_variable =
         {(ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl, NULL, NULL, 0, 0, 0, NULL};
 static struct d3d10_effect_variable null_vector_variable =
         {(ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl, NULL, NULL, 0, 0, 0, NULL};
+static struct d3d10_effect_variable null_matrix_variable =
+        {(ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl, NULL, NULL, 0, 0, 0, NULL};
 
 static inline void read_dword(const char **ptr, DWORD *d)
 {
@@ -607,6 +610,11 @@ static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char *
             v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl;
             break;
 
+        case D3D10_SVC_MATRIX_ROWS:
+        case D3D10_SVC_MATRIX_COLUMNS:
+            v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_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;
@@ -1576,9 +1584,14 @@ static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_variab
 static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsMatrix(
         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_matrix_variable_vtbl)
+        return (ID3D10EffectMatrixVariable *)This;
+
+    return (ID3D10EffectMatrixVariable *)&null_matrix_variable;
 }
 
 static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_variable_AsString(
@@ -2560,6 +2573,265 @@ static const struct ID3D10EffectVectorVariableVtbl d3d10_effect_vector_variable_
     d3d10_effect_vector_variable_GetFloatVectorArray,
 };
 
+/* ID3D10EffectVariable methods */
+
+static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
+{
+    TRACE("iface %p\n", iface);
+
+    return (struct d3d10_effect_variable *)iface != &null_matrix_variable;
+}
+
+static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetType(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetDesc(ID3D10EffectMatrixVariable *iface,
+        D3D10_EFFECT_VARIABLE_DESC *desc)
+{
+    return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc);
+}
+
+static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByIndex(
+        ID3D10EffectMatrixVariable *iface, UINT index)
+{
+    return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index);
+}
+
+static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetAnnotationByName(
+        ID3D10EffectMatrixVariable *iface, LPCSTR name)
+{
+    return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name);
+}
+
+static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByIndex(
+        ID3D10EffectMatrixVariable *iface, UINT index)
+{
+    return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index);
+}
+
+static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberByName(
+        ID3D10EffectMatrixVariable *iface, LPCSTR name)
+{
+    return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name);
+}
+
+static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMemberBySemantic(
+        ID3D10EffectMatrixVariable *iface, LPCSTR semantic)
+{
+    return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic);
+}
+
+static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetElement(
+        ID3D10EffectMatrixVariable *iface, UINT index)
+{
+    return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index);
+}
+
+static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetParentConstantBuffer(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsScalar(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsVector(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsMatrix(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsString(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShaderResource(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRenderTargetView(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencilView(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsConstantBuffer(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsShader(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsBlend(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsDepthStencil(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsRasterizer(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface);
+}
+
+static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_matrix_variable_AsSampler(
+        ID3D10EffectMatrixVariable *iface)
+{
+    return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetRawValue(ID3D10EffectMatrixVariable *iface,
+        void *data, UINT offset, UINT count)
+{
+    return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetRawValue(ID3D10EffectMatrixVariable *iface,
+        void *data, UINT offset, UINT count)
+{
+    return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count);
+}
+
+/* ID3D10EffectMatrixVariable methods */
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrix(ID3D10EffectMatrixVariable *iface,
+        float *data)
+{
+    FIXME("iface %p, data %p stub!\n", iface, data);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrix(ID3D10EffectMatrixVariable *iface,
+        float *data)
+{
+    FIXME("iface %p, data %p stub!\n", iface, data);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixArray(ID3D10EffectMatrixVariable *iface,
+        float *data, UINT offset, UINT count)
+{
+    FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixArray(ID3D10EffectMatrixVariable *iface,
+        float *data, UINT offset, UINT count)
+{
+    FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
+        float *data)
+{
+    FIXME("iface %p, data %p stub!\n", iface, data);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTranspose(ID3D10EffectMatrixVariable *iface,
+        float *data)
+{
+    FIXME("iface %p, data %p stub!\n", iface, data);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_SetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
+        float *data, UINT offset, UINT count)
+{
+    FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_effect_matrix_variable_GetMatrixTransposeArray(ID3D10EffectMatrixVariable *iface,
+        float *data, UINT offset, UINT count)
+{
+    FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
+
+    return E_NOTIMPL;
+}
+
+
+static const struct ID3D10EffectMatrixVariableVtbl d3d10_effect_matrix_variable_vtbl =
+{
+    /* ID3D10EffectVariable methods */
+    d3d10_effect_matrix_variable_IsValid,
+    d3d10_effect_matrix_variable_GetType,
+    d3d10_effect_matrix_variable_GetDesc,
+    d3d10_effect_matrix_variable_GetAnnotationByIndex,
+    d3d10_effect_matrix_variable_GetAnnotationByName,
+    d3d10_effect_matrix_variable_GetMemberByIndex,
+    d3d10_effect_matrix_variable_GetMemberByName,
+    d3d10_effect_matrix_variable_GetMemberBySemantic,
+    d3d10_effect_matrix_variable_GetElement,
+    d3d10_effect_matrix_variable_GetParentConstantBuffer,
+    d3d10_effect_matrix_variable_AsScalar,
+    d3d10_effect_matrix_variable_AsVector,
+    d3d10_effect_matrix_variable_AsMatrix,
+    d3d10_effect_matrix_variable_AsString,
+    d3d10_effect_matrix_variable_AsShaderResource,
+    d3d10_effect_matrix_variable_AsRenderTargetView,
+    d3d10_effect_matrix_variable_AsDepthStencilView,
+    d3d10_effect_matrix_variable_AsConstantBuffer,
+    d3d10_effect_matrix_variable_AsShader,
+    d3d10_effect_matrix_variable_AsBlend,
+    d3d10_effect_matrix_variable_AsDepthStencil,
+    d3d10_effect_matrix_variable_AsRasterizer,
+    d3d10_effect_matrix_variable_AsSampler,
+    d3d10_effect_matrix_variable_SetRawValue,
+    d3d10_effect_matrix_variable_GetRawValue,
+    /* ID3D10EffectMatrixVariable methods */
+    d3d10_effect_matrix_variable_SetMatrix,
+    d3d10_effect_matrix_variable_GetMatrix,
+    d3d10_effect_matrix_variable_SetMatrixArray,
+    d3d10_effect_matrix_variable_GetMatrixArray,
+    d3d10_effect_matrix_variable_SetMatrixTranspose,
+    d3d10_effect_matrix_variable_GetMatrixTranspose,
+    d3d10_effect_matrix_variable_SetMatrixTransposeArray,
+    d3d10_effect_matrix_variable_GetMatrixTransposeArray,
+};
+
 static BOOL STDMETHODCALLTYPE d3d10_effect_type_IsValid(ID3D10EffectType *iface)
 {
     FIXME("iface %p stub!\n", iface);
-- 
1.6.0.6




More information about the wine-patches mailing list