Changeset 49170 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d
- Timestamp:
- Oct 17, 2013 6:58:57 PM (11 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/device.c
r48900 r49170 1340 1340 context = context_acquire(device, NULL); 1341 1341 gl_info = context->gl_info; 1342 1343 zv_destroy(device); 1342 1344 1343 1345 if (device->logo_surface) … … 5709 5711 } 5710 5712 #endif 5713 5714 5715 #ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR 5716 static GLuint zv_value_el_size(GLenum enmzvValue) 5717 { 5718 switch (enmzvValue) 5719 { 5720 case GL_FLOAT: 5721 return 4; 5722 case GL_UNSIGNED_SHORT: 5723 case GL_SHORT: 5724 return 2; 5725 case GL_BYTE: 5726 case GL_UNSIGNED_BYTE: 5727 return 1; 5728 default: 5729 ERR("unexpected value type %#x\n", enmzvValue); 5730 return 0; 5731 } 5732 } 5733 5734 static void zv_create(struct wined3d_device *device, GLenum enmzvValue, GLuint czvValue, GLuint czvValueElements, const GLvoid *pzvValue) 5735 { 5736 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; 5737 GLuint cbValel = zv_value_el_size(enmzvValue); 5738 GLuint cbVal = cbValel * czvValueElements; 5739 GLuint cbBuf = cbVal * czvValue; 5740 GLvoid *pvBuf; 5741 GLubyte *pubBuf; 5742 GLuint i; 5743 5744 /* quickly sort out if we can use the current value */ 5745 if (device->zvBuffer 5746 && device->enmzvValue == enmzvValue 5747 && device->czvValue >= czvValue 5748 && device->czvValueElements == czvValueElements 5749 && !memcmp(pzvValue, &device->zvValue, cbVal)) 5750 return; 5751 5752 if (czvValueElements > 4) 5753 { 5754 ERR("invalid czvValueElements %d\n", czvValueElements); 5755 return; 5756 } 5757 5758 pvBuf = HeapAlloc(GetProcessHeap(), 0, cbBuf); 5759 pubBuf = (GLubyte*)pvBuf; 5760 5761 for (i = 0; i < czvValue; ++i) 5762 { 5763 memcpy(pubBuf, pzvValue, cbVal); 5764 pubBuf += cbVal; 5765 } 5766 5767 /* */ 5768 if (!device->zvBuffer) 5769 { 5770 GL_EXTCALL(glGenBuffersARB(1, &device->zvBuffer)); 5771 Assert(device->zvBuffer); 5772 } 5773 5774 GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, device->zvBuffer)); 5775 5776 if (device->cbzvBuffer < cbBuf) 5777 { 5778 GL_EXTCALL(glBufferDataARB(GL_ARRAY_BUFFER_ARB, cbBuf, pvBuf, GL_DYNAMIC_DRAW_ARB)); 5779 device->cbzvBuffer = cbBuf; 5780 } 5781 else 5782 { 5783 GL_EXTCALL(glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, cbBuf, pvBuf)); 5784 } 5785 5786 device->enmzvValue = enmzvValue; 5787 device->czvValue = czvValue; 5788 device->czvValueElements = czvValueElements; 5789 memcpy(&device->zvValue, pzvValue, cbVal); 5790 5791 HeapFree(GetProcessHeap(), 0, pvBuf); 5792 } 5793 5794 void zv_destroy(struct wined3d_device *device) 5795 { 5796 if (device->zvBuffer) 5797 { 5798 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; 5799 GL_EXTCALL(glDeleteBuffersARB(1, &device->zvBuffer)); 5800 } 5801 5802 device->zvBuffer = 0; 5803 device->cbzvBuffer = 0; 5804 } 5805 5806 void zv_bind(struct wined3d_context *context, GLenum enmzvValue, GLuint czvValue, GLuint czvValueElements, GLboolean bzvNormalized, const GLvoid *pzvValue) 5807 { 5808 struct wined3d_device *device = context->swapchain->device; 5809 const struct wined3d_gl_info *gl_info = context->gl_info; 5810 5811 zv_create(device, enmzvValue, czvValue, czvValueElements, pzvValue); 5812 5813 Assert(device->zvBuffer); 5814 5815 GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, device->zvBuffer)); 5816 5817 GL_EXTCALL(glVertexAttribPointerARB(0, czvValueElements, 5818 enmzvValue, 5819 bzvNormalized, 5820 0, /*stride*/ 5821 NULL /*addr*/)); 5822 5823 if (!(context->numbered_array_mask & (1 << 0))) 5824 { 5825 GL_EXTCALL(glEnableVertexAttribArrayARB(0)); 5826 context->numbered_array_mask |= (1 << 0); 5827 } 5828 } 5829 5830 void zv_bind_by_element(struct wined3d_context *context, const struct wined3d_stream_info_element *element, GLuint czvValue, const GLvoid *pzvValue) 5831 { 5832 zv_bind(context, element->format->gl_vtx_type, czvValue, element->format->gl_vtx_format, element->format->gl_normalized, pzvValue); 5833 } 5834 5835 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/drawprim.c
r48345 r49170 499 499 for (i = MAX_ATTRIBS - 1; i >= 0; i--) 500 500 { 501 if (!(si->use_map & (1 << i))) continue; 501 if (!(si->use_map & (1 << i))) 502 { 503 #ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR 504 if (i == 0) 505 { 506 # ifdef DEBUG_misha 507 ERR("Test it!\n"); 508 # endif 509 GL_EXTCALL(glVertexAttrib4fARB(0, 0.0f, 0.0f, 0.0f, 0.0f)); 510 } 511 #endif 512 continue; 513 } 502 514 503 515 ptr = si->elements[i].data.addr + si->elements[i].stride * SkipnStrides; … … 667 679 } 668 680 681 #ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR 682 Assert(device->czvDrawVertices == 0); 683 device->czvDrawVertices = index_count; 684 #endif 685 669 686 if (!context_apply_draw_state(context, device)) 670 687 { 671 688 context_release(context); 672 689 WARN("Unable to apply draw state, skipping draw.\n"); 690 #ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR 691 device->czvDrawVertices = 0; 692 #endif 673 693 return; 674 694 } 695 696 #ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR 697 device->czvDrawVertices = 0; 698 #endif 699 675 700 676 701 #ifdef DEBUG_misha -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/state.c
r48680 r49170 4119 4119 if (!(stream_info->use_map & (1 << i))) 4120 4120 { 4121 #ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR 4122 if (i == 0) 4123 { 4124 GLfloat af[4] = {0., 0., 0., 0.,}; 4125 # ifdef DEBUG_misha 4126 ERR("Test it!\n"); 4127 # endif 4128 Assert(device->czvDrawVertices); 4129 zv_bind(context, GL_FLOAT, device->czvDrawVertices, 4, GL_FALSE, af); 4130 # ifdef VBOX_WITH_WINE_FIX_CURVBO 4131 /* we need to invalidate the curVBO state, since buffer_get_sysmem maay change the current buffer */ 4132 curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0; 4133 # endif 4134 } 4135 else 4136 #endif 4137 { 4138 4121 4139 if (context->numbered_array_mask & (1 << i)) 4122 4140 unload_numbered_array(context, i); 4123 4141 if (state->vertex_shader->reg_maps.input_registers & (1 << i)) 4124 4142 GL_EXTCALL(glVertexAttrib4fARB(i, 0.0f, 0.0f, 0.0f, 0.0f)); 4143 4144 } 4145 4125 4146 continue; 4126 4147 } … … 4190 4211 #endif 4191 4212 } 4213 4214 #ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR 4215 if (i == 0) 4216 { 4217 Assert(device->czvDrawVertices); 4218 zv_bind_by_element(context, &stream_info->elements[i], device->czvDrawVertices, ptr); 4219 # ifdef VBOX_WITH_WINE_FIX_CURVBO 4220 /* we need to invalidate the curVBO state, since buffer_get_sysmem maay change the current buffer */ 4221 curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0; 4222 # endif 4223 } 4224 else 4225 #endif 4226 { 4192 4227 4193 4228 if (context->numbered_array_mask & (1 << i)) unload_numbered_array(context, i); … … 4274 4309 ERR("Unexpected declaration in stride 0 attributes\n"); 4275 4310 break; 4311 4312 } 4276 4313 4277 4314 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/wined3d_private.h
r48345 r49170 1959 1959 UINT context_count; 1960 1960 1961 #ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR 1962 /* number of vertices in the current draw operation */ 1963 GLuint czvDrawVertices; 1964 /* ogl 2.1 requires 0 vertattr to be present 1965 * GL_ARRAY_BUFFER_ARB buffer */ 1966 GLuint zvBuffer; 1967 /* buffer length */ 1968 GLuint cbzvBuffer; 1969 /* current buffer value type */ 1970 GLenum enmzvValue; 1971 /* number of values stored in the buffer currently */ 1972 GLuint czvValue; 1973 /* number of elements in a value */ 1974 GLuint czvValueElements; 1975 /* current buffer value */ 1976 union 1977 { 1978 GLfloat f[4]; 1979 GLuint ui[4]; 1980 GLubyte ub[4]; 1981 GLshort s[4]; 1982 GLushort us[4]; 1983 } zvValue; 1984 #endif 1985 1961 1986 #ifdef VBOX_WITH_WDDM 1962 1987 struct VBOXUHGSMI *pHgsmi; … … 3025 3050 #endif 3026 3051 3052 #ifdef VBOX_WITH_WINE_FIX_ZEROVERTATTR 3053 void zv_destroy(struct wined3d_device *device); 3054 void zv_bind(struct wined3d_context *context, GLenum enmzvValue, GLuint czvValue, GLuint czvValueElements, GLboolean bzvNormalized, const GLvoid *pzvValue); 3055 void zv_bind_by_element(struct wined3d_context *context, const struct wined3d_stream_info_element *element, GLuint czvValue, const GLvoid *pzvValue); 3056 #endif 3057 3027 3058 struct wined3d_palette 3028 3059 {
Note:
See TracChangeset
for help on using the changeset viewer.